Skip to content

Commit

Permalink
fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Feb 13, 2024
1 parent 145d756 commit 7301b85
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions boa/contracts/vyper/vyper_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,10 @@ def __init__(
self._ctor = VyperFunction(external_fns.pop("__init__"), self)

if skip_initcode:
self._address = Address(override_address)
addr = Address(override_address)
else:
self._address = self._run_init(*args, override_address=override_address)
addr = self._run_init(*args, override_address=override_address)
self._address: Address = addr

for fn_name, fn in external_fns.items():
setattr(self, fn_name, VyperFunction(fn, self))
Expand Down
5 changes: 3 additions & 2 deletions boa/explorer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import json
from typing import Optional

import requests

SESSION = requests.Session()


def _fetch_etherscan(uri: str, api_key: str = None, **params) -> dict:
def _fetch_etherscan(uri: str, api_key: Optional[str] = None, **params) -> dict:
if api_key is not None:
params["apikey"] = api_key

Expand Down Expand Up @@ -34,7 +35,7 @@ def fetch_abi_from_etherscan(

# fetch the address of a contract; resolves at most one layer of indirection
# if the address is a proxy contract.
def _resolve_implementation_address(address: str, uri: str, api_key: str):
def _resolve_implementation_address(address: str, uri: str, api_key: Optional[str]):
params = dict(module="contract", action="getsourcecode", address=address)
data = _fetch_etherscan(uri, api_key, **params)
source_data = data["result"][0]
Expand Down
2 changes: 1 addition & 1 deletion boa/integrations/jupyter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def load_jupyter_server_extension(server_app):
_load_jupyter_server_extension = load_jupyter_server_extension


__all__ = [
__all__ = [ # type: ignore
BrowserSigner,
BrowserRPC,
BrowserEnv,
Expand Down
2 changes: 1 addition & 1 deletion boa/interpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ def from_etherscan(
return ABIContractFactory.from_abi_dict(abi, name=name).at(addr)


__all__ = []
__all__ = [] # type: ignore
3 changes: 2 additions & 1 deletion boa/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dataclasses import dataclass
from functools import cached_property
from math import ceil
from typing import Any

from eth_account import Account
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -188,7 +189,7 @@ def get_eip1559_fee(self) -> tuple[str, str, str, str]:
max_fee = to_hex(base_fee_estimate + to_int(max_priority_fee))
return to_hex(base_fee_estimate), max_priority_fee, max_fee, chain_id

def get_static_fee(self) -> tuple[str, str]:
def get_static_fee(self) -> list[Any]:
# non eip-1559 transaction
return self._rpc.fetch_multi([("eth_gasPrice", []), ("eth_chainId", [])])

Expand Down
8 changes: 4 additions & 4 deletions boa/vm/fork.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import Any, Dict, Optional, Tuple
from typing import Any

from requests import HTTPError

Expand Down Expand Up @@ -50,7 +50,7 @@ def __init__(self, rpc: RPC, cache_file: str = DEFAULT_CACHE_DIR):

# _loaded is a cache for the constructor.
# reduces fork time after the first fork.
_loaded: Dict[Tuple[str, str], "CachingRPC"] = {}
_loaded: dict[tuple[str, str], "CachingRPC"] = {}
_pid: int = os.getpid() # so we can detect if our fds are bad

def _init_mem_db(self):
Expand Down Expand Up @@ -120,8 +120,8 @@ def fetch_multi(self, payload):
# AccountDB which dispatches to an RPC when we don't have the
# data locally
class AccountDBFork(AccountDB):
_rpc: Optional[RPC] = None
_rpc_init_kwargs: Dict[str, Any] = {}
_rpc: RPC = None # type: ignore
_rpc_init_kwargs: dict[str, Any] = {}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down

0 comments on commit 7301b85

Please sign in to comment.