mypy: Fix fallout of ignore-without-code
Fix fallout of mypy --enable-error-code=ignore-without-code check. The multi_key_dict class had several type issues: the keys() and values() methods could implicitly return None when a key type was specified but not found, pyright flagged the conditional items() redefinition, and six test call sites carried bare "# type: ignore" comments. Add from __future__ import annotations, a _keys_from_dict() helper, and proper parameter/return type annotations to keys(), values(), and items(). Consolidate the conditional Python 2/3 items() into a single function with runtime dispatch. Remove all six bare type-ignores from multi_key_dict.py and annotate the remaining pre-existing ones in other files with specific error codes required by ignore-without-code. 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
0e660dc58b
commit
241aa79120
2 changed files with 41 additions and 35 deletions
|
|
@ -100,7 +100,7 @@ class Auth(AuthBase): # export
|
|||
@override
|
||||
def _access(
|
||||
self, what: str, access_type: Access | None, who: EntityBase | None
|
||||
) -> bool: # type: ignore
|
||||
) -> bool: # type: ignore[return-value]
|
||||
slog(
|
||||
WARNING,
|
||||
f'Returning False for {access_type} access to resource {what} by {who}'
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class Auth(AuthBase): # export
|
|||
def __user_by_email(self) -> dict[str, Entity]:
|
||||
if self.___user_by_email is None:
|
||||
self.__users
|
||||
return self.___user_by_email # type: ignore # We are sure that ___user_by_email is not None at this point
|
||||
return self.___user_by_email # type: ignore[return-value] # We are sure that ___user_by_email is not None at this point
|
||||
|
||||
def _create_entity(
|
||||
self,
|
||||
|
|
@ -158,7 +158,7 @@ class Auth(AuthBase): # export
|
|||
@override
|
||||
def _access(
|
||||
self, what: str, access_type: Access | None, who: EntityBase | None
|
||||
) -> bool: # type: ignore
|
||||
) -> bool: # type: ignore[return-value]
|
||||
slog(
|
||||
WARNING,
|
||||
f'Returning False for {access_type} access to resource {what} by {who}'
|
||||
|
|
|
|||
Loading…
Reference in a new issue