Skip to content

Commit

Permalink
code style and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravlochab committed Sep 23, 2024
1 parent 13adcd9 commit d65f644
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions operate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(
self.setup()

self.logger = logger or setup_logger(name="operate")
self.keys_manager = services.manage.KeysManager( # type: ignore
self.keys_manager = services.manage.KeysManager( # type: ignore
path=self._keys,
logger=self.logger,
)
Expand All @@ -95,9 +95,9 @@ def create_user_account(self, password: str) -> UserAccount:
path=self._path / "user.json",
)

def service_manager(self) -> services.manage.ServiceManager: # type: ignore
def service_manager(self) -> services.manage.ServiceManager: # type: ignore
"""Load service manager."""
return services.manage.ServiceManager( # type: ignore
return services.manage.ServiceManager( # type: ignore
path=self._services,
keys_manager=self.keys_manager,
wallet_manager=self.wallet_manager,
Expand Down
7 changes: 3 additions & 4 deletions operate/services/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from autonomy.cli.helpers.chain import MintHelper as MintManager
from autonomy.cli.helpers.chain import OnChainHelper
from autonomy.cli.helpers.chain import ServiceHelper as ServiceManager
from eth_utils import to_bytes # type: ignore
from eth_utils import to_bytes # type: ignore
from hexbytes import HexBytes
from web3.contract import Contract

Expand Down Expand Up @@ -575,9 +575,8 @@ def owner_of(self, token_id: int) -> str:
chain_type=self.chain_type
)
owner = registry_contracts.service_manager.owner_of(
ledger_api=ledger_api,
token_id=token_id
).get('owner', "")
ledger_api=ledger_api, token_id=token_id
).get("owner", "")
return owner

def info(self, token_id: int) -> t.Dict:
Expand Down
4 changes: 3 additions & 1 deletion operate/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,9 @@ def new(
service.store()
return service

def update_user_params_from_template(self, service_template: ServiceTemplate) -> None:
def update_user_params_from_template(
self, service_template: ServiceTemplate
) -> None:
"""Update user params from template."""
for chain, config in service_template["configurations"].items():
self.chain_configs[
Expand Down
16 changes: 8 additions & 8 deletions operate/wallet/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class EthereumMasterWallet(MasterWallet):
safe_chains: t.List[ChainType] # For cross-chain support

ledger_type: LedgerType = LedgerType.ETHEREUM
safes: t.Optional[t.Dict[ChainType, str]] = field(default_factory=dict) # type: ignore
safes: t.Optional[t.Dict[ChainType, str]] = field(default_factory=dict) # type: ignore
safe_nonce: t.Optional[int] = None # For cross-chain reusability

_file = ledger_type.config_file
Expand Down Expand Up @@ -249,7 +249,7 @@ def _transfer_erc20_from_safe(
ledger_api=self.ledger_api(chain_type=chain_type, rpc=rpc),
crypto=self.crypto,
token=token,
safe=t.cast(str, self.safes[chain_type]), # type: ignore
safe=t.cast(str, self.safes[chain_type]), # type: ignore
to=to,
amount=amount,
)
Expand Down Expand Up @@ -353,9 +353,9 @@ def add_backup_owner(
) -> None:
"""Add a backup owner."""
ledger_api = self.ledger_api(chain_type=chain_type, rpc=rpc)
if chain_type not in self.safes: # type: ignore
if chain_type not in self.safes: # type: ignore
raise ValueError(f"Safes not created for chain_type {chain_type}!")
safe = t.cast(str, self.safes[chain_type]) # type: ignore
safe = t.cast(str, self.safes[chain_type]) # type: ignore
if len(get_owners(ledger_api=ledger_api, safe=safe)) == 2:
raise ValueError("Backup owner already exist!")
add_owner(
Expand All @@ -374,9 +374,9 @@ def swap_backup_owner(
) -> None:
"""Swap backup owner."""
ledger_api = self.ledger_api(chain_type=chain_type, rpc=rpc)
if chain_type not in self.safes: # type: ignore
if chain_type not in self.safes: # type: ignore
raise ValueError(f"Safes not created for chain_type {chain_type}!")
safe = t.cast(str, self.safes[chain_type]) # type: ignore
safe = t.cast(str, self.safes[chain_type]) # type: ignore
if len(get_owners(ledger_api=ledger_api, safe=safe)) == 1:
raise ValueError("Backup owner does not exist, cannot swap!")
swap_owner(
Expand Down Expand Up @@ -419,10 +419,10 @@ def load(cls, path: Path) -> "EthereumMasterWallet":
"""Load master wallet."""
raw_ethereum_wallet = super().load(path) # type: ignore
safes = {}
for id_, safe_address in raw_ethereum_wallet.safes.items(): # type: ignore
for id_, safe_address in raw_ethereum_wallet.safes.items(): # type: ignore
safes[ChainType(int(id_))] = safe_address

raw_ethereum_wallet.safes = safes # type: ignore
raw_ethereum_wallet.safes = safes # type: ignore
return t.cast(EthereumMasterWallet, raw_ethereum_wallet)


Expand Down

0 comments on commit d65f644

Please sign in to comment.