def __init__(self): self.patcher_functions = {} if sys.version_info[0] >= 3: from importlib.machinery import PathFinder self.pathfinder = PathFinder()
def _get_module(app, modname): # Find out the app's __path__ try: app_path = import_module(app).__path__ except AttributeError: # pragma: no cover return # Use importlib's PathFinder().find_spec() to find the app's modname.py if PathFinder().find_spec(modname, app_path) is None: return # Import the app's module file import_module('{}.{}'.format(app, modname))