Fix code-style

This commit is contained in:
Mark Haines 2015-01-29 16:01:14 +00:00
parent 33391db5f8
commit 9150a0d62e

View File

@ -98,10 +98,8 @@ class Filtering(object):
# room checks
if hasattr(event, "room_id"):
room_id = event.room_id
allow_rooms = definition["rooms"] if "rooms" in definition else None
reject_rooms = (
definition["not_rooms"] if "not_rooms" in definition else None
)
allow_rooms = definition.get("rooms", None)
reject_rooms = definition.get("not_rooms", None)
if reject_rooms and room_id in reject_rooms:
return False
if allow_rooms and room_id not in allow_rooms:
@ -111,12 +109,8 @@ class Filtering(object):
if hasattr(event, "sender"):
# Should we be including event.state_key for some event types?
sender = event.sender
allow_senders = (
definition["senders"] if "senders" in definition else None
)
reject_senders = (
definition["not_senders"] if "not_senders" in definition else None
)
allow_senders = definition.get("senders", None)
reject_senders = definition.get("not_senders", None)
if reject_senders and sender in reject_senders:
return False
if allow_senders and sender not in allow_senders:
@ -176,7 +170,6 @@ class Filtering(object):
if key in user_filter["room"]:
self._check_definition(user_filter["room"][key])
def _check_definition(self, definition):
"""Check if the provided definition is valid.