diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-30 11:10:17 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-30 11:10:17 +0000 |
commit | 7d709542ca3ae3c69a46f3d9dc383cf9c4dfab95 (patch) | |
tree | 155997683ee2d493e53218a725eb2b85b526fbe9 /synapse/handlers/presence.py | |
parent | SYWEB-112: Use the right user ID when determining invites for display on the ... (diff) | |
download | synapse-7d709542ca3ae3c69a46f3d9dc383cf9c4dfab95.tar.xz |
Fix pep8 warnings
Diffstat (limited to 'synapse/handlers/presence.py')
-rw-r--r-- | synapse/handlers/presence.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 4bbcb52b28..2ccc2245b7 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -76,9 +76,7 @@ class PresenceHandler(BaseHandler): "stopped_user_eventstream", self.stopped_user_eventstream ) - distributor.observe("user_joined_room", - self.user_joined_room - ) + distributor.observe("user_joined_room", self.user_joined_room) distributor.declare("collect_presencelike_data") @@ -156,14 +154,12 @@ class PresenceHandler(BaseHandler): defer.returnValue(True) if (yield self.store.user_rooms_intersect( - [u.to_string() for u in observer_user, observed_user] - )): + [u.to_string() for u in observer_user, observed_user])): defer.returnValue(True) if (yield self.store.is_presence_visible( - observed_localpart=observed_user.localpart, - observer_userid=observer_user.to_string(), - )): + observed_localpart=observed_user.localpart, + observer_userid=observer_user.to_string())): defer.returnValue(True) defer.returnValue(False) @@ -171,7 +167,8 @@ class PresenceHandler(BaseHandler): @defer.inlineCallbacks def get_state(self, target_user, auth_user): if target_user.is_mine: - visible = yield self.is_presence_visible(observer_user=auth_user, + visible = yield self.is_presence_visible( + observer_user=auth_user, observed_user=target_user ) @@ -219,9 +216,9 @@ class PresenceHandler(BaseHandler): ) if state["presence"] not in self.STATE_LEVELS: - raise SynapseError(400, "'%s' is not a valid presence state" % - state["presence"] - ) + raise SynapseError(400, "'%s' is not a valid presence state" % ( + state["presence"], + )) logger.debug("Updating presence state of %s to %s", target_user.localpart, state["presence"]) @@ -229,7 +226,7 @@ class PresenceHandler(BaseHandler): state_to_store = dict(state) state_to_store["state"] = state_to_store.pop("presence") - statuscache=self._get_or_offline_usercache(target_user) + statuscache = self._get_or_offline_usercache(target_user) was_level = self.STATE_LEVELS[statuscache.get_state()["presence"]] now_level = self.STATE_LEVELS[state["presence"]] @@ -649,8 +646,9 @@ class PresenceHandler(BaseHandler): del state["user_id"] if "presence" not in state: - logger.warning("Received a presence 'push' EDU from %s without" - + " a 'presence' key", origin + logger.warning( + "Received a presence 'push' EDU from %s without a" + " 'presence' key", origin ) continue @@ -745,7 +743,7 @@ class PresenceHandler(BaseHandler): defer.returnValue((localusers, remote_domains)) def push_update_to_clients(self, observed_user, users_to_push=[], - room_ids=[], statuscache=None): + room_ids=[], statuscache=None): self.notifier.on_new_user_event( users_to_push, room_ids, @@ -765,8 +763,7 @@ class PresenceEventSource(object): presence = self.hs.get_handlers().presence_handler if (yield presence.store.user_rooms_intersect( - [u.to_string() for u in observer_user, observed_user] - )): + [u.to_string() for u in observer_user, observed_user])): defer.returnValue(True) if observed_user.is_mine: |