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

@@ -13,10 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List
class ServerAclEvaluator:
def __init__(
self, allow_ip_literals: bool, allow: List[str], deny: List[str]
self, allow_ip_literals: bool, allow: list[str], deny: list[str]
) -> None: ...
def server_matches_acl_event(self, server_name: str) -> bool: ...

View File

@@ -10,7 +10,7 @@
# See the GNU Affero General Public License for more details:
# <https://www.gnu.org/licenses/agpl-3.0.html>.
from typing import List, Mapping, Optional, Tuple
from typing import Mapping, Optional
from synapse.types import JsonDict
@@ -115,7 +115,7 @@ def event_visible_to_server(
history_visibility: str,
erased_senders: Mapping[str, bool],
partial_state_invisible: bool,
memberships: List[Tuple[str, str]],
memberships: list[tuple[str, str]],
) -> bool:
"""Determine whether the server is allowed to see the unredacted event.

View File

@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Any, Collection, Dict, Mapping, Optional, Sequence, Tuple, Union
from typing import Any, Collection, Mapping, Optional, Sequence, Union
from synapse.types import JsonDict, JsonValue
@@ -43,7 +43,7 @@ class FilteredPushRules:
def __init__(
self,
push_rules: PushRules,
enabled_map: Dict[str, bool],
enabled_map: dict[str, bool],
msc1767_enabled: bool,
msc3381_polls_enabled: bool,
msc3664_enabled: bool,
@@ -51,7 +51,7 @@ class FilteredPushRules:
msc4210_enabled: bool,
msc4306_enabled: bool,
): ...
def rules(self) -> Collection[Tuple[PushRule, bool]]: ...
def rules(self) -> Collection[tuple[PushRule, bool]]: ...
def get_base_rule_ids() -> Collection[str]: ...
@@ -65,7 +65,7 @@ class PushRuleEvaluator:
notification_power_levels: Mapping[str, int],
related_events_flattened: Mapping[str, Mapping[str, JsonValue]],
related_event_match_enabled: bool,
room_version_feature_flags: Tuple[str, ...],
room_version_feature_flags: tuple[str, ...],
msc3931_enabled: bool,
msc4210_enabled: bool,
msc4306_enabled: bool,

View File

@@ -1,3 +1 @@
from typing import List
def parse_words(text: str) -> List[str]: ...
def parse_words(text: str) -> list[str]: ...