def _load_module(path):
    'Helper to load a Python file at path and return as a module'

    module_name = os.path.splitext(os.path.basename(path))[0]

    module = None
    if sys.version_info.minor < 5:
        loader = importlib.machinery.SourceFileLoader(module_name, path)
        module = loader.load_module()
    else:
        spec = importlib.util.spec_from_file_location(module_name, path)
        module = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(module)

    return module
def _load_module ( path ) : module_name = os . path . splitext ( os . path . basename ( path ) ) [ 0 ] module = None if sys . version_info . minor < 5 : loader = importlib . machinery . SourceFileLoader ( module_name , path ) module = loader . load_module ( ) else : spec = importlib . util . spec_from_file_location ( module_name , path ) module = importlib . util . module_from_spec ( spec ) spec . loader . exec_module ( module ) return module
Helper to load a Python file at path and return as a module