Skip to content

Commit 0939e38

Browse files
committed
fix is_config_level for < 3.8
1 parent e4caa80 commit 0939e38

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎git/types.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if sys.version_info[:2] >= (3, 8):
1212
from typing import Final, Literal, SupportsIndex, TypedDict, Protocol, get_args # noqa: F401
1313
else:
14-
from typing_extensions import Final, Literal, SupportsIndex, TypedDict, Protocol, get_args # noqa: F401
14+
from typing_extensions import Final, Literal, SupportsIndex, TypedDict, Protocol # noqa: F401
1515

1616
if sys.version_info[:2] >= (3, 10):
1717
from typing import TypeGuard # noqa: F401
@@ -51,7 +51,10 @@ class ConfigLevels_NT(NamedTuple):
5151

5252

5353
def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
54-
return inp in get_args(Lit_config_levels)
54+
try:
55+
return inp in get_args(Lit_config_levels)
56+
except NameError: # get_args added in py 3.8
57+
return True
5558

5659

5760
def assert_never(inp: NoReturn, exc: Union[Exception, None] = None) -> NoReturn:

0 commit comments

Comments
 (0)