Skip to content

Commit

Permalink
fix: undo cache stupidnes
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 27, 2024
1 parent da7fd4f commit c5f0939
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 3 additions & 4 deletions ape_vyper/compiler/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ def get_imports(
project: Optional[ProjectManager] = None,
) -> dict[str, list[str]]:
pm = project or self.local_project
imports = self._import_resolver.get_imports(pm, contract_filepaths, use_cache=False)
imports = self._import_resolver.get_imports(pm, contract_filepaths)
return {
f"{get_relative_path(p.absolute(), pm.path)}": [imp.source_id for imp in import_ls]
for p, import_ls in imports.items()
if p in contract_filepaths
}

def get_versions(self, all_paths: Iterable[Path]) -> set[str]:
Expand Down Expand Up @@ -260,7 +259,7 @@ def _compile(
):
pm = project or self.local_project
contract_types: list[ContractType] = []
import_map = self._import_resolver.get_imports(pm, contract_filepaths, use_cache=False)
import_map = self._import_resolver.get_imports(pm, contract_filepaths)
config = self.get_config(pm)
version_map = self._get_version_map_from_import_map(
contract_filepaths,
Expand Down Expand Up @@ -388,7 +387,7 @@ def get_version_map(
) -> dict[Version, set[Path]]:
pm = project or self.local_project
paths = [p for p in contract_filepaths]
import_map = self._import_resolver.get_imports(pm, paths, use_cache=False)
import_map = self._import_resolver.get_imports(pm, paths)
return self._get_version_map_from_import_map(paths, import_map, project=pm)

def _get_version_map_from_import_map(
Expand Down
9 changes: 2 additions & 7 deletions ape_vyper/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,9 @@ class ImportResolver(ManagerAccessMixin):
_projects: dict[str, ImportMap] = {}
_dependency_attempted_compile: set[str] = set()

def get_imports(
self,
project: ProjectManager,
contract_filepaths: Iterable[Path],
use_cache: bool = True,
) -> ImportMap:
def get_imports(self, project: ProjectManager, contract_filepaths: Iterable[Path]) -> ImportMap:
paths = list(contract_filepaths)
if project.project_id not in self._projects or not use_cache:
if project.project_id not in self._projects:
self._projects[project.project_id] = ImportMap(project, paths)

return self._get_imports(paths, project)
Expand Down

0 comments on commit c5f0939

Please sign in to comment.