diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-02-14 12:49:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 12:49:40 -0500 |
commit | 10027c80b031f1e62b47cd61c534420673f49a71 (patch) | |
tree | 73652ba5b9350bf444b03fb6752451b2252bd18c /synapse/spam_checker_api | |
parent | contrib/docker: Ensure correct encoding and locale settings on DB creation (#... (diff) | |
download | synapse-10027c80b031f1e62b47cd61c534420673f49a71.tar.xz |
Add type hints to the spam check module (#6915)
Add typing information to the spam checker modules.
Diffstat (limited to 'synapse/spam_checker_api')
-rw-r--r-- | synapse/spam_checker_api/__init__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/spam_checker_api/__init__.py b/synapse/spam_checker_api/__init__.py index efcc10f808..9b78924d96 100644 --- a/synapse/spam_checker_api/__init__.py +++ b/synapse/spam_checker_api/__init__.py @@ -18,6 +18,10 @@ from twisted.internet import defer from synapse.storage.state import StateFilter +MYPY = False +if MYPY: + import synapse.server + logger = logging.getLogger(__name__) @@ -26,18 +30,18 @@ class SpamCheckerApi(object): access to rooms and other relevant information. """ - def __init__(self, hs): + def __init__(self, hs: "synapse.server.HomeServer"): self.hs = hs self._store = hs.get_datastore() @defer.inlineCallbacks - def get_state_events_in_room(self, room_id, types): + def get_state_events_in_room(self, room_id: str, types: tuple) -> defer.Deferred: """Gets state events for the given room. Args: - room_id (string): The room ID to get state events in. - types (tuple): The event type and state key (using None + room_id: The room ID to get state events in. + types: The event type and state key (using None to represent 'any') of the room state to acquire. Returns: |