1
0

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 17:48:19 -04:00
committed by GitHub
parent cba3a814c6
commit fc244bb592
539 changed files with 4599 additions and 5066 deletions

View File

@@ -20,7 +20,6 @@
# [This file includes modifications made by New Vector Limited]
#
#
from typing import List
from unittest.mock import patch
import jsonschema
@@ -50,7 +49,7 @@ class FilteringTestCase(unittest.HomeserverTestCase):
def test_errors_on_invalid_filters(self) -> None:
# See USER_FILTER_SCHEMA for the filter schema.
invalid_filters: List[JsonDict] = [
invalid_filters: list[JsonDict] = [
# `account_data` must be a dictionary
{"account_data": "Hello World"},
# `event_format` must be "client" or "federation"
@@ -67,7 +66,7 @@ class FilteringTestCase(unittest.HomeserverTestCase):
def test_ignores_unknown_filter_fields(self) -> None:
# For forward compatibility, we must ignore unknown filter fields.
# See USER_FILTER_SCHEMA for the filter schema.
filters: List[JsonDict] = [
filters: list[JsonDict] = [
{"org.matrix.msc9999.future_option": True},
{"presence": {"org.matrix.msc9999.future_option": True}},
{"room": {"org.matrix.msc9999.future_option": True}},
@@ -78,7 +77,7 @@ class FilteringTestCase(unittest.HomeserverTestCase):
# Must not raise.
def test_valid_filters(self) -> None:
valid_filters: List[JsonDict] = [
valid_filters: list[JsonDict] = [
{
"room": {
"timeline": {"limit": 20},
@@ -557,7 +556,7 @@ class FilteringTestCase(unittest.HomeserverTestCase):
room_id="!foo:bar",
),
]
jsondicts: List[JsonDict] = [{}]
jsondicts: list[JsonDict] = [{}]
# For the following tests we patch the datastore method (intead of injecting
# events). This is a bit cheeky, but tests the logic of _check_event_relations.
@@ -565,7 +564,7 @@ class FilteringTestCase(unittest.HomeserverTestCase):
# Filter for a particular sender.
definition = {"related_by_senders": ["@foo:bar"]}
async def events_have_relations(*args: object, **kwargs: object) -> List[str]:
async def events_have_relations(*args: object, **kwargs: object) -> list[str]:
return ["$with_relation"]
with patch.object(