Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ruff's COM812 #3144

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,18 @@ select = [
"YTT", # flake8-2020
]
extend-ignore = [
'A002', # builtin-argument-shadowing
'ANN401', # any-type (mypy's `disallow_any_explicit` is better)
'E402', # module-import-not-at-top-of-file (usually OS-specific)
'E501', # line-too-long
'F403', # undefined-local-with-import-star
'F405', # undefined-local-with-import-star-usage
'PERF203', # try-except-in-loop (not always possible to refactor)
'PT012', # multiple statements in pytest.raises block
'SIM117', # multiple-with-statements (messes up lots of context-based stuff and looks bad)
"A002", # builtin-argument-shadowing
"ANN401", # any-type (mypy's `disallow_any_explicit` is better)
"E402", # module-import-not-at-top-of-file (usually OS-specific)
"E501", # line-too-long
"F403", # undefined-local-with-import-star
"F405", # undefined-local-with-import-star-usage
"PERF203", # try-except-in-loop (not always possible to refactor)
"PT012", # multiple statements in pytest.raises block
"SIM117", # multiple-with-statements (messes up lots of context-based stuff and looks bad)

# conflicts with formatter (ruff recommends these be disabled)
"COM812",
]

[tool.ruff.lint.per-file-ignores]
Expand Down
11 changes: 3 additions & 8 deletions src/trio/_core/_generated_io_kqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def current_kqueue() -> select.kqueue:

@enable_ki_protection
def monitor_kevent(
ident: int,
filter: int,
ident: int, filter: int
) -> AbstractContextManager[_core.UnboundedQueue[select.kevent]]:
"""TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
Expand All @@ -60,19 +59,15 @@ def monitor_kevent(

@enable_ki_protection
async def wait_kevent(
ident: int,
filter: int,
abort_func: Callable[[RaiseCancelT], Abort],
ident: int, filter: int, abort_func: Callable[[RaiseCancelT], Abort]
) -> Abort:
"""TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
<https://github.com/python-trio/trio/issues/26>`__.
"""
try:
return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_kevent(
ident,
filter,
abort_func,
ident, filter, abort_func
)
except AttributeError:
raise RuntimeError("must be called from async context") from None
Expand Down
19 changes: 5 additions & 14 deletions src/trio/_core/_generated_io_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,15 @@ async def wait_overlapped(handle_: int | CData, lpOverlapped: CData | int) -> ob
"""
try:
return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_overlapped(
handle_,
lpOverlapped,
handle_, lpOverlapped
)
except AttributeError:
raise RuntimeError("must be called from async context") from None


@enable_ki_protection
async def write_overlapped(
handle: int | CData,
data: Buffer,
file_offset: int = 0,
handle: int | CData, data: Buffer, file_offset: int = 0
) -> int:
"""TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
Expand All @@ -156,19 +153,15 @@ async def write_overlapped(
"""
try:
return await GLOBAL_RUN_CONTEXT.runner.io_manager.write_overlapped(
handle,
data,
file_offset,
handle, data, file_offset
)
except AttributeError:
raise RuntimeError("must be called from async context") from None


@enable_ki_protection
async def readinto_overlapped(
handle: int | CData,
buffer: Buffer,
file_offset: int = 0,
handle: int | CData, buffer: Buffer, file_offset: int = 0
) -> int:
"""TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
Expand All @@ -177,9 +170,7 @@ async def readinto_overlapped(
"""
try:
return await GLOBAL_RUN_CONTEXT.runner.io_manager.readinto_overlapped(
handle,
buffer,
file_offset,
handle, buffer, file_offset
)
except AttributeError:
raise RuntimeError("must be called from async context") from None
Expand Down
5 changes: 1 addition & 4 deletions src/trio/_core/_generated_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,7 @@ def spawn_system_task(
"""
try:
return GLOBAL_RUN_CONTEXT.runner.spawn_system_task(
async_fn,
*args,
name=name,
context=context,
async_fn, *args, name=name, context=context
)
except AttributeError:
raise RuntimeError("must be called from async context") from None
Expand Down
Loading