Type hints for tests.appservice (#14990)

* Accept a Sequence of events in synapse.appservice

This avoids some casts/ignores in the tests I'm about to fixup. It seems
that `List[Mock]` is not a subtype of `List[EventBase]`, but
`Sequence[Mock]` is a subtype of `Sequence[EventBase]`. So presumably
`Mock` is considered a subtype of anything, much like `Any`.

* make tests.appservice.test_scheduler pass mypy

* Extra hints in tests.appservice.test_scheduler

* Extra hints in tests.appservice.test_api

* Extra hints in tests.appservice.test_appservice

* Disallow untyped defs

* Changelog
This commit is contained in:
David Robertson 2023-02-06 12:49:06 +00:00 committed by GitHub
parent 3e37ff1a7e
commit e8269ed391
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 132 additions and 59 deletions

View file

@ -57,6 +57,7 @@ from typing import (
Iterable,
List,
Optional,
Sequence,
Set,
Tuple,
)
@ -364,7 +365,7 @@ class _TransactionController:
async def send(
self,
service: ApplicationService,
events: List[EventBase],
events: Sequence[EventBase],
ephemeral: Optional[List[JsonDict]] = None,
to_device_messages: Optional[List[JsonDict]] = None,
one_time_keys_count: Optional[TransactionOneTimeKeysCount] = None,