mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Add type hints to the spam check module (#6915)
Add typing information to the spam checker modules.
This commit is contained in:
parent
32873efa87
commit
10027c80b0
4 changed files with 36 additions and 22 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue