forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap
158 lines (143 loc) · 4.89 KB
/
ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument defaults
|
5 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
6 | import os
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
2 2 | # https://github.com/astral-sh/ruff/issues/7616
3 3 |
4 4 |
5 |-def import_module_wrong(value: dict[str, str] = {}):
5 |+def import_module_wrong(value: dict[str, str] = None):
6 6 | import os
7 |+ if value is None:
8 |+ value = {}
7 9 |
8 10 |
9 11 | def import_module_with_values_wrong(value: dict[str, str] = {}):
B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument defaults
|
9 | def import_module_with_values_wrong(value: dict[str, str] = {}):
| ^^ B006
10 | import os
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
6 6 | import os
7 7 |
8 8 |
9 |-def import_module_with_values_wrong(value: dict[str, str] = {}):
9 |+def import_module_with_values_wrong(value: dict[str, str] = None):
10 10 | import os
11 |+ if value is None:
12 |+ value = {}
11 13 |
12 14 | return 2
13 15 |
B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaults
|
15 | def import_modules_wrong(value: dict[str, str] = {}):
| ^^ B006
16 | import os
17 | import sys
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
12 12 | return 2
13 13 |
14 14 |
15 |-def import_modules_wrong(value: dict[str, str] = {}):
15 |+def import_modules_wrong(value: dict[str, str] = None):
16 16 | import os
17 17 | import sys
18 18 | import itertools
19 |+ if value is None:
20 |+ value = {}
19 21 |
20 22 |
21 23 | def from_import_module_wrong(value: dict[str, str] = {}):
B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaults
|
21 | def from_import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
22 | from os import path
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
18 18 | import itertools
19 19 |
20 20 |
21 |-def from_import_module_wrong(value: dict[str, str] = {}):
21 |+def from_import_module_wrong(value: dict[str, str] = None):
22 22 | from os import path
23 |+ if value is None:
24 |+ value = {}
23 25 |
24 26 |
25 27 | def from_imports_module_wrong(value: dict[str, str] = {}):
B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaults
|
25 | def from_imports_module_wrong(value: dict[str, str] = {}):
| ^^ B006
26 | from os import path
27 | from sys import version_info
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
22 22 | from os import path
23 23 |
24 24 |
25 |-def from_imports_module_wrong(value: dict[str, str] = {}):
25 |+def from_imports_module_wrong(value: dict[str, str] = None):
26 26 | from os import path
27 27 | from sys import version_info
28 |+ if value is None:
29 |+ value = {}
28 30 |
29 31 |
30 32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaults
|
30 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
| ^^ B006
31 | import os
32 | from sys import version_info
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
27 27 | from sys import version_info
28 28 |
29 29 |
30 |-def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
30 |+def import_and_from_imports_module_wrong(value: dict[str, str] = None):
31 31 | import os
32 32 | from sys import version_info
33 |+ if value is None:
34 |+ value = {}
33 35 |
34 36 |
35 37 | def import_docstring_module_wrong(value: dict[str, str] = {}):
B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaults
|
35 | def import_docstring_module_wrong(value: dict[str, str] = {}):
| ^^ B006
36 | """Docstring"""
37 | import os
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
32 32 | from sys import version_info
33 33 |
34 34 |
35 |-def import_docstring_module_wrong(value: dict[str, str] = {}):
35 |+def import_docstring_module_wrong(value: dict[str, str] = None):
36 36 | """Docstring"""
37 37 | import os
38 |+
39 |+ if value is None:
40 |+ value = {}