Skip to content

Commit

Permalink
Bump mypy from 1.11.2 to 1.12.1 and fix new typechecking errors (#17999)
Browse files Browse the repository at this point in the history
Supersedes #17958.

Awkwardly, the changes made to fix the mypy errors in 1.12.1 cause
errors in 1.11.2. So you'll need to update your mypy version to 1.12.1
to eliminate typechecking errors during developing.
  • Loading branch information
anoadragon453 authored Dec 18, 2024
1 parent f1ecf46 commit f1b0f9a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 43 deletions.
1 change: 1 addition & 0 deletions changelog.d/17999.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump mypy from 1.11.2 to 1.12.1.
65 changes: 35 additions & 30 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion synapse/config/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging
import os
from typing import Any, Dict, List, Tuple
from urllib.request import getproxies_environment # type: ignore
from urllib.request import getproxies_environment

import attr

Expand Down
8 changes: 4 additions & 4 deletions synapse/handlers/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,10 @@ async def claim_e2e_one_time_keys(
results = await make_deferred_yieldable(
defer.DeferredList(
[
run_in_background(
run_in_background( # type: ignore[call-overload]
self.appservice_api.claim_client_keys,
# We know this must be an app service.
self.store.get_app_service_by_id(service_id), # type: ignore[arg-type]
self.store.get_app_service_by_id(service_id),
service_query,
)
for service_id, service_query in query_by_appservice.items()
Expand Down Expand Up @@ -952,10 +952,10 @@ async def query_keys(
results = await make_deferred_yieldable(
defer.DeferredList(
[
run_in_background(
run_in_background( # type: ignore[call-overload]
self.appservice_api.query_keys,
# We know this must be an app service.
self.store.get_app_service_by_id(service_id), # type: ignore[arg-type]
self.store.get_app_service_by_id(service_id),
service_query,
)
for service_id, service_query in query_by_appservice.items()
Expand Down
8 changes: 4 additions & 4 deletions synapse/push/bulk_push_rule_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ async def _action_for_event_by_user(
"Deferred[Tuple[int, Tuple[dict, Optional[int]], Dict[str, Dict[str, JsonValue]], Mapping[str, ProfileInfo]]]",
gather_results(
(
run_in_background( # type: ignore[call-arg]
run_in_background( # type: ignore[call-overload]
self.store.get_number_joined_users_in_room,
event.room_id, # type: ignore[arg-type]
),
Expand All @@ -382,10 +382,10 @@ async def _action_for_event_by_user(
event_id_to_event,
),
run_in_background(self._related_events, event),
run_in_background( # type: ignore[call-arg]
run_in_background( # type: ignore[call-overload]
self.store.get_subset_users_in_room_with_profiles,
event.room_id, # type: ignore[arg-type]
rules_by_user.keys(), # type: ignore[arg-type]
event.room_id,
rules_by_user.keys(),
),
),
consumeErrors=True,
Expand Down
4 changes: 2 additions & 2 deletions synapse/rest/client/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,9 @@ async def on_GET(
# decorator on `get_number_joined_users_in_room` doesn't play well with
# the type system. Maybe in the future, it can use some ParamSpec
# wizardry to fix it up.
room_member_count_deferred = run_in_background( # type: ignore[call-arg]
room_member_count_deferred = run_in_background( # type: ignore[call-overload]
self.store.get_number_joined_users_in_room,
room_id, # type: ignore[arg-type]
room_id,
)

requester = await self.auth.get_user_by_req(request, allow_guest=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/replication/http/test__base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, hs: HomeServer):
self.clock = hs.get_clock()

@staticmethod
async def _serialize_payload() -> JsonDict:
async def _serialize_payload(**kwargs: ReplicationEndpoint) -> JsonDict:
return {}

@cancellable
Expand All @@ -68,7 +68,7 @@ def __init__(self, hs: HomeServer):
self.clock = hs.get_clock()

@staticmethod
async def _serialize_payload() -> JsonDict:
async def _serialize_payload(**kwargs: ReplicationEndpoint) -> JsonDict:
return {}

async def _handle_request( # type: ignore[override]
Expand Down

0 comments on commit f1b0f9a

Please sign in to comment.