Skip to content

Commit

Permalink
[typing] remove more superfluous typing suppressions
Browse files Browse the repository at this point in the history
mypy appearently got a bit better at narrowing and inference.
  • Loading branch information
lukasjuhrich committed Jan 25, 2024
1 parent 3e1c683 commit 7e6e77a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ldap_sync/concepts/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pycroft/lib/user_deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion web/blueprints/finance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def _create_field_list_and_matched_activities_dict(
matched_activities[f"{prefix}-{str(activity.id)}"] = {
'purpose': activity.reference,
'name': activity.other_name,
prefix: entity, # type: ignore[misc]
prefix: entity,

Check failure on line 606 in web/blueprints/finance/__init__.py

View workflow job for this annotation

GitHub Actions / python-lint

Error

Expected TypedDict key to be string literal [misc]
'amount': activity.amount
}
field_list.append((str(activity.id), BooleanField(str(activity.id), default=True)))
Expand Down
5 changes: 1 addition & 4 deletions web/table/lazy_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7e6e77a

Please sign in to comment.