Skip to main content

use-context

GitHub Build Status PyPI

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

👍

Release files for use-context 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for use-context 0.0.3
File Size Uploaded
use_context-0.0.3.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for use-context 0.0.3
File Interpreter ABI Platform
use_context-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / use_context-0.0.3.tar.gz

Download URL use_context-0.0.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c5725801fa09a16faa3abb29554982e007e97535676aa135e96e8723b99602b7
BLAKE2b-256 checksum
How to use checksums
c7e63791f18cad1d783829b3cdfd922be756a61fbb7f8891091b03b6c6ebf932
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / use_context-0.0.3-py3-none-any.whl

Download URL use_context-0.0.3-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a90be319aade88d4b50e08718360f4ea88377aad40c5eb902c25fbdb989221ce
BLAKE2b-256 checksum
How to use checksums
2be5d2016de9bcd7b9da0faf7afcc28c2683845d3928c0af4583f43ab9d20de0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page