Skip to content

Commit

Permalink
Remove a few ruff rules from checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshardmind committed Apr 16, 2024
1 parent ce312a7 commit ca59b3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 6 additions & 8 deletions async_utils/priority_sem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@

from __future__ import annotations


import asyncio
import contextvars
import heapq

from collections.abc import Callable
from typing import Any, NamedTuple
import threading
import contextvars
from collections.abc import Callable
from contextlib import contextmanager
from typing import Any, NamedTuple

__all__ = ["priority_context", "PrioritySemaphore"]

Expand Down Expand Up @@ -80,7 +78,7 @@ class PrioritySemaphore:

_loop: asyncio.AbstractEventLoop | None = None

def _get_loop(self):
def _get_loop(self) -> asyncio.AbstractEventLoop:
loop = asyncio.get_running_loop()

if self._loop is None:
Expand Down Expand Up @@ -112,7 +110,7 @@ def locked(self) -> bool:
async def __aenter__(self):
prio = _priority.get()
await self.acquire(prio)
return None
return

async def __aexit__(self, *dont_care: Any):
self.release()
Expand Down Expand Up @@ -146,7 +144,7 @@ async def acquire(self, priority: int) -> bool:
self._maybe_wake()
return True

def _maybe_wake(self):
def _maybe_wake(self) -> None:
while self._value > 0 and self._waiters:
next_waiter = heapq.heappop(self._waiters)

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ extend-ignore = [
"ANN102", # Same, but for cls
"ANN201", # return types
"ANN204", # special method return types
"ANN401",
"EM101",
"EM102",
"TRY003",
"PLR0913", # number of function arguments
"UP007", # "Use | For Union" doesn't account for typevar tuple unpacking.
"PTH123", # `open()` should be replaced by `Path.open()`
Expand Down

0 comments on commit ca59b3c

Please sign in to comment.