lsst.pex.config gba4ed39666+1ac82b564f
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.pex.config.config.RecordingImporter Class Reference

Public Member Functions

 __init__ (self)
 
 __enter__ (self)
 
 __exit__ (self, *args)
 
 uninstall (self)
 
 find_spec (self, fullname, path, target=None)
 
 getModules (self)
 

Public Attributes

 origMetaPath
 

Protected Attributes

 _modules
 

Detailed Description

Importer (for `sys.meta_path`) that records which modules are being
imported.

*This class does not do any importing itself.*

Examples
--------
Use this class as a context manager to ensure it is properly uninstalled
when done:

>>> with RecordingImporter() as importer:
...     # import stuff
...     import numpy as np
... print("Imported: " + importer.getModules())

Member Function Documentation

◆ find_spec()

lsst.pex.config.config.RecordingImporter.find_spec ( self,
fullname,
path,
target = None )
Find a module.

Called as part of the ``import`` chain of events.

Parameters
----------
fullname : `str`
    Name of module.
path : `list` [`str`]
    Search path. Unused.
target : `~typing.Any`, optional
    Unused.

◆ getModules()

lsst.pex.config.config.RecordingImporter.getModules ( self)
Get the set of modules that were imported.

Returns
-------
modules : `set` of `str`
    Set of imported module names.

◆ uninstall()

lsst.pex.config.config.RecordingImporter.uninstall ( self)
Uninstall the importer.

The documentation for this class was generated from the following file: