From cb9cf87db7a1c2c978f59c1783d630c513dc2963 Mon Sep 17 00:00:00 2001 From: Nikita Pastukhov Date: Wed, 24 Jul 2024 22:03:24 +0300 Subject: [PATCH] lint: fix mypy --- faststream/broker/fastapi/route.py | 5 +++-- faststream/utils/classes.py | 4 ++-- serve.py | 7 ------- 3 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 serve.py diff --git a/faststream/broker/fastapi/route.py b/faststream/broker/fastapi/route.py index 1ee27caefc..e7ae9febbb 100644 --- a/faststream/broker/fastapi/route.py +++ b/faststream/broker/fastapi/route.py @@ -72,7 +72,7 @@ def __init__( if isinstance(endpoint, HandlerCallWrapper): orig_call = endpoint._original_call while hasattr(orig_call, "__consumer__"): - orig_call = orig_call.__wrapped__ # type: ignore[attr-defined] + orig_call = orig_call.__wrapped__ # type: ignore[union-attr] else: orig_call = endpoint @@ -106,12 +106,13 @@ def __init__( ) ) + handler: HandlerCallWrapper[Any, Any, Any] if isinstance(endpoint, HandlerCallWrapper): endpoint._original_call = call handler = endpoint else: - handler = call + handler = call # type: ignore[assignment] self.handler = broker.subscriber( # type: ignore[assignment,call-arg] *extra, diff --git a/faststream/utils/classes.py b/faststream/utils/classes.py index 316687eb0a..1bf053cbce 100644 --- a/faststream/utils/classes.py +++ b/faststream/utils/classes.py @@ -1,4 +1,4 @@ -from typing import Any, ClassVar, Optional, cast +from typing import Any, ClassVar, Optional from typing_extensions import Self @@ -28,7 +28,7 @@ def __new__(cls, *args: Any, **kwargs: Any) -> Self: """ if cls._instance is None: cls._instance = super().__new__(cls) - return cast(Self, cls._instance) + return cls._instance @classmethod def _drop(cls) -> None: diff --git a/serve.py b/serve.py deleted file mode 100644 index b2e39ddb5f..0000000000 --- a/serve.py +++ /dev/null @@ -1,7 +0,0 @@ -from fastapi import FastAPI - -from faststream.kafka.fastapi import KafkaRouter - -router = KafkaRouter(schema_url=None) -app = FastAPI(lifespan=router.lifespan_context) -app.include_router(router)