Use type hinting generics in standard collections (#19046)

aka PEP 585, added in Python 3.9

 - https://peps.python.org/pep-0585/
 - https://docs.astral.sh/ruff/rules/non-pep585-annotation/
This commit is contained in:
Andrew Ferrazzutti
2025-10-22 16:48:19 -05:00
committed by GitHub
parent cba3a814c6
commit fc244bb592
539 changed files with 4599 additions and 5066 deletions
+8 -8
View File
@@ -18,7 +18,7 @@
#
#
import itertools
from typing import Dict, List, Optional, Sequence, Set
from typing import Optional, Sequence
from twisted.internet import defer
from twisted.test.proto_helpers import MemoryReactor
@@ -357,11 +357,11 @@ class StateResV21TestCase(unittest.HomeserverTestCase):
self,
room_id: str,
state_maps: Sequence[StateMap[str]],
event_map: Optional[Dict[str, EventBase]],
event_map: Optional[dict[str, EventBase]],
state_res_store: StateResolutionStoreInterface,
) -> Set[str]:
) -> set[str]:
_, conflicted_state = _seperate(state_maps)
conflicted_set: Optional[Set[str]] = set(
conflicted_set: Optional[set[str]] = set(
itertools.chain.from_iterable(conflicted_state.values())
)
if event_map is None:
@@ -377,7 +377,7 @@ class StateResV21TestCase(unittest.HomeserverTestCase):
def get_resolution_and_verify_expected(
self,
state_maps: Sequence[StateMap[str]],
events: List[EventBase],
events: list[EventBase],
expected: StateMap[str],
) -> None:
room_id = events[0].room_id
@@ -475,9 +475,9 @@ class StateResV21TestCase(unittest.HomeserverTestCase):
event_type: str,
state_key: Optional[str],
sender: str,
content: Dict,
auth_events: List[str],
prev_events: Optional[List[str]] = None,
content: dict,
auth_events: list[str],
prev_events: Optional[list[str]] = None,
room_id: Optional[str] = None,
) -> EventBase:
"""Short-hand for event_from_pdu_json for fields we typically care about.