Skip to content

Commit

Permalink
chore: upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 12, 2023
1 parent 30f087a commit 23649d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: check-yaml

Expand All @@ -10,24 +10,24 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.9.1
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.6.0
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools, pydantic, types-pkg-resources]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies: [mdformat-gfm, mdformat-frontmatter]
Expand Down
4 changes: 2 additions & 2 deletions ape_solidity/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ape.logging import logger
from packaging.version import InvalidVersion
from packaging.version import Version as _Version
from pydantic import BaseModel, validator
from pydantic import BaseModel, field_validator
from semantic_version import NpmSpec, Version # type: ignore
from solcx.exceptions import SolcError # type: ignore
from solcx.install import get_executable # type: ignore
Expand All @@ -37,7 +37,7 @@ class ImportRemapping(BaseModel):
entry: str
packages_cache: Path

@validator("entry")
@field_validator("entry", mode="before")
def validate_entry(cls, value):
if len((value or "").split("=")) != 2:
raise IncorrectMappingFormatError()
Expand Down
10 changes: 5 additions & 5 deletions ape_solidity/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_import_remapping(self, base_path: Optional[Path] = None) -> Dict[str, st
logger.debug(f"Unable to find dependency '{package_id}'.")

else:
manifest = PackageManifest.parse_file(cached_manifest_file)
manifest = PackageManifest.model_validate_json(cached_manifest_file.read_text())
self._add_dependencies(manifest, sub_contracts_cache, builder)

# Update cache and hash
Expand Down Expand Up @@ -280,7 +280,7 @@ def _add_dependencies(
/ f"{dependency_name}.json"
)
if dependency_path.is_file():
sub_manifest = PackageManifest.parse_file(dependency_path)
sub_manifest = PackageManifest.model_validate_json(dependency_path.read_text())
dep_id = Path(dependency_name) / version
if dep_id not in builder.dependencies_added:
builder.dependencies_added.add(dep_id)
Expand Down Expand Up @@ -422,7 +422,7 @@ def classify_ast(_node: ASTNode):

for source_id, contracts_out in contracts.items():
ast_data = output["sources"][source_id]["ast"]
ast = ASTNode.parse_obj(ast_data)
ast = ASTNode.model_validate(ast_data)
classify_ast(ast)

for contract_name, ct_data in contracts_out.items():
Expand Down Expand Up @@ -470,7 +470,7 @@ def classify_ast(_node: ASTNode):
ct_data["devdoc"] = load_dict(ct_data["devdoc"])
ct_data["sourcemap"] = evm_data["bytecode"]["sourceMap"]
ct_data["ast"] = ast
contract_type = ContractType.parse_obj(ct_data)
contract_type = ContractType.model_validate(ct_data)
contract_types.append(contract_type)
solc_versions_by_contract_name[contract_name] = solc_version

Expand Down Expand Up @@ -778,7 +778,7 @@ def flatten_contract(self, path: Path, **kwargs) -> Content:
source = "\n".join([pragma, source])
lines = source.splitlines()
line_dict = {i + 1: line for i, line in enumerate(lines)}
return Content(__root__=line_dict)
return Content(root=line_dict)


def remove_imports(flattened_contract: str) -> str:
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer
],
"lint": [
"black>=23.3.0,<24", # Auto-formatter and linter
"mypy>=0.991,<1", # Static type analyzer
"black>=23.9.1,<24", # Auto-formatter and linter
"mypy>=1.6.0,<2", # Static type analyzer
"types-requests", # Needed due to mypy typeshed
"types-setuptools", # Needed due to mypy typeshed
"types-pkg-resources", # Needed for type checking tests
"flake8>=6.0.0,<7", # Style linter
"flake8>=6.1.0,<7", # Style linter
"isort>=5.10.1,<6", # Import sorting linter
"mdformat>=0.7.16", # Auto-formatter for markdown
"mdformat>=0.7.17", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown
"mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates
],
Expand Down

0 comments on commit 23649d1

Please sign in to comment.