No project description provided
Project description
use-context
use some vars in current context and try rollback state when exit the context.
Usage
By default:
from use_context import use
ls = [1, 2, 3]
with use(ls):
ls.append(5)
assert ls == [1, 2, 3]
For use ref (by name):
a = 15
with use(refs=['a']) as ctx:
assert not ctx.is_ref_changed('a')
a = 16
assert a == 16
assert ctx.is_ref_changed('a')
assert a == 15
👍
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
use_context-0.0.3.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file use_context-0.0.3.tar.gz
.
File metadata
- Download URL: use_context-0.0.3.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5725801fa09a16faa3abb29554982e007e97535676aa135e96e8723b99602b7 |
|
MD5 | ba7be880128d176d324da436dc94aade |
|
BLAKE2b-256 | c7e63791f18cad1d783829b3cdfd922be756a61fbb7f8891091b03b6c6ebf932 |
File details
Details for the file use_context-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: use_context-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a90be319aade88d4b50e08718360f4ea88377aad40c5eb902c25fbdb989221ce |
|
MD5 | 544dd24dbdf86d1bd3bcd7616dd246c0 |
|
BLAKE2b-256 | 2be5d2016de9bcd7b9da0faf7afcc28c2683845d3928c0af4583f43ab9d20de0 |