-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[
flake8-bugbear
] Do not raise error if keyword argument is present …
…and target-python version is less or equals than 3.9 (`B903`) (#15549)
- Loading branch information
1 parent
4328df7
commit 4fdf8af
Showing
5 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...hots/ruff_linter__rules__flake8_bugbear__tests__B903_py39_class_as_data_structure.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs | ||
--- | ||
class_as_data_structure.py:6:1: B903 Class could be dataclass or namedtuple | ||
| | ||
6 | / class Point: # B903 | ||
7 | | def __init__(self, x: float, y: float) -> None: | ||
8 | | self.x = x | ||
9 | | self.y = y | ||
| |__________________^ B903 | ||
| | ||
|
||
class_as_data_structure.py:40:1: B903 Class could be dataclass or namedtuple | ||
| | ||
38 | ... | ||
39 | | ||
40 | / class C: # B903 | ||
41 | | c: int | ||
42 | | def __init__(self,d:list): | ||
43 | | self.d = d | ||
| |__________________^ B903 | ||
44 | | ||
45 | class D: # B903 | ||
| | ||
|
||
class_as_data_structure.py:45:1: B903 Class could be dataclass or namedtuple | ||
| | ||
43 | self.d = d | ||
44 | | ||
45 | / class D: # B903 | ||
46 | | """This class has a docstring.""" | ||
47 | | # this next method is an init | ||
48 | | def __init__(self,e:dict): | ||
49 | | self.e = e | ||
| |__________________^ B903 | ||
50 | | ||
51 | # <--- begin flake8-bugbear tests below | ||
| | ||
|
||
class_as_data_structure.py:63:1: B903 Class could be dataclass or namedtuple | ||
| | ||
63 | / class NoWarningsClassAttributes: | ||
64 | | spam = "ham" | ||
65 | | | ||
66 | | def __init__(self, foo:int, bar:list): | ||
67 | | self.foo = foo | ||
68 | | self.bar = bar | ||
| |______________________^ B903 | ||
| | ||
|
||
class_as_data_structure.py:85:1: B903 Class could be dataclass or namedtuple | ||
| | ||
85 | / class Warnings: | ||
86 | | def __init__(self, foo:int, bar:list): | ||
87 | | self.foo = foo | ||
88 | | self.bar = bar | ||
| |______________________^ B903 | ||
| | ||
|
||
class_as_data_structure.py:91:1: B903 Class could be dataclass or namedtuple | ||
| | ||
91 | / class WarningsWithDocstring: | ||
92 | | """A docstring should not be an impediment to a warning""" | ||
93 | | | ||
94 | | def __init__(self, foo:int, bar:list): | ||
95 | | self.foo = foo | ||
96 | | self.bar = bar | ||
| |______________________^ B903 | ||
| |