Skip to content

Commit

Permalink
fix: ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Dec 26, 2024
1 parent 75d6209 commit e2ed1e2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ fixable = [
"RUF020", # never-union
"NPY201", # numpy2-deprecation
"PT",
"RUF022", # unsorted-dunder-all
"RUF023", # unsorted-dunder-slots
]
ignore = [
"TD",
'E712', # TrueFalseComparison # sqlalchemy
"E711", # none-comparison # sqlalchemy
"EM101", # raw-string-in-exception
"TRY003", # raise-vanilla-args
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
"ANN401", # dynamically-typed-expression
"FBT002", # boolean-default-value-in-function-definition
"PGH003", # blanket-type-ignore
Expand Down
14 changes: 7 additions & 7 deletions src/async_wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
from async_wrapper.wait import Completed, Waiter, wait_for

__all__ = [
"TaskGroupWrapper",
"Queue",
"Waiter",
"Completed",
"Pipe",
"Queue",
"SimpleDisposable",
"toggle_func",
"TaskGroupWrapper",
"Waiter",
"async_to_sync",
"sync_to_async",
"create_task_group_wrapper",
"create_disposable",
"create_queue",
"create_task_group_wrapper",
"sync_to_async",
"toggle_func",
"wait_for",
"create_disposable",
]

__version__: str
Expand Down
2 changes: 1 addition & 1 deletion src/async_wrapper/convert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from async_wrapper.convert.main import async_to_sync, sync_to_async, toggle_func

__all__ = ["toggle_func", "sync_to_async", "async_to_sync"]
__all__ = ["async_to_sync", "sync_to_async", "toggle_func"]
2 changes: 1 addition & 1 deletion src/async_wrapper/convert/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
_T = TypeVar("_T", infer_variance=True)
_P = ParamSpec("_P")

__all__ = ["toggle_func", "async_to_sync", "sync_to_async"]
__all__ = ["async_to_sync", "sync_to_async", "toggle_func"]


@overload
Expand Down
10 changes: 5 additions & 5 deletions src/async_wrapper/exception.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from __future__ import annotations

__all__ = [
"AlreadyDisposedError",
"DisposableError",
"PendingError",
"QueueError",
"QueueBrokenError",
"QueueClosedError",
"QueueEmptyError",
"QueueError",
"QueueFullError",
"QueueClosedError",
"QueueBrokenError",
"QueueRestrictedError",
"DisposableError",
"AlreadyDisposedError",
]


Expand Down
12 changes: 6 additions & 6 deletions src/async_wrapper/pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Synchronization(TypedDict, total=False):
__all__ = [
"Disposable",
"DisposableWithCallback",
"Subscribable",
"SimpleDisposable",
"Pipe",
"SimpleDisposable",
"Subscribable",
"create_disposable",
]

Expand Down Expand Up @@ -110,7 +110,7 @@ class SimpleDisposable(DisposableWithCallback[_T, _T2], Generic[_T, _T2]):
"""simple disposable impl."""

_journals: deque[Subscribable[_T, _T2]]
__slots__ = ("_func", "_is_disposed", "_journals", "_async_lock", "_thread_lock")
__slots__ = ("_async_lock", "_func", "_is_disposed", "_journals", "_thread_lock")

def __init__(self, func: Callable[[_T], Awaitable[_T2]]) -> None:
self._func = func
Expand Down Expand Up @@ -170,11 +170,11 @@ class Pipe(Subscribable[_T, _T2], Generic[_T, _T2]):

__slots__ = (
"_context",
"_listener",
"_listeners",
"_dispose",
"_is_disposed",
"_dispose_lock",
"_is_disposed",
"_listener",
"_listeners",
)

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions src/async_wrapper/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def main() -> None:
```
"""

__slots__ = ("_putter", "_getter", "_close_putter", "_close_getter")
__slots__ = ("_close_getter", "_close_putter", "_getter", "_putter")

if TYPE_CHECKING:

Expand Down Expand Up @@ -406,7 +406,7 @@ def __repr__(self) -> str:


class _RestrictedQueue(Queue[_T], Generic[_T]):
__slots__ = ("_queue", "_do_putter", "_do_getter")
__slots__ = ("_do_getter", "_do_putter", "_queue")

def __init__(self, queue: Queue[_T], *, putter: bool, getter: bool) -> None:
self._queue = queue
Expand Down
2 changes: 1 addition & 1 deletion src/async_wrapper/task_group/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
)
from async_wrapper.task_group.value import SoonValue

__all__ = ["TaskGroupWrapper", "SoonValue", "create_task_group_wrapper"]
__all__ = ["SoonValue", "TaskGroupWrapper", "create_task_group_wrapper"]
4 changes: 2 additions & 2 deletions src/async_wrapper/task_group/task_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def main() -> None:
```
"""

__slots__ = ("_task_group", "_active_self")
__slots__ = ("_active_self", "_task_group")

def __init__(self, task_group: _TaskGroup) -> None:
self._task_group = task_group
Expand Down Expand Up @@ -128,7 +128,7 @@ def wrap(
class SoonWrapper(Generic[_P, _T]):
"""wrapped func using in `TaskGroupWrapper`"""

__slots__ = ("func", "task_group", "semaphore", "limiter", "lock", "_wrapped")
__slots__ = ("_wrapped", "func", "limiter", "lock", "semaphore", "task_group")

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/async_wrapper/wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream


__all__ = ["Waiter", "Completed", "wait_for"]
__all__ = ["Completed", "Waiter", "wait_for"]

_T = TypeVar("_T", infer_variance=True)
_P = ParamSpec("_P")
Expand Down Expand Up @@ -57,7 +57,7 @@ async def main() -> None:
```
"""

__slots__ = ("_event", "_func", "_args", "_kwargs")
__slots__ = ("_args", "_event", "_func", "_kwargs")

_event: Event

Expand Down Expand Up @@ -173,7 +173,7 @@ async def main() -> None:
```
"""

__slots__ = ("_events", "__setter", "__getter", "__task_group")
__slots__ = ("__getter", "__setter", "__task_group", "_events")

def __init__(self, task_group: TaskGroup | None = None) -> None:
self._events: dict[Waiter, MemoryObjectReceiveStream[Any]] = {}
Expand Down

0 comments on commit e2ed1e2

Please sign in to comment.