Skip to content

Commit

Permalink
chore: pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Nov 4, 2023
1 parent 67c6aed commit 912685a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions ethpm_types/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def get_contract_compiler(self, contract_type_name: str) -> Optional[Compiler]:

return None

def update_compilers(self, compilers: List[Compiler]):
def add_compilers(self, *compilers: List[Compiler]):
"""
Update compilers in the manifest. This method appends any
given compiler with a a different name, version, and settings
Expand All @@ -291,9 +291,9 @@ def update_compilers(self, compilers: List[Compiler]):
compilers.
"""

updated_compilers = [*compilers]
for prior_compiler in self.compilers or []:
if prior_compiler not in updated_compilers:
updated_compilers.append(prior_compiler)
if self.compilers is None:
self.compilers = []

self.compilers = updated_compilers
for compiler in compilers:
if compiler not in self.compilers:
self.compilers.append(compiler)
4 changes: 2 additions & 2 deletions tests/test_package_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_get_contract_compiler():
assert manifest.get_contract_compiler("yoyoyo") is None


def test_update_compilers():
def test_add_compilers():
compiler = Compiler(name="vyper", version="0.3.7", settings={}, contractTypes=["foobar"])
manifest = PackageManifest(
compilers=[compiler],
Expand All @@ -146,7 +146,7 @@ def test_update_compilers():
Compiler(name="vyper", version="0.3.7", settings={}, contractTypes=["foobar", "testtest"]),
Compiler(name="vyper", version="0.3.10", settings={}, contractTypes=["yoyo"]),
]
manifest.update_compilers(new_compilers)
manifest.update_compilers(*new_compilers)
assert len(manifest.compilers) == 2


Expand Down

0 comments on commit 912685a

Please sign in to comment.