Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
python: Remove redundant dest for argparse arguments.
Anders Kaseorga5dbab8fb08e
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_timeindex bce83254eac..197051f8ec2 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,20 +33,16 @@ usage = """Usage: send-receive.py [options] [config]parser = argparse.ArgumentParser(usage=usage)parser.add_argument('--site',- dest='site',default="https://api.zulip.com",action='store')parser.add_argument('--nagios',- dest='nagios',action='store_true')parser.add_argument('--insecure',- dest='insecure',action='store_true')parser.add_argument('--munin',- dest='munin',action='store_true')parser.add_argument('config', nargs='?', default=None)diff --git a/scripts/lib/email-mirror-postfix b/scripts/lib/email-mirror-postfixindex 3f22cef3841..3b04f9dc916 100755--- a/scripts/lib/email-mirror-postfix+++ b/scripts/lib/email-mirror-postfix@@ -54,10 +54,10 @@ from urllib.request import Request, urlopenparser = argparse.ArgumentParser()-parser.add_argument('-r', '--recipient', dest="recipient", type=str, default='',+parser.add_argument('-r', '--recipient', type=str, default='',help="Original recipient.")-parser.add_argument('-s', '--shared-secret', dest="shared_secret", type=str, default='',+parser.add_argument('-s', '--shared-secret', type=str, default='',help="Secret access key.")parser.add_argument('-d', '--dst-host', dest="host", type=str, default='https://127.0.0.1',@@ -70,7 +70,7 @@ parser.add_argument('-u', '--dst-url', dest="url", type=str, default='/email_mirparser.add_argument('-n', '--not-verify-ssl', dest="verify_ssl", action='store_false', default=True,help="Disable ssl certificate verifying for self-signed certificates")-parser.add_argument('-t', '--test', dest="test", action='store_true', default=False,+parser.add_argument('-t', '--test', action='store_true', default=False,help="Test mode.")options = parser.parse_args()diff --git a/scripts/lib/queue_workers.py b/scripts/lib/queue_workers.pyindex 68b337c38a1..0f57253ec8c 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_queuesif __name__ == "__main__":parser = argparse.ArgumentParser()- parser.add_argument('--queue-type', action='store', dest='queue_type', default=None,+ parser.add_argument('--queue-type', action='store', default=None,help="Specify which types of queues to list")args = parser.parse_args()diff --git a/scripts/lib/upgrade-zulip-from-git b/scripts/lib/upgrade-zulip-from-gitindex 2359bf9f2c5..a91ebb8db2b 100755--- a/scripts/lib/upgrade-zulip-from-git+++ b/scripts/lib/upgrade-zulip-from-git@@ -38,7 +38,7 @@ logging.basicConfig(format="%(asctime)s upgrade-zulip-from-git: %(message)s",parser = argparse.ArgumentParser()parser.add_argument("refname", help="Git reference, e.g. a branch, tag, or commit ID.")-parser.add_argument("--remote-url", dest="remote_url",+parser.add_argument("--remote-url",help="Override the Git remote URL configured in /etc/zulip/zulip.conf.")args = parser.parse_args()diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2index 0475a180730..746e2c6c98a 100755--- a/scripts/lib/upgrade-zulip-stage-2+++ b/scripts/lib/upgrade-zulip-stage-2@@ -71,17 +71,17 @@ os.umask(0o22)parser = argparse.ArgumentParser()parser.add_argument("deploy_path", metavar="deploy_path",help="Path to deployment directory")-parser.add_argument("--skip-puppet", dest="skip_puppet", action='store_true',+parser.add_argument("--skip-puppet", action='store_true',help="Skip doing puppet/apt upgrades.")-parser.add_argument("--skip-migrations", dest="skip_migrations", action='store_true',+parser.add_argument("--skip-migrations", action='store_true',help="Skip doing migrations.")-parser.add_argument("--from-git", dest="from_git", action='store_true',+parser.add_argument("--from-git", action='store_true',help="Upgrading from git, so run update-prod-static.")-parser.add_argument("--ignore-static-assets", dest="ignore_static_assets", action='store_true',+parser.add_argument("--ignore-static-assets", action='store_true',help="Do not attempt to copy/manage static assets.")-parser.add_argument("--skip-purge-old-deployments", dest="skip_purge_old_deployments",+parser.add_argument("--skip-purge-old-deployments",action="store_true", help="Skip purging old deployments.")-parser.add_argument("--audit-fts-indexes", dest="audit_fts_indexes",+parser.add_argument("--audit-fts-indexes",action="store_true", help="Audit and fix full text search indexes.")args = parser.parse_args()diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.pyindex e0d4fc389ec..05a2dc2473c 100755--- a/scripts/lib/zulip_tools.py+++ b/scripts/lib/zulip_tools.py@@ -68,11 +68,11 @@ def parse_cache_script_args(description: str) -> argparse.Namespace:"installation in dev) and older than threshold days will be ""deleted. (defaults to 14)")parser.add_argument(- "--dry-run", dest="dry_run", action="store_true",+ "--dry-run", action="store_true",help="If specified then script will only print the caches ""that it will delete/keep back. It will not delete any cache.")parser.add_argument(- "--verbose", dest="verbose", action="store_true",+ "--verbose", action="store_true",help="If specified then script will print a detailed report ""of what is being will deleted/kept back.")parser.add_argument(diff --git a/scripts/purge-old-deployments b/scripts/purge-old-deploymentsindex a1fcc56df76..36ab43efc97 100755--- a/scripts/purge-old-deployments+++ b/scripts/purge-old-deployments@@ -20,11 +20,11 @@ def parse_args() -> argparse.Namespace:nargs="?", metavar="<days>", help="Deployments older than ""threshold days will be deleted. (defaults to 14)")parser.add_argument(- "--dry-run", dest="dry_run", action="store_true",+ "--dry-run", action="store_true",help="If specified then script will only print the deployments and ""caches that it will delete/keep back. It will not delete anything.")parser.add_argument(- "--verbose", dest="verbose", action="store_true",+ "--verbose", action="store_true",help="If specified then script will print a detailed report ""of what is going on.")diff --git a/scripts/restart-server b/scripts/restart-serverindex c4849110ae3..8553b4fc601 100755--- a/scripts/restart-server+++ b/scripts/restart-server@@ -17,7 +17,7 @@ logging.basicConfig(format="%(asctime)s restart-server: %(message)s",level=logging.INFO)parser = argparse.ArgumentParser()-parser.add_argument('--fill-cache', action='store_true', dest='fill_cache', default=False,+parser.add_argument('--fill-cache', action='store_true', default=False,help='Fill the memcached caches')args = parser.parse_args()diff --git a/scripts/setup/generate_secrets.py b/scripts/setup/generate_secrets.pyindex c63b8e34e5e..e9e7204f8fd 100755--- a/scripts/setup/generate_secrets.py+++ b/scripts/setup/generate_secrets.py@@ -183,7 +183,7 @@ if __name__ == '__main__':parser = argparse.ArgumentParser()group = parser.add_mutually_exclusive_group(required=True)- group.add_argument('--development', action='store_true', dest='development',+ group.add_argument('--development', action='store_true',help='For setting up the developer env for zulip')group.add_argument('--production', action='store_false', dest='development',help='For setting up the production env for zulip')diff --git a/tools/check-capitalization b/tools/check-capitalizationindex 1645ed98161..90bd806aa00 100755--- a/tools/check-capitalization+++ b/tools/check-capitalization@@ -21,11 +21,11 @@ DJANGO_PO_REGEX = re.compile('msgid "(.*?)"')if __name__ == '__main__':parser = argparse.ArgumentParser()parser.add_argument('--show-ignored',- action='store_true', dest='show_ignored', default=False,+ action='store_true', default=False,help='Show strings that passed the check because they ''contained ignored phrases.')parser.add_argument('--no-generate',- action='store_true', dest='no_generate', default=False,+ action='store_true', default=False,help="Don't run makemessages command.")args = parser.parse_args()diff --git a/tools/check-frontend-i18n b/tools/check-frontend-i18nindex 6c119cd201a..b1890d15d77 100755--- a/tools/check-frontend-i18n+++ b/tools/check-frontend-i18n@@ -26,7 +26,7 @@ def find_handlebars(translatable_strings: List[str]) -> List[str]:if __name__ == '__main__':parser = argparse.ArgumentParser()parser.add_argument('--no-generate',- action='store_true', dest='no_generate', default=False,+ action='store_true', default=False,help="Don't run makemessages command.")args = parser.parse_args()diff --git a/tools/check-issue-labels b/tools/check-issue-labelsindex 8ff7e785cf3..43b4a97a499 100755--- a/tools/check-issue-labels+++ b/tools/check-issue-labels@@ -44,7 +44,7 @@ def get_next_page_url(link_header: str) -> Optional[str]:def check_issue_labels() -> None:parser = argparse.ArgumentParser()- parser.add_argument('--force', action="store_true", dest="force", default=False)+ parser.add_argument('--force', action="store_true", default=False)args = parser.parse_args()if not args.force:diff --git a/tools/droplets/create.py b/tools/droplets/create.pyindex 6df020f47f8..f62dee8c82a 100644--- a/tools/droplets/create.py+++ b/tools/droplets/create.py@@ -30,7 +30,7 @@ import digitaloceanparser = argparse.ArgumentParser(description='Create a Zulip devopment VM DigitalOcean droplet.')parser.add_argument("username", help="Github username for whom you want to create a Zulip dev droplet")parser.add_argument('--tags', nargs='+', default=[])-parser.add_argument('-f', '--recreate', dest='recreate', action="store_true", default=False)+parser.add_argument('-f', '--recreate', action="store_true", default=False)def get_config() -> configparser.ConfigParser:config = configparser.ConfigParser()diff --git a/tools/lib/provision.py b/tools/lib/provision.pyindex 721e31a0553..e9fec428bd4 100755--- a/tools/lib/provision.py+++ b/tools/lib/provision.py@@ -434,7 +434,6 @@ if __name__ == "__main__":help="Provision needed to build release tarball.")parser.add_argument('--skip-dev-db-build', action='store_true',- dest='skip_dev_db_build',default=False,help="Don't run migrations on dev database.")diff --git a/tools/lib/provision_inner.py b/tools/lib/provision_inner.pyindex 94f5c16d12a..34eaa6f82ae 100755--- a/tools/lib/provision_inner.py+++ b/tools/lib/provision_inner.py@@ -337,7 +337,6 @@ if __name__ == "__main__":help="Provision for test suite with production settings.")parser.add_argument('--skip-dev-db-build', action='store_true',- dest='skip_dev_db_build',default=False,help="Don't run migrations on dev database.")diff --git a/tools/test-api b/tools/test-apiindex 9b4b2192ab2..bc619795bce 100755--- a/tools/test-api+++ b/tools/test-api@@ -21,7 +21,7 @@ from tools.lib.test_server import test_server_runningusage = """test-api [options]"""parser = argparse.ArgumentParser(usage)-parser.add_argument('--force', dest='force',+parser.add_argument('--force',action="store_true",default=False, help='Run tests despite possible provisioning problems.')options = parser.parse_args()diff --git a/tools/test-backend b/tools/test-backendindex 794a306aee2..15d624f2b4a 100755--- a/tools/test-backend+++ b/tools/test-backend@@ -211,14 +211,14 @@ def main() -> None:parser.add_argument('--nonfatal-errors', action="store_false", default=True,dest="fatal_errors", help="Continue past test failures to run all tests")- parser.add_argument('--coverage', dest='coverage',+ parser.add_argument('--coverage',action="store_true",default=False,help='Compute test coverage.')- parser.add_argument('--verbose-coverage', dest='verbose_coverage',+ parser.add_argument('--verbose-coverage',action="store_true",default=False, help='Enable verbose print of coverage report.')- parser.add_argument('--no-cov-cleanup', dest='no_cov_cleanup',+ parser.add_argument('--no-cov-cleanup',action='store_true',default=False,help="Do not clean generated coverage files.")@@ -229,39 +229,39 @@ def main() -> None:default=default_parallel,help='Specify the number of processes to run the ''tests in. Default is the number of logical CPUs')- parser.add_argument('--profile', dest='profile',+ parser.add_argument('--profile',action="store_true",default=False, help='Profile test runtime.')- parser.add_argument('--force', dest='force',+ parser.add_argument('--force',action="store_true",default=False, help='Run tests despite possible problems.')- parser.add_argument('--no-shallow', dest='no_shallow',+ parser.add_argument('--no-shallow',action="store_true",default=False,help="Don't allow shallow testing of templates (deprecated)")- parser.add_argument('--verbose', dest='verbose',+ parser.add_argument('--verbose',action="store_true",default=False,help="Show detailed output")- parser.add_argument('--reverse', dest='reverse',+ parser.add_argument('--reverse',action="store_true",default=False,help="Run tests in reverse order.")- parser.add_argument('--rerun', dest="rerun",+ parser.add_argument('--rerun',action="store_true",default=False,help=("Run the tests which failed the last time ""test-backend was run. Implies --nonfatal-errors."))- parser.add_argument('--include-webhooks', dest="include_webhooks",+ parser.add_argument('--include-webhooks',action="store_true",default=False,help=("Include webhook tests. By default, they are skipped for performance."))- parser.add_argument('--generate-stripe-fixtures', dest="generate_stripe_fixtures",+ parser.add_argument('--generate-stripe-fixtures',action="store_true",default=False,help=("Generate Stripe test fixtures by making requests to Stripe test network"))parser.add_argument('args', nargs='*')- parser.add_argument('--ban-console-output', dest='ban_console_output',+ parser.add_argument('--ban-console-output',action="store_true",default=False, help='Require stdout and stderr to be clean of unexpected output.')diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex 02bf2221e19..e90d7459871 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -164,10 +164,10 @@ EXEMPT_FILES = {}parser = argparse.ArgumentParser(USAGE)-parser.add_argument('--coverage', dest='coverage',+parser.add_argument('--coverage',action="store_true",default=False, help='Get coverage report')-parser.add_argument('--force', dest='force',+parser.add_argument('--force',action="store_true",default=False, help='Run tests despite possible problems.')parser.add_argument('args', nargs=argparse.REMAINDER)diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteerindex 67bb4c7296f..bd2904bc61c 100755--- a/tools/test-js-with-puppeteer+++ b/tools/test-js-with-puppeteer@@ -27,10 +27,10 @@ usage = """test-js-with-puppeteer [options]test-js-with-puppeteer 01 03 # Run a few test files, 01-login.js and 03-narrow.js here"""parser = argparse.ArgumentParser(usage)-parser.add_argument('--interactive', dest='interactive',+parser.add_argument('--interactive',action="store_true",default=False, help='Run tests interactively')-parser.add_argument('--force', dest='force',+parser.add_argument('--force',action="store_true",default=False, help='Run tests despite possible problems.')parser.add_argument('tests', nargs=argparse.REMAINDER,diff --git a/tools/test-tools b/tools/test-toolsindex 326f726ecff..2e6476c0a48 100755--- a/tools/test-tools+++ b/tools/test-tools@@ -11,7 +11,7 @@ sanity_check.check_venv(__file__)if __name__ == '__main__':parser = argparse.ArgumentParser()- parser.add_argument('--coverage', dest='coverage',+ parser.add_argument('--coverage',action="store_true",default=False, help='compute test coverage')args = parser.parse_args()diff --git a/tools/webpack b/tools/webpackindex 1b764c7a130..3735212c65e 100755--- a/tools/webpack+++ b/tools/webpack@@ -112,25 +112,25 @@ def build_for_most_tests() -> None:parser = argparse.ArgumentParser()parser.add_argument('--test',- action='store_true', dest='test', default=False,+ action='store_true', default=False,help='generate a stub webpack-stats.json file (for backend testing)')parser.add_argument('--quiet',- action='store_true', dest='quiet', default=False,+ action='store_true', default=False,help='Minimizes webpack output while running')parser.add_argument('--watch',- action='store_true', dest='watch', default=False,+ action='store_true', default=False,help='watch for changes to source files (for development)')parser.add_argument('--host',- action='store', dest='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', dest='port',+ action='store',default='9994', help='set the port for the webpack server to run on')parser.add_argument('--minify',- action='store_true', dest='minify', default=False,+ action='store_true', default=False,help='Minify and optimize the assets (for development)')parser.add_argument('--disable-host-check',- action='store_true', dest='disable_host_check', default=None,+ action='store_true', default=None,help='Disable host check for webpack-dev-server')args = parser.parse_args()diff --git a/zerver/lib/management.py b/zerver/lib/management.pyindex 0f157c45aa9..45ff73bc731 100644--- a/zerver/lib/management.py+++ b/zerver/lib/management.py@@ -59,13 +59,11 @@ You can use the command list_realms to find ID of the realms in this server."""all_users_help: str="All users in realm.") -> None:parser.add_argument('-u', '--users',- dest='users',type=str,help=help)parser.add_argument('-a', '--all-users',- dest='all_users',action="store_true",default=False,help=all_users_help)diff --git a/zerver/management/commands/add_users_to_mailing_list.py b/zerver/management/commands/add_users_to_mailing_list.pyindex a0ee04d53da..7561e00ede1 100644--- a/zerver/management/commands/add_users_to_mailing_list.py+++ b/zerver/management/commands/add_users_to_mailing_list.py@@ -16,15 +16,12 @@ class Command(BaseCommand):def add_arguments(self, parser: argparse.ArgumentParser) -> None:parser.add_argument('--api-key',- dest='api_key',type=str,help='MailChimp API key.')parser.add_argument('--list-id',- dest='list_id',type=str,help='List ID of the MailChimp mailing list.')parser.add_argument('--optin-time',- dest='optin_time',type=str,default=datetime.isoformat(timezone_now().replace(microsecond=0)),help='Opt-in time of the users.')diff --git a/zerver/management/commands/add_users_to_streams.py b/zerver/management/commands/add_users_to_streams.pyindex 2ab536a3c02..29a1f31b1ac 100644--- a/zerver/management/commands/add_users_to_streams.py+++ b/zerver/management/commands/add_users_to_streams.py@@ -15,7 +15,6 @@ class Command(ZulipBaseCommand):parser.add_argument('-s', '--streams',- dest='streams',type=str,required=True,help='A comma-separated list of stream names.')diff --git a/zerver/management/commands/check_redis.py b/zerver/management/commands/check_redis.pyindex bc4cd91d1a8..9de6cbb23ef 100644--- a/zerver/management/commands/check_redis.py+++ b/zerver/management/commands/check_redis.py@@ -17,7 +17,6 @@ class Command(BaseCommand):def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-t', '--trim',- dest='trim',default=False,action='store_true',help="Actually trim excess")diff --git a/zerver/management/commands/convert_gitter_data.py b/zerver/management/commands/convert_gitter_data.pyindex c6c8d7406be..f2384adbef9 100644--- a/zerver/management/commands/convert_gitter_data.py+++ b/zerver/management/commands/convert_gitter_data.py@@ -22,7 +22,6 @@ class Command(BaseCommand):help='Directory to write exported data to.')parser.add_argument('--threads',- dest='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.pyindex e3f4e77cfe0..8b72314cc9a 100644--- a/zerver/management/commands/convert_hipchat_data.py+++ b/zerver/management/commands/convert_hipchat_data.py@@ -42,7 +42,7 @@ class Command(BaseCommand):action="store_true",help='Mask the content for privacy during QA.')- parser.add_argument('--slim-mode', dest='slim_mode',+ parser.add_argument('--slim-mode',action="store_true",help="Default to no public stream subscriptions if no token is available." +" See import docs for details.")diff --git a/zerver/management/commands/convert_slack_data.py b/zerver/management/commands/convert_slack_data.pyindex dbdb0e0e08a..0bea8e30e40 100644--- a/zerver/management/commands/convert_slack_data.py+++ b/zerver/management/commands/convert_slack_data.py@@ -25,7 +25,6 @@ class Command(BaseCommand):help='Directory to write exported data to.')parser.add_argument('--threads',- dest='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/create_default_stream_groups.py b/zerver/management/commands/create_default_stream_groups.pyindex 4b622cc7150..d160afad96f 100644--- a/zerver/management/commands/create_default_stream_groups.py+++ b/zerver/management/commands/create_default_stream_groups.py@@ -18,7 +18,6 @@ Create default stream groups which the users can choose during sign up.parser.add_argument('-n', '--name',- dest='name',type=str,required=True,help='Name of the group you want to create.',@@ -26,7 +25,6 @@ Create default stream groups which the users can choose during sign up.parser.add_argument('-d', '--description',- dest='description',type=str,required=True,help='Description of the group.',@@ -34,7 +32,6 @@ Create default stream groups which the users can choose during sign up.parser.add_argument('-s', '--streams',- dest='streams',type=str,required=True,help='A comma-separated list of stream names.')diff --git a/zerver/management/commands/create_user.py b/zerver/management/commands/create_user.pyindex d1f6a129d70..c34794fff86 100644--- a/zerver/management/commands/create_user.py+++ b/zerver/management/commands/create_user.py@@ -27,7 +27,6 @@ Omit both <email> and <full name> for interactive user creation.default=False,help='Acknowledgement that the user has already accepted the ToS.')parser.add_argument('--password',- dest='password',type=str,default='',help='password of new user. For development only.'@@ -36,7 +35,6 @@ Omit both <email> and <full name> for interactive user creation.'on the server via `ps -ef` or by any superuser with''read access to the user\'s bash history.')parser.add_argument('--password-file',- dest='password_file',type=str,default='',help='The file containing the password of the new user.')diff --git a/zerver/management/commands/deactivate_user.py b/zerver/management/commands/deactivate_user.pyindex 061bdf79078..6ae6643d8aa 100644--- a/zerver/management/commands/deactivate_user.py+++ b/zerver/management/commands/deactivate_user.py@@ -12,7 +12,6 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('-f', '--for-real',- dest='for_real',action='store_true',default=False,help="Actually deactivate the user. Default is a dry run.")diff --git a/zerver/management/commands/delete_old_unclaimed_attachments.py b/zerver/management/commands/delete_old_unclaimed_attachments.pyindex 512f6021149..291ff748578 100644--- a/zerver/management/commands/delete_old_unclaimed_attachments.py+++ b/zerver/management/commands/delete_old_unclaimed_attachments.py@@ -20,7 +20,6 @@ class Command(BaseCommand):help="Limiting value of how old the file can be.")parser.add_argument('-f', '--for-real',- dest='for_real',action='store_true',default=False,help="Actually remove the files from the storage.")diff --git a/zerver/management/commands/dump_messages.py b/zerver/management/commands/dump_messages.pyindex 6a6e2daf3c5..c08fc9e31d2 100644--- a/zerver/management/commands/dump_messages.py+++ b/zerver/management/commands/dump_messages.py@@ -15,7 +15,6 @@ class Command(ZulipBaseCommand):default_cutoff = time.time() - 60 * 60 * 24 * 30 # 30 days.self.add_realm_args(parser, True)parser.add_argument('--since',- dest='since',type=int,default=default_cutoff,help='The time in epoch since from which to start the dump.')diff --git a/zerver/management/commands/export.py b/zerver/management/commands/export.pyindex 8610de8576b..c8cbb2e2ae1 100644--- a/zerver/management/commands/export.py+++ b/zerver/management/commands/export.py@@ -83,7 +83,6 @@ class Command(ZulipBaseCommand):default=None,help='Directory to write exported data to.')parser.add_argument('--threads',- dest='threads',action="store",default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,help='Threads to use in exporting UserMessage objects in parallel')@@ -94,7 +93,6 @@ class Command(ZulipBaseCommand):action="store_true",help='Deactivate the realm immediately before exporting')parser.add_argument('--consent-message-id',- dest="consent_message_id",action="store",default=None,type=int,diff --git a/zerver/management/commands/export_usermessage_batch.py b/zerver/management/commands/export_usermessage_batch.pyindex 4944e594e4c..621d5caeaca 100644--- a/zerver/management/commands/export_usermessage_batch.py+++ b/zerver/management/commands/export_usermessage_batch.py@@ -15,17 +15,14 @@ class Command(BaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('--path',- dest='path',action="store",default=None,help='Path to find messages.json archives')parser.add_argument('--thread',- dest='thread',action="store",default=None,help='Thread ID')parser.add_argument('--consent-message-id',- dest="consent_message_id",action="store",default=None,type=int,diff --git a/zerver/management/commands/fill_memcached_caches.py b/zerver/management/commands/fill_memcached_caches.pyindex 933a17004e0..ad084e95911 100644--- a/zerver/management/commands/fill_memcached_caches.py+++ b/zerver/management/commands/fill_memcached_caches.py@@ -8,7 +8,7 @@ from zerver.lib.cache_helpers import cache_fillers, fill_remote_cacheclass Command(BaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:- parser.add_argument('--cache', dest="cache", default=None,+ parser.add_argument('--cache', default=None,help="Populate the memcached cache of messages.")def handle(self, *args: Any, **options: Optional[str]) -> None:diff --git a/zerver/management/commands/fix_unreads.py b/zerver/management/commands/fix_unreads.pyindex 2ceb610271a..112dd77bf51 100644--- a/zerver/management/commands/fix_unreads.py+++ b/zerver/management/commands/fix_unreads.py@@ -21,7 +21,6 @@ class Command(ZulipBaseCommand):help='email address to spelunk')parser.add_argument('--all',action='store_true',- dest='all',default=False,help='fix all users in specified realm')self.add_realm_args(parser)diff --git a/zerver/management/commands/generate_invite_links.py b/zerver/management/commands/generate_invite_links.pyindex 08f975ba141..1a62ae0e561 100644--- a/zerver/management/commands/generate_invite_links.py+++ b/zerver/management/commands/generate_invite_links.py@@ -14,7 +14,6 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('--force',- dest='force',action="store_true",default=False,help='Override that the domain is restricted to external users.')diff --git a/zerver/management/commands/generate_multiuse_invite_link.py b/zerver/management/commands/generate_multiuse_invite_link.pyindex 0a8e216ad85..834a2bc7084 100644--- a/zerver/management/commands/generate_multiuse_invite_link.py+++ b/zerver/management/commands/generate_multiuse_invite_link.py@@ -14,13 +14,11 @@ class Command(ZulipBaseCommand):parser.add_argument('-s', '--streams',- dest='streams',type=str,help='A comma-separated list of stream names.')parser.add_argument('--referred-by',- dest='referred_by',type=str,help='Email of referrer',required=True,diff --git a/zerver/management/commands/get_migration_status.py b/zerver/management/commands/get_migration_status.pyindex 847e333fae0..d47a2f6601f 100644--- a/zerver/management/commands/get_migration_status.py+++ b/zerver/management/commands/get_migration_status.py@@ -16,7 +16,7 @@ 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', dest='database',+ parser.add_argument('--database', action='store',default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. ''Defaults to the "default" database.')diff --git a/zerver/management/commands/import.py b/zerver/management/commands/import.pyindex fbe68e0f4a4..c56ccb35c8f 100644--- a/zerver/management/commands/import.py+++ b/zerver/management/commands/import.py@@ -19,13 +19,11 @@ import a database dump from one or more JSON files."""def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('--destroy-rebuild-database',- dest='destroy_rebuild_database',default=False,action="store_true",help='Destroys and rebuilds the databases prior to import.')parser.add_argument('--import-into-nonempty',- dest='import_into_nonempty',default=False,action="store_true",help='Import into an existing nonempty database.')@@ -37,7 +35,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',- dest='processes',action="store",default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,help='Number of processes to use for uploading Avatars to S3 in parallel')diff --git a/zerver/management/commands/knight.py b/zerver/management/commands/knight.pyindex 0ccf196709d..401589aa458 100644--- a/zerver/management/commands/knight.py+++ b/zerver/management/commands/knight.py@@ -26,7 +26,6 @@ ONLY perform this on customer request from an authorized person.default=True,help='Remove an administrator\'s rights.')parser.add_argument('--permission',- dest='permission',action="store",default='administer',choices=['administer', 'api_super_user'],diff --git a/zerver/management/commands/list_realms.py b/zerver/management/commands/list_realms.pyindex c1a09120081..9b0afd123aa 100644--- a/zerver/management/commands/list_realms.py+++ b/zerver/management/commands/list_realms.py@@ -16,7 +16,6 @@ Usage examples:def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument("--all",- dest="all",action="store_true",default=False,help="Print all the configuration settings of the realms.")diff --git a/zerver/management/commands/process_queue.py b/zerver/management/commands/process_queue.pyindex 785f62078d9..0eb6fb35025 100644--- a/zerver/management/commands/process_queue.py+++ b/zerver/management/commands/process_queue.py@@ -19,7 +19,7 @@ class Command(BaseCommand):help="queue to process")parser.add_argument('--worker_num', metavar='<worker number>', type=int, nargs='?', default=0,help="worker label")- parser.add_argument('--all', dest="all", action="store_true", default=False,+ parser.add_argument('--all', action="store_true", default=False,help="run all queues")parser.add_argument('--multi_threaded', nargs='+',metavar='<list of queue name>',diff --git a/zerver/management/commands/purge_queue.py b/zerver/management/commands/purge_queue.pyindex 83de62156c6..efad754045c 100644--- a/zerver/management/commands/purge_queue.py+++ b/zerver/management/commands/purge_queue.py@@ -12,7 +12,7 @@ class Command(BaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument(dest="queue_name", type=str, nargs='?',help="queue to purge", default=None)- parser.add_argument('--all', dest="all", action="store_true",+ parser.add_argument('--all', action="store_true",default=False, help="purge all queues")help = "Discards all messages from the given queue"diff --git a/zerver/management/commands/rate_limit.py b/zerver/management/commands/rate_limit.pyindex 4491351605a..51fe41177ec 100644--- a/zerver/management/commands/rate_limit.py+++ b/zerver/management/commands/rate_limit.py@@ -11,18 +11,14 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('-e', '--email',- dest='email',help="Email account of user.")parser.add_argument('-a', '--api-key',- dest='api_key',help="API key of user.")parser.add_argument('-s', '--seconds',- dest='seconds',default=60,type=int,help="Seconds to block for.")parser.add_argument('-d', '--domain',- dest='domain',default='api_by_user',help="Rate-limiting domain. Defaults to 'api_by_user'.")parser.add_argument('-b', '--all-bots',diff --git a/zerver/management/commands/realm_domain.py b/zerver/management/commands/realm_domain.pyindex e395e2c3855..1ea248ab3eb 100644--- a/zerver/management/commands/realm_domain.py+++ b/zerver/management/commands/realm_domain.py@@ -15,12 +15,10 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('--op',- dest='op',type=str,default="show",help='What operation to do (add, show, remove).')parser.add_argument('--allow-subdomains',- dest='allow_subdomains',action="store_true",default=False,help='Whether subdomains are allowed or not.')diff --git a/zerver/management/commands/realm_filters.py b/zerver/management/commands/realm_filters.pyindex e4d4304685e..9bd14e834fb 100644--- a/zerver/management/commands/realm_filters.py+++ b/zerver/management/commands/realm_filters.py@@ -24,7 +24,6 @@ Example: ./manage.py realm_filters --realm=zulip --op=showdef add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('--op',- dest='op',type=str,default="show",help='What operation to do (add, show, remove).')diff --git a/zerver/management/commands/register_server.py b/zerver/management/commands/register_server.pyindex 13856faed52..61d23897e0e 100644--- a/zerver/management/commands/register_server.py+++ b/zerver/management/commands/register_server.py@@ -20,12 +20,10 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('--agree_to_terms_of_service',- dest='agree_to_terms_of_service',action='store_true',default=False,help="Agree to the Zulipchat Terms of Service: https://zulip.com/terms/.")parser.add_argument('--rotate-key',- dest="rotate_key",action='store_true',default=False,help="Automatically rotate your server's zulip_org_key")diff --git a/zerver/management/commands/remove_users_from_stream.py b/zerver/management/commands/remove_users_from_stream.pyindex 19915a72a60..99ea668e2ce 100644--- a/zerver/management/commands/remove_users_from_stream.py+++ b/zerver/management/commands/remove_users_from_stream.py@@ -12,7 +12,6 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-s', '--stream',- dest='stream',required=True,type=str,help='A stream name.')diff --git a/zerver/management/commands/restore_messages.py b/zerver/management/commands/restore_messages.pyindex fa0b2a8b204..fa172e2a765 100644--- a/zerver/management/commands/restore_messages.py+++ b/zerver/management/commands/restore_messages.py@@ -29,11 +29,9 @@ To restore a specific ArchiveTransaction:def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-d', '--restore-deleted',- dest='restore_deleted',action='store_true',help='Restore manually deleted messages.')parser.add_argument('-t', '--transaction-id',- dest='transaction_id',type=int,help='Restore a specific ArchiveTransaction.')diff --git a/zerver/management/commands/send_custom_email.py b/zerver/management/commands/send_custom_email.pyindex c834939c242..72d58de06c4 100644--- a/zerver/management/commands/send_custom_email.py+++ b/zerver/management/commands/send_custom_email.py@@ -19,7 +19,6 @@ class Command(ZulipBaseCommand):parser.add_argument('--entire-server', action="store_true", default=False,help="Send to every user on the server.")parser.add_argument('--markdown-template-path', '--path',- dest='markdown_template_path',required=True,type=str,help='Path to a Markdown-format body for the email.')diff --git a/zerver/management/commands/send_to_email_mirror.py b/zerver/management/commands/send_to_email_mirror.pyindex c9e39f85541..188a54e5452 100644--- a/zerver/management/commands/send_to_email_mirror.py+++ b/zerver/management/commands/send_to_email_mirror.py@@ -37,14 +37,12 @@ Example:def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-f', '--fixture',- dest='fixture',type=str,help='The path to the email message you\'d like to send ''to the email mirror.\n''Accepted formats: json or raw email file. ''See zerver/tests/fixtures/email/ for examples')parser.add_argument('-s', '--stream',- dest='stream',type=str,help='The name of the stream to which you\'d like to send ''the message. Default: Denmark')diff --git a/zerver/management/commands/send_webhook_fixture_message.py b/zerver/management/commands/send_webhook_fixture_message.pyindex 0b1ed266783..8cc3c0e7df1 100644--- a/zerver/management/commands/send_webhook_fixture_message.py+++ b/zerver/management/commands/send_webhook_fixture_message.py@@ -32,19 +32,16 @@ approach shown above.def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-f', '--fixture',- dest='fixture',type=str,help='The path to the fixture you\'d like to send ''into Zulip')parser.add_argument('-u', '--url',- dest='url',type=str,help='The url on your Zulip server that you want ''to post the fixture to')parser.add_argument('-H', '--custom-headers',- dest='custom-headers',type=str,help='The headers you want to provide along with ''your mock request to Zulip.')@@ -71,7 +68,7 @@ approach shown above.if not self._does_fixture_path_exist(full_fixture_path):raise CommandError('Fixture {} does not exist'.format(options['fixture']))- headers = self.parse_headers(options['custom-headers'])+ headers = self.parse_headers(options['custom_headers'])json = self._get_fixture_as_json(full_fixture_path)realm = self.get_realm(options)if realm is None:diff --git a/zerver/management/commands/set_message_flags.py b/zerver/management/commands/set_message_flags.pyindex 9cde3eadcd2..9fb5258698e 100644--- a/zerver/management/commands/set_message_flags.py+++ b/zerver/management/commands/set_message_flags.py@@ -16,18 +16,15 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-l', '--for-real',- dest='for_real',action='store_true',default=False,help="Actually change message flags. Default is a dry run.")parser.add_argument('-f', '--flag',- dest='flag',type=str,help="The flag to add of remove")parser.add_argument('-o', '--op',- dest='op',type=str,help="The operation to do: 'add' or 'remove'")@@ -37,7 +34,6 @@ class Command(ZulipBaseCommand):help="Mark all messages <= specific usermessage id")parser.add_argument('-m', '--email',- dest='email',type=str,help="Email to set messages for")self.add_realm_args(parser)diff --git a/zerver/management/commands/soft_deactivate_users.py b/zerver/management/commands/soft_deactivate_users.pyindex 0d92daad0b6..2425983d8f9 100644--- a/zerver/management/commands/soft_deactivate_users.py+++ b/zerver/management/commands/soft_deactivate_users.py@@ -38,12 +38,10 @@ class Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:self.add_realm_args(parser)parser.add_argument('-d', '--deactivate',- dest='deactivate',action='store_true',default=False,help='Used to deactivate user/users.')parser.add_argument('-a', '--activate',- dest='activate',action='store_true',default=False,help='Used to activate user/users.')diff --git a/zerver/management/commands/sync_ldap_user_data.py b/zerver/management/commands/sync_ldap_user_data.pyindex ad8874b0bf0..35f6450f8e7 100644--- a/zerver/management/commands/sync_ldap_user_data.py+++ b/zerver/management/commands/sync_ldap_user_data.py@@ -53,7 +53,6 @@ def sync_ldap_user_data(user_profiles: List[UserProfile], deactivation_protectioclass Command(ZulipBaseCommand):def add_arguments(self, parser: ArgumentParser) -> None:parser.add_argument('-f', '--force',- dest='force',action="store_true",default=False,help='Disable the protection against deactivating all users.')diff --git a/zerver/management/commands/transfer_uploads_to_s3.py b/zerver/management/commands/transfer_uploads_to_s3.pyindex c6465137234..f37836538fe 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',- dest='processes',action="store",default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,help='Processes to use for exporting uploads in parallel')diff --git a/zilencer/management/commands/calculate_first_visible_message_id.py b/zilencer/management/commands/calculate_first_visible_message_id.pyindex 103e10c14bd..3df4332dcec 100644--- a/zilencer/management/commands/calculate_first_visible_message_id.py+++ b/zilencer/management/commands/calculate_first_visible_message_id.py@@ -14,7 +14,6 @@ class Command(ZulipBaseCommand):self.add_realm_args(parser)parser.add_argument('--lookback-hours',- dest='lookback_hours',type=int,help="Period a bit larger than that of the cron job that runs ""this command so that the lookback periods are sure to overlap.",diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.pyindex e60588926e4..1ed8503453f 100644--- a/zilencer/management/commands/populate_db.py+++ b/zilencer/management/commands/populate_db.py@@ -160,37 +160,31 @@ class Command(BaseCommand):def add_arguments(self, parser: CommandParser) -> None:parser.add_argument('-n', '--num-messages',- dest='num_messages',type=int,default=500,help='The number of messages to create.')parser.add_argument('-b', '--batch-size',- dest='batch_size',type=int,default=1000,help='How many messages to process in a single batch')parser.add_argument('--extra-users',- dest='extra_users',type=int,default=0,help='The number of extra users to create')parser.add_argument('--extra-bots',- dest='extra_bots',type=int,default=0,help='The number of extra bots to create')parser.add_argument('--extra-streams',- dest='extra_streams',type=int,default=0,help='The number of extra streams to create')parser.add_argument('--max-topics',- dest='max_topics',type=int,default=None,help='The number of maximum topics to create')@@ -208,25 +202,21 @@ class Command(BaseCommand):help='The number of personal pairs to create.')parser.add_argument('--threads',- dest='threads',type=int,default=1,help='The number of threads to use.')parser.add_argument('--percent-huddles',- dest='percent_huddles',type=float,default=15,help='The percent of messages to be huddles.')parser.add_argument('--percent-personals',- dest='percent_personals',type=float,default=15,help='The percent of messages to be personals.')parser.add_argument('--stickyness',- dest='stickyness',type=float,default=20,help='The percent of messages to repeat recent folks.')