diff --git a/silkaj/checksum.py b/silkaj/checksum.py index d095e5986d7e9bf9755e2b55b51e392a01f366ec..a7bfaa37e3c8c09fef95641cbb93559b8a9af4f0 100644 --- a/silkaj/checksum.py +++ b/silkaj/checksum.py @@ -35,7 +35,7 @@ MESSAGE = "You should specify a pubkey or an authentication method" Can also check if the checksum is valid", ) @click.argument("pubkey_checksum", nargs=-1) -def checksum_command(pubkey_checksum): +def checksum_command(pubkey_checksum: str) -> None: if has_auth_method(): key = auth_method() click.echo(gen_pubkey_checksum(key.pubkey)) diff --git a/silkaj/cli.py b/silkaj/cli.py index 1930bbd9edd6481e3c142e0db0fc810678935185..d8203875d7a65b3d8d668a17ceb831e5393a5df0 100644 --- a/silkaj/cli.py +++ b/silkaj/cli.py @@ -15,7 +15,7 @@ import sys -from click import group, help_option, option, pass_context, version_option +from click import Context, group, help_option, option, pass_context, version_option from duniterpy.api.endpoint import endpoint from silkaj import revocation @@ -91,18 +91,18 @@ Do not send the document, but display it instead", ) @pass_context def cli( - ctx, - endpoint, - gtest, - auth_scrypt, - nrp, - auth_file, - file, - auth_seed, - auth_wif, - display, - dry_run, -): + ctx: Context, + endpoint: str, + gtest: bool, + auth_scrypt: bool, + nrp: str, + auth_file: bool, + file: str, + auth_seed: bool, + auth_wif: bool, + display: bool, + dry_run: bool, +) -> None: if display and dry_run: sys.exit("ERROR: display and dry-run options can not be used together") @@ -143,7 +143,7 @@ cli.add_command(received_sent_certifications) Subcommands optionally take the path to the revocation document.", ) @help_option("-h", "--help") -def revocation_group(): +def revocation_group() -> None: pass @@ -154,7 +154,7 @@ revocation_group.add_command(revocation.revoke_now) @cli.command("about", help="Display program information") -def about(): +def about() -> None: print( "\ \n @@@@@@@@@@@@@\ diff --git a/silkaj/cli_tools.py b/silkaj/cli_tools.py index 9928d230d77862e6c50b9e31c8a1fcd08259c49b..498a110a658a15d83b67f3548585ad80568ae299 100644 --- a/silkaj/cli_tools.py +++ b/silkaj/cli_tools.py @@ -13,11 +13,13 @@ # You should have received a copy of the GNU Affero General Public License # along with Silkaj. If not, see <https://www.gnu.org/licenses/>. -from click import Option, UsageError +from typing import Any + +from click import Context, Option, UsageError class MutuallyExclusiveOption(Option): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: self.mutually_exclusive = set(kwargs.pop("mutually_exclusive", [])) help = kwargs.get("help", "") if self.mutually_exclusive: @@ -27,7 +29,7 @@ class MutuallyExclusiveOption(Option): ] = f"{help} NOTE: This argument is mutually exclusive with arguments: [{ex_str}]." super().__init__(*args, **kwargs) - def handle_parse_result(self, ctx, opts, args): + def handle_parse_result(self, ctx: Context, opts: Any, args: Any) -> Any: if self.mutually_exclusive.intersection(opts) and self.name in opts: arguments = ", ".join(self.mutually_exclusive) raise UsageError(