def load_module(path=None, source=None, name=None): def load(source): if path is not None and path.endswith('.py'): if source is None: with open(path) as f: source = f.read() else: return compiled.load_module(path, name) p = path or name p = fast.FastParser(common.source_to_unicode(source), p) cache.save_parser(path, name, p) return p.module cached = cache.load_parser(path, name) return load(source) if cached is None else cached.module
def load_module(path=None, source=None, name=None): def load(source): if path is not None and path.endswith('.py'): if source is None: with open(path) as f: source = f.read() else: return compiled.load_module(path, name) p = path or name p = fast.FastParser(common.source_to_unicode(source), p) cache.save_parser(path, name, p) return p.module cached = cache.load_parser(path, name) return load(source) if cached is None else cached.module
def _load_module(evaluator, path=None, source=None, name=None, sys_path=None): def load(source): dotted_path = path and compiled.dotted_from_fs_path(path, sys_path) if path is not None and path.endswith('.py') \ and not dotted_path in settings.auto_import_modules: if source is None: with open(path, 'rb') as f: source = f.read() else: return compiled.load_module(path, name) p = path or name p = fast.FastParser(evaluator.grammar, common.source_to_unicode(source), p) cache.save_parser(path, name, p) return p.module cached = cache.load_parser(path, name) return load(source) if cached is None else cached.module
def _load_module(evaluator, path=None, source=None, name=None, sys_path=None): def load(source): dotted_path = path and compiled.dotted_from_fs_path(path, sys_path) if path is not None and path.endswith('.py') \ and not dotted_path in settings.auto_import_modules: if source is None: with open(path, 'rb') as f: source = f.read() else: return compiled.load_module(path, name) p = path or name p = fast.FastParser(evaluator.grammar, common.source_to_unicode(source), p) cache.save_parser(path, name, p) return p.module cached = cache.load_parser(path, name) return load(source) if cached is None else cached.module
def _get_paths_from_buildout_script(evaluator, buildout_script): def load(buildout_script): try: with open(buildout_script, 'rb') as f: source = common.source_to_unicode(f.read()) except IOError: debug.dbg('Error trying to read buildout_script: %s', buildout_script) return p = Parser(evaluator.grammar, source, buildout_script) cache.save_parser(buildout_script, None, p) return p.module cached = cache.load_parser(buildout_script, None) module = cached and cached.module or load(buildout_script) if not module: return for path in _check_module(evaluator, module): yield path
def _get_paths_from_buildout_script(evaluator, buildout_script): def load(buildout_script): try: with open(buildout_script, 'rb') as f: source = common.source_to_unicode(f.read()) except IOError: debug.dbg('Error trying to read buildout_script: %s', buildout_script) return p = Parser(evaluator.grammar, source, buildout_script) cache.save_parser(buildout_script, p) return p.module cached = cache.load_parser(buildout_script) module = cached and cached.module or load(buildout_script) if not module: return for path in _check_module(evaluator, module): yield path
def load_stored_item(cache, path, item): """Load `item` stored at `path` in `cache`.""" return cache.load_parser(path, item.change_time - 1)
def load_stored_item(cache, path, item): """Load `item` stored at `path` in `cache`.""" return cache.load_parser(path, item.change_time - 1)