VarScope
Ultra simple module for creating local scopes in Python.
Installation
VarScope can be installed with pip:
pip install varscope
Usage
>>> from varscope import scope
>>>
>>> a = 1
>>> with scope(): # Everything defined after will only apply inside the scope
... a = 2
... b = 3
...
>>> a
1
>>> b # Not defined, because outside of scope
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'b' is not defined
>>>
>>> with scope() as s: # We can choose to keep some variables
... a = 2
... b = 3
... s.keep("b")
...
>>> b
3
>>> with scope("a"): # We can also move variables inside scope
... a = 2
...
>>> a # Not defined, because outside of scope
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
>>>
>>> d = {}
>>> with scope(): # Scope can mutate object from outside
... d["a"] = 1
...
>>> d["a"]
1
Metadata
Release files for varscope 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| varscope-0.1.1.tar.gz | 3.8 kB | Without provenance | Details for varscope-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| varscope-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for varscope-0.1.1-py3-none-any.whl |
Total release size: 7.9 kB
Release files / varscope-0.1.1.tar.gz
| Download URL | varscope-0.1.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12bb03e38506f45e1952bba03e622cf08835548fd8fd2734e1026c7e0ee3ab9d
|
|
BLAKE2b-256 checksum How to use checksums |
598b0610f3f1012addec72d752e22a0e3b8f6222d03d0b9181fce0c573e409f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1042-azure
|
Release files / varscope-0.1.1-py3-none-any.whl
| Download URL | varscope-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e02fea1ec9d030834913aa2805b39d415239a0a899e7d10ba290075d236854d
|
|
BLAKE2b-256 checksum How to use checksums |
36c10a87217f6fd3fb54381e58ae9aa158cad72559a98365e569ce182d3e52d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1042-azure
|
Security for varscope 0.1.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.