Skip to content

Commit

Permalink
chore: fix valid mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 27, 2023
1 parent 4b819c7 commit 43e1073
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/ape/api/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from ethpm_types import Checksum, ContractType, PackageManifest, Source
from ethpm_types.manifest import PackageName
from ethpm_types.source import Content
from ethpm_types.utils import Algorithm, AnyUrl, compute_checksum
from packaging.version import InvalidVersion, Version

Expand Down Expand Up @@ -143,7 +144,7 @@ def contracts(self) -> Dict[str, ContractType]:
continue

contract_name = p.stem
contract_type = ContractType().parse_file(p)
contract_type = ContractType.parse_file(p)
if contract_type.name is None:
contract_type.name = contract_name

Expand Down Expand Up @@ -214,7 +215,7 @@ def _create_source_dict(
hash=compute_checksum(source_path.read_bytes()),
),
urls=[],
content=text,
content=Content(__root__={i + 1: x for i, x in enumerate(text.splitlines())}),
imports=source_imports.get(key, []),
references=source_references.get(key, []),
)
Expand Down
8 changes: 5 additions & 3 deletions src/ape/managers/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ def query(
)

query = BlockQuery(
columns=columns,
columns=list(columns),
start_block=start_block,
stop_block=stop_block,
step=step,
)

blocks = self.query_manager.query(query, engine_to_use=engine_to_use)
columns = validate_and_expand_columns(columns, self.head.__class__) # type: ignore
columns: List[str] = validate_and_expand_columns( # type: ignore
columns, self.head.__class__
)
blocks = map(partial(extract_fields, columns=columns), blocks)
return pd.DataFrame(columns=columns, data=blocks)

Expand Down Expand Up @@ -486,7 +488,7 @@ def query(
)

query = AccountTransactionQuery(
columns=columns,
columns=list(columns),
account=self.address,
start_nonce=start_nonce,
stop_nonce=stop_nonce,
Expand Down
1 change: 0 additions & 1 deletion src/ape/managers/project/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ def track_deployment(self, contract: ContractInstance):
if network == LOCAL_NETWORK_NAME or network.endswith("-fork"):
raise ProjectError("Can only publish deployments on a live network.")

contract_name = contract.contract_type.name
if not (contract_name := contract.contract_type.name):
raise ProjectError("Contract name required when publishing.")

Expand Down
2 changes: 1 addition & 1 deletion src/ape/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def validate_multiplier(cls, value):
"""


TopicFilter = Sequence[Union[Optional[HexStr], List[Optional[HexStr]]]]
TopicFilter = Sequence[Union[Optional[HexStr], Sequence[Optional[HexStr]]]]


@dataclass
Expand Down
6 changes: 5 additions & 1 deletion src/ape/utils/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def decode_output(self, values: Union[List, Tuple]) -> Any:

return self._decode(self.abi.outputs, values) if isinstance(self.abi, MethodABI) else None

def _decode(self, _types: Sequence[ABIType], values: Union[Sequence, Dict[str, Any]]):
def _decode(
self,
_types: Union[Sequence[ABIType]],
values: Union[Sequence, Dict[str, Any]],
):
if is_struct(_types):
return self._create_struct(_types[0], values)

Expand Down

0 comments on commit 43e1073

Please sign in to comment.