Skip to content

Commit 4878587

Browse files
authored
[flake8-bugbear] Update to 25.10.21 (#14912)
1 parent c7f70d8 commit 4878587

File tree

3 files changed

+39
-67
lines changed

3 files changed

+39
-67
lines changed

stubs/flake8-bugbear/@tests/stubtest_allowlist.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bugbear.NamedExprFinder.__gt__
2424
bugbear.NamedExprFinder.__le__
2525
bugbear.NamedExprFinder.__lt__
2626
bugbear.NamedExprFinder.__match_args__
27-
# >= Python 3.13
27+
# == Python 3.13
2828
bugbear.B040CaughtException.__replace__
2929
bugbear.B041VariableKeyType.__replace__
3030
bugbear.BugBearChecker.__replace__

stubs/flake8-bugbear/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "24.12.12"
1+
version = "25.10.21"
22
upstream_repository = "https://github.com/PyCQA/flake8-bugbear"

stubs/flake8-bugbear/bugbear.pyi

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import argparse
22
import ast
33
import sys
44
from _typeshed import Incomplete
5-
from collections.abc import Callable, Generator, Iterable, Sequence
5+
from collections.abc import Generator, Iterable, Sequence
66
from functools import partial
77
from logging import Logger
8-
from typing import Any, ClassVar, Final, Literal, NamedTuple, overload
8+
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, overload
99

1010
__version__: Final[str]
1111
LOG: Logger
@@ -28,7 +28,7 @@ class BugBearChecker:
2828
max_line_length: int
2929
visitor: ast.NodeVisitor
3030
options: argparse.Namespace | None
31-
def run(self) -> Generator[error]: ...
31+
def run(self) -> Iterable[tuple[int, int, str, type[BugBearChecker]]]: ...
3232
def gen_line_based_checks(self) -> Generator[error]: ...
3333
@classmethod
3434
def adapt_error(cls, e: error) -> tuple[int, int, str, type[BugBearChecker]]: ...
@@ -67,7 +67,19 @@ class B041VariableKeyType:
6767
name: str
6868
def __init__(self, name: str) -> None: ...
6969

70+
class AstPositionNode(Protocol):
71+
lineno: int
72+
col_offset: int
73+
7074
class BugBearVisitor(ast.NodeVisitor):
75+
filename: str
76+
lines: Sequence[str] | None
77+
b008_b039_extend_immutable_calls: set[str]
78+
b902_classmethod_decorators: set[str]
79+
node_window: list[ast.AST]
80+
errors: list[error]
81+
contexts: list[Context]
82+
b040_caught_exception: B040CaughtException | None
7183
NODE_WINDOW_SIZE: ClassVar[int] = 4
7284
in_trystar: str
7385
def __init__(
@@ -82,6 +94,7 @@ class BugBearVisitor(ast.NodeVisitor):
8294
b040_caught_exception: B040CaughtException | None = None,
8395
in_trystar: str = "",
8496
) -> None: ...
97+
def add_error(self, code: str, node: AstPositionNode, *vars: object) -> None: ...
8598
@property
8699
def node_stack(self) -> list[Context]: ...
87100
def in_class_init(self) -> bool: ...
@@ -137,7 +150,9 @@ class BugBearVisitor(ast.NodeVisitor):
137150
def check_for_b017(self, node: ast.With | ast.AsyncWith) -> None: ...
138151
def check_for_b019(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: ...
139152
def check_for_b020(self, node: ast.For | ast.AsyncFor | ast.comprehension) -> None: ...
140-
def check_for_b023(self, loop_node: ast.For | ast.AsyncFor | ast.comprehension) -> None: ...
153+
def check_for_b023(
154+
self, loop_node: ast.For | ast.AsyncFor | ast.While | ast.GeneratorExp | ast.SetComp | ast.ListComp | ast.DictComp
155+
) -> None: ...
141156
def check_for_b024_and_b027(self, node: ast.ClassDef) -> None: ...
142157
def check_for_b026(self, call: ast.Call) -> None: ...
143158
def check_for_b031(self, loop_node: ast.For | ast.AsyncFor) -> None: ...
@@ -163,12 +178,14 @@ class BugBearVisitor(ast.NodeVisitor):
163178
def check_for_b908(self, node: ast.With) -> None: ...
164179
def check_for_b025(self, node: ast.Try) -> None: ...
165180
def check_for_b905(self, node: ast.Call) -> None: ...
181+
def check_for_b912(self, node: ast.Call) -> None: ...
166182
def check_for_b906(self, node: ast.FunctionDef) -> None: ...
167183
def check_for_b907(self, node: ast.JoinedStr) -> None: ...
168184
def check_for_b028(self, node: ast.Call) -> None: ...
169185
def check_for_b032(self, node: ast.AnnAssign) -> None: ...
170186
def check_for_b033(self, node: ast.Set | ast.List | ast.Tuple) -> None: ...
171187
def check_for_b034(self, node: ast.Call) -> None: ...
188+
def check_for_b042(self, node: ast.ClassDef) -> None: ...
172189
def check_for_b909(self, node: ast.For) -> None: ...
173190
def check_for_b910(self, node: ast.Call) -> None: ...
174191
def check_for_b911(self, node: ast.Call) -> None: ...
@@ -180,7 +197,7 @@ class B909Checker(ast.NodeVisitor):
180197
MUTATING_FUNCTIONS: ClassVar[tuple[str, ...]]
181198
name: str
182199
key: str
183-
mutations: dict[int, list[ast.AST]]
200+
mutations: dict[int, list[ast.Assign | ast.AugAssign | ast.Delete | ast.Call]]
184201
def __init__(self, name: str, key: str) -> None: ...
185202
def visit_Assign(self, node: ast.Assign) -> None: ...
186203
def visit_AugAssign(self, node: ast.AugAssign) -> None: ...
@@ -222,75 +239,30 @@ class B020NameFinder(NameFinder):
222239
def visit_comprehension(self, node: ast.comprehension) -> None: ...
223240
def visit_Lambda(self, node: ast.Lambda) -> None: ...
224241

225-
class error(NamedTuple):
226-
lineno: int
227-
col: int
228-
message: str
229-
type: type[BugBearChecker]
230-
vars: tuple[Incomplete]
231-
232-
Error: Callable[..., partial[error]]
233-
B001: partial[error]
234-
B002: partial[error]
235-
B003: partial[error]
236-
B004: partial[error]
237-
B005: partial[error]
238242
B005_METHODS: Final[set[str]]
239-
B006: partial[error]
240243
B006_MUTABLE_LITERALS: Final[tuple[Literal["Dict"], Literal["List"], Literal["Set"]]]
241244
B006_MUTABLE_COMPREHENSIONS: Final[tuple[Literal["ListComp"], Literal["DictComp"], Literal["SetComp"]]]
242245
B006_MUTABLE_CALLS: Final[set[str]]
243-
B007: partial[error]
244-
B008: partial[error]
245246
B008_IMMUTABLE_CALLS: Final[set[str]]
246-
B009: partial[error]
247-
B010: partial[error]
248-
B011: partial[error]
249-
B012: partial[error]
250-
B013: partial[error]
251-
B014: partial[error]
252247
B014_REDUNDANT_EXCEPTIONS: Final[dict[Literal["OSError", "ValueError"], set[str]]]
253-
B015: partial[error]
254-
B016: partial[error]
255-
B017: partial[error]
256-
B018: partial[error]
257-
B019: partial[error]
258248
B019_CACHES: Final[set[str]]
259-
B020: partial[error]
260-
B021: partial[error]
261-
B022: partial[error]
262-
B023: partial[error]
263-
B024: partial[error]
264-
B025: partial[error]
265-
B026: partial[error]
266-
B027: partial[error]
267-
B028: partial[error]
268-
B029: partial[error]
269-
B030: partial[error]
270-
B031: partial[error]
271-
B032: partial[error]
272-
B033: partial[error]
273-
B034: partial[error]
274-
B035: partial[error]
275-
B036: partial[error]
276-
B037: partial[error]
277-
B039: partial[error]
278-
B040: partial[error]
279-
B041: partial[error]
280-
B901: partial[error]
281-
B902: partial[error]
282249
B902_IMPLICIT_CLASSMETHODS: Final[set[str]]
283250
B902_SELF: Final[list[str]]
284251
B902_CLS: Final[list[str]]
285252
B902_METACLS: Final[list[str]]
286-
B903: partial[error]
287-
B904: partial[error]
288-
B905: partial[error]
289-
B906: partial[error]
290-
B907: partial[error]
291-
B908: partial[error]
292-
B909: partial[error]
293-
B910: partial[error]
294-
B911: partial[error]
295-
B950: partial[error]
253+
254+
class error(NamedTuple):
255+
lineno: int
256+
col: int
257+
message: str
258+
type: type[BugBearChecker]
259+
# Arguments for formatting the message, i.e. message.format(*vars).
260+
vars: tuple[object, ...]
261+
262+
class Error:
263+
message: str
264+
def __init__(self, message: str) -> None: ...
265+
def __call__(self, lineno: int, col: int, vars: tuple[object, ...] = ()) -> error: ...
266+
267+
error_codes: Final[dict[str, Error]]
296268
disabled_by_default: Final[list[str]]

0 commit comments

Comments
 (0)