Skip to content

Commit

Permalink
scripts: drop redundant argparser 'default' args
Browse files Browse the repository at this point in the history
There is no need to provide a default when 'store_true' or 'store_false'
action is used.

Signed-off-by: Markus Lehtonen <[email protected]>
  • Loading branch information
marquiz committed Jan 15, 2018
1 parent 69e3f27 commit 964074e
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 45 deletions.
8 changes: 4 additions & 4 deletions gbp/scripts/buildpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,17 @@ def build_parser(name, prefix=None):
"alternative build tree related options")

parser.add_bool_conf_file_arg("--ignore-new", dest="ignore_new")
parser.add_arg("--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")
parser.add_conf_file_arg("--notify", dest="notify", type='tristate')
tag_group.add_arg("--tag", action="store_true", dest="tag", default=False,
tag_group.add_arg("--tag", action="store_true", dest="tag",
help="create a tag after a successful build")
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only", default=False,
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
help="don't build, only tag and run the posttag hook")
tag_group.add_arg("--retag", action="store_true", dest="retag", default=False,
tag_group.add_arg("--retag", action="store_true", dest="retag",
help="don't fail if the tag already exists")
tag_group.add_bool_conf_file_arg("--sign-tags", dest="sign_tags")
tag_group.add_conf_file_arg("--keyid", dest="keyid")
Expand Down
6 changes: 2 additions & 4 deletions gbp/scripts/buildpackage_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def build_parser(name, prefix=None, git_treeish=None):
parser.add_bool_conf_file_arg("--ignore-new",
dest="ignore_new")
parser.add_arg("--verbose", action="store_true", dest="verbose",
default=False, help="verbose command execution")
help="verbose command execution")
parser.add_conf_file_arg("--tmp-dir", dest="tmp_dir")
parser.add_conf_file_arg("--color", dest="color",
type='tristate')
Expand All @@ -320,13 +320,11 @@ def build_parser(name, prefix=None, git_treeish=None):
parser.add_conf_file_arg("--native", dest="native",
type='tristate')
tag_group.add_arg("--tag", action="store_true", dest="tag",
default=False,
help="create a tag after a successful build")
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
default=False,
help="don't build, only tag and run the posttag hook")
tag_group.add_arg("--retag", action="store_true", dest="retag",
default=False, help="don't fail if the tag already exists")
help="don't fail if the tag already exists")
tag_group.add_bool_conf_file_arg("--sign-tags",
dest="sign_tags")
tag_group.add_conf_file_arg("--keyid", dest="keyid")
Expand Down
4 changes: 2 additions & 2 deletions gbp/scripts/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def build_parser(name):
branch_group = parser.add_argument_group("branch options", "branch tracking and layout options")
cmd_group = parser.add_argument_group("external command options", "how and when to invoke hooks")

branch_group.add_arg("--all", action="store_true", dest="all", default=False,
branch_group.add_arg("--all", action="store_true", dest="all",
help="track all branches, not only debian and upstream")
branch_group.add_conf_file_arg("--upstream-branch", dest="upstream_branch")
branch_group.add_conf_file_arg("--debian-branch", dest="debian_branch")
Expand All @@ -122,7 +122,7 @@ def build_parser(name):
help="hook to run after cloning the source tree")
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")

parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme", dest="color_scheme")
Expand Down
1 change: 0 additions & 1 deletion gbp/scripts/create_remote_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def build_parser(name, sections=[]):
parser.add_arg("-v", "--verbose",
action="store_true",
dest="verbose",
default=False,
help="verbose command execution")
parser.add_conf_file_arg("--color",
dest="color",
Expand Down
22 changes: 11 additions & 11 deletions gbp/scripts/dch.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,36 +351,36 @@ def build_parser(name):
help="expression to determine the next snapshot number")
parser.add_conf_file_arg("--git-log", dest="git_log",
help="options to pass to git-log")
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme", dest="color_scheme")
range_group.add_arg("-s", "--since", dest="since", help="commit to start from (e.g. HEAD^^^, debian/0.4.3)")
range_group.add_arg("-a", "--auto", action="store_true", dest="auto", default=False,
range_group.add_arg("-a", "--auto", action="store_true", dest="auto",
help="autocomplete changelog from last snapshot or tag")
version_group.add_arg("-R", "--release", action="store_true", dest="release", default=False,
version_group.add_arg("-R", "--release", action="store_true", dest="release",
help="mark as release")
version_group.add_arg("-S", "--snapshot", action="store_true", dest="snapshot", default=False,
version_group.add_arg("-S", "--snapshot", action="store_true", dest="snapshot",
help="mark as snapshot build")
version_group.add_arg("-D", "--distribution", dest="distribution", help="Set distribution")
version_group.add_arg("--force-distribution", action="store_true", dest="force_distribution", default=False,
version_group.add_arg("--force-distribution", action="store_true", dest="force_distribution",
help="Force the provided distribution to be used, "
"even if it doesn't match the list of known distributions")
version_group.add_arg("-N", "--new-version", dest="new_version",
help="use this as base for the new version number")
version_group.add_conf_file_arg("--urgency", dest="urgency")
version_group.add_arg("--bpo", dest="bpo", action="store_true", default=False,
version_group.add_arg("--bpo", dest="bpo", action="store_true",
help="Increment the Debian release number for an upload to backports, "
"and add a backport upload changelog comment.")
version_group.add_arg("--nmu", dest="nmu", action="store_true", default=False,
version_group.add_arg("--nmu", dest="nmu", action="store_true",
help="Increment the Debian release number for a non-maintainer upload")
version_group.add_arg("--qa", dest="qa", action="store_true", default=False,
version_group.add_arg("--qa", dest="qa", action="store_true",
help="Increment the Debian release number for a Debian QA Team upload, "
"and add a QA upload changelog comment.")
version_group.add_arg("--team", dest="team", action="store_true", default=False,
version_group.add_arg("--team", dest="team", action="store_true",
help="Increment the Debian release number for a Debian Team upload, "
"and add a Team upload changelog comment.")
version_group.add_arg("--security", dest="security", action="store_true", default=False,
version_group.add_arg("--security", dest="security", action="store_true",
help="Increment the Debian release number for a security upload and "
"add a security upload changelog comment.")
version_group.add_bool_conf_file_arg("--git-author", dest="use_git_author")
Expand All @@ -398,7 +398,7 @@ def build_parser(name):
commit_group.add_conf_file_arg("--spawn-editor", dest="spawn_editor")
parser.add_conf_file_arg("--commit-msg",
dest="commit_msg")
parser.add_arg("-c", "--commit", action="store_true", dest="commit", default=False,
parser.add_arg("-c", "--commit", action="store_true", dest="commit",
help="commit changelog file after generating")
parser.add_conf_file_arg("--dch-opt", dest="dch_opts", action="append",
help="option to pass to dch verbatim, "
Expand Down
2 changes: 1 addition & 1 deletion gbp/scripts/export_orig.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def build_parser(name):
branch_group = parser.add_argument_group("branch options",
"branch layout options")

parser.add_arg("--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme",
Expand Down
8 changes: 4 additions & 4 deletions gbp/scripts/import_dsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def build_parser(name):
branch_group = parser.add_argument_group("version and branch naming options",
"version number and branch layout options")

parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme",
Expand All @@ -341,15 +341,15 @@ def build_parser(name):
tag_group.add_conf_file_arg("--upstream-tag",
dest="upstream_tag")
tag_group.add_arg("--skip-debian-tag", dest="skip_debian_tag",
action="store_true", default=False,
action="store_true",
help="Don't add a tag after importing the Debian patch")

import_group.add_conf_file_arg("--filter",
dest="filters", action="append")
import_group.add_bool_conf_file_arg("--pristine-tar",
dest="pristine_tar")
import_group.add_arg("--allow-same-version", action="store_true",
dest="allow_same_version", default=False,
dest="allow_same_version",
help="allow import of already imported version")
import_group.add_bool_conf_file_arg("--author-is-committer",
dest="author_committer")
Expand All @@ -363,7 +363,7 @@ def build_parser(name):
parser.add_conf_file_arg("--repo-email", dest="repo_email",
choices=['DEBIAN', 'GIT'])
parser.add_arg("--download", dest='download', action="store_true",
default=False, help="Ignored. Accepted for compatibility.")
help="Ignored. Accepted for compatibility.")
parser.add_argument("package", metavar="PACKAGE",
help="package to import")
parser.add_argument("target_dir", metavar="TARGET_DIR", nargs="?",
Expand Down
4 changes: 2 additions & 2 deletions gbp/scripts/import_orig.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,15 @@ def build_parser(name):
dest='interactive')
parser.add_bool_conf_file_arg("--rollback",
dest="rollback")
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")

# Accepted for compatibility
parser.add_arg("--download", dest='download', action="store_true",
default=False, help="Ignored. Accepted for compatibility.")
help="Ignored. Accepted for compatibility.")

src_group = parser.add_mutually_exclusive_group(required=True)
src_group.add_arg("--uscan", action="store_true",
Expand Down
11 changes: 5 additions & 6 deletions gbp/scripts/import_srpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def build_parser(name):
"version number and branch layout options")

parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
default=False, help="verbose command execution")
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color",
type='tristate')
parser.add_conf_file_arg("--color-scheme",
Expand All @@ -143,18 +143,17 @@ def build_parser(name):
parser.add_conf_file_arg("--vendor", action="store",
dest="vendor")
parser.add_arg("--download", action="store_true", dest="download",
default=False, help="download source package")
help="download source package")
branch_group.add_conf_file_arg("--packaging-branch",
dest="packaging_branch")
branch_group.add_conf_file_arg("--upstream-branch",
dest="upstream_branch")
branch_group.add_bool_conf_file_arg("--create-missing-branches",
dest="create_missing_branches")
branch_group.add_arg("--orphan-packaging", action="store_true",
dest="orphan_packaging", default=False,
dest="orphan_packaging",
help="The packaging branch doesn't base on upstream")
branch_group.add_arg("--native", action="store_true",
dest="native", default=False,
branch_group.add_arg("--native", action="store_true", dest="native",
help="This is a dist native package, no separate "
"upstream branch")

Expand All @@ -172,7 +171,7 @@ def build_parser(name):
import_group.add_bool_conf_file_arg("--pristine-tar",
dest="pristine_tar")
import_group.add_arg("--allow-same-version", action="store_true",
dest="allow_same_version", default=False,
dest="allow_same_version",
help="allow import of already imported version")
import_group.add_bool_conf_file_arg("--author-is-committer",
dest="author_is_committer")
Expand Down
4 changes: 2 additions & 2 deletions gbp/scripts/pq.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,14 @@ def build_parser(name):
return None

# Add common arguments
_parent.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False,
_parent.add_arg("-v", "--verbose", action="store_true", dest="verbose",
help="verbose command execution")
_parent.add_conf_file_arg("--color", dest="color", type='tristate')
_parent.add_conf_file_arg("--color-scheme",
dest="color_scheme")
_parent.add_conf_file_arg("--pq-from", dest="pq_from", choices=['DEBIAN', 'TAG'])
_parent.add_conf_file_arg("--upstream-tag", dest="upstream_tag")
_parent.add_arg("--force", dest="force", action="store_true", default=False,
_parent.add_arg("--force", dest="force", action="store_true",
help="in case of import even import if the branch already exists")
_parent.add_conf_file_arg("--time-machine", dest="time_machine", type=int)

Expand Down
3 changes: 1 addition & 2 deletions gbp/scripts/pq_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def build_parser(name):

# Add common arguments
_parent.add_arg("-v", "--verbose", action="store_true", dest="verbose",
default=False, help="Verbose command execution")
help="Verbose command execution")
_parent.add_conf_file_arg("--color", dest="color",
type='tristate')
_parent.add_conf_file_arg("--color-scheme",
Expand Down Expand Up @@ -405,7 +405,6 @@ def build_parser(name):
help="Create a patch queue / devel branch from spec file "
"and patches in current dir.")
_parser.add_arg("--force", dest="force", action="store_true",
default=False,
help="In case of import even import if the branch already exists")
# Rebase
_parser = subparsers.add_parser('rebase', parents=[_parent],
Expand Down
2 changes: 1 addition & 1 deletion gbp/scripts/pristine_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def build_parser(name):
dest="upstream_tag")
parser.add_conf_file_arg("--component", action="append", metavar='COMPONENT',
dest="components")
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False,
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme",
Expand Down
4 changes: 2 additions & 2 deletions gbp/scripts/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def build_parser(name):
gbp.log.err(err)
return None

parser.add_arg("-d", "--dry-run", dest="dryrun", default=False,
parser.add_arg("-d", "--dry-run", dest="dryrun",
action="store_true", help="dry run, don't push.")
parser.add_conf_file_arg("--upstream-branch",
dest="upstream_branch")
Expand All @@ -53,7 +53,7 @@ def build_parser(name):
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")
parser.add_arg("--verbose", action="store_true", dest="verbose",
default=False, help="verbose command execution")
help="verbose command execution")
parser.add_argument("remote", metavar="REMOTE", nargs="?",
help="remote where to push")
return parser
Expand Down
2 changes: 1 addition & 1 deletion gbp/scripts/rpm_ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def build_parser(name):
range_grp.add_arg("-s", "--since", dest="since",
help="commit to start from (e.g. HEAD^^^, release/0.1.2)")
# Formatting group options
format_grp.add_arg("--no-release", action="store_false", default=True,
format_grp.add_arg("--no-release", action="store_false",
dest="release",
help="no release, just update the last changelog section")
format_grp.add_bool_conf_file_arg("--git-author",
Expand Down
4 changes: 2 additions & 2 deletions gbp/scripts/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def build_parser(name):
gbp.log.err(err)
return None

parser.add_arg("--retag", action="store_true", dest="retag", default=False,
parser.add_arg("--retag", action="store_true", dest="retag",
help="don't fail if the tag already exists")
parser.add_conf_file_arg("--debian-branch",
dest="debian_branch")
Expand All @@ -102,7 +102,7 @@ def build_parser(name):
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")
parser.add_arg("--verbose", action="store_true", dest="verbose",
default=False, help="verbose command execution")
help="verbose command execution")
return parser


Expand Down

0 comments on commit 964074e

Please sign in to comment.