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

Commit 0b7830e

Browse files
dependabot[bot]erikjohnstonDavid Robertson
authored
Bump flake8-bugbear from 21.3.2 to 22.9.23 (#14042)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Erik Johnston <[email protected]> Co-authored-by: David Robertson <[email protected]>
1 parent 695a85d commit 0b7830e

File tree

8 files changed

+22
-15
lines changed

8 files changed

+22
-15
lines changed

.flake8

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@
88
# E203: whitespace before ':' (which is contrary to pep8?)
99
# E731: do not assign a lambda expression, use a def
1010
# E501: Line too long (black enforces this for us)
11-
ignore=W503,W504,E203,E731,E501
11+
#
12+
# flake8-bugbear runs extra checks. Its error codes are described at
13+
# https://github.com/PyCQA/flake8-bugbear#list-of-warnings
14+
# B019: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks
15+
# B023: Functions defined inside a loop must not use variables redefined in the loop
16+
# B024: Abstract base class with no abstract method.
17+
18+
ignore=W503,W504,E203,E731,E501,B019,B023,B024

changelog.d/14042.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump flake8-bugbear from 21.3.2 to 22.9.23.

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synapse/storage/databases/main/roommember.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,8 @@ async def get_rooms_for_users(
707707

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

713713
return all_user_rooms
714714

synapse/util/caches/deferred_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ def invalidate(self, key: KT) -> None:
395395
# _pending_deferred_cache.pop should either return a CacheEntry, or, in the
396396
# case of a TreeCache, a dict of keys to cache entries. Either way calling
397397
# iterate_tree_cache_entry on it will do the right thing.
398-
for entry in iterate_tree_cache_entry(entry):
399-
for cb in entry.get_invalidation_callbacks(key):
398+
for iter_entry in iterate_tree_cache_entry(entry):
399+
for cb in iter_entry.get_invalidation_callbacks(key):
400400
cb()
401401

402402
def invalidate_all(self) -> None:

synapse/util/caches/descriptors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def __get__(
432432
num_args = cached_method.num_args
433433

434434
if num_args != self.num_args:
435-
raise Exception(
435+
raise TypeError(
436436
"Number of args (%s) does not match underlying cache_method_name=%s (%s)."
437437
% (self.num_args, self.cached_method_name, num_args)
438438
)

tests/federation/transport/test_client.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from synapse.api.room_versions import RoomVersions
1919
from synapse.federation.transport.client import SendJoinParser
20+
from synapse.util import ExceptionBundle
2021

2122
from tests.unittest import TestCase
2223

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

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

130129
# In any case, we should have tried to close both coros.

tests/util/caches/test_descriptors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,5 +1037,5 @@ def list_fn(self, keys: Iterable[Tuple[str, str]]):
10371037
obj = Cls()
10381038

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

0 commit comments

Comments
 (0)