Skip to content

Commit

Permalink
Replaced black with ruff-format
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 4, 2023
1 parent 1bdb9ac commit c0aa276
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 17 deletions.
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --show-fixes]

- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ version_scheme = "post-release"
local_scheme = "dirty-tag"

[tool.ruff]
line-length = 88
select = [
"E", "F", "W", # default flake-8
"I", # isort
Expand Down
6 changes: 2 additions & 4 deletions src/anyio/_backends/_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ def get_callable_name(func: Callable) -> str:
# Event loop
#

_run_vars = (
WeakKeyDictionary()
) # type: WeakKeyDictionary[asyncio.AbstractEventLoop, Any]
_run_vars: WeakKeyDictionary[asyncio.AbstractEventLoop, Any] = WeakKeyDictionary()


def _task_started(task: asyncio.Task) -> bool:
Expand Down Expand Up @@ -2072,7 +2070,7 @@ async def run_sync_in_worker_thread(
_threadpool_idle_workers.set(idle_workers)
_threadpool_workers.set(workers)

async with (limiter or cls.current_default_thread_limiter()):
async with limiter or cls.current_default_thread_limiter():
with CancelScope(shield=not cancellable):
future: asyncio.Future = asyncio.Future()
root_task = find_root_task()
Expand Down
6 changes: 3 additions & 3 deletions src/anyio/abc/_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]:

# Provide local and remote ports for IP based sockets
if self._raw_socket.family in (AddressFamily.AF_INET, AddressFamily.AF_INET6):
attributes[
SocketAttribute.local_port
] = lambda: self._raw_socket.getsockname()[1]
attributes[SocketAttribute.local_port] = (
lambda: self._raw_socket.getsockname()[1]
)
if peername is not None:
remote_port = peername[1]
attributes[SocketAttribute.remote_port] = lambda: remote_port
Expand Down
2 changes: 1 addition & 1 deletion src/anyio/to_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def send_raw_command(pickled_cmd: bytes) -> object:
_process_pool_idle_workers.set(idle_workers)
get_async_backend().setup_process_pool_exit_at_shutdown(workers)

async with (limiter or current_default_process_limiter()):
async with limiter or current_default_process_limiter():
# Pop processes from the pool (starting from the most recently used) until we
# find one that hasn't exited yet
process: Process
Expand Down
3 changes: 1 addition & 2 deletions tests/streams/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ async def test_send() -> None:


@pytest.mark.xfail(
platform.python_implementation() == "PyPy"
and sys.pypy_version_info < (7, 3, 2), # type: ignore[attr-defined]
platform.python_implementation() == "PyPy" and sys.pypy_version_info < (7, 3, 2), # type: ignore[attr-defined]
reason="PyPy has a bug in its incremental UTF-8 decoder (#3274)",
)
async def test_receive_encoding_error() -> None:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_from_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ def taskfunc(*, task_status: TaskStatus) -> None:

with start_blocking_portal(anyio_backend_name, anyio_backend_options) as portal:
future, start_value = portal.start_task(
taskfunc, name="testname" # type: ignore[arg-type]
taskfunc, # type: ignore[arg-type]
name="testname",
)
assert start_value == "testname"

Expand Down

0 comments on commit c0aa276

Please sign in to comment.