python: Elide default=None for argparse arguments.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-09-02 12:02:34 -07:00
committed by Alex Vandiver
parent 3c5b39da9c
commit 1f2ac1962f
13 changed files with 9 additions and 16 deletions

View File

@@ -45,7 +45,7 @@ parser.add_argument('--insecure',
parser.add_argument('--munin', parser.add_argument('--munin',
action='store_true') action='store_true')
parser.add_argument('config', nargs='?', default=None) parser.add_argument('config', nargs='?')
options = parser.parse_args() options = parser.parse_args()

View File

@@ -18,7 +18,7 @@ from zerver.worker.queue_processors import get_active_worker_queues
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--queue-type', action='store', default=None, parser.add_argument('--queue-type', action='store',
help="Specify which types of queues to list") help="Specify which types of queues to list")
args = parser.parse_args() args = parser.parse_args()

View File

@@ -49,7 +49,7 @@ parser.add_argument('--minify',
help='Minifies assets for testing in dev') help='Minifies assets for testing in dev')
parser.add_argument('--interface', parser.add_argument('--interface',
action='store', action='store',
default=None, help='Set the IP or hostname for the proxy to listen on') help='Set the IP or hostname for the proxy to listen on')
parser.add_argument('--no-clear-memcached', parser.add_argument('--no-clear-memcached',
action='store_false', dest='clear_memcached', action='store_false', dest='clear_memcached',
help='Do not clear memcached') help='Do not clear memcached')

View File

@@ -22,7 +22,7 @@ class Command(ZulipBaseCommand):
return parser return parser
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument("--output", default=None, help="Filename of output tarball") parser.add_argument("--output", help="Filename of output tarball")
parser.add_argument("--skip-db", action='store_true', help="Skip database backup") parser.add_argument("--skip-db", action='store_true', help="Skip database backup")
parser.add_argument("--skip-uploads", action='store_true', help="Skip uploads backup") parser.add_argument("--skip-uploads", action='store_true', help="Skip uploads backup")

View File

@@ -18,7 +18,7 @@ class Command(BaseCommand):
help="Gitter data in json format") help="Gitter data in json format")
parser.add_argument('--output', dest='output_dir', parser.add_argument('--output', dest='output_dir',
action="store", default=None, action="store",
help='Directory to write exported data to.') help='Directory to write exported data to.')
parser.add_argument('--threads', parser.add_argument('--threads',

View File

@@ -21,7 +21,7 @@ class Command(BaseCommand):
type=str, help='Slack legacy token of the organsation') type=str, help='Slack legacy token of the organsation')
parser.add_argument('--output', dest='output_dir', parser.add_argument('--output', dest='output_dir',
action="store", default=None, action="store",
help='Directory to write exported data to.') help='Directory to write exported data to.')
parser.add_argument('--threads', parser.add_argument('--threads',

View File

@@ -80,7 +80,6 @@ class Command(ZulipBaseCommand):
parser.add_argument('--output', parser.add_argument('--output',
dest='output_dir', dest='output_dir',
action="store", action="store",
default=None,
help='Directory to write exported data to.') help='Directory to write exported data to.')
parser.add_argument('--threads', parser.add_argument('--threads',
action="store", action="store",
@@ -94,7 +93,6 @@ class Command(ZulipBaseCommand):
help='Deactivate the realm immediately before exporting') help='Deactivate the realm immediately before exporting')
parser.add_argument('--consent-message-id', parser.add_argument('--consent-message-id',
action="store", action="store",
default=None,
type=int, type=int,
help='ID of the message advertising users to react with thumbs up') help='ID of the message advertising users to react with thumbs up')
parser.add_argument('--upload', parser.add_argument('--upload',

View File

@@ -24,7 +24,6 @@ class Command(ZulipBaseCommand):
parser.add_argument('--output', parser.add_argument('--output',
dest='output_dir', dest='output_dir',
action="store", action="store",
default=None,
help='Directory to write exported data to.') help='Directory to write exported data to.')
self.add_realm_args(parser) self.add_realm_args(parser)

View File

@@ -16,15 +16,12 @@ class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--path', parser.add_argument('--path',
action="store", action="store",
default=None,
help='Path to find messages.json archives') help='Path to find messages.json archives')
parser.add_argument('--thread', parser.add_argument('--thread',
action="store", action="store",
default=None,
help='Thread ID') help='Thread ID')
parser.add_argument('--consent-message-id', parser.add_argument('--consent-message-id',
action="store", action="store",
default=None,
type=int, type=int,
help='ID of the message advertising users to react with thumbs up') help='ID of the message advertising users to react with thumbs up')

View File

@@ -8,7 +8,7 @@ from zerver.lib.cache_helpers import cache_fillers, fill_remote_cache
class Command(BaseCommand): class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--cache', default=None, parser.add_argument('--cache',
help="Populate the memcached cache of messages.") help="Populate the memcached cache of messages.")
def handle(self, *args: Any, **options: Optional[str]) -> None: def handle(self, *args: Any, **options: Optional[str]) -> None:

View File

@@ -11,7 +11,7 @@ from zerver.worker.queue_processors import get_active_worker_queues
class Command(BaseCommand): class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument(dest="queue_name", type=str, nargs='?', parser.add_argument(dest="queue_name", type=str, nargs='?',
help="queue to purge", default=None) help="queue to purge")
parser.add_argument('--all', action="store_true", parser.add_argument('--all', action="store_true",
help="purge all queues") help="purge all queues")

View File

@@ -27,7 +27,7 @@ Example: ./manage.py realm_filters --realm=zulip --op=show
type=str, type=str,
default="show", default="show",
help='What operation to do (add, show, remove).') help='What operation to do (add, show, remove).')
parser.add_argument('pattern', metavar='<pattern>', type=str, nargs='?', default=None, parser.add_argument('pattern', metavar='<pattern>', type=str, nargs='?',
help="regular expression to match") help="regular expression to match")
parser.add_argument('url_format_string', metavar='<url pattern>', type=str, nargs='?', parser.add_argument('url_format_string', metavar='<url pattern>', type=str, nargs='?',
help="format string to substitute") help="format string to substitute")

View File

@@ -186,7 +186,6 @@ class Command(BaseCommand):
parser.add_argument('--max-topics', parser.add_argument('--max-topics',
type=int, type=int,
default=None,
help='The number of maximum topics to create') help='The number of maximum topics to create')
parser.add_argument('--huddles', parser.add_argument('--huddles',