Skip to content

Commit c5ae611

Browse files
chore(deps): bump the pip group with 6 updates (#2129)
* chore(deps): bump the pip group with 6 updates Bumps the pip group with 6 updates: | Package | From | To | | --- | --- | --- | | [mkdocs-material](https://github.com/squidfunk/mkdocs-material) | `9.6.7` | `9.6.9` | | [mkdocstrings[python]](https://github.com/mkdocstrings/mkdocstrings) | `0.28.3` | `0.29.0` | | [mkdocs-git-revision-date-localized-plugin](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin) | `1.4.4` | `1.4.5` | | [ruff](https://github.com/astral-sh/ruff) | `0.9.10` | `0.11.0` | | [semgrep](https://github.com/returntocorp/semgrep) | `1.111.0` | `1.112.0` | | [coverage[toml]](https://github.com/nedbat/coveragepy) | `7.6.12` | `7.7.0` | Updates `mkdocs-material` from 9.6.7 to 9.6.9 - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](squidfunk/mkdocs-material@9.6.7...9.6.9) Updates `mkdocstrings[python]` from 0.28.3 to 0.29.0 - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/mkdocstrings@0.28.3...0.29.0) Updates `mkdocs-git-revision-date-localized-plugin` from 1.4.4 to 1.4.5 - [Release notes](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/releases) - [Commits](timvink/mkdocs-git-revision-date-localized-plugin@v1.4.4...v1.4.5) Updates `ruff` from 0.9.10 to 0.11.0 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@0.9.10...0.11.0) Updates `semgrep` from 1.111.0 to 1.112.0 - [Release notes](https://github.com/returntocorp/semgrep/releases) - [Changelog](https://github.com/semgrep/semgrep/blob/develop/CHANGELOG.md) - [Commits](semgrep/semgrep@v1.111.0...v1.112.0) Updates `coverage[toml]` from 7.6.12 to 7.7.0 - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@7.6.12...7.7.0) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pip - dependency-name: mkdocstrings[python] dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip - dependency-name: mkdocs-git-revision-date-localized-plugin dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pip - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip - dependency-name: semgrep dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip - dependency-name: coverage[toml] dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip ... Signed-off-by: dependabot[bot] <[email protected]> * lint: fix ruff --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nikita Pastukhov <[email protected]>
1 parent e3230c2 commit c5ae611

File tree

33 files changed

+74
-75
lines changed

33 files changed

+74
-75
lines changed

faststream/broker/core/usecase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ def __init__(
151151
middlewares=middlewares,
152152
dependencies=dependencies,
153153
decoder=cast(
154-
Optional["AsyncCustomCallable"],
154+
"Optional[AsyncCustomCallable]",
155155
to_async(decoder) if decoder else None,
156156
),
157157
parser=cast(
158-
Optional["AsyncCustomCallable"],
158+
"Optional[AsyncCustomCallable]",
159159
to_async(parser) if parser else None,
160160
),
161161
# Broker is a root router
@@ -300,7 +300,7 @@ def _abc_start(self) -> None:
300300

301301
if not self.use_custom and self.logger is not None:
302302
set_logger_fmt(
303-
cast(logging.Logger, self.logger),
303+
cast("logging.Logger", self.logger),
304304
self._get_fmt(),
305305
)
306306

faststream/broker/fastapi/get_dependant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _patch_fastapi_dependent(dependant: "Dependant") -> "Dependant":
7575
if PYDANTIC_V2:
7676
from pydantic.fields import FieldInfo
7777

78-
info = cast(FieldInfo, info)
78+
info = cast("FieldInfo", info)
7979

8080
field_data.update(
8181
{
@@ -102,7 +102,7 @@ def _patch_fastapi_dependent(dependant: "Dependant") -> "Dependant":
102102
else:
103103
from pydantic.fields import ModelField # type: ignore[attr-defined]
104104

105-
info = cast(ModelField, info)
105+
info = cast("ModelField", info)
106106

107107
field_data.update(
108108
{

faststream/broker/fastapi/router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
)
2424
from weakref import WeakSet
2525

26-
from fastapi.background import BackgroundTasks
2726
from fastapi.datastructures import Default
2827
from fastapi.responses import HTMLResponse
2928
from fastapi.routing import APIRoute, APIRouter
@@ -49,6 +48,7 @@
4948
from types import TracebackType
5049

5150
from fastapi import FastAPI, params
51+
from fastapi.background import BackgroundTasks
5252
from fastapi.types import IncEx
5353
from starlette import routing
5454
from starlette.types import ASGIApp, AppType, Lifespan
@@ -73,7 +73,7 @@ async def __aexit__(
7373
) -> Optional[bool]:
7474
if not exc_type and (
7575
background := cast(
76-
Optional[BackgroundTasks],
76+
"Optional[BackgroundTasks]",
7777
getattr(context.get_local("message"), "background", None),
7878
)
7979
):

faststream/broker/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def decode_message(message: "StreamMessage[Any]") -> "DecodedMessage":
117117
m: DecodedMessage = body
118118

119119
if (content_type := getattr(message, "content_type", EMPTY)) is not EMPTY:
120-
content_type = cast(Optional[str], content_type)
120+
content_type = cast("Optional[str]", content_type)
121121

122122
if not content_type:
123123
with suppress(json.JSONDecodeError, UnicodeDecodeError):

faststream/broker/middlewares/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def __init__(
132132
(
133133
exc_type,
134134
apply_types(
135-
cast(Callable[..., Awaitable[None]], to_async(handler))
135+
cast("Callable[..., Awaitable[None]]", to_async(handler))
136136
),
137137
)
138138
for exc_type, handler in (handlers or {}).items()

faststream/broker/subscriber/call_item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ async def is_suitable(
131131
cache: Dict[Any, Any],
132132
) -> Optional["StreamMessage[MsgType]"]:
133133
"""Check is message suite for current filter."""
134-
if not (parser := cast(Optional["AsyncCallable"], self.item_parser)) or not (
135-
decoder := cast(Optional["AsyncCallable"], self.item_decoder)
134+
if not (parser := cast("Optional[AsyncCallable]", self.item_parser)) or not (
135+
decoder := cast("Optional[AsyncCallable]", self.item_decoder)
136136
):
137137
raise SetupError("You should setup `HandlerItem` at first.")
138138

faststream/broker/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def resolve_custom_func(
148148
original_params = inspect.signature(custom_func).parameters
149149

150150
if len(original_params) == 1:
151-
return to_async(cast(Union["SyncCallable", "AsyncCallable"], custom_func))
151+
return to_async(cast("Union[SyncCallable, AsyncCallable]", custom_func))
152152

153153
else:
154154
name = tuple(original_params.items())[1][0]

faststream/confluent/opentelemetry/provider.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_publish_destination_name(
4141
self,
4242
kwargs: "AnyDict",
4343
) -> str:
44-
return cast(str, kwargs["topic"])
44+
return cast("str", kwargs["topic"])
4545

4646

4747
class ConfluentTelemetrySettingsProvider(
@@ -70,7 +70,7 @@ def get_consume_destination_name(
7070
self,
7171
msg: "StreamMessage[Message]",
7272
) -> str:
73-
return cast(str, msg.raw_message.topic())
73+
return cast("str", msg.raw_message.topic())
7474

7575

7676
class BatchConfluentTelemetrySettingsProvider(
@@ -87,7 +87,7 @@ def get_consume_attrs_from_message(
8787
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: msg.correlation_id,
8888
SpanAttributes.MESSAGING_BATCH_MESSAGE_COUNT: len(msg.raw_message),
8989
SpanAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: len(
90-
bytearray().join(cast(Sequence[bytes], msg.body))
90+
bytearray().join(cast("Sequence[bytes]", msg.body))
9191
),
9292
SpanAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION: raw_message.partition(),
9393
MESSAGING_DESTINATION_PUBLISH_NAME: raw_message.topic(),
@@ -99,7 +99,7 @@ def get_consume_destination_name(
9999
self,
100100
msg: "StreamMessage[Tuple[Message, ...]]",
101101
) -> str:
102-
return cast(str, msg.raw_message[0].topic())
102+
return cast("str", msg.raw_message[0].topic())
103103

104104

105105
def telemetry_attributes_provider_factory(

faststream/confluent/prometheus/provider.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_publish_destination_name_from_kwargs(
2222
self,
2323
kwargs: "AnyDict",
2424
) -> str:
25-
return cast(str, kwargs["topic"])
25+
return cast("str", kwargs["topic"])
2626

2727

2828
class ConfluentMetricsSettingsProvider(BaseConfluentMetricsSettingsProvider["Message"]):
@@ -31,7 +31,7 @@ def get_consume_attrs_from_message(
3131
msg: "StreamMessage[Message]",
3232
) -> ConsumeAttrs:
3333
return {
34-
"destination_name": cast(str, msg.raw_message.topic()),
34+
"destination_name": cast("str", msg.raw_message.topic()),
3535
"message_size": len(msg.body),
3636
"messages_count": 1,
3737
}
@@ -46,8 +46,8 @@ def get_consume_attrs_from_message(
4646
) -> ConsumeAttrs:
4747
raw_message = msg.raw_message[0]
4848
return {
49-
"destination_name": cast(str, raw_message.topic()),
50-
"message_size": len(bytearray().join(cast(Sequence[bytes], msg.body))),
49+
"destination_name": cast("str", raw_message.topic()),
50+
"message_size": len(bytearray().join(cast("Sequence[bytes]", msg.body))),
5151
"messages_count": len(msg.raw_message),
5252
}
5353

faststream/confluent/publisher/asyncapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def create(
162162
headers=headers,
163163
reply_to=reply_to,
164164
broker_middlewares=cast(
165-
Sequence["BrokerMiddleware[Tuple[ConfluentMsg, ...]]"],
165+
"Sequence[BrokerMiddleware[Tuple[ConfluentMsg, ...]]]",
166166
broker_middlewares,
167167
),
168168
middlewares=middlewares,
@@ -180,7 +180,7 @@ def create(
180180
headers=headers,
181181
reply_to=reply_to,
182182
broker_middlewares=cast(
183-
Sequence["BrokerMiddleware[ConfluentMsg]"], broker_middlewares
183+
"Sequence[BrokerMiddleware[ConfluentMsg]]", broker_middlewares
184184
),
185185
middlewares=middlewares,
186186
schema_=schema_,

faststream/confluent/publisher/usecase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ async def publish(
259259
if extra_messages:
260260
msgs = (cast("SendableMessage", message), *extra_messages)
261261
else:
262-
msgs = cast(Iterable["SendableMessage"], message)
262+
msgs = cast("Iterable[SendableMessage]", message)
263263

264264
kwargs: AnyDict = {
265265
"topic": topic or self.topic,

faststream/confluent/subscriber/factory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def create_subscriber(
157157
retry=retry,
158158
broker_dependencies=broker_dependencies,
159159
broker_middlewares=cast(
160-
Sequence["BrokerMiddleware[Tuple[ConfluentMsg, ...]]"],
160+
"Sequence[BrokerMiddleware[Tuple[ConfluentMsg, ...]]]",
161161
broker_middlewares,
162162
),
163163
title_=title_,
@@ -179,7 +179,7 @@ def create_subscriber(
179179
retry=retry,
180180
broker_dependencies=broker_dependencies,
181181
broker_middlewares=cast(
182-
Sequence["BrokerMiddleware[ConfluentMsg]"],
182+
"Sequence[BrokerMiddleware[ConfluentMsg]]",
183183
broker_middlewares,
184184
),
185185
title_=title_,
@@ -199,7 +199,7 @@ def create_subscriber(
199199
retry=retry,
200200
broker_dependencies=broker_dependencies,
201201
broker_middlewares=cast(
202-
Sequence["BrokerMiddleware[ConfluentMsg]"],
202+
"Sequence[BrokerMiddleware[ConfluentMsg]]",
203203
broker_middlewares,
204204
),
205205
title_=title_,

faststream/kafka/opentelemetry/provider.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_publish_destination_name(
4141
self,
4242
kwargs: "AnyDict",
4343
) -> str:
44-
return cast(str, kwargs["topic"])
44+
return cast("str", kwargs["topic"])
4545

4646

4747
class KafkaTelemetrySettingsProvider(
@@ -70,7 +70,7 @@ def get_consume_destination_name(
7070
self,
7171
msg: "StreamMessage[ConsumerRecord]",
7272
) -> str:
73-
return cast(str, msg.raw_message.topic)
73+
return cast("str", msg.raw_message.topic)
7474

7575

7676
class BatchKafkaTelemetrySettingsProvider(
@@ -87,7 +87,7 @@ def get_consume_attrs_from_message(
8787
SpanAttributes.MESSAGING_MESSAGE_ID: msg.message_id,
8888
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: msg.correlation_id,
8989
SpanAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: len(
90-
bytearray().join(cast(Sequence[bytes], msg.body))
90+
bytearray().join(cast("Sequence[bytes]", msg.body))
9191
),
9292
SpanAttributes.MESSAGING_BATCH_MESSAGE_COUNT: len(msg.raw_message),
9393
SpanAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION: raw_message.partition,
@@ -100,7 +100,7 @@ def get_consume_destination_name(
100100
self,
101101
msg: "StreamMessage[Tuple[ConsumerRecord, ...]]",
102102
) -> str:
103-
return cast(str, msg.raw_message[0].topic)
103+
return cast("str", msg.raw_message[0].topic)
104104

105105

106106
def telemetry_attributes_provider_factory(

faststream/kafka/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def decode_message(
100100
) -> "DecodedMessage":
101101
"""Decode a batch of messages."""
102102
# super() should be here due python can't find it in comprehension
103-
super_obj = cast(AioKafkaParser, super())
103+
super_obj = cast("AioKafkaParser", super())
104104

105105
return [
106106
decode_message(await super_obj.parse_message(m)) for m in msg.raw_message

faststream/kafka/prometheus/provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_publish_destination_name_from_kwargs(
2222
self,
2323
kwargs: "AnyDict",
2424
) -> str:
25-
return cast(str, kwargs["topic"])
25+
return cast("str", kwargs["topic"])
2626

2727

2828
class KafkaMetricsSettingsProvider(BaseKafkaMetricsSettingsProvider["ConsumerRecord"]):
@@ -47,7 +47,7 @@ def get_consume_attrs_from_message(
4747
raw_message = msg.raw_message[0]
4848
return {
4949
"destination_name": raw_message.topic,
50-
"message_size": len(bytearray().join(cast(Sequence[bytes], msg.body))),
50+
"message_size": len(bytearray().join(cast("Sequence[bytes]", msg.body))),
5151
"messages_count": len(msg.raw_message),
5252
}
5353

faststream/kafka/publisher/usecase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ async def publish(
463463
if extra_messages:
464464
msgs = (cast("SendableMessage", message), *extra_messages)
465465
else:
466-
msgs = cast(Iterable["SendableMessage"], message)
466+
msgs = cast("Iterable[SendableMessage]", message)
467467

468468
topic = topic or self.topic
469469
partition = partition or self.partition

faststream/kafka/subscriber/usecase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,4 +620,4 @@ async def get_msg(self, consumer: "AIOKafkaConsumer") -> "KafkaRawMessage":
620620
assert consumer, "You should setup subscriber at first." # nosec B101
621621
message = await consumer.getone()
622622
message.consumer = consumer
623-
return cast(KafkaRawMessage, message)
623+
return cast("KafkaRawMessage", message)

faststream/nats/broker/registrator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def subscriber( # type: ignore[override]
212212
stream = self._stream_builder.create(stream)
213213

214214
subscriber = cast(
215-
AsyncAPISubscriber,
215+
"AsyncAPISubscriber",
216216
super().subscriber(
217217
create_subscriber(
218218
subject=subject,
@@ -328,7 +328,7 @@ def publisher( # type: ignore[override]
328328
stream = self._stream_builder.create(stream)
329329

330330
publisher = cast(
331-
AsyncAPIPublisher,
331+
"AsyncAPIPublisher",
332332
super().publisher(
333333
publisher=AsyncAPIPublisher.create(
334334
subject=subject,

faststream/nats/fastapi/fastapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from faststream.broker.utils import default_filter
3838
from faststream.nats.broker import NatsBroker
3939
from faststream.nats.publisher.asyncapi import AsyncAPIPublisher
40-
from faststream.nats.subscriber.asyncapi import AsyncAPISubscriber
4140
from faststream.types import EMPTY
4241

4342
if TYPE_CHECKING:
@@ -67,6 +66,7 @@
6766
)
6867
from faststream.nats.message import NatsBatchMessage, NatsMessage
6968
from faststream.nats.schemas import JStream, KvWatch, ObjWatch, PullSub
69+
from faststream.nats.subscriber.asyncapi import AsyncAPISubscriber
7070
from faststream.security import BaseSecurity
7171
from faststream.types import AnyDict, LoggerProto
7272

@@ -869,7 +869,7 @@ def subscriber( # type: ignore[override]
869869
] = False,
870870
) -> "AsyncAPISubscriber":
871871
return cast(
872-
AsyncAPISubscriber,
872+
"AsyncAPISubscriber",
873873
super().subscriber(
874874
subject=subject,
875875
queue=queue,

faststream/nats/prometheus/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_publish_destination_name_from_kwargs(
2222
self,
2323
kwargs: "AnyDict",
2424
) -> str:
25-
return cast(str, kwargs["subject"])
25+
return cast("str", kwargs["subject"])
2626

2727

2828
class NatsMetricsSettingsProvider(BaseNatsMetricsSettingsProvider["Msg"]):

faststream/nats/subscriber/usecase.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from faststream.broker.types import MsgType
3030
from faststream.broker.utils import process_msg
3131
from faststream.exceptions import NOT_CONNECTED_YET
32-
from faststream.nats.message import NatsMessage
3332
from faststream.nats.parser import (
3433
BatchParser,
3534
JsParser,
@@ -59,7 +58,7 @@
5958
CustomCallable,
6059
)
6160
from faststream.nats.helpers import KVBucketDeclarer, OSBucketDeclarer
62-
from faststream.nats.message import NatsKvMessage, NatsObjMessage
61+
from faststream.nats.message import NatsKvMessage, NatsMessage, NatsObjMessage
6362
from faststream.nats.schemas import JStream, KvWatch, ObjWatch, PullSub
6463
from faststream.types import AnyDict, Decorator, LoggerProto, SendableMessage
6564

@@ -920,7 +919,7 @@ async def get_one(
920919
return None
921920

922921
msg = cast(
923-
NatsMessage,
922+
"NatsMessage",
924923
await process_msg(
925924
msg=raw_message,
926925
middlewares=self._broker_middlewares,
@@ -1080,7 +1079,7 @@ async def _consume_watch(self) -> None:
10801079
while self.running:
10811080
with suppress(ConnectionClosedError, TimeoutError):
10821081
message = cast(
1083-
Optional["KeyValue.Entry"],
1082+
"Optional[KeyValue.Entry]",
10841083
await key_watcher.updates(self.kv_watch.timeout), # type: ignore[no-untyped-call]
10851084
)
10861085

@@ -1234,7 +1233,7 @@ async def _consume_watch(self) -> None:
12341233
while self.running:
12351234
with suppress(TimeoutError):
12361235
message = cast(
1237-
Optional["ObjectInfo"],
1236+
"Optional[ObjectInfo]",
12381237
await obj_watch.updates(self.obj_watch.timeout), # type: ignore[no-untyped-call]
12391238
)
12401239

0 commit comments

Comments
 (0)