Skip to content

Commit

Permalink
v3.12.5 (#154)
Browse files Browse the repository at this point in the history
* version bump

* silence pyright errors
  • Loading branch information
maxfischer2781 authored Aug 25, 2024
1 parent cb745e8 commit f9f7571
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion asyncstdlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from .asynctools import borrow, scoped_iter, await_each, any_iter, apply, sync
from .heapq import merge, nlargest, nsmallest

__version__ = "3.12.4"
__version__ = "3.12.5"

__all__ = [
"anext",
Expand Down
4 changes: 3 additions & 1 deletion asyncstdlib/_lrucache.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
from ._utility import public_module


@public_module("asyncstdlib.functools")
@public_module(
"asyncstdlib.functools"
) # pyright: ignore[reportArgumentType,reportUntypedClassDecorator]
class CacheInfo(NamedTuple):
"""
Metadata on the current state of a cache
Expand Down
2 changes: 1 addition & 1 deletion asyncstdlib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async def data(self):
If the attribute is accessed by multiple tasks before a cached value has
been produced, the getter can be run more than once. The final cached value
is determined by the last getter coroutine to return. To enforce that the
getter is executed at most once, provide a ``lock`` type - e.g. the
getter is executed at most once, provide an appropriate lock type - e.g. the
:py:class:`asyncio.Lock` class in an :py:mod:`asyncio` application - and
access is automatically synchronised.
Expand Down
13 changes: 6 additions & 7 deletions asyncstdlib/itertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ async def maybe_step(self) -> None:
await self.step()

def consume_value(self) -> T_co:
"""Return the current value, after removing it from the current state"""
"""Return the current value after removing it from the current state"""
value, self._current_value = self._current_value, self._sentinel
return value

Expand All @@ -600,21 +600,21 @@ def __init__(self, target_key: R, state: "_GroupByState[R, T_co]") -> None:

async def __anext__(self) -> T_co:
state = self._state
# the groupby already advanced to another group
if state.current_group is not self:
raise StopAsyncIteration

await state.maybe_step()
# the step advanced the iterator to another group
if self._target_key != state.current_key:
raise StopAsyncIteration

return state.consume_value()

async def aclose(self) -> None:
"""Close the group iterator
"""
Close the group iterator
Note: this does _not_ close the underlying groupby managed iterator;
closing a single group shouldn't affect other groups in the series.
"""
state = self._state
if state.current_group is not self:
Expand Down Expand Up @@ -662,8 +662,7 @@ def __init__(

async def __anext__(self) -> Tuple[R, AsyncIterator[T_co]]:
state = self._state
# disable the last group to avoid concurrency
# issues.
# already disable the current group to avoid concurrency issues
state.current_group = None
await state.maybe_step()
try:
Expand Down
8 changes: 4 additions & 4 deletions docs/source/api/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ Attribute Caches

This type of cache tracks ``await``\ ing an attribute.

.. py:function:: cached_property(getter: (Self) → await T, /)
.. py:function:: cached_property(getter: (Self) → await T, /) -> await T
:decorator:

.. autofunction:: cached_property(asynccontextmanager_type: Type[AsyncContextManager], /)((Self) → await T)
.. autofunction:: cached_property(context_type: Type[AsyncContextManager], /)((Self) → await T) -> await T
:decorator:
:noindex:

.. versionadded:: 1.1.0
.. versionadded:: 3.13.0
.. versionadded:: 3.12.5

The ``asynccontextmanager_type`` decorator parameter.
The ``context_type`` decorator parameter.


Callable Caches
Expand Down

0 comments on commit f9f7571

Please sign in to comment.