From 53f1195b7e279a0a3d783dff3b4ec68b47261d96 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 5 Jul 2021 14:20:42 +0100 Subject: Add Literal_config_levels.__args__ --- git/types.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git') 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: -- cgit v1.2.1