Skip to content

Commit

Permalink
Further cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshardmind committed Jan 24, 2025
1 parent 0c31c00 commit e29ea6a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 520 deletions.
2 changes: 2 additions & 0 deletions _misc/_ensure_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def version_specific_annotation_interactions(obj: Any):

failures: list[tuple[str, Exception]] = []

print("Checking annotations for runtime validity", flush=True) # noqa: T201

for mod_info in pkgutil.iter_modules(async_utils.__spec__.submodule_search_locations):
mod = importlib.import_module(f"async_utils.{mod_info.name}")
for name in getattr(mod, "__all__", ()):
Expand Down
4 changes: 2 additions & 2 deletions _misc/_queue_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from contextlib import contextmanager
from typing import Any

from src.async_utils._qs import Queue # noqa: PLC2701
from src.async_utils.bg_loop import threaded_loop
from async_utils.bg_loop import threaded_loop
from async_utils.dual_color import Queue

log = logging.getLogger()

Expand Down
8 changes: 3 additions & 5 deletions src/async_utils/_qs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AsyncEvent:

def __init__(self, /) -> None:
self._loop = asyncio.get_running_loop()
self._future = None
self._future: asyncio.Future[bool] | None = None
self._unset = [True]
self._cancelled = False

Expand Down Expand Up @@ -80,16 +80,14 @@ def __await__(self, /) -> Generator[t.Any, t.Any, bool]:
self._future = self._loop.create_future()

try:
yield from self._future.__await__()
return (yield from self._future.__await__())
except BaseException:
self.cancel()
raise
finally:
self._future = None
else:
yield from asyncio.sleep(0).__await__()

return True
return (yield from asyncio.sleep(0, True).__await__())

def _set_state(self, /) -> None:
if (future := self._future) is not None:
Expand Down
238 changes: 0 additions & 238 deletions src/async_utils/corofunc_cache_with_stats.py

This file was deleted.

Loading

0 comments on commit e29ea6a

Please sign in to comment.