Tempvars

Latest version: v1.0.1

Safety actively analyzes 621751 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.0.1

This release ***should not*** affect the behavior of the
package in any way.

Refactored

* Remove duplicative call to `inspect.currentframe()` in
`TempVars._ns_default`
* Replace custom `copy_if_not_none()` inner function with
built-in `copy.copy()`, in `__attrs_post_init__()`
* Refactor the temporary variable popping operations to
a more concise form in both `__enter__()`
and `__exit__()`

Administrative

* Switched to [`black`](https://github.com/ambv/black)-style
code formatting
* Switched source file headers from comment blocks to
module docstrings
* Relocated some commentary from code comments to method
docstrings

1.0.0

Added

* `TempVars` now emits a warning if it is instantiated without
masking pattern arguments.

Changed

* `TempVars().names` changed to be an exact copy of the `__init__` argument
*names*. The actual variables masked can be retrieved as
`tv.stored_nsvars.keys()`.
* Since, due to the above, initialization of `names` as a new, empty list
is no longer needed, its default was changed to `None`
* The `globals()` namespace stored as `TempVars.ns` has been renamed
to `._ns` to discourage fiddling with it.
* `TempVars` changed to be an `attr.s(slots=True)` class.

Removed

* `TempVars.passed_names` has been completely removed.

1.0.0b2

Fixed

* `starts` and `ends` no longer allow patterns that respectively
start and end with `__`, to avoid munging the default dunder
objects in the namespace
* If a variable referencing a list, rather than a list literal, is
passed as `names`, that passed reference is no longer erroneously
updated with matches to the `starts` and `ends` patterns.
* Fixed an erroneous duplication of variable names held in
`names` due to variables in the namespace, e.g., matching multiple
pattern entries in `starts` and/or `ends`.

1.0.0b1

Added

* Created the `TempVars` context manager
* Implemented hard prevention of use in other than global scopes
(raises `RuntimeError`) due to known improper behavior
* Implemented masking of specific variables with `names` argument
* Implemented `.startswith`/`.endswith` pattern-based masking
via `starts` and `ends` arguments
* Implemented option to restore or not masked namespace variables
via `restore` argument
* Implemented storage of pre-existing masked namespace variables
for use within the managed context (`TempVars.stored_nsvars`)
* Implemented storage of temporary variables and values assigned
within the managed context (`TempVars.retained_tempvars`) for
use after exiting the suite

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.