This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
Releases: jorenham/asynced
Releases · jorenham/asynced
1.3.1
1.3.0
Features:
StateDict
constructor now additionally accepts the signature:
StateDict(aiterable: AsyncIterable[Mapping[K, V]]) -> StateDict[K, V]
StateDict.differences()
that returns an async iterator of(key, value_old | None, value_new | None)
StateDict.keys_contained()
that returns an async iterator of the current and future keys as(key, key in statedict)
StateDict.update()
, likedict.update()
Fixes:
StateCollection
async iterable producers that yield items are "batched" if they do not return control to the event loop in between yields. This allows for multiple collection items to be set together, without resulting in separate updates forawait
oraiter
of the instance.
1.2.1
1.2.0
New
Added three new methods to StateDict[K, V]
:
.additions() -> AsyncIterator[tuple[K, V]]
: Yields(key, value)
once a new key is set in state dict (in the future)..deletions() -> AsyncIterator[tuple[K, V]]
: Likeadditions()
, but for deleted keys..changes() -> AsyncIterator[tuple[K, V, V]]
: Yields(key, value_old, value_new)
once an existing key is set to a new value.
If the async iterable constructor argument of a StateDict[K, V]
can now yield (K, ...)
(in contrast to (K, V)
) to delete the state dict entry with the key (not documented yet).
Removed
StateDict.head
: The new methods are more flexible and robust
Fixed
- Async iteration of a
State
instance now internally uses a lightweight queue of futures, to ensure that all changes are iterated (even if it's iterated over slower than it changes).
1.1.1
1.1.0
-
StateDict
constructor now additionally accepts the following arguments:StateDict(mapping: Mapping[K, StateVar[V]]) -> StateDict[K, V]
StateDict(mapping: Mapping[str, StateVar[V]], kwargs: StateVar[V]) -> StateDict[str, V]
StateDict(aiterable: AsyncIterable[tuple[K, V]]) -> StateDict[K, V]
-
The latest set/deleted item can be accessed as a state tuple with
StateDict.head: StateTuple[K, V | None]