def recall_code_tree(self, module_subpath): if self._is_cached(module_subpath): return self._cached_code_tree[1] try: log.debug("Loading code tree for module %r from a file and caching..." % \ module_subpath) code_tree = load_pickle_from(self._code_tree_path(module_subpath)) self._cache(code_tree, module_subpath) return code_tree except IOError: raise CodeTreeNotFound(module_subpath)
def from_directory(cls, project_path): """Read the project information from the .pythoscope/ directory of the given project. The pickle file may not exist for project that is analyzed the first time and that's OK. """ project_path = os.path.realpath(project_path) try: project = load_pickle_from(get_pickle_path(project_path)) # Update project's path, as the directory could've been moved. project.path = project_path except IOError: project = Project(project_path) return project