| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | 30 | def is_change_type(inp: str) -> TypeGuard[Lit_change_type]: | |
| 31 | - return inp in Lit_change_type.__args__ # type: ignore | ||
| 31 | + return inp in ('A', 'D', 'M', 'R', 'T') | ||
| 32 | 32 | ||
| 33 | 33 | # ------------------------------------------------------------------------ | |
| 34 | 34 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,6 +38,10 @@ | |||
| 38 | 38 | Lit_config_levels = Literal['system', 'global', 'user', 'repository'] | |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | + def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]: | ||
| 42 | + return inp in ('system', 'global', 'user', 'repository') | ||
| 43 | + | ||
| 44 | + | ||
| 41 | 45 | class ConfigLevels_NT(NamedTuple): | |
| 42 | 46 | """NamedTuple of allowed CONFIG_LEVELS""" | |
| 43 | 47 | # works for pylance, but not mypy | |
@@ -51,10 +55,6 @@ class ConfigLevels_NT(NamedTuple): | |||
| 51 | 55 | # Typing this as specific literals breaks for mypy | |
| 52 | 56 | ||
| 53 | 57 | ||
| 54 | - def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]: | ||
| 55 | - return inp in Lit_config_levels.__args__ # type: ignore # mypy lies about __args__ | ||
| 56 | - | ||
| 57 | - | ||
| 58 | 58 | def assert_never(inp: NoReturn, exc: Union[Exception, None] = None) -> NoReturn: | |
| 59 | 59 | if exc is None: | |
| 60 | 60 | assert False, f"An unhandled Literal ({inp}) in an if else chain was found" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments