Skip to main content

No project description provided

Project description

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

👍

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for use-context, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size use_context-0.0.3-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size use_context-0.0.3.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page