File: py312.py

package info (click to toggle)
python-importlib-metadata 8.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 444 kB
  • sloc: python: 1,981; sh: 7; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 364 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import contextlib

from .py39 import import_helper


@contextlib.contextmanager
def isolated_modules():
    """
    Save modules on entry and cleanup on exit.
    """
    (saved,) = import_helper.modules_setup()
    try:
        yield
    finally:
        import_helper.modules_cleanup(saved)


vars(import_helper).setdefault('isolated_modules', isolated_modules)