Skip to content

Commit

Permalink
Chore: update deps (#1503)
Browse files Browse the repository at this point in the history
* Update dependency versions

* Run pre-commit

* Limit typing-extensions version for python 3.8
  • Loading branch information
kumaranvpl authored Jun 6, 2024
1 parent edc0f30 commit 4ebaa65
Show file tree
Hide file tree
Showing 35 changed files with 67 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs_update-references.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Generate API References documentation

on:
pull_request:
types:
types:
- opened
- synchronize
paths:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: 'Dependency Review'

on:
pull_request:
types:
types:
- opened
- synchronize
branches:
Expand Down
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"filename": "docs/docs/en/release.md",
"hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450",
"is_verified": false,
"line_number": 1282,
"line_number": 1308,
"is_secret": false
}
],
Expand Down Expand Up @@ -163,5 +163,5 @@
}
]
},
"generated_at": "2024-05-27T11:45:58Z"
"generated_at": "2024-06-06T04:30:54Z"
}
2 changes: 1 addition & 1 deletion faststream/asyncapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def resolve_payloads(
served_words: int = 1,
) -> "AnyDict":
ln = len(payloads)
payload: "AnyDict"
payload: AnyDict
if ln > 1:
one_of_payloads = {}

Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/fastapi/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ async def real_consumer(message: "NativeMessage[Any]") -> Any:
"""An asynchronous function that processes an incoming message and returns a sendable message."""
body = message.decoded_body

fastapi_body: Union["AnyDict", List[Any]]
fastapi_body: Union[AnyDict, List[Any]]
if first_arg is not None:
if isinstance(body, dict):
path = fastapi_body = body or {}
Expand Down
4 changes: 2 additions & 2 deletions faststream/broker/fastapi/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __init__(
on_shutdown=on_shutdown,
)

self.weak_dependencies_provider: "WeakSet[Any]" = WeakSet()
self.weak_dependencies_provider: WeakSet[Any] = WeakSet()
if dependency_overrides_provider is not None:
self.weak_dependencies_provider.add(dependency_overrides_provider)

Expand Down Expand Up @@ -306,7 +306,7 @@ async def start_broker_lifespan(

async with lifespan_context(app) as maybe_context:
if maybe_context is None:
context: "AnyDict" = {}
context: AnyDict = {}
else:
context = dict(maybe_context)

Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def reject(self) -> None:
def decode_message(message: "StreamMessage[Any]") -> "DecodedMessage":
"""Decodes a message."""
body: Any = getattr(message, "body", message)
m: "DecodedMessage" = body
m: DecodedMessage = body

if (
content_type := getattr(message, "content_type", Parameter.empty)
Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/publisher/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def publish(
**kwargs,
}

call: "AsyncFunc" = self.method
call: AsyncFunc = self.method
for m in chain(_extra_middlewares, self.middlewares):
call = partial(m, call)

Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __call__(
return handler_call

def get_payloads(self) -> List[Tuple["AnyDict", str]]:
payloads: List[Tuple["AnyDict", str]] = []
payloads: List[Tuple[AnyDict, str]] = []

if self.schema_:
params = {"response__": (self.schema_, ...)}
Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/subscriber/call_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def call(
_extra_middlewares: Iterable["SubscriberMiddleware[Any]"],
) -> Any:
"""Execute wrapped handler with consume middlewares."""
call: "AsyncFuncAny" = self.handler.call_wrapped
call: AsyncFuncAny = self.handler.call_wrapped

for middleware in chain(self.item_middlewares, _extra_middlewares):
call = partial(middleware, call)
Expand Down
4 changes: 2 additions & 2 deletions faststream/broker/subscriber/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ async def consume(self, msg: MsgType) -> Any:
await stack.enter_async_context(self._stop_scope())

# enter all middlewares
middlewares: List["BaseMiddleware"] = []
middlewares: List[BaseMiddleware] = []
for base_m in self._broker_middlewares:
middleware = base_m(msg)
middlewares.append(middleware)
Expand Down Expand Up @@ -412,7 +412,7 @@ def get_description(self) -> Optional[str]:

def get_payloads(self) -> List[Tuple["AnyDict", str]]:
"""Get the payloads of the handler."""
payloads: List[Tuple["AnyDict", str]] = []
payloads: List[Tuple[AnyDict, str]] = []

for h in self.calls:
if h.dependant is None:
Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MultiLock:

def __init__(self) -> None:
"""Initialize a new instance of the class."""
self.queue: "asyncio.Queue[None]" = asyncio.Queue()
self.queue: asyncio.Queue[None] = asyncio.Queue()

def __enter__(self) -> Self:
"""Enter the context."""
Expand Down
2 changes: 1 addition & 1 deletion faststream/broker/wrapper/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def set_wrapped(

f: Callable[..., Awaitable[Any]] = to_async(call)

dependent: Optional["CallModel[..., Any]"] = None
dependent: Optional[CallModel[..., Any]] = None
if _get_dependant is None:
dependent = build_call_model(
f,
Expand Down
2 changes: 1 addition & 1 deletion faststream/cli/supervisors/multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
super().__init__(target, args, None)

self.workers = workers
self.processes: List["SpawnProcess"] = []
self.processes: List[SpawnProcess] = []

def startup(self) -> None:
logger.info(f"Started parent process [{self.pid}]")
Expand Down
2 changes: 1 addition & 1 deletion faststream/cli/utils/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ def set_log_level(level: int, app: "FastStream") -> None:
if app.logger and isinstance(app.logger, logging.Logger):
app.logger.setLevel(level)

broker_logger: Optional["LoggerProto"] = getattr(app.broker, "logger", None)
broker_logger: Optional[LoggerProto] = getattr(app.broker, "logger", None)
if broker_logger is not None and isinstance(broker_logger, logging.Logger):
broker_logger.setLevel(level)
4 changes: 2 additions & 2 deletions faststream/cli/utils/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

def parse_cli_args(*args: str) -> Tuple[str, Dict[str, "SettingField"]]:
"""Parses command line arguments."""
extra_kwargs: Dict[str, "SettingField"] = {}
extra_kwargs: Dict[str, SettingField] = {}

k: str = ""
v: "SettingField"
v: SettingField

field_args: List[str] = []
app = ""
Expand Down
2 changes: 1 addition & 1 deletion faststream/confluent/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ async def publish_batch(

correlation_id = correlation_id or gen_cor_id()

call: "AsyncFunc" = self._producer.publish_batch
call: AsyncFunc = self._producer.publish_batch
for m in self._middlewares:
call = partial(m(None).publish_scope, call)

Expand Down
4 changes: 2 additions & 2 deletions faststream/confluent/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def parse_message(
offset = message.offset()
_, timestamp = message.timestamp()

handler: Optional["LogicSubscriber[Any]"] = context.get_local("handler_")
handler: Optional[LogicSubscriber[Any]] = context.get_local("handler_")

return KafkaMessage(
body=body,
Expand Down Expand Up @@ -59,7 +59,7 @@ async def parse_message_batch(

_, first_timestamp = first.timestamp()

handler: Optional["LogicSubscriber[Any]"] = context.get_local("handler_")
handler: Optional[LogicSubscriber[Any]] = context.get_local("handler_")

return KafkaMessage(
body=body,
Expand Down
10 changes: 5 additions & 5 deletions faststream/confluent/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def publish(
) -> Optional[Any]:
assert self._producer, NOT_CONNECTED_YET # nosec B101

kwargs: "AnyDict" = {
kwargs: AnyDict = {
"key": key or self.key,
# basic args
"topic": topic or self.topic,
Expand All @@ -124,7 +124,7 @@ async def publish(
"correlation_id": correlation_id or gen_cor_id(),
}

call: "AsyncFunc" = self._producer.publish
call: AsyncFunc = self._producer.publish

for m in chain(
(
Expand Down Expand Up @@ -155,13 +155,13 @@ async def publish( # type: ignore[override]
) -> None:
assert self._producer, NOT_CONNECTED_YET # nosec B101

msgs: Iterable["SendableMessage"]
msgs: Iterable[SendableMessage]
if extra_messages:
msgs = (cast("SendableMessage", message), *extra_messages)
else:
msgs = cast(Iterable["SendableMessage"], message)

kwargs: "AnyDict" = {
kwargs: AnyDict = {
"topic": topic or self.topic,
"partition": partition or self.partition,
"timestamp_ms": timestamp_ms,
Expand All @@ -170,7 +170,7 @@ async def publish( # type: ignore[override]
"correlation_id": correlation_id or gen_cor_id(),
}

call: "AsyncFunc" = self._producer.publish_batch
call: AsyncFunc = self._producer.publish_batch

for m in chain(
(
Expand Down
4 changes: 2 additions & 2 deletions faststream/kafka/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ async def connect( # type: ignore[override]
To startup subscribers too you should use `broker.start()` after/instead this method.
"""
if bootstrap_servers is not Parameter.empty:
connect_kwargs: "AnyDict" = {
connect_kwargs: AnyDict = {
**kwargs,
"bootstrap_servers": bootstrap_servers,
}
Expand Down Expand Up @@ -792,7 +792,7 @@ async def publish_batch(

correlation_id = correlation_id or gen_cor_id()

call: "AsyncFunc" = self._producer.publish_batch
call: AsyncFunc = self._producer.publish_batch

for m in self._middlewares:
call = partial(m(None).publish_scope, call)
Expand Down
4 changes: 2 additions & 2 deletions faststream/kafka/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def parse_message(
) -> "StreamMessage[ConsumerRecord]":
"""Parses a Kafka message."""
headers = {i: j.decode() for i, j in message.headers}
handler: Optional["LogicSubscriber[Any]"] = context.get_local("handler_")
handler: Optional[LogicSubscriber[Any]] = context.get_local("handler_")
return KafkaMessage(
body=message.value,
headers=headers,
Expand Down Expand Up @@ -51,7 +51,7 @@ async def parse_message_batch(

headers = next(iter(batch_headers), {})

handler: Optional["LogicSubscriber[Any]"] = context.get_local("handler_")
handler: Optional[LogicSubscriber[Any]] = context.get_local("handler_")

return KafkaMessage(
body=body,
Expand Down
6 changes: 3 additions & 3 deletions faststream/kafka/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ async def publish(
reply_to = reply_to or self.reply_to
correlation_id = correlation_id or gen_cor_id()

call: "AsyncFunc" = self._producer.publish
call: AsyncFunc = self._producer.publish

for m in chain(
(
Expand Down Expand Up @@ -250,7 +250,7 @@ async def publish( # type: ignore[override]
) -> None:
assert self._producer, NOT_CONNECTED_YET # nosec B101

msgs: Iterable["SendableMessage"]
msgs: Iterable[SendableMessage]
if extra_messages:
msgs = (cast("SendableMessage", message), *extra_messages)
else:
Expand All @@ -262,7 +262,7 @@ async def publish( # type: ignore[override]
reply_to = reply_to or self.reply_to
correlation_id = correlation_id or gen_cor_id()

call: "AsyncFunc" = self._producer.publish_batch
call: AsyncFunc = self._producer.publish_batch

for m in chain(
(
Expand Down
6 changes: 3 additions & 3 deletions faststream/nats/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ async def connect( # type: ignore[override]
To startup subscribers too you should use `broker.start()` after/instead this method.
"""
if servers is not Parameter.empty:
connect_kwargs: "AnyDict" = {
connect_kwargs: AnyDict = {
**kwargs,
"servers": servers,
}
Expand Down Expand Up @@ -768,8 +768,8 @@ def setup_subscriber( # type: ignore[override]
subscriber: "AsyncAPISubscriber",
) -> None:
connection: Union[
"Client",
"JetStreamContext",
Client,
JetStreamContext,
KVBucketDeclarer,
OSBucketDeclarer,
None,
Expand Down
6 changes: 3 additions & 3 deletions faststream/nats/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_path(
self,
subject: str,
) -> Optional["AnyDict"]:
path: Optional["AnyDict"] = None
path: Optional[AnyDict] = None

if (path_re := self.__path_re) is not None and (
match := path_re.match(subject)
Expand Down Expand Up @@ -136,9 +136,9 @@ async def decode_batch(
self,
msg: "StreamMessage[List[Msg]]",
) -> List["DecodedMessage"]:
data: List["DecodedMessage"] = []
data: List[DecodedMessage] = []

path: Optional["AnyDict"] = None
path: Optional[AnyDict] = None
for m in msg.raw_message:
one_msg = await self.parse_message(m, path=path)
path = one_msg.path
Expand Down
4 changes: 2 additions & 2 deletions faststream/nats/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async def publish(
) -> Optional[Any]:
assert self._producer, NOT_CONNECTED_YET # nosec B101

kwargs: "AnyDict" = {
kwargs: AnyDict = {
"subject": subject or self.subject,
"headers": headers or self.headers,
"reply_to": reply_to or self.reply_to,
Expand All @@ -139,7 +139,7 @@ async def publish(
if stream := stream or getattr(self.stream, "name", None):
kwargs.update({"stream": stream, "timeout": timeout or self.timeout})

call: "AsyncFunc" = self._producer.publish
call: AsyncFunc = self._producer.publish

for m in chain(
(
Expand Down
2 changes: 1 addition & 1 deletion faststream/nats/subscriber/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def get_log_context(

class _TasksMixin(LogicSubscriber[Any]):
def __init__(self, **kwargs: Any) -> None:
self.tasks: List["asyncio.Task[Any]"] = []
self.tasks: List[asyncio.Task[Any]] = []

super().__init__(**kwargs)

Expand Down
4 changes: 2 additions & 2 deletions faststream/rabbit/publisher/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def publish( # type: ignore[override]
) -> Optional[Any]:
"""Publish a message to a RabbitMQ queue."""
context: AsyncContextManager[
Optional["MemoryObjectReceiveStream[IncomingMessage]"]
Optional[MemoryObjectReceiveStream[IncomingMessage]]
]
if rpc:
if reply_to is not None:
Expand Down Expand Up @@ -126,7 +126,7 @@ async def publish( # type: ignore[override]
return r

else:
msg: Optional["IncomingMessage"] = None
msg: Optional[IncomingMessage] = None
with timeout_scope(rpc_timeout, raise_timeout):
msg = await response_queue.receive()

Expand Down
Loading

0 comments on commit 4ebaa65

Please sign in to comment.