temporary_namespace

utilipy.utils.temporary_namespace(locals_ref, keep: List[str] = [])[source]

Temporary Namespace within with statement.

  1. copies current namespace from locals_ref

  2. Enters with statement

  3. restores original namespace except those specified in keep

Parameters
modulemodule

sys.modules[__name__] of module calling from.

Todo

not need to pass any module information. infer.

keeplist, optional

list of (str) variable names to keep.

Yields
locals_reflocals

for accessing namespace

Warning

Does NOT work within functions.