Asynced

Latest version: v1.3.1

Safety actively analyzes 688872 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

1.3.1

Fixed:
- Ignored exceptions before `State` has been set
- `StopAsyncIteration` raised in `__await__` when cancelled before set

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()`, like `dict.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 for `await` or `aiter` of the instance.

1.2.1

Made the buffer within `State.__aiter__` of finite size (max 4 by default), avoiding potential memory leaks

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]] `: Like `additions()`, 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

StateDict` constructor now additionally accepts the following argument:

- `StateDict(aiterable: AsyncIterable[tuple[K, StateVar[V]]]) -> StateDict[K, V]`

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]`

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.