A refreshable is a simple container for a value changing over time.
Project description
nr.refreshable
Provides the Refreshable
class. A refreshable is a thread-safe container for a value that changes
over time. Refreshables can be subscribed to, to be notified when they are updated, and mapped to
compute new values and cache them as the parent gets updated.
Example
from nr.refreshable import Refreshable
root = Refreshable(42)
child = root.map(lambda n: n + 10)
assert child.get() == 52
root.update(100)
assert child.get() == 110
Copyright © 2021 Niklas Rosenstein
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nr.refreshable-0.0.2.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file nr.refreshable-0.0.2.tar.gz
.
File metadata
- Download URL: nr.refreshable-0.0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cb9c127c9b195463ceff0bc6f17f9a8c0841b740f6f347670428c985d0841e1 |
|
MD5 | 8180977912ed9da216b27148570b4d42 |
|
BLAKE2b-256 | 038719f1fbdbceda43ec953d683066bf3d33e40ea1cbe7c664ae12daf37667dc |
File details
Details for the file nr.refreshable-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: nr.refreshable-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf85b4ee7ca7b12b16159f0548e6fc1b7f6b0041c4f10572d7cd16a096e8d06 |
|
MD5 | 10375580d3c5cd4688aecd9592ebc0c9 |
|
BLAKE2b-256 | 408ac3ba359e1a00981a687a00f6dae7d5bac171e10ef47161b04724197226f6 |