mirror of
https://github.com/element-hq/synapse.git
synced 2026-10-23 19:33:44 +00:00
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:
1 parent
cba3a814c6
commit
fc244bb592
539 files changed
+4599
-5066
No files matched your search
@@ -18,7 +18,7 @@
|
||||
# [This file includes modifications made by New Vector Limited]
|
||||
#
|
||||
#
|
||||
from typing import Any, List, Mapping, Optional, Sequence, Union
|
||||
from typing import Any, Mapping, Optional, Sequence, Union
|
||||
from unittest.mock import Mock
|
||||
|
||||
from twisted.internet.testing import MemoryReactor
|
||||
@@ -81,7 +81,7 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
|
||||
url: str,
|
||||
args: Mapping[Any, Any],
|
||||
headers: Mapping[Union[str, bytes], Sequence[Union[str, bytes]]],
|
||||
) -> List[JsonDict]:
|
||||
) -> list[JsonDict]:
|
||||
# Ensure the access token is passed as a header.
|
||||
if not headers or not headers.get(b"Authorization"):
|
||||
raise RuntimeError("Access token not provided")
|
||||
@@ -157,7 +157,7 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
|
||||
headers: Optional[
|
||||
Mapping[Union[str, bytes], Sequence[Union[str, bytes]]]
|
||||
] = None,
|
||||
) -> List[JsonDict]:
|
||||
) -> list[JsonDict]:
|
||||
# Ensure the access token is passed as a both a query param and in the headers.
|
||||
if not args.get(b"access_token"):
|
||||
raise RuntimeError("Access token should be provided in query params.")
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# [This file includes modifications made by New Vector Limited]
|
||||
#
|
||||
#
|
||||
from typing import List, Optional, Sequence, Tuple
|
||||
from typing import Optional, Sequence
|
||||
from unittest.mock import AsyncMock, Mock
|
||||
|
||||
from typing_extensions import TypeAlias
|
||||
@@ -288,11 +288,11 @@ class ApplicationServiceSchedulerRecovererTestCase(unittest.HomeserverTestCase):
|
||||
# Corresponds to synapse.appservice.scheduler._TransactionController.send
|
||||
TxnCtrlArgs: TypeAlias = """
|
||||
defer.Deferred[
|
||||
Tuple[
|
||||
tuple[
|
||||
ApplicationService,
|
||||
Sequence[EventBase],
|
||||
Optional[List[JsonDict]],
|
||||
Optional[List[JsonDict]],
|
||||
Optional[list[JsonDict]],
|
||||
Optional[list[JsonDict]],
|
||||
Optional[TransactionOneTimeKeysCount],
|
||||
Optional[TransactionUnusedFallbackKeys],
|
||||
Optional[DeviceListUpdates],
|
||||
|
||||
Reference in new issue
Block a user