Skip to content

Commit 2fb7393

Browse files
committed
chore: fix import typing-extensions
1 parent df33237 commit 2fb7393

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

pdm.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.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dev = [
4949
"pytest>=7.4.3",
5050
"pytest-cov>=4.1.0",
5151
"pytest-mock>=3.12.0",
52+
"typing-extensions>=4.8.0; python_version < \"3.11\"",
5253
]
5354

5455
[tool.pdm.scripts]

src/mypy_to_codeclimate/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77
from enum import Enum
88
from hashlib import md5
99
from pathlib import Path
10-
from typing import Any, Callable, NoReturn
11-
12-
from typing_extensions import Literal, NotRequired, TypedDict
10+
from typing import TYPE_CHECKING, Any, Callable, Literal, NoReturn, TypedDict
1311

1412
from mypy_to_codeclimate._version import __version__
1513

14+
if TYPE_CHECKING:
15+
if sys.version_info < (3, 11):
16+
from typing_extensions import NotRequired
17+
else:
18+
from typing import NotRequired
19+
20+
1621
MYPY_OUTPUT_PATTERN = r"^(?P<file>[^\n]+?):(?P<line>\d+):?((?P<column>\d+):)? (?P<error_level>\w+):\s*(?P<message>.+?)(?:\s+\[(?P<rule>[a-z\-]*)\])?$"
1722

1823
MYPY_OUTPUT_REGEX: re.Pattern[str] = re.compile(MYPY_OUTPUT_PATTERN, re.MULTILINE)

0 commit comments

Comments
 (0)