Skip to content

Commit 02a4236

Browse files
committed
Fix TypeGuard on python < 3.10
1 parent 7a13fa9 commit 02a4236

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

poetry.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "1.5.0"
44
description = "FastAPI like dependency injection implementation"
55
authors = ["Pavel Kirilin <win10@list.ru>"]
66
readme = "README.md"
7-
packages = [{include = "taskiq_dependencies"}]
7+
packages = [{ include = "taskiq_dependencies" }]
88
classifiers = [
99
"Typing :: Typed",
1010
"Programming Language :: Python",
@@ -21,7 +21,8 @@ keywords = ["taskiq", "dependencies", "injection", "async", "DI"]
2121

2222
[tool.poetry.dependencies]
2323
python = "^3.8.1"
24-
graphlib-backport = { version = "^1.0.3", python="<3.9" }
24+
graphlib-backport = { version = "^1.0.3", python = "<3.9" }
25+
typing-extensions = { version = "^4.6.3", python = "<3.10" }
2526

2627
[tool.poetry.group.dev.dependencies]
2728
pytest = "^7.1.3"

taskiq_dependencies/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import inspect
2-
from typing import Any, AsyncContextManager, ContextManager, Optional, TypeGuard
2+
import sys
3+
from typing import Any, AsyncContextManager, ContextManager, Optional
4+
5+
if sys.version_info < (3, 10):
6+
from typing_extensions import TypeGuard # noqa: WPS433
7+
else:
8+
from typing import TypeGuard # noqa: WPS433
39

410

511
class ParamInfo:

0 commit comments

Comments
 (0)