Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

python: Elide nargs for argparse flag arguments.

Anders Kaseorg3c5b39da9cc6
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py
index d333201731b..f707cc59db0 100755
--- a/scripts/lib/zulip_tools.py
+++ b/scripts/lib/zulip_tools.py
@@ -63,7 +63,7 @@ def parse_cache_script_args(description: str) -> argparse.Namespace:
parser.add_argument(
"--threshold", dest="threshold_days", type=int, default=14,
- nargs="?", metavar="<days>", help="Any cache which is not in "
+ metavar="<days>", help="Any cache which is not in "
"use by a deployment not older than threshold days(current "
"installation in dev) and older than threshold days will be "
"deleted. (defaults to 14)")
diff --git a/scripts/purge-old-deployments b/scripts/purge-old-deployments
index 674aad82889..c664453feb6 100755
--- a/scripts/purge-old-deployments
+++ b/scripts/purge-old-deployments
@@ -17,7 +17,7 @@ def parse_args() -> argparse.Namespace:
"examined and removed.")
parser.add_argument(
"--threshold", dest="threshold_days", type=int, default=14,
- nargs="?", metavar="<days>", help="Deployments older than "
+ metavar="<days>", help="Deployments older than "
"threshold days will be deleted. (defaults to 14)")
parser.add_argument(
"--dry-run", action="store_true",
diff --git a/zerver/management/commands/backup.py b/zerver/management/commands/backup.py
index d9272e3a850..9a76c7935e5 100644
--- a/zerver/management/commands/backup.py
+++ b/zerver/management/commands/backup.py
@@ -22,9 +22,7 @@ class Command(ZulipBaseCommand):
return parser
def add_arguments(self, parser: ArgumentParser) -> None:
- parser.add_argument(
- "--output", default=None, nargs="?", help="Filename of output tarball",
- )
+ parser.add_argument("--output", default=None, help="Filename of output tarball")
parser.add_argument("--skip-db", action='store_true', help="Skip database backup")
parser.add_argument("--skip-uploads", action='store_true', help="Skip uploads backup")
diff --git a/zerver/management/commands/process_queue.py b/zerver/management/commands/process_queue.py
index c2656084231..c6a77d63395 100644
--- a/zerver/management/commands/process_queue.py
+++ b/zerver/management/commands/process_queue.py
@@ -17,7 +17,7 @@ class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--queue_name', metavar='<queue name>', type=str,
help="queue to process")
- parser.add_argument('--worker_num', metavar='<worker number>', type=int, nargs='?', default=0,
+ parser.add_argument('--worker_num', metavar='<worker number>', type=int, default=0,
help="worker label")
parser.add_argument('--all', action="store_true",
help="run all queues")