From 43521b1369d695b1db866fe4a9e652c3209da0ed Mon Sep 17 00:00:00 2001 From: Lukas Juhrich Date: Thu, 25 Jan 2024 10:35:39 +0100 Subject: [PATCH] [typing] remove more superfluous typing suppressions mypy appearently got a bit better at narrowing and inference. --- ldap_sync/concepts/record.py | 2 +- pycroft/lib/user_deletion.py | 2 +- web/table/lazy_join.py | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ldap_sync/concepts/record.py b/ldap_sync/concepts/record.py index a88003712..a22211186 100644 --- a/ldap_sync/concepts/record.py +++ b/ldap_sync/concepts/record.py @@ -34,7 +34,7 @@ def _canonicalize_to_list( if isinstance(value, list): return list(value) if value == "" or value == b"" or value is None: - return [] # type: ignore + return [] # str, byte, int – or unknown. But good fallback. return [value] # type: ignore diff --git a/pycroft/lib/user_deletion.py b/pycroft/lib/user_deletion.py index d00eb257c..8ba292d9f 100644 --- a/pycroft/lib/user_deletion.py +++ b/pycroft/lib/user_deletion.py @@ -79,7 +79,7 @@ def get_archivable_members(session: Session) -> Sequence[ArchivableMemberInfo]: # …and use that to filter out the `do-not-archive` occurrences. .filter(CurrentProperty.property_name.is_(None)) .join(User, User.id == last_mem.c.user_id) - .filter(last_mem.c.mem_end < current_timestamp() - timedelta(days=14)) # type: ignore[no-untyped-call] + .filter(last_mem.c.mem_end < current_timestamp() - timedelta(days=14)) .order_by(last_mem.c.mem_end) .options(joinedload(User.hosts), # joinedload(User.current_memberships), joinedload(User.account, innerjoin=True), joinedload(User.room), diff --git a/web/table/lazy_join.py b/web/table/lazy_join.py index c95e6dcdf..cf7e05711 100644 --- a/web/table/lazy_join.py +++ b/web/table/lazy_join.py @@ -98,10 +98,7 @@ def __init__(self, glue: str = "") -> None: self.glue = glue def __call__(self, func: DecoratedInType) -> DecoratedOutType: - # error: Argument 1 to "__call__" of "IdentityFunction" has incompatible type - # "Callable[_P, LazilyJoined]"; expected "Callable[_P, LazilyJoined]" [arg-type] - # …go home mypy, you're drunk! - @wraps(func) # type: ignore[arg-type] + @wraps(func) def wrapped(*a: _P.args, **kw: _P.kwargs) -> LazilyJoined: return LazilyJoined(func(*a, **kw), glue=self.glue)