From a5dbab8fb08ee631eccd463ad27c2a648fd6870b Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 1 Sep 2020 19:49:02 -0700 Subject: [PATCH] python: Remove redundant dest for argparse arguments. Signed-off-by: Anders Kaseorg --- .../check_send_receive_time | 4 ---- scripts/lib/email-mirror-postfix | 6 ++--- scripts/lib/queue_workers.py | 2 +- scripts/lib/upgrade-zulip-from-git | 2 +- scripts/lib/upgrade-zulip-stage-2 | 12 +++++----- scripts/lib/zulip_tools.py | 4 ++-- scripts/purge-old-deployments | 4 ++-- scripts/restart-server | 2 +- scripts/setup/generate_secrets.py | 2 +- tools/check-capitalization | 4 ++-- tools/check-frontend-i18n | 2 +- tools/check-issue-labels | 2 +- tools/droplets/create.py | 2 +- tools/lib/provision.py | 1 - tools/lib/provision_inner.py | 1 - tools/test-api | 2 +- tools/test-backend | 24 +++++++++---------- tools/test-js-with-node | 4 ++-- tools/test-js-with-puppeteer | 4 ++-- tools/test-tools | 2 +- tools/webpack | 14 +++++------ zerver/lib/management.py | 2 -- .../commands/add_users_to_mailing_list.py | 3 --- .../commands/add_users_to_streams.py | 1 - zerver/management/commands/check_redis.py | 1 - .../commands/convert_gitter_data.py | 1 - .../commands/convert_hipchat_data.py | 2 +- .../management/commands/convert_slack_data.py | 1 - .../commands/create_default_stream_groups.py | 3 --- zerver/management/commands/create_user.py | 2 -- zerver/management/commands/deactivate_user.py | 1 - .../delete_old_unclaimed_attachments.py | 1 - zerver/management/commands/dump_messages.py | 1 - zerver/management/commands/export.py | 2 -- .../commands/export_usermessage_batch.py | 3 --- .../commands/fill_memcached_caches.py | 2 +- zerver/management/commands/fix_unreads.py | 1 - .../commands/generate_invite_links.py | 1 - .../commands/generate_multiuse_invite_link.py | 2 -- .../commands/get_migration_status.py | 2 +- zerver/management/commands/import.py | 3 --- zerver/management/commands/knight.py | 1 - zerver/management/commands/list_realms.py | 1 - zerver/management/commands/process_queue.py | 2 +- zerver/management/commands/purge_queue.py | 2 +- zerver/management/commands/rate_limit.py | 4 ---- zerver/management/commands/realm_domain.py | 2 -- zerver/management/commands/realm_filters.py | 1 - zerver/management/commands/register_server.py | 2 -- .../commands/remove_users_from_stream.py | 1 - .../management/commands/restore_messages.py | 2 -- .../management/commands/send_custom_email.py | 1 - .../commands/send_to_email_mirror.py | 2 -- .../commands/send_webhook_fixture_message.py | 5 +--- .../management/commands/set_message_flags.py | 4 ---- .../commands/soft_deactivate_users.py | 2 -- .../commands/sync_ldap_user_data.py | 1 - .../commands/transfer_uploads_to_s3.py | 1 - .../calculate_first_visible_message_id.py | 1 - zilencer/management/commands/populate_db.py | 10 -------- 60 files changed, 53 insertions(+), 127 deletions(-) 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 bce83254ea..197051f8ec 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-postfix index 3f22cef384..3b04f9dc91 100755 --- a/scripts/lib/email-mirror-postfix +++ b/scripts/lib/email-mirror-postfix @@ -54,10 +54,10 @@ from urllib.request import Request, urlopen parser = 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_mir parser.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.py index 68b337c38a..0f57253ec8 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', 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-git index 2359bf9f2c..a91ebb8db2 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-2 index 0475a18073..746e2c6c98 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.py index e0d4fc389e..05a2dc2473 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-deployments index a1fcc56df7..36ab43efc9 100755 --- a/scripts/purge-old-deployments +++ b/scripts/purge-old-deployments @@ -20,11 +20,11 @@ def parse_args() -> argparse.Namespace: nargs="?", metavar="", 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-server index c4849110ae..8553b4fc60 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.py index c63b8e34e5..e9e7204f8f 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-capitalization index 1645ed9816..90bd806aa0 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-i18n index 6c119cd201..b1890d15d7 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-labels index 8ff7e785cf..43b4a97a49 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.py index 6df020f47f..f62dee8c82 100644 --- a/tools/droplets/create.py +++ b/tools/droplets/create.py @@ -30,7 +30,7 @@ import digitalocean parser = 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.py index 721e31a055..e9fec428bd 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.py index 94f5c16d12..34eaa6f82a 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-api index 9b4b2192ab..bc619795bc 100755 --- a/tools/test-api +++ b/tools/test-api @@ -21,7 +21,7 @@ from tools.lib.test_server import test_server_running usage = """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-backend index 794a306aee..15d624f2b4 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-node index 02bf2221e1..e90d745987 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-puppeteer index 67bb4c7296..bd2904bc61 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-tools index 326f726ecf..2e6476c0a4 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/webpack index 1b764c7a13..3735212c65 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.py index 0f157c45aa..45ff73bc73 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.py index a0ee04d53d..7561e00ede 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.py index 2ab536a3c0..29a1f31b1a 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.py index bc4cd91d1a..9de6cbb23e 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.py index c6c8d7406b..f2384adbef 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.py index e3f4e77cfe..8b72314cc9 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.py index dbdb0e0e08..0bea8e30e4 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.py index 4b622cc715..d160afad96 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.py index d1f6a129d7..c34794fff8 100644 --- a/zerver/management/commands/create_user.py +++ b/zerver/management/commands/create_user.py @@ -27,7 +27,6 @@ Omit both and 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 and 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.py index 061bdf7907..6ae6643d8a 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.py index 512f602114..291ff74857 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.py index 6a6e2daf3c..c08fc9e31d 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.py index 8610de8576..c8cbb2e2ae 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.py index 4944e594e4..621d5caeac 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.py index 933a17004e..ad084e9591 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_cache class 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.py index 2ceb610271..112dd77bf5 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.py index 08f975ba14..1a62ae0e56 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.py index 0a8e216ad8..834a2bc708 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.py index 847e333fae..d47a2f6601 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.py index fbe68e0f4a..c56ccb35c8 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='', 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.py index 0ccf196709..401589aa45 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.py index c1a0912008..9b0afd123a 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.py index 785f62078d..0eb6fb3502 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='', 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='', diff --git a/zerver/management/commands/purge_queue.py b/zerver/management/commands/purge_queue.py index 83de62156c..efad754045 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.py index 4491351605..51fe41177e 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.py index e395e2c385..1ea248ab3e 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.py index e4d4304685..9bd14e834f 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=show 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).') diff --git a/zerver/management/commands/register_server.py b/zerver/management/commands/register_server.py index 13856faed5..61d23897e0 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.py index 19915a72a6..99ea668e2c 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.py index fa0b2a8b20..fa172e2a76 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.py index c834939c24..72d58de06c 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.py index c9e39f8554..188a54e545 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.py index 0b1ed26678..8cc3c0e7df 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.py index 9cde3eadcd..9fb5258698 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.py index 0d92daad0b..2425983d8f 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.py index ad8874b0bf..35f6450f8e 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_protectio class 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.py index c646513723..f37836538f 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.py index 103e10c14b..3df4332dce 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.py index e60588926e..1ed8503453 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.')