diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-05 14:20:42 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-05 14:20:42 +0100 |
commit | 53f1195b7e279a0a3d783dff3b4ec68b47261d96 (patch) | |
tree | 8b8da596eafb072c47203a785007f965e2a87e9f | |
parent | 0fc93b5da3459023de391f14532542f2bae61439 (diff) | |
download | gitpython-53f1195b7e279a0a3d783dff3b4ec68b47261d96.tar.gz |
Add Literal_config_levels.__args__
-rw-r--r-- | git/types.py | 6 |
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: |