From 4c81e3cc7331d94f1e26ada7f18e3dbfc72bf032 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Wed, 24 Jul 2024 17:15:00 +0530 Subject: [PATCH 1/3] Chore: Update dependency versions --- pyproject.toml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cb15482ce1..21fb85de92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ devdocs = [ types = [ "faststream[optionals]", - "mypy==1.10.1", + "mypy==1.11.0", # mypy extensions "types-Deprecated", "types-PyYAML", @@ -111,16 +111,16 @@ types = [ lint = [ "faststream[types]", - "ruff==0.5.2", + "ruff==0.5.4", "bandit==1.7.9", - "semgrep==1.79.0", + "semgrep==1.80.0", "codespell==2.3.0", ] test-core = [ "coverage[toml]==7.6.0", - "pytest==8.2.2", - "pytest-asyncio==0.23.7", + "pytest==8.3.1", + "pytest-asyncio==0.23.8", "dirty-equals==0.7.1.post0", "typing-extensions>=4.8.0,<4.12.1; python_version < '3.9'", # to fix dirty-equals ] @@ -341,4 +341,3 @@ omit = [ [tool.codespell] skip = "./venv,./docs/site/*" ignore-words = ".codespell-whitelist.txt" - From fbe4bb77da1dab0ccb33a2c505dcce8f2306c68b Mon Sep 17 00:00:00 2001 From: Nikita Pastukhov Date: Wed, 24 Jul 2024 21:57:17 +0300 Subject: [PATCH 2/3] lint: fix mypy --- serve.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 serve.py diff --git a/serve.py b/serve.py new file mode 100644 index 0000000000..b2e39ddb5f --- /dev/null +++ b/serve.py @@ -0,0 +1,7 @@ +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) From cb9cf87db7a1c2c978f59c1783d630c513dc2963 Mon Sep 17 00:00:00 2001 From: Nikita Pastukhov Date: Wed, 24 Jul 2024 22:03:24 +0300 Subject: [PATCH 3/3] 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)