Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3150 from NotAFile/py3-listcomp-yield
Browse files Browse the repository at this point in the history
Don't yield in list comprehensions
  • Loading branch information
richvdh authored Apr 30, 2018
2 parents 2fd9672 + cdb4647 commit 3b0e431
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions synapse/handlers/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,15 @@ def _get_services_for_event(self, event):
event based on the service regex.
"""
services = self.store.get_app_services()
interested_list = [
s for s in services if (
yield s.is_interested(event, self.store)
)
]

# we can't use a list comprehension here. Since python 3, list
# comprehensions use a generator internally. This means you can't yield
# inside of a list comprehension anymore.
interested_list = []
for s in services:
if (yield s.is_interested(event, self.store)):
interested_list.append(s)

defer.returnValue(interested_list)

def _get_services_for_user(self, user_id):
Expand Down

0 comments on commit 3b0e431

Please sign in to comment.