Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)

Ensure good comprehension hygiene using flake8-comprehensions.
This commit is contained in:
Patrick Cloke 2020-02-21 07:15:07 -05:00 committed by GitHub
parent 272eee1ae1
commit 509e381afa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 251 additions and 276 deletions

View file

@ -69,14 +69,14 @@ class ApplicationServiceStoreTestCase(unittest.TestCase):
pass
def _add_appservice(self, as_token, id, url, hs_token, sender):
as_yaml = dict(
url=url,
as_token=as_token,
hs_token=hs_token,
id=id,
sender_localpart=sender,
namespaces={},
)
as_yaml = {
"url": url,
"as_token": as_token,
"hs_token": hs_token,
"id": id,
"sender_localpart": sender,
"namespaces": {},
}
# use the token as the filename
with open(as_token, "w") as outfile:
outfile.write(yaml.dump(as_yaml))
@ -135,14 +135,14 @@ class ApplicationServiceTransactionStoreTestCase(unittest.TestCase):
)
def _add_service(self, url, as_token, id):
as_yaml = dict(
url=url,
as_token=as_token,
hs_token="something",
id=id,
sender_localpart="a_sender",
namespaces={},
)
as_yaml = {
"url": url,
"as_token": as_token,
"hs_token": "something",
"id": id,
"sender_localpart": "a_sender",
"namespaces": {},
}
# use the token as the filename
with open(as_token, "w") as outfile:
outfile.write(yaml.dump(as_yaml))
@ -384,8 +384,8 @@ class ApplicationServiceTransactionStoreTestCase(unittest.TestCase):
)
self.assertEquals(2, len(services))
self.assertEquals(
set([self.as_list[2]["id"], self.as_list[0]["id"]]),
set([services[0].id, services[1].id]),
{self.as_list[2]["id"], self.as_list[0]["id"]},
{services[0].id, services[1].id},
)