def load_module(module_name): """Dynamically load a module. >>> from panoptes.utils.library import load_module >>> error = load_module('panoptes.utils.error') >>> error.__name__ 'panoptes.utils.error' >>> error.__package__ 'panoptes.utils' Args: module_name (str): Name of module to import. Returns: module: an imported module name Raises: error.NotFound: If module cannot be imported. """ try: module = resolve_name(module_name) except ImportError: raise error.NotFound(msg=module_name) return module
def load_module(module_name): """ Args: module_name (str): Name of module to import. Returns: module: The imported module. Raises: ImportError: If module cannot be imported. """ return resolve_name(module_name)
def load_module(module_name): """ Dynamically load a module Returns: module: an imported module name """ try: module = resolve_name(module_name) except ImportError: raise error.NotFound(msg=module_name) return module
def load_module(module_name): """Dynamically load a module. >>> from panoptes_utils import load_module >>> camera = load_module('pocs.camera.simulator') >>> camera.__package__ 'pocs.camera' Args: module_name (str): Name of module to import. Returns: module: an imported module name Raises: error.NotFound: If module cannot be imported. """ from panoptes_utils import error try: module = resolve_name(module_name) except ImportError: raise error.NotFound(msg=module_name) return module
def test_deprecated_private_variables(attr): """Test deprecation warnings are raised for private variables.""" with pytest.warns(AstropyDeprecationWarning): resolve_name("astropy", "cosmology", "flrw", attr)