Skip to content

Commit e553a4a

Browse files
committed
reformat
1 parent 6697e85 commit e553a4a

3 files changed

Lines changed: 27 additions & 9 deletions

File tree

benchmarks/compare_event_loops.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ def child_main(args: argparse.Namespace) -> int:
428428
raise RuntimeError("profiling is only supported for rsloop")
429429
rsloop = importlib.import_module("rsloop")
430430
if args.profile_label:
431-
print(f"[profile] Tracy session label: {args.profile_label}", flush=True)
431+
print(
432+
f"[profile] Tracy session label: {args.profile_label}", flush=True
433+
)
432434
with rsloop.profile():
433435
result = run_with_loop(args.loop, coro)
434436
else:

python/rsloop/__init__.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ def sendto(self, data, addr=None):
386386
return
387387
except (BlockingIOError, InterruptedError):
388388
if self._writer_task is None:
389-
self._writer_task = self._loop.create_task(self._flush_write_buffer())
389+
self._writer_task = self._loop.create_task(
390+
self._flush_write_buffer()
391+
)
390392
except OSError as exc:
391393
self._protocol.error_received(exc)
392394
return
@@ -493,7 +495,9 @@ async def __loop_sock_sendto(self, sock, data, address):
493495
await __wait_for_fd(self, sock, readable=False)
494496

495497

496-
async def __loop_sendfile(self, transport, file, offset=0, count=None, *, fallback=True):
498+
async def __loop_sendfile(
499+
self, transport, file, offset=0, count=None, *, fallback=True
500+
):
497501
if transport.is_closing():
498502
raise RuntimeError("Transport is closing")
499503
if not fallback:
@@ -531,7 +535,9 @@ async def drain_transport() -> None:
531535
file.seek(offset + total_sent)
532536

533537

534-
async def __loop_sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=True):
538+
async def __loop_sock_sendfile(
539+
self, sock, file, offset=0, count=None, *, fallback=True
540+
):
535541
if sock.gettimeout() != 0:
536542
raise ValueError("the socket must be non-blocking")
537543
if "b" not in getattr(file, "mode", "b"):
@@ -598,7 +604,9 @@ async def __loop_create_datagram_endpoint(
598604
):
599605
resolved_remote_addr = None
600606
if sock is not None and (local_addr is not None or remote_addr is not None):
601-
raise ValueError("socket modifier keyword arguments can not be used when sock is specified")
607+
raise ValueError(
608+
"socket modifier keyword arguments can not be used when sock is specified"
609+
)
602610
if sock is None and local_addr is None and remote_addr is None:
603611
raise ValueError("unexpected address family")
604612

@@ -1623,7 +1631,9 @@ async def wrapper():
16231631
try:
16241632
__cancel_all_tasks(loop)
16251633
loop.run_until_complete(loop.shutdown_asyncgens())
1626-
shutdown_default_executor = getattr(loop, "shutdown_default_executor", None)
1634+
shutdown_default_executor = getattr(
1635+
loop, "shutdown_default_executor", None
1636+
)
16271637
if shutdown_default_executor is not None:
16281638
loop.run_until_complete(shutdown_default_executor())
16291639
finally:

tests/test_compat.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ def shutdown(self, wait):
204204
await loop.run_in_executor(None, lambda: 1)
205205
except RuntimeError as exc:
206206
return str(exc)
207-
raise AssertionError("run_in_executor(None, ...) should fail after shutdown")
207+
raise AssertionError(
208+
"run_in_executor(None, ...) should fail after shutdown"
209+
)
208210

209211
self.assertEqual(
210212
rsloop.run(main()),
@@ -322,7 +324,9 @@ def shutdown(self, wait):
322324
await loop.getaddrinfo("localhost", 80)
323325
except RuntimeError as exc:
324326
return str(exc)
325-
raise AssertionError("getaddrinfo should fail after default executor shutdown")
327+
raise AssertionError(
328+
"getaddrinfo should fail after default executor shutdown"
329+
)
326330

327331
self.assertEqual(
328332
rsloop.run(main()),
@@ -486,7 +490,9 @@ def connection_lost(self, exc):
486490
path = pathlib.Path(tmpdir) / "payload.bin"
487491
payload = b"sendfile-payload"
488492
path.write_bytes(payload)
489-
self.assertEqual(rsloop.run(main(str(path), payload)), (len(payload), payload))
493+
self.assertEqual(
494+
rsloop.run(main(str(path), payload)), (len(payload), payload)
495+
)
490496

491497
def test_sock_recvfrom_receives_datagram(self) -> None:
492498
async def main() -> tuple[bytes, tuple[str, int]]:

0 commit comments

Comments
 (0)