Skip to content

Commit

Permalink
Use typing_extensions only when needed
Browse files Browse the repository at this point in the history
Annotated was added in Python 3.9
Literal was added in Python 3.8
  • Loading branch information
qarkai committed Apr 30, 2024
1 parent 1b1b0f2 commit e6769b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion inflect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
Dict,
Iterable,
List,
Literal,
Match,
Optional,
Sequence,
Expand All @@ -78,7 +79,11 @@

from more_itertools import windowed_complete
from typeguard import typechecked
from typing_extensions import Annotated, Literal
try:
# Python 3.9+
from typing import Annotated
except ImportError:
from typing_extensions import Annotated


class UnknownClassicalModeError(Exception):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ requires-python = ">=3.8"
dependencies = [
"more_itertools",
"typeguard >= 4.0.1",
"typing_extensions",
"typing_extensions ; python_version<'3.9'",
]
keywords = [
"plural",
Expand Down

0 comments on commit e6769b2

Please sign in to comment.