summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
Diffstat (limited to 'git')
-rw-r--r--git/types.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/git/types.py b/git/types.py
index 9de4449b..f20221b9 100644
--- a/git/types.py
+++ b/git/types.py
@@ -46,8 +46,12 @@ class ConfigLevels_NT(NamedTuple):
repository: Literal['repository']
-# Typing this as specific literals breaks for mypy
ConfigLevels_Tup = Tuple[Lit_config_levels, Lit_config_levels, Lit_config_levels, Lit_config_levels]
+# Typing this as specific literals breaks for mypy
+
+
+def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
+ return inp in Lit_config_levels.__args__ # type: ignore # mypy lies about __args__
def assert_never(inp: NoReturn, exc: Union[Exception, None] = None) -> NoReturn: