Skip to content

Commit efd995c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b6ad99e commit efd995c

3 files changed

Lines changed: 26 additions & 51 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pysource-codegen --seed 42
2727

2828
or as a library:
2929

30-
``` python
30+
```python
3131
from pysource_codegen import generate
3232

3333
seed = 42
@@ -38,7 +38,7 @@ You might find [pysource-minimize](https://github.com/15r10nk/pysource-minimize)
3838
to reduce the generated code which triggers your bug down to a minimal code snipped,
3939
which can be used to fix the issue.
4040

41-
``` python
41+
```python
4242
from pysource_codegen import generate
4343
from pysource_minimize import minimize
4444

pysource_codegen/ast_info.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from .types import NodeType
1010
from .types import UnionNodeType
1111

12-
1312
type_infos: dict[str, NodeType | BuiltinNodeType | UnionNodeType] = {}
1413

1514

tests/test_fix_nonlocal.py

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,10 @@ def test_global_0():
7272
def a(x):
7373
global x
7474
""",
75-
snapshot(
76-
"""\
75+
snapshot("""\
7776
def a(x):
7877
pass
79-
"""
80-
),
78+
"""),
8179
)
8280

8381

@@ -88,13 +86,11 @@ def a():
8886
x = 0
8987
global x
9088
""",
91-
snapshot(
92-
"""\
89+
snapshot("""\
9390
def a():
9491
x = 0
9592
pass
96-
"""
97-
),
93+
"""),
9894
)
9995

10096

@@ -105,13 +101,11 @@ def a():
105101
print(x)
106102
global x
107103
""",
108-
snapshot(
109-
"""\
104+
snapshot("""\
110105
def a():
111106
print(x)
112107
pass
113-
"""
114-
),
108+
"""),
115109
)
116110

117111

@@ -122,13 +116,11 @@ def a():
122116
x:int
123117
global x
124118
""",
125-
snapshot(
126-
"""\
119+
snapshot("""\
127120
def a():
128121
x: int
129122
pass
130-
"""
131-
),
123+
"""),
132124
)
133125

134126

@@ -142,16 +134,14 @@ def b():
142134
nonlocal x
143135
global x
144136
""",
145-
snapshot(
146-
"""\
137+
snapshot("""\
147138
def a():
148139
x = 5
149140
150141
def b():
151142
nonlocal x
152143
pass
153-
"""
154-
),
144+
"""),
155145
)
156146

157147

@@ -162,13 +152,11 @@ def name_4():
162152
global name_3
163153
name_3: int
164154
""",
165-
snapshot(
166-
"""\
155+
snapshot("""\
167156
def name_4():
168157
global name_3
169158
pass
170-
"""
171-
),
159+
"""),
172160
)
173161

174162

@@ -179,14 +167,12 @@ def b():
179167
def a():
180168
nonlocal x
181169
""",
182-
snapshot(
183-
"""\
170+
snapshot("""\
184171
def b():
185172
186173
def a():
187174
pass
188-
"""
189-
),
175+
"""),
190176
)
191177

192178

@@ -198,15 +184,13 @@ def b():
198184
def a(x):
199185
nonlocal x
200186
""",
201-
snapshot(
202-
"""\
187+
snapshot("""\
203188
def b():
204189
x = 0
205190
206191
def a(x):
207192
pass
208-
"""
209-
),
193+
"""),
210194
)
211195

212196

@@ -219,16 +203,14 @@ def a():
219203
print(x)
220204
nonlocal x
221205
""",
222-
snapshot(
223-
"""\
206+
snapshot("""\
224207
def b():
225208
x = 0
226209
227210
def a():
228211
print(x)
229212
pass
230-
"""
231-
),
213+
"""),
232214
)
233215

234216

@@ -241,16 +223,14 @@ def a():
241223
x=5
242224
nonlocal x
243225
""",
244-
snapshot(
245-
"""\
226+
snapshot("""\
246227
def b():
247228
x = 0
248229
249230
def a():
250231
x = 5
251232
pass
252-
"""
253-
),
233+
"""),
254234
)
255235

256236

@@ -263,16 +243,14 @@ def a():
263243
x:int
264244
nonlocal x
265245
""",
266-
snapshot(
267-
"""\
246+
snapshot("""\
268247
def b():
269248
x = 0
270249
271250
def a():
272251
x: int
273252
pass
274-
"""
275-
),
253+
"""),
276254
)
277255

278256

@@ -285,13 +263,11 @@ def b():
285263
def a[x:int]():
286264
nonlocal x
287265
""",
288-
snapshot(
289-
"""\
266+
snapshot("""\
290267
def b():
291268
x = 0
292269
293270
def a[x: int]():
294271
pass
295-
"""
296-
),
272+
"""),
297273
)

0 commit comments

Comments
 (0)