diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-12-11 11:43:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 11:43:53 -0500 |
commit | 5d34f40d494305bb32b3d57c18fb17d98d21a31f (patch) | |
tree | 9e1384355c811a8c9a81e28e1dc1f587012507b4 /synapse/push/action_generator.py | |
parent | Honour AS ratelimit settings for /login requests (#8920) (diff) | |
download | synapse-5d34f40d494305bb32b3d57c18fb17d98d21a31f.tar.xz |
Add type hints to the push module. (#8901)
Diffstat (limited to 'synapse/push/action_generator.py')
-rw-r--r-- | synapse/push/action_generator.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/synapse/push/action_generator.py b/synapse/push/action_generator.py index fabc9ba126..aaed28650d 100644 --- a/synapse/push/action_generator.py +++ b/synapse/push/action_generator.py @@ -14,19 +14,22 @@ # limitations under the License. import logging +from typing import TYPE_CHECKING +from synapse.events import EventBase +from synapse.events.snapshot import EventContext +from synapse.push.bulk_push_rule_evaluator import BulkPushRuleEvaluator from synapse.util.metrics import Measure -from .bulk_push_rule_evaluator import BulkPushRuleEvaluator +if TYPE_CHECKING: + from synapse.app.homeserver import HomeServer logger = logging.getLogger(__name__) class ActionGenerator: - def __init__(self, hs): - self.hs = hs + def __init__(self, hs: "HomeServer"): self.clock = hs.get_clock() - self.store = hs.get_datastore() self.bulk_evaluator = BulkPushRuleEvaluator(hs) # really we want to get all user ids and all profile tags too, # since we want the actions for each profile tag for every user and @@ -35,6 +38,8 @@ class ActionGenerator: # event stream, so we just run the rules for a client with no profile # tag (ie. we just need all the users). - async def handle_push_actions_for_event(self, event, context): + async def handle_push_actions_for_event( + self, event: EventBase, context: EventContext + ) -> None: with Measure(self.clock, "action_for_event_by_user"): await self.bulk_evaluator.action_for_event_by_user(event, context) |