Skip to main content

TmpVar

TmpVar is used to change the variables environement temprorarily to run some codes and restore the previous environment.

Example

    import TmpVar
    
    a = 3
    b = 6
    c = 9
    class TestClass:
        def __init__(self, a, b, c) -> None:
            self.a = a
            self.b = b
            self.c = c
    d = TestClass(a, b ,c)
    print(a, b, c, 
          d.a, d.b, d.c)
    with TmpVar({'d.a':3354}, a=453):
        print('—————— temporal environment:——————')
        print(a, b, c, 
            d.a, d.b, d.c)
    print('—————— raw environment:——————')
    print(a, b, c, 
          d.a, d.b, d.c)

    # 3 6 9 3 6 9
    # —————— temporal environment:——————
    # 453 6 9 3354 6 9
    # —————— raw environment:——————
    # 3 6 9 3 6 9

Usage

For single variable, you can simpily run it with:

with TempEnv(varname1=value1, varname2=value2,...):
    run some code
    ...

For attribute of variables, you can use:

with TempEnv('varname1.attribute1=value1', 'varname2.attribute2=value2',...):
    run some code
    ...

For some items in list or dict, I didn't figure out how to access them in proper way.

Metadata

Release files for TmpVar 0.0.1

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

Source distribution (sdist)

Source distribution for TmpVar 0.0.1
File Size Uploaded Provenance
TmpVar-0.0.1.tar.gz 2.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for TmpVar 0.0.1
File Interpreter ABI Platform
TmpVar-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.0 kB

Release files / TmpVar-0.0.1.tar.gz

Download URL TmpVar-0.0.1.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4f77a026d41ac5f5dafe236c31e492ed73cc767524afca272ae2af990a91c1d8
BLAKE2b-256 checksum
How to use checksums
e39a02e7907d725ad7762598a701f003e087eb8c713b504c26c30f2093cdbe0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release files / TmpVar-0.0.1-py3-none-any.whl

Download URL TmpVar-0.0.1-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27902264619804603448d2715c93ca7f9660491f69793e13beb408f573a33c0c
BLAKE2b-256 checksum
How to use checksums
854f3ef3974c33998a8dc02e0024dfdeb0070ae44b65f3602bbcd6b3725945eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Security for TmpVar 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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