Skip to content

Commit a2321ac

Browse files
committed
fix: polish middleware types in favor to Pycharm
1 parent 6050ba3 commit a2321ac

File tree

9 files changed

+11
-12
lines changed

9 files changed

+11
-12
lines changed

docs/docs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from http.server import HTTPServer, SimpleHTTPRequestHandler
66
from pathlib import Path
77

8-
import mkdocs.commands.build
98
import mkdocs.commands.serve
109
import typer
1110
from create_api_docs import create_api_docs, remove_api_dir, render_navigation

faststream/confluent/prometheus/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
class KafkaPrometheusMiddleware(
1616
PrometheusMiddleware[
17-
KafkaPublishCommand,
1817
Message | Sequence[Message],
18+
KafkaPublishCommand,
1919
],
2020
):
2121
def __init__(

faststream/kafka/prometheus/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
class KafkaPrometheusMiddleware(
1616
PrometheusMiddleware[
17-
KafkaPublishCommand,
1817
ConsumerRecord | Sequence[ConsumerRecord],
18+
KafkaPublishCommand,
1919
],
2020
):
2121
def __init__(

faststream/nats/prometheus/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class NatsPrometheusMiddleware(
16-
PrometheusMiddleware[NatsPublishCommand, Msg | Sequence[Msg]],
16+
PrometheusMiddleware[Msg | Sequence[Msg], NatsPublishCommand],
1717
):
1818
def __init__(
1919
self,

faststream/opentelemetry/middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from collections import defaultdict
33
from collections.abc import Callable
44
from copy import copy
5-
from typing import TYPE_CHECKING, Any, Generic, Optional, cast
5+
from typing import TYPE_CHECKING, Any, Optional, cast
66

77
from opentelemetry import baggage, context, metrics, trace
88
from opentelemetry.baggage.propagation import W3CBaggagePropagator
@@ -12,7 +12,7 @@
1212
from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
1313

1414
from faststream._internal.middlewares import BaseMiddleware
15-
from faststream._internal.types import PublishCommandType
15+
from faststream._internal.types import BrokerMiddleware, PublishCommandType
1616
from faststream.opentelemetry.baggage import Baggage
1717
from faststream.opentelemetry.consts import (
1818
ERROR_TYPE,
@@ -42,7 +42,7 @@
4242
_TRACE_PROPAGATOR = TraceContextTextMapPropagator()
4343

4444

45-
class TelemetryMiddleware(Generic[PublishCommandType]):
45+
class TelemetryMiddleware(BrokerMiddleware[Any, PublishCommandType]):
4646
__slots__ = (
4747
"_meter",
4848
"_metrics",

faststream/prometheus/middleware.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from faststream._internal.constants import EMPTY
66
from faststream._internal.middlewares import BaseMiddleware
7-
from faststream._internal.types import AnyMsg, PublishCommandType
7+
from faststream._internal.types import AnyMsg, BrokerMiddleware, PublishCommandType
88
from faststream.exceptions import IgnoredException
99
from faststream.message import SourceType
1010
from faststream.prometheus.consts import (
@@ -25,7 +25,7 @@
2525
from faststream.message.message import StreamMessage
2626

2727

28-
class PrometheusMiddleware(Generic[PublishCommandType, AnyMsg]):
28+
class PrometheusMiddleware(BrokerMiddleware[AnyMsg, PublishCommandType]):
2929
__slots__ = (
3030
"_dynamic_labels",
3131
"_metrics_container",

faststream/rabbit/prometheus/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class RabbitPrometheusMiddleware(
16-
PrometheusMiddleware[RabbitPublishCommand, IncomingMessage],
16+
PrometheusMiddleware[IncomingMessage, RabbitPublishCommand],
1717
):
1818
def __init__(
1919
self,

faststream/redis/prometheus/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class RedisPrometheusMiddleware(
14-
PrometheusMiddleware[RedisPublishCommand, dict[str, Any]]
14+
PrometheusMiddleware[dict[str, Any], RedisPublishCommand]
1515
):
1616
def __init__(
1717
self,

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)