diff --git a/nixops/__main__.py b/nixops/__main__.py index 67fce0eac..b845587ba 100755 --- a/nixops/__main__.py +++ b/nixops/__main__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from nixops import deployment -from argparse import ArgumentParser, SUPPRESS, REMAINDER +from argparse import ArgumentParser, _SubParsersAction, SUPPRESS, REMAINDER import os from nixops.script_defs import * @@ -10,7 +10,7 @@ parser = ArgumentParser(description="NixOS cloud deployment tool", prog="nixops") parser.add_argument("--version", action="version", version="NixOps @version@") -subparsers = parser.add_subparsers( +subparsers: _SubParsersAction = parser.add_subparsers( help="sub-command help", metavar="operation", required=True ) diff --git a/nixops/script_defs.py b/nixops/script_defs.py index 48fdbc78b..9a263b40e 100644 --- a/nixops/script_defs.py +++ b/nixops/script_defs.py @@ -7,7 +7,7 @@ import nixops.statefile import prettytable -from argparse import Namespace +from argparse import ArgumentParser, _SubParsersAction, Namespace import os import pwd import re @@ -974,7 +974,9 @@ def setup_logging(args): nixops.util.TeeStdout() -def add_subparser(subparsers, name, help): +def add_subparser( + subparsers: _SubParsersAction, name: str, help: str +) -> ArgumentParser: subparser = subparsers.add_parser(name, help=help) subparser.add_argument( "--state", @@ -1062,7 +1064,7 @@ def add_subparser(subparsers, name, help): return subparser -def add_common_modify_options(subparser): +def add_common_modify_options(subparser: ArgumentParser): subparser.add_argument( "nix_exprs", nargs="*", @@ -1079,7 +1081,7 @@ def add_common_modify_options(subparser): ) -def add_common_deployment_options(subparser): +def add_common_deployment_options(subparser: ArgumentParser): subparser.add_argument( "--include", nargs="+",