mypy: Fix fallout of warn-unreachable, exhaustive-match
Fix fallout of mypy --warn-unreachable --error-code=exchaustive-match. The warn_unreachable and exhaustive-match mypy directives exposed several classes of issues: unreachable statements after exhaustive matches, unreachable isinstance checks on already-narrowed types, dead code after raise statements, and missing None in type unions where the code checked for it at runtime. Fix the following files: - Config.py: Broaden glob_paths parameter type to accept str, matching the isinstance check in the function body. - ldap.py: Remove dead code (unreachable if-block with False condition and unreachable continue after raise). - DataType.py: Use case _ fallback in py_type() match for exhaustive- match compliance, remove redundant isinstance check and assertion that were unreachable given type annotations. - Event.py: Add | None to Dest type alias where the code checks for None at runtime. - EventHub.py: Add | None to peer_confs variable type annotation where the code checks for None at runtime. - StringTree.py: Fix is_quoted() to accept only str (not StringTree), fix __set() path parameter type to str | None, remove dead code after exhaustive isinstance checks, remove unnecessary assert. - auth/ldap/Auth.py: Remove unreachable continue statement after raise. Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
241aa79120
commit
9e24a2f394
1 changed files with 6 additions and 28 deletions
|
|
@ -22,7 +22,7 @@ class Config(Mapping): # export
|
|||
def __load(
|
||||
self,
|
||||
search_dirs: list[str] | None,
|
||||
glob_paths: list[str] | None,
|
||||
glob_paths: list[str] | str | None,
|
||||
refuse_mode_mask: int | None
|
||||
) -> StringTree:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue