-
Notifications
You must be signed in to change notification settings - Fork 902
/
ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap
313 lines (283 loc) · 9.79 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
---
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 11 |
12 |+ if value is None:
13 |+ value = {}
12 14 | return 2
13 15 |
14 16 |
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 |+ if value is None:
39 |+ value = {}
38 40 |
39 41 |
40 42 | def import_module_wrong(value: dict[str, str] = {}):
B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaults
|
40 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
41 | """Docstring"""
42 | import os; import sys
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
37 37 | import os
38 38 |
39 39 |
40 |-def import_module_wrong(value: dict[str, str] = {}):
40 |+def import_module_wrong(value: dict[str, str] = None):
41 41 | """Docstring"""
42 42 | import os; import sys
43 |+ if value is None:
44 |+ value = {}
43 45 |
44 46 |
45 47 | def import_module_wrong(value: dict[str, str] = {}):
B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaults
|
45 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
46 | """Docstring"""
47 | import os; import sys; x = 1
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
42 42 | import os; import sys
43 43 |
44 44 |
45 |-def import_module_wrong(value: dict[str, str] = {}):
45 |+def import_module_wrong(value: dict[str, str] = None):
46 46 | """Docstring"""
47 |+ if value is None:
48 |+ value = {}
47 49 | import os; import sys; x = 1
48 50 |
49 51 |
B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaults
|
50 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
51 | """Docstring"""
52 | import os; import sys
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
47 47 | import os; import sys; x = 1
48 48 |
49 49 |
50 |-def import_module_wrong(value: dict[str, str] = {}):
50 |+def import_module_wrong(value: dict[str, str] = None):
51 51 | """Docstring"""
52 52 | import os; import sys
53 |+ if value is None:
54 |+ value = {}
53 55 |
54 56 |
55 57 | def import_module_wrong(value: dict[str, str] = {}):
B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaults
|
55 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
56 | import os; import sys
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
52 52 | import os; import sys
53 53 |
54 54 |
55 |-def import_module_wrong(value: dict[str, str] = {}):
55 |+def import_module_wrong(value: dict[str, str] = None):
56 56 | import os; import sys
57 |+ if value is None:
58 |+ value = {}
57 59 |
58 60 |
59 61 | def import_module_wrong(value: dict[str, str] = {}):
B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaults
|
59 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
60 | import os; import sys; x = 1
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
56 56 | import os; import sys
57 57 |
58 58 |
59 |-def import_module_wrong(value: dict[str, str] = {}):
59 |+def import_module_wrong(value: dict[str, str] = None):
60 |+ if value is None:
61 |+ value = {}
60 62 | import os; import sys; x = 1
61 63 |
62 64 |
B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaults
|
63 | def import_module_wrong(value: dict[str, str] = {}):
| ^^ B006
64 | import os; import sys
|
= help: Replace with `None`; initialize within function
ℹ Possible fix
60 60 | import os; import sys; x = 1
61 61 |
62 62 |
63 |-def import_module_wrong(value: dict[str, str] = {}):
63 |+def import_module_wrong(value: dict[str, str] = None):
64 64 | import os; import sys
65 |+ if value is None:
66 |+ value = {}
65 67 |
66 68 |
67 69 | def import_module_wrong(value: dict[str, str] = {}): import os
B006_5.py:67:49: B006 Do not use mutable data structures for argument defaults
|
67 | def import_module_wrong(value: dict[str, str] = {}): import os
| ^^ B006
|
= help: Replace with `None`; initialize within function
B006_5.py:70:49: B006 Do not use mutable data structures for argument defaults
|
70 | def import_module_wrong(value: dict[str, str] = {}): import os; import sys
| ^^ B006
|
= help: Replace with `None`; initialize within function
B006_5.py:73:49: B006 Do not use mutable data structures for argument defaults
|
73 | def import_module_wrong(value: dict[str, str] = {}): \
| ^^ B006
74 | import os
|
= help: Replace with `None`; initialize within function