Skip to content

Commit 53f1195

Browse files
committed
Add Literal_config_levels.__args__
1 parent 0fc93b5 commit 53f1195

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

git/types.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ class ConfigLevels_NT(NamedTuple):
4646
repository: Literal['repository']
4747

4848

49-
# Typing this as specific literals breaks for mypy
5049
ConfigLevels_Tup = Tuple[Lit_config_levels, Lit_config_levels, Lit_config_levels, Lit_config_levels]
50+
# Typing this as specific literals breaks for mypy
51+
52+
53+
def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
54+
return inp in Lit_config_levels.__args__ # type: ignore # mypy lies about __args__
5155

5256

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

0 commit comments

Comments
 (0)