Skip to content

Commit 3bb7168

Browse files
authored
Fix flake8 unused nonlocal and global warnings (F824) (#602)
1 parent 8abbde3 commit 3bb7168

8 files changed

Lines changed: 1 addition & 18 deletions

‎gql/transport/file_upload.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def recurse_extract(path, obj):
8989
replacing any file-like objects with nulls and
9090
shunting the originals off to the side.
9191
"""
92-
nonlocal files
9392
if isinstance(obj, list):
9493
nulled_list = []
9594
for key, value in enumerate(obj):

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
dev_requires = [
2929
"black==26.5.1",
3030
"check-manifest>=0.42,<1",
31-
"flake8==7.1.2",
31+
"flake8==7.3.0",
3232
"isort==6.0.1",
3333
"mypy==1.15",
3434
"sphinx>=8.1.0,<9",

‎tests/test_aiohttp_websocket_graphqlws_subscription.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ async def keepalive_coro():
111111
async def receiving_coro():
112112
print(" Server: receiving task started")
113113
try:
114-
nonlocal counting_task
115114
while True:
116115

117116
try:
@@ -314,7 +313,6 @@ async def task_coro():
314313
task = asyncio.ensure_future(task_coro())
315314

316315
async def cancel_task_coro():
317-
nonlocal task
318316

319317
await asyncio.sleep(5.5 * COUNTING_DELAY)
320318

@@ -354,7 +352,6 @@ async def task_coro():
354352
task = asyncio.ensure_future(task_coro())
355353

356354
async def close_transport_task_coro():
357-
nonlocal task
358355

359356
await asyncio.sleep(5.5 * COUNTING_DELAY)
360357

‎tests/test_aiohttp_websocket_subscription.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ async def server_countdown(ws):
9797

9898
logged_messages.clear()
9999

100-
global WITH_KEEPALIVE
101100
try:
102101
await WebSocketServerHelper.send_connection_ack(ws)
103102
if WITH_KEEPALIVE:
@@ -126,7 +125,6 @@ async def counting_coro():
126125
counting_task = asyncio.ensure_future(counting_coro())
127126

128127
async def stopping_coro():
129-
nonlocal counting_task
130128
while True:
131129

132130
try:
@@ -305,7 +303,6 @@ async def task_coro():
305303
task = asyncio.ensure_future(task_coro())
306304

307305
async def cancel_task_coro():
308-
nonlocal task
309306

310307
await asyncio.sleep(11 * MS)
311308

@@ -345,7 +342,6 @@ async def task_coro():
345342
task = asyncio.ensure_future(task_coro())
346343

347344
async def close_transport_task_coro():
348-
nonlocal task
349345

350346
await asyncio.sleep(11 * MS)
351347

‎tests/test_appsync_websockets.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ async def keepalive_coro():
277277
async def receiving_coro():
278278
print(" Server: receiving task started")
279279
try:
280-
nonlocal send_message_task
281280
while True:
282281

283282
try:

‎tests/test_graphqlws_subscription.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ async def keepalive_coro():
111111
async def receiving_coro():
112112
print(" Server: receiving task started")
113113
try:
114-
nonlocal counting_task
115114
while True:
116115

117116
try:
@@ -312,7 +311,6 @@ async def task_coro():
312311
task = asyncio.ensure_future(task_coro())
313312

314313
async def cancel_task_coro():
315-
nonlocal task
316314

317315
await asyncio.sleep(5.5 * COUNTING_DELAY)
318316

@@ -352,7 +350,6 @@ async def task_coro():
352350
task = asyncio.ensure_future(task_coro())
353351

354352
async def close_transport_task_coro():
355-
nonlocal task
356353

357354
await asyncio.sleep(5.5 * COUNTING_DELAY)
358355

‎tests/test_phoenix_channel_subscription.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ async def counting_coro():
117117
counting_task = asyncio.ensure_future(counting_coro())
118118

119119
async def stopping_coro():
120-
nonlocal counting_task
121120
while True:
122121
result = await ws.recv()
123122
json_result = json.loads(result)

‎tests/test_websocket_subscription.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ async def server_countdown(ws):
3333

3434
logged_messages.clear()
3535

36-
global WITH_KEEPALIVE
3736
try:
3837
await WebSocketServerHelper.send_connection_ack(ws)
3938
if WITH_KEEPALIVE:
@@ -62,7 +61,6 @@ async def counting_coro():
6261
counting_task = asyncio.ensure_future(counting_coro())
6362

6463
async def stopping_coro():
65-
nonlocal counting_task
6664
while True:
6765

6866
try:
@@ -232,7 +230,6 @@ async def task_coro():
232230
task = asyncio.ensure_future(task_coro())
233231

234232
async def cancel_task_coro():
235-
nonlocal task
236233

237234
await asyncio.sleep(11 * MS)
238235

@@ -272,7 +269,6 @@ async def task_coro():
272269
task = asyncio.ensure_future(task_coro())
273270

274271
async def close_transport_task_coro():
275-
nonlocal task
276272

277273
await asyncio.sleep(11 * MS)
278274

0 commit comments

Comments
 (0)