Skip to content

Commit

Permalink
fix: correct return type of abort() function [APE-1242] (#1574)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Jul 28, 2023
1 parent 359fc48 commit eea39f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ape/cli/options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, List, Optional, Union
from typing import Dict, List, NoReturn, Optional, Union

import click
from ethpm_types import ContractType
Expand Down Expand Up @@ -30,7 +30,7 @@ def __init__(self):
self.config_manager.load()

@staticmethod
def abort(msg: str, base_error: Optional[Exception] = None):
def abort(msg: str, base_error: Optional[Exception] = None) -> NoReturn:
"""
End execution of the current command invocation.
Expand Down
3 changes: 1 addition & 2 deletions src/ape_accounts/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,13 @@ def _import(cli_ctx, alias, import_from_mnemonic, custom_hd_path):
account = EthAccount.from_mnemonic(mnemonic=mnemonic, account_path=custom_hd_path)
except Exception as error:
cli_ctx.abort(f"Seed phrase can't be imported: {error}")
return

else:
key = click.prompt("Enter Private Key", hide_input=True)
try:
account = EthAccount.from_key(to_bytes(hexstr=key))
except Exception as error:
cli_ctx.abort(f"Key can't be imported: {error}")
return

passphrase = click.prompt(
"Create Passphrase to encrypt account",
Expand Down
5 changes: 1 addition & 4 deletions src/ape_pm/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,7 @@ def compile(cli_ctx, name, version, force):
break

if not version_found:
# Return only needed for mypy
return cli_ctx.abort(
f"Version '{version}' for dependency '{name}' not found. Is it installed?"
)
cli_ctx.abort(f"Version '{version}' for dependency '{name}' not found. Is it installed?")

dependency = versions[version_found]

Expand Down

0 comments on commit eea39f3

Please sign in to comment.