From 9b05ad30a81053b8aec2a23afebca53021951c80 Mon Sep 17 00:00:00 2001 From: z80 Date: Tue, 24 Oct 2023 00:25:03 -0400 Subject: [PATCH] fix: make mypy happy --- ape_vyper/compiler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ape_vyper/compiler.py b/ape_vyper/compiler.py index 5bf5e327..ed25fb13 100644 --- a/ape_vyper/compiler.py +++ b/ape_vyper/compiler.py @@ -302,21 +302,22 @@ def compile( all_settings = self.get_compiler_settings(sources, base_path=base_path) for vyper_version, source_paths in version_map.items(): - settings = all_settings.get(vyper_version, {}) + version_settings = all_settings.get(vyper_version, {}) optimizations_map = self.get_optimization_pragma_map(list(source_paths)) for optimization, source_paths in optimizations_map.items(): + settings: Dict[str, Any] = version_settings.copy() + settings["optimize"] = optimization path_args = { str(get_relative_path(p.absolute(), base_path)): p for p in source_paths } + settings["outputSelection"] = {s: ["*"] for s in path_args} input_json = { "language": "Vyper", "settings": settings, "sources": {s: {"content": p.read_text()} for s, p in path_args.items()}, } - input_json["settings"]["optimize"] = optimization - input_json["settings"]["outputSelection"] = {s: ["*"] for s in path_args} if interfaces := self.import_remapping: input_json["interfaces"] = interfaces @@ -396,9 +397,9 @@ def classify_ast(_node: ASTNode): def get_optimization_pragma_map( self, contract_filepaths: List[Path], base_path: Optional[Path] = None - ) -> Dict[str, Set[Path]]: + ) -> Dict[Union[str, bool], Set[Path]]: base_path = base_path or self.config_manager.contracts_folder - optimization_pragma_map: Dict[str, Set[Path]] = {} + optimization_pragma_map: Dict[Union[str, bool], Set[Path]] = {} for path in contract_filepaths: if pragma := get_optimization_pragma(path): if pragma not in optimization_pragma_map: