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 action="store" for argparse arguments.

Anders Kaseorgfbfd4b399dd7
diff --git a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time
index 6cdb6a4455a..10037f95c71 100755
--- a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time
+++ b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time
@@ -33,8 +33,7 @@ usage = """Usage: send-receive.py [options] [config]
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('--site',
- default="https://api.zulip.com",
- action='store')
+ default="https://api.zulip.com")
parser.add_argument('--nagios',
action='store_true')
diff --git a/scripts/lib/queue_workers.py b/scripts/lib/queue_workers.py
index fe90f2f7cd4..71391d7ce65 100755
--- a/scripts/lib/queue_workers.py
+++ b/scripts/lib/queue_workers.py
@@ -18,7 +18,7 @@ from zerver.worker.queue_processors import get_active_worker_queues
if __name__ == "__main__":
parser = argparse.ArgumentParser()
- parser.add_argument('--queue-type', action='store',
+ parser.add_argument('--queue-type',
help="Specify which types of queues to list")
args = parser.parse_args()
diff --git a/scripts/nagios/check-rabbitmq-consumers b/scripts/nagios/check-rabbitmq-consumers
index 8cf11a9f2f1..e8f1ca64319 100755
--- a/scripts/nagios/check-rabbitmq-consumers
+++ b/scripts/nagios/check-rabbitmq-consumers
@@ -29,8 +29,7 @@ parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('--min-threshold',
dest='min_count',
type=int,
- default=1,
- action='store')
+ default=1)
options = parser.parse_args()
diff --git a/scripts/zulip-puppet-apply b/scripts/zulip-puppet-apply
index 289feaf5eee..d5cf797ecd2 100755
--- a/scripts/zulip-puppet-apply
+++ b/scripts/zulip-puppet-apply
@@ -16,7 +16,7 @@ parser.add_argument('--force', '-f', action="store_true",
help="Do not prompt with proposed changes")
parser.add_argument('--noop', action="store_true",
help="Do not apply the changes")
-parser.add_argument('--config', action="store",
+parser.add_argument('--config',
default="/etc/zulip/zulip.conf",
help="Alternate zulip.conf path")
args, extra_args = parser.parse_known_args()
diff --git a/tools/run-dev.py b/tools/run-dev.py
index 8c4101bb0d7..6a7007f865a 100755
--- a/tools/run-dev.py
+++ b/tools/run-dev.py
@@ -48,7 +48,6 @@ parser.add_argument('--minify',
action='store_true',
help='Minifies assets for testing in dev')
parser.add_argument('--interface',
- action='store',
help='Set the IP or hostname for the proxy to listen on')
parser.add_argument('--no-clear-memcached',
action='store_false', dest='clear_memcached',
diff --git a/tools/test-backend b/tools/test-backend
index 3c3b294ae99..50f414ab802 100755
--- a/tools/test-backend
+++ b/tools/test-backend
@@ -223,7 +223,6 @@ def main() -> None:
parser.add_argument('--parallel', dest='processes',
type=int,
- action='store',
default=default_parallel,
help='Specify the number of processes to run the '
'tests in. Default is the number of logical CPUs')
diff --git a/tools/webpack b/tools/webpack
index 4d743f24fb1..26d21c19de9 100755
--- a/tools/webpack
+++ b/tools/webpack
@@ -121,10 +121,8 @@ parser.add_argument('--watch',
action='store_true',
help='watch for changes to source files (for development)')
parser.add_argument('--host',
- action='store',
default='127.0.0.1', help='set the host for the webpack server to run on')
parser.add_argument('--port',
- action='store',
default='9994', help='set the port for the webpack server to run on')
parser.add_argument('--minify',
action='store_true',
diff --git a/tools/zulip-export/zulip-export b/tools/zulip-export/zulip-export
index b07c47fadf0..f6230144ac7 100755
--- a/tools/zulip-export/zulip-export
+++ b/tools/zulip-export/zulip-export
@@ -38,7 +38,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '../../api'))
import zulip
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
-parser.add_argument('--stream', default='', action="store")
+parser.add_argument('--stream', default='')
options = parser.parse_args()
client = zulip.init_from_options(options)
diff --git a/zerver/management/commands/convert_gitter_data.py b/zerver/management/commands/convert_gitter_data.py
index 16239b716bf..cc5da9fc409 100644
--- a/zerver/management/commands/convert_gitter_data.py
+++ b/zerver/management/commands/convert_gitter_data.py
@@ -18,11 +18,9 @@ class Command(BaseCommand):
help="Gitter data in json format")
parser.add_argument('--output', dest='output_dir',
- action="store",
help='Directory to write exported data to.')
parser.add_argument('--threads',
- action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Threads to download avatars and attachments faster')
diff --git a/zerver/management/commands/convert_hipchat_data.py b/zerver/management/commands/convert_hipchat_data.py
index 8b72314cc9a..615f1f66266 100644
--- a/zerver/management/commands/convert_hipchat_data.py
+++ b/zerver/management/commands/convert_hipchat_data.py
@@ -35,7 +35,6 @@ class Command(BaseCommand):
help="tar of Hipchat data")
parser.add_argument('--output', dest='output_dir',
- action="store",
help='Directory to write exported data to.')
parser.add_argument('--mask', dest='masking_content',
@@ -48,7 +47,6 @@ class Command(BaseCommand):
" See import docs for details.")
parser.add_argument('--token', dest='api_token',
- action="store",
help='API token for the HipChat API for fetching subscribers.')
parser.formatter_class = argparse.RawTextHelpFormatter
diff --git a/zerver/management/commands/convert_mattermost_data.py b/zerver/management/commands/convert_mattermost_data.py
index 292a8b9c3d0..887c3bef023 100644
--- a/zerver/management/commands/convert_mattermost_data.py
+++ b/zerver/management/commands/convert_mattermost_data.py
@@ -29,7 +29,6 @@ class Command(BaseCommand):
help=dir_help)
parser.add_argument('--output', dest='output_dir',
- action="store",
help='Directory to write converted data to.')
parser.add_argument('--mask', dest='masking_content',
diff --git a/zerver/management/commands/convert_slack_data.py b/zerver/management/commands/convert_slack_data.py
index 79b4f016338..443b6b18a3f 100644
--- a/zerver/management/commands/convert_slack_data.py
+++ b/zerver/management/commands/convert_slack_data.py
@@ -21,11 +21,9 @@ class Command(BaseCommand):
type=str, help='Slack legacy token of the organsation')
parser.add_argument('--output', dest='output_dir',
- action="store",
help='Directory to write exported data to.')
parser.add_argument('--threads',
- action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Threads to use in exporting UserMessage objects in parallel')
diff --git a/zerver/management/commands/export.py b/zerver/management/commands/export.py
index 15231d1457a..43bfb94c77c 100644
--- a/zerver/management/commands/export.py
+++ b/zerver/management/commands/export.py
@@ -79,10 +79,8 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--output',
dest='output_dir',
- action="store",
help='Directory to write exported data to.')
parser.add_argument('--threads',
- action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Threads to use in exporting UserMessage objects in parallel')
parser.add_argument('--public-only',
@@ -92,7 +90,6 @@ class Command(ZulipBaseCommand):
action="store_true",
help='Deactivate the realm immediately before exporting')
parser.add_argument('--consent-message-id',
- action="store",
type=int,
help='ID of the message advertising users to react with thumbs up')
parser.add_argument('--upload',
diff --git a/zerver/management/commands/export_single_user.py b/zerver/management/commands/export_single_user.py
index f786db52ae3..97770730f1a 100644
--- a/zerver/management/commands/export_single_user.py
+++ b/zerver/management/commands/export_single_user.py
@@ -23,7 +23,6 @@ class Command(ZulipBaseCommand):
help="email of user to export")
parser.add_argument('--output',
dest='output_dir',
- action="store",
help='Directory to write exported data to.')
self.add_realm_args(parser)
diff --git a/zerver/management/commands/export_usermessage_batch.py b/zerver/management/commands/export_usermessage_batch.py
index 900897c4363..9a9683e82bf 100644
--- a/zerver/management/commands/export_usermessage_batch.py
+++ b/zerver/management/commands/export_usermessage_batch.py
@@ -15,13 +15,10 @@ class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--path',
- action="store",
help='Path to find messages.json archives')
parser.add_argument('--thread',
- action="store",
help='Thread ID')
parser.add_argument('--consent-message-id',
- action="store",
type=int,
help='ID of the message advertising users to react with thumbs up')
diff --git a/zerver/management/commands/get_migration_status.py b/zerver/management/commands/get_migration_status.py
index d47a2f6601f..b92c90f9dc5 100644
--- a/zerver/management/commands/get_migration_status.py
+++ b/zerver/management/commands/get_migration_status.py
@@ -16,11 +16,11 @@ class Command(BaseCommand):
parser.add_argument('app_label', nargs='?',
help='App label of an application to synchronize the state.')
- parser.add_argument('--database', action='store',
+ parser.add_argument('--database',
default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
'Defaults to the "default" database.')
- parser.add_argument('--output', action='store',
+ parser.add_argument('--output',
help='Path to store the status to (default to stdout).')
def handle(self, *args: Any, **options: Any) -> None:
diff --git a/zerver/management/commands/import.py b/zerver/management/commands/import.py
index 1ede79de29e..94e8c03f102 100644
--- a/zerver/management/commands/import.py
+++ b/zerver/management/commands/import.py
@@ -33,7 +33,6 @@ import a database dump from one or more JSON files."""
metavar='<export path>',
help="list of export directories to import")
parser.add_argument('--processes',
- action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Number of processes to use for uploading Avatars to S3 in parallel')
parser.formatter_class = argparse.RawTextHelpFormatter
diff --git a/zerver/management/commands/knight.py b/zerver/management/commands/knight.py
index 3dac43e0ac2..b162601f12b 100644
--- a/zerver/management/commands/knight.py
+++ b/zerver/management/commands/knight.py
@@ -24,7 +24,6 @@ ONLY perform this on customer request from an authorized person.
action="store_false",
help='Remove an administrator\'s rights.')
parser.add_argument('--permission',
- action="store",
default='administer',
choices=['administer', 'api_super_user'],
help='Permission to grant/remove.')
diff --git a/zerver/management/commands/transfer_uploads_to_s3.py b/zerver/management/commands/transfer_uploads_to_s3.py
index f37836538fe..a1f4b650c5b 100644
--- a/zerver/management/commands/transfer_uploads_to_s3.py
+++ b/zerver/management/commands/transfer_uploads_to_s3.py
@@ -11,7 +11,6 @@ class Command(BaseCommand):
def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('--processes',
- action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Processes to use for exporting uploads in parallel')