Skip to content

Commit 0090581

Browse files
authored
Merge pull request #3044 from CoolCat467/enable-flake8-commas
Enable ruff's `flake8-commas` rule
2 parents 51c8f9c + 30babaf commit 0090581

File tree

100 files changed

+1097
-504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1097
-504
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# sorting all imports with isort
22
933f77b96f0092e1baab4474a9208fc2e379aa32
3+
# enabling ruff's flake8-commas rule
4+
b25c02a94e2defcb0fad32976b02218be1133bdf

docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def autodoc_process_signature(
132132
# and insert the fully-qualified name.
133133
signature = signature.replace("+E", "~trio.testing._raises_group.E")
134134
signature = signature.replace(
135-
"+MatchE", "~trio.testing._raises_group.MatchE"
135+
"+MatchE",
136+
"~trio.testing._raises_group.MatchE",
136137
)
137138
if "DTLS" in name:
138139
signature = signature.replace("SSL.Context", "OpenSSL.SSL.Context")

notes-to-self/afd-lab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def afd_poll(self, sock, flags, *, exclusive=0):
125125
ffi.sizeof("AFD_POLL_INFO"),
126126
ffi.NULL,
127127
lpOverlapped,
128-
)
128+
),
129129
)
130130
except OSError as exc:
131131
if exc.winerror != ErrorCodes.ERROR_IO_PENDING: # pragma: no cover

notes-to-self/blocking-read-hack.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ class BlockingReadTimeoutError(Exception):
1212

1313

1414
async def blocking_read_with_timeout(
15-
fd, count, timeout # noqa: ASYNC109 # manual timeout
15+
fd,
16+
count,
17+
timeout, # noqa: ASYNC109 # manual timeout
1618
):
1719
print("reading from fd", fd)
1820
cancel_requested = False

notes-to-self/file-read-latency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
seek = (end - between) / COUNT * 1e9
2424
read = both - seek
2525
print(
26-
f"{both:.2f} ns/(seek+read), {seek:.2f} ns/seek, estimate ~{read:.2f} ns/read"
26+
f"{both:.2f} ns/(seek+read), {seek:.2f} ns/seek, estimate ~{read:.2f} ns/read",
2727
)

notes-to-self/how-does-windows-so-reuseaddr-work.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def table_entry(mode1, bind_type1, mode2, bind_type2):
4949
"""
5050
second bind
5151
| """
52-
+ " | ".join(["%-19s" % mode for mode in modes])
52+
+ " | ".join(["%-19s" % mode for mode in modes]),
5353
)
5454

5555
print(""" """, end="")
@@ -58,7 +58,7 @@ def table_entry(mode1, bind_type1, mode2, bind_type2):
5858

5959
print(
6060
"""
61-
first bind -----------------------------------------------------------------"""
61+
first bind -----------------------------------------------------------------""",
6262
# default | wildcard | INUSE | Success | ACCESS | Success | INUSE | Success
6363
)
6464

@@ -72,5 +72,5 @@ def table_entry(mode1, bind_type1, mode2, bind_type2):
7272
# print(mode1, bind_type1, mode2, bind_type2, entry)
7373
print(
7474
f"{mode1:>19} | {bind_type1:>8} | "
75-
+ " | ".join(["%8s" % entry for entry in row])
75+
+ " | ".join(["%8s" % entry for entry in row]),
7676
)

notes-to-self/manual-signal-handler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
"""
1212
void* WINAPI GetProcAddress(void* hModule, char* lpProcName);
1313
typedef void (*PyOS_sighandler_t)(int);
14-
"""
14+
""",
1515
)
1616
kernel32 = ffi.dlopen("kernel32.dll")
1717
PyOS_getsig_ptr = kernel32.GetProcAddress(
18-
ffi.cast("void*", sys.dllhandle), b"PyOS_getsig"
18+
ffi.cast("void*", sys.dllhandle),
19+
b"PyOS_getsig",
1920
)
2021
PyOS_getsig = ffi.cast("PyOS_sighandler_t (*)(int)", PyOS_getsig_ptr)
2122

notes-to-self/proxy-benchmarks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def add_wrapper(cls, method):
5454
f"""
5555
def wrapper(self, *args, **kwargs):
5656
return self._wrapped.{method}(*args, **kwargs)
57-
"""
57+
""",
5858
)
5959
ns = {}
6060
exec(code, ns)
@@ -113,7 +113,7 @@ def setter(self, newval):
113113
114114
def deleter(self):
115115
del self._wrapped.{attr}
116-
"""
116+
""",
117117
)
118118
ns = {}
119119
exec(code, ns)

notes-to-self/ssl-handshake/ssl-handshake.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def echo_server_connection():
2727
client_sock, server_sock = socket.socketpair()
2828
with client_sock, server_sock:
2929
t = threading.Thread(
30-
target=_ssl_echo_serve_sync, args=(server_sock,), daemon=True
30+
target=_ssl_echo_serve_sync,
31+
args=(server_sock,),
32+
daemon=True,
3133
)
3234
t.start()
3335

@@ -101,7 +103,9 @@ def wrap_socket_via_wrap_bio(ctx, sock, **kwargs):
101103
with echo_server_connection() as client_sock:
102104
client_ctx = ssl.create_default_context(cafile="trio-test-CA.pem")
103105
wrapped = wrap_socket(
104-
client_ctx, client_sock, server_hostname="trio-test-1.example.org"
106+
client_ctx,
107+
client_sock,
108+
server_hostname="trio-test-1.example.org",
105109
)
106110
wrapped.do_handshake()
107111
wrapped.sendall(b"x")
@@ -113,7 +117,9 @@ def wrap_socket_via_wrap_bio(ctx, sock, **kwargs):
113117
with echo_server_connection() as client_sock:
114118
client_ctx = ssl.create_default_context(cafile="trio-test-CA.pem")
115119
wrapped = wrap_socket(
116-
client_ctx, client_sock, server_hostname="trio-test-2.example.org"
120+
client_ctx,
121+
client_sock,
122+
server_hostname="trio-test-2.example.org",
117123
)
118124
try:
119125
wrapped.do_handshake()
@@ -126,7 +132,9 @@ def wrap_socket_via_wrap_bio(ctx, sock, **kwargs):
126132
with echo_server_connection() as client_sock:
127133
client_ctx = ssl.create_default_context(cafile="trio-test-CA.pem")
128134
wrapped = wrap_socket(
129-
client_ctx, client_sock, server_hostname="trio-test-2.example.org"
135+
client_ctx,
136+
client_sock,
137+
server_hostname="trio-test-2.example.org",
130138
)
131139
# We forgot to call do_handshake
132140
# But the hostname is wrong so something had better error out...

notes-to-self/wakeup-fd-racer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def main():
9191
if duration < 2:
9292
print(
9393
f"Attempt {attempt}: OK, trying again "
94-
f"(select_calls = {select_calls}, drained = {drained})"
94+
f"(select_calls = {select_calls}, drained = {drained})",
9595
)
9696
else:
9797
print(f"Attempt {attempt}: FAILED, took {duration} seconds")

0 commit comments

Comments
 (0)