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

Commit

Permalink
Bump flake8-bugbear from 21.3.2 to 22.9.23 (#14042)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Erik Johnston <erik@matrix.org>
Co-authored-by: David Robertson <davidr@element.io>
  • Loading branch information
3 people authored Oct 19, 2022
1 parent 695a85d commit 0b7830e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
9 changes: 8 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@
# E203: whitespace before ':' (which is contrary to pep8?)
# E731: do not assign a lambda expression, use a def
# E501: Line too long (black enforces this for us)
ignore=W503,W504,E203,E731,E501
#
# flake8-bugbear runs extra checks. Its error codes are described at
# https://github.com/PyCQA/flake8-bugbear#list-of-warnings
# B019: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks
# B023: Functions defined inside a loop must not use variables redefined in the loop
# B024: Abstract base class with no abstract method.

ignore=W503,W504,E203,E731,E501,B019,B023,B024
1 change: 1 addition & 0 deletions changelog.d/14042.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump flake8-bugbear from 21.3.2 to 22.9.23.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions synapse/storage/databases/main/roommember.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,8 @@ async def get_rooms_for_users(

# 250 users is pretty arbitrary but the data can be quite large if users
# are in many rooms.
for user_ids in batch_iter(user_ids, 250):
all_user_rooms.update(await self._get_rooms_for_users(user_ids))
for batch_user_ids in batch_iter(user_ids, 250):
all_user_rooms.update(await self._get_rooms_for_users(batch_user_ids))

return all_user_rooms

Expand Down
4 changes: 2 additions & 2 deletions synapse/util/caches/deferred_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ def invalidate(self, key: KT) -> None:
# _pending_deferred_cache.pop should either return a CacheEntry, or, in the
# case of a TreeCache, a dict of keys to cache entries. Either way calling
# iterate_tree_cache_entry on it will do the right thing.
for entry in iterate_tree_cache_entry(entry):
for cb in entry.get_invalidation_callbacks(key):
for iter_entry in iterate_tree_cache_entry(entry):
for cb in iter_entry.get_invalidation_callbacks(key):
cb()

def invalidate_all(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion synapse/util/caches/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def __get__(
num_args = cached_method.num_args

if num_args != self.num_args:
raise Exception(
raise TypeError(
"Number of args (%s) does not match underlying cache_method_name=%s (%s)."
% (self.num_args, self.cached_method_name, num_args)
)
Expand Down
7 changes: 3 additions & 4 deletions tests/federation/transport/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from synapse.api.room_versions import RoomVersions
from synapse.federation.transport.client import SendJoinParser
from synapse.util import ExceptionBundle

from tests.unittest import TestCase

Expand Down Expand Up @@ -121,10 +122,8 @@ def test_errors_closing_coroutines(self) -> None:
# Send half of the data to the parser
parser.write(serialisation[: len(serialisation) // 2])

# Close the parser. There should be _some_ kind of exception, but it need not
# be that RuntimeError directly. E.g. we might want to raise a wrapper
# encompassing multiple errors from multiple coroutines.
with self.assertRaises(Exception):
# Close the parser. There should be _some_ kind of exception.
with self.assertRaises(ExceptionBundle):
parser.finish()

# In any case, we should have tried to close both coros.
Expand Down
2 changes: 1 addition & 1 deletion tests/util/caches/test_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,5 +1037,5 @@ def list_fn(self, keys: Iterable[Tuple[str, str]]):
obj = Cls()

# Make sure this raises an error about the arg mismatch
with self.assertRaises(Exception):
with self.assertRaises(TypeError):
obj.list_fn([("foo", "bar")])

0 comments on commit 0b7830e

Please sign in to comment.