From b4597a8ca80697f72f3d787521d629cda518c175 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 2 Sep 2020 11:45:48 -0700 Subject: [PATCH] python: Elide default for store_{true,false} argparse arguments. Signed-off-by: Anders Kaseorg --- .../commands/update_analytics_counts.py | 6 ++---- scripts/lib/email-mirror-postfix | 4 ++-- scripts/restart-server | 2 +- tools/check-capitalization | 4 ++-- tools/check-frontend-i18n | 2 +- tools/check-issue-labels | 2 +- tools/check-provision | 2 +- tools/check-templates | 6 +++--- tools/droplets/add_mentor.py | 2 +- tools/droplets/create.py | 2 +- tools/generate-integration-docs-screenshot | 2 +- tools/lib/provision.py | 3 --- tools/lib/provision_inner.py | 3 --- tools/lint | 2 +- tools/run-dev.py | 8 ++++---- tools/test-api | 2 +- tools/test-backend | 18 +++++------------- tools/test-help-documentation | 4 ++-- tools/test-js-with-node | 4 ++-- tools/test-js-with-puppeteer | 4 ++-- tools/test-tools | 2 +- tools/webpack | 10 +++++----- zerver/lib/management.py | 1 - zerver/management/commands/check_redis.py | 1 - zerver/management/commands/compilemessages.py | 1 - zerver/management/commands/create_user.py | 1 - zerver/management/commands/deactivate_user.py | 1 - .../delete_old_unclaimed_attachments.py | 1 - zerver/management/commands/fix_unreads.py | 1 - .../commands/generate_invite_links.py | 1 - zerver/management/commands/import.py | 2 -- zerver/management/commands/knight.py | 2 -- zerver/management/commands/list_realms.py | 1 - zerver/management/commands/logout_all_users.py | 1 - zerver/management/commands/process_queue.py | 2 +- zerver/management/commands/purge_queue.py | 2 +- zerver/management/commands/rate_limit.py | 1 - zerver/management/commands/realm_domain.py | 1 - zerver/management/commands/register_server.py | 2 -- zerver/management/commands/runtornado.py | 4 ++-- .../management/commands/send_custom_email.py | 2 +- .../commands/send_password_reset_email.py | 2 +- .../management/commands/set_message_flags.py | 1 - .../commands/soft_deactivate_users.py | 2 -- .../management/commands/sync_ldap_user_data.py | 1 - zilencer/management/commands/populate_db.py | 2 -- 46 files changed, 45 insertions(+), 85 deletions(-) diff --git a/analytics/management/commands/update_analytics_counts.py b/analytics/management/commands/update_analytics_counts.py index 1acd1e6f5b..df72714b17 100644 --- a/analytics/management/commands/update_analytics_counts.py +++ b/analytics/management/commands/update_analytics_counts.py @@ -29,15 +29,13 @@ class Command(BaseCommand): default=timezone_now().isoformat()) parser.add_argument('--utc', action='store_true', - help="Interpret --time in UTC.", - default=False) + help="Interpret --time in UTC.") parser.add_argument('--stat', '-s', type=str, help="CountStat to process. If omitted, all stats are processed.") parser.add_argument('--verbose', action='store_true', - help="Print timing information to stdout.", - default=False) + help="Print timing information to stdout.") def handle(self, *args: Any, **options: Any) -> None: try: diff --git a/scripts/lib/email-mirror-postfix b/scripts/lib/email-mirror-postfix index 3b04f9dc91..e5df625ae9 100755 --- a/scripts/lib/email-mirror-postfix +++ b/scripts/lib/email-mirror-postfix @@ -67,10 +67,10 @@ parser.add_argument('-d', '--dst-host', dest="host", type=str, default='https:// parser.add_argument('-u', '--dst-url', dest="url", type=str, default='/email_mirror_message', help="Destination relative url for uploading email from email mirror.") -parser.add_argument('-n', '--not-verify-ssl', dest="verify_ssl", action='store_false', default=True, +parser.add_argument('-n', '--not-verify-ssl', dest="verify_ssl", action='store_false', help="Disable ssl certificate verifying for self-signed certificates") -parser.add_argument('-t', '--test', action='store_true', default=False, +parser.add_argument('-t', '--test', action='store_true', help="Test mode.") options = parser.parse_args() diff --git a/scripts/restart-server b/scripts/restart-server index d0937e14ce..3bafb4fa59 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', default=False, +parser.add_argument('--fill-cache', action='store_true', help='Fill the memcached caches') args = parser.parse_args() diff --git a/tools/check-capitalization b/tools/check-capitalization index 90bd806aa0..0c9370b703 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', default=False, + action='store_true', help='Show strings that passed the check because they ' 'contained ignored phrases.') parser.add_argument('--no-generate', - action='store_true', default=False, + action='store_true', help="Don't run makemessages command.") args = parser.parse_args() diff --git a/tools/check-frontend-i18n b/tools/check-frontend-i18n index b1890d15d7..1fa3830ce8 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', default=False, + action='store_true', help="Don't run makemessages command.") args = parser.parse_args() diff --git a/tools/check-issue-labels b/tools/check-issue-labels index 43b4a97a49..1ecf5a09bb 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", default=False) + parser.add_argument('--force', action="store_true") args = parser.parse_args() if not args.force: diff --git a/tools/check-provision b/tools/check-provision index fe64e18daa..9a6ad52aea 100755 --- a/tools/check-provision +++ b/tools/check-provision @@ -12,7 +12,7 @@ from tools.lib.test_script import assert_provisioning_status_ok def run() -> None: parser = argparse.ArgumentParser() - parser.add_argument('--force', default=False, + parser.add_argument('--force', action="store_true", help='Run tests despite possible problems.') options = parser.parse_args() diff --git a/tools/check-templates b/tools/check-templates index dbcc7f9c65..59e6cc840a 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -156,13 +156,13 @@ def check_handlebar_templates(templates: Iterable[str], fix: bool) -> None: if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('-m', '--modified', - action='store_true', default=False, + action='store_true', help='only check modified files') parser.add_argument('--all-dups', - action="store_true", default=False, + action="store_true", help='Run lint tool to detect duplicate ids on ignored files as well') parser.add_argument('--fix', - action='store_true', default=False, + action='store_true', help='Automatically fix indentation problems.') parser.add_argument('targets', nargs=argparse.REMAINDER) args = parser.parse_args() diff --git a/tools/droplets/add_mentor.py b/tools/droplets/add_mentor.py index 5ab63bef36..488908bb31 100644 --- a/tools/droplets/add_mentor.py +++ b/tools/droplets/add_mentor.py @@ -21,7 +21,7 @@ import requests parser = ArgumentParser(description='Give a mentor ssh access to this machine.') parser.add_argument('username', help='Github username of the mentor.') parser.add_argument('--remove', help='Remove his/her key from the machine.', - action='store_true', default=False) + action='store_true') # Wrap keys with line comments for easier key removal. append_key = """\ diff --git a/tools/droplets/create.py b/tools/droplets/create.py index f62dee8c82..20ce311a45 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', action="store_true", default=False) +parser.add_argument('-f', '--recreate', action="store_true") def get_config() -> configparser.ConfigParser: config = configparser.ConfigParser() diff --git a/tools/generate-integration-docs-screenshot b/tools/generate-integration-docs-screenshot index 915ee2bc03..7bd845c254 100755 --- a/tools/generate-integration-docs-screenshot +++ b/tools/generate-integration-docs-screenshot @@ -193,7 +193,7 @@ def generate_screenshot_from_config(integration_name: str, screenshot_config: Sc parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) -group.add_argument('--all', default=False, action='store_true') +group.add_argument('--all', action='store_true') group.add_argument('--integration', type=str, help='Name of the integration') parser.add_argument('--fixture', type=str, help='Name of the fixture file to use') parser.add_argument('--image-name', type=str, help='Name for the screenshot image') diff --git a/tools/lib/provision.py b/tools/lib/provision.py index 7cf6aeff2a..29bef1d740 100755 --- a/tools/lib/provision.py +++ b/tools/lib/provision.py @@ -421,16 +421,13 @@ if __name__ == "__main__": description = ("Provision script to install Zulip") parser = argparse.ArgumentParser(description=description) parser.add_argument('--force', action='store_true', dest='is_force', - default=False, help="Ignore all provisioning optimizations.") parser.add_argument('--build-release-tarball-only', action='store_true', dest='is_build_release_tarball_only', - default=False, help="Provision needed to build release tarball.") parser.add_argument('--skip-dev-db-build', action='store_true', - default=False, help="Don't run migrations on dev database.") options = parser.parse_args() diff --git a/tools/lib/provision_inner.py b/tools/lib/provision_inner.py index 34eaa6f82a..573c37be7b 100755 --- a/tools/lib/provision_inner.py +++ b/tools/lib/provision_inner.py @@ -328,16 +328,13 @@ def main(options: argparse.Namespace) -> int: if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--force', action='store_true', dest='is_force', - default=False, help="Ignore all provisioning optimizations.") parser.add_argument('--build-release-tarball-only', action='store_true', dest='is_build_release_tarball_only', - default=False, help="Provision for test suite with production settings.") parser.add_argument('--skip-dev-db-build', action='store_true', - default=False, help="Don't run migrations on dev database.") options = parser.parse_args() diff --git a/tools/lint b/tools/lint index 6f2aef5a9d..cc6506d060 100755 --- a/tools/lint +++ b/tools/lint @@ -16,7 +16,7 @@ from linter_lib.custom_check import non_py_rules, python_rules def run() -> None: parser = argparse.ArgumentParser() - parser.add_argument('--force', default=False, + parser.add_argument('--force', action="store_true", help='Run tests despite possible problems.') parser.add_argument('--full', diff --git a/tools/run-dev.py b/tools/run-dev.py index 46946d65ca..4752d2c559 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -52,16 +52,16 @@ parser.add_argument('--interface', default=None, help='Set the IP or hostname for the proxy to listen on') parser.add_argument('--no-clear-memcached', action='store_false', dest='clear_memcached', - default=True, help='Do not clear memcached') + help='Do not clear memcached') parser.add_argument('--streamlined', action="store_true", - default=False, help='Avoid thumbor, etc.') + help='Avoid thumbor, etc.') parser.add_argument('--force', action="store_true", - default=False, help='Run command despite possible problems.') + help='Run command despite possible problems.') parser.add_argument('--enable-tornado-logging', action="store_true", - default=False, help='Enable access logs from tornado proxy server.') + help='Enable access logs from tornado proxy server.') options = parser.parse_args() assert_provisioning_status_ok(options.force) diff --git a/tools/test-api b/tools/test-api index bc619795bc..674040c0b2 100755 --- a/tools/test-api +++ b/tools/test-api @@ -23,7 +23,7 @@ usage = """test-api [options]""" parser = argparse.ArgumentParser(usage) parser.add_argument('--force', action="store_true", - default=False, help='Run tests despite possible provisioning problems.') + help='Run tests despite possible provisioning problems.') options = parser.parse_args() assert_provisioning_status_ok(options.force) diff --git a/tools/test-backend b/tools/test-backend index 15d624f2b4..3c3b294ae9 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -209,18 +209,16 @@ def main() -> None: parser = argparse.ArgumentParser(description=usage, formatter_class=argparse.RawTextHelpFormatter) - parser.add_argument('--nonfatal-errors', action="store_false", default=True, + parser.add_argument('--nonfatal-errors', action="store_false", dest="fatal_errors", help="Continue past test failures to run all tests") parser.add_argument('--coverage', action="store_true", - default=False, help='Compute test coverage.') parser.add_argument('--verbose-coverage', action="store_true", - default=False, help='Enable verbose print of coverage report.') + help='Enable verbose print of coverage report.') parser.add_argument('--no-cov-cleanup', action='store_true', - default=False, help="Do not clean generated coverage files.") parser.add_argument('--parallel', dest='processes', @@ -231,39 +229,33 @@ def main() -> None: 'tests in. Default is the number of logical CPUs') parser.add_argument('--profile', action="store_true", - default=False, help='Profile test runtime.') + help='Profile test runtime.') parser.add_argument('--force', action="store_true", - default=False, help='Run tests despite possible problems.') + help='Run tests despite possible problems.') parser.add_argument('--no-shallow', action="store_true", - default=False, help="Don't allow shallow testing of templates (deprecated)") parser.add_argument('--verbose', action="store_true", - default=False, help="Show detailed output") parser.add_argument('--reverse', action="store_true", - default=False, help="Run tests in reverse order.") 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', action="store_true", - default=False, help=("Include webhook tests. By default, they are skipped for performance.")) 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', action="store_true", - default=False, help='Require stdout and stderr to be clean of unexpected output.') + help='Require stdout and stderr to be clean of unexpected output.') options = parser.parse_args() if options.ban_console_output: diff --git a/tools/test-help-documentation b/tools/test-help-documentation index 138de54ac5..f8c76b9365 100755 --- a/tools/test-help-documentation +++ b/tools/test-help-documentation @@ -14,10 +14,10 @@ from lib import sanity_check sanity_check.check_venv(__file__) parser = argparse.ArgumentParser() -parser.add_argument('--force', default=False, +parser.add_argument('--force', action="store_true", help='Run tests despite possible problems.') -parser.add_argument('--skip-external-links', default=False, +parser.add_argument('--skip-external-links', dest="skip_external_link_check", action="store_true", help='Skip checking of external links.') diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 6ad5f4dd9c..06bc1a0ebb 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -166,10 +166,10 @@ EXEMPT_FILES = { parser = argparse.ArgumentParser(USAGE) parser.add_argument('--coverage', action="store_true", - default=False, help='Get coverage report') + help='Get coverage report') parser.add_argument('--force', action="store_true", - default=False, help='Run tests despite possible problems.') + help='Run tests despite possible problems.') parser.add_argument('args', nargs=argparse.REMAINDER) options = parser.parse_args() individual_files = options.args diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteer index 79e2e5e075..5161392043 100755 --- a/tools/test-js-with-puppeteer +++ b/tools/test-js-with-puppeteer @@ -29,10 +29,10 @@ parser = argparse.ArgumentParser(usage) parser.add_argument('--interactive', action="store_true", - default=False, help='Run tests interactively') + help='Run tests interactively') parser.add_argument('--force', action="store_true", - default=False, help='Run tests despite possible problems.') + help='Run tests despite possible problems.') parser.add_argument('tests', nargs=argparse.REMAINDER, help='Specific tests to run; by default, runs all tests') diff --git a/tools/test-tools b/tools/test-tools index 2e6476c0a4..ef22e1f81e 100755 --- a/tools/test-tools +++ b/tools/test-tools @@ -13,7 +13,7 @@ if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--coverage', action="store_true", - default=False, help='compute test coverage') + help='compute test coverage') args = parser.parse_args() def dir_join(dir1: str, dir2: str) -> str: diff --git a/tools/webpack b/tools/webpack index 3735212c65..4d743f24fb 100755 --- a/tools/webpack +++ b/tools/webpack @@ -112,13 +112,13 @@ def build_for_most_tests() -> None: parser = argparse.ArgumentParser() parser.add_argument('--test', - action='store_true', default=False, + action='store_true', help='generate a stub webpack-stats.json file (for backend testing)') parser.add_argument('--quiet', - action='store_true', default=False, + action='store_true', help='Minimizes webpack output while running') parser.add_argument('--watch', - action='store_true', default=False, + action='store_true', help='watch for changes to source files (for development)') parser.add_argument('--host', action='store', @@ -127,10 +127,10 @@ 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', default=False, + action='store_true', help='Minify and optimize the assets (for development)') parser.add_argument('--disable-host-check', - action='store_true', default=None, + action='store_true', 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 45ff73bc73..0b5173ac4c 100644 --- a/zerver/lib/management.py +++ b/zerver/lib/management.py @@ -65,7 +65,6 @@ You can use the command list_realms to find ID of the realms in this server.""" parser.add_argument( '-a', '--all-users', action="store_true", - default=False, help=all_users_help) def get_realm(self, options: Dict[str, Any]) -> Optional[Realm]: diff --git a/zerver/management/commands/check_redis.py b/zerver/management/commands/check_redis.py index 9de6cbb23e..dc9f4e0838 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', - default=False, action='store_true', help="Actually trim excess") diff --git a/zerver/management/commands/compilemessages.py b/zerver/management/commands/compilemessages.py index 2dc19a919a..f1de927330 100644 --- a/zerver/management/commands/compilemessages.py +++ b/zerver/management/commands/compilemessages.py @@ -23,7 +23,6 @@ class Command(compilemessages.Command): parser.add_argument( '--strict', '-s', action='store_true', - default=False, help='Stop execution in case of errors.') def handle(self, *args: Any, **options: Any) -> None: diff --git a/zerver/management/commands/create_user.py b/zerver/management/commands/create_user.py index c34794fff8..01e6eff828 100644 --- a/zerver/management/commands/create_user.py +++ b/zerver/management/commands/create_user.py @@ -24,7 +24,6 @@ Omit both and for interactive user creation. parser.add_argument('--this-user-has-accepted-the-tos', dest='tos', action="store_true", - default=False, help='Acknowledgement that the user has already accepted the ToS.') parser.add_argument('--password', type=str, diff --git a/zerver/management/commands/deactivate_user.py b/zerver/management/commands/deactivate_user.py index 6ae6643d8a..094ba8ea61 100644 --- a/zerver/management/commands/deactivate_user.py +++ b/zerver/management/commands/deactivate_user.py @@ -13,7 +13,6 @@ class Command(ZulipBaseCommand): def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument('-f', '--for-real', action='store_true', - default=False, help="Actually deactivate the user. Default is a dry run.") parser.add_argument('email', metavar='', type=str, help='email of user to deactivate') diff --git a/zerver/management/commands/delete_old_unclaimed_attachments.py b/zerver/management/commands/delete_old_unclaimed_attachments.py index 291ff74857..1e6ccf74f0 100644 --- a/zerver/management/commands/delete_old_unclaimed_attachments.py +++ b/zerver/management/commands/delete_old_unclaimed_attachments.py @@ -21,7 +21,6 @@ class Command(BaseCommand): parser.add_argument('-f', '--for-real', action='store_true', - default=False, help="Actually remove the files from the storage.") def handle(self, *args: Any, **options: Any) -> None: diff --git a/zerver/management/commands/fix_unreads.py b/zerver/management/commands/fix_unreads.py index 112dd77bf5..9d2df7983f 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', - 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 1a62ae0e56..64bd3fa8bf 100644 --- a/zerver/management/commands/generate_invite_links.py +++ b/zerver/management/commands/generate_invite_links.py @@ -15,7 +15,6 @@ class Command(ZulipBaseCommand): def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument('--force', action="store_true", - default=False, help='Override that the domain is restricted to external users.') parser.add_argument('emails', metavar='', type=str, nargs='*', help='email of users to generate an activation link for') diff --git a/zerver/management/commands/import.py b/zerver/management/commands/import.py index c56ccb35c8..1ede79de29 100644 --- a/zerver/management/commands/import.py +++ b/zerver/management/commands/import.py @@ -19,12 +19,10 @@ import a database dump from one or more JSON files.""" def add_arguments(self, parser: CommandParser) -> None: parser.add_argument('--destroy-rebuild-database', - default=False, action="store_true", help='Destroys and rebuilds the databases prior to import.') parser.add_argument('--import-into-nonempty', - default=False, action="store_true", help='Import into an existing nonempty database.') diff --git a/zerver/management/commands/knight.py b/zerver/management/commands/knight.py index 401589aa45..3dac43e0ac 100644 --- a/zerver/management/commands/knight.py +++ b/zerver/management/commands/knight.py @@ -18,12 +18,10 @@ ONLY perform this on customer request from an authorized person. parser.add_argument('-f', '--for-real', dest='ack', action="store_true", - default=False, help='Acknowledgement that this is done according to policy.') parser.add_argument('--revoke', dest='grant', action="store_false", - default=True, help='Remove an administrator\'s rights.') parser.add_argument('--permission', action="store", diff --git a/zerver/management/commands/list_realms.py b/zerver/management/commands/list_realms.py index 9b0afd123a..80f556a317 100644 --- a/zerver/management/commands/list_realms.py +++ b/zerver/management/commands/list_realms.py @@ -17,7 +17,6 @@ Usage examples: def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument("--all", action="store_true", - default=False, help="Print all the configuration settings of the realms.") def handle(self, *args: Any, **options: Any) -> None: diff --git a/zerver/management/commands/logout_all_users.py b/zerver/management/commands/logout_all_users.py index b41b1c867c..594ff08a6f 100644 --- a/zerver/management/commands/logout_all_users.py +++ b/zerver/management/commands/logout_all_users.py @@ -15,7 +15,6 @@ class Command(ZulipBaseCommand): def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument('--deactivated-only', action='store_true', - default=False, help="Only logout all users who are deactivated") self.add_realm_args(parser, help="Only logout all users in a particular realm") diff --git a/zerver/management/commands/process_queue.py b/zerver/management/commands/process_queue.py index 0eb6fb3502..c265608423 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', action="store_true", default=False, + parser.add_argument('--all', action="store_true", 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 efad754045..77388ed435 100644 --- a/zerver/management/commands/purge_queue.py +++ b/zerver/management/commands/purge_queue.py @@ -13,7 +13,7 @@ class Command(BaseCommand): parser.add_argument(dest="queue_name", type=str, nargs='?', help="queue to purge", default=None) parser.add_argument('--all', action="store_true", - default=False, help="purge all queues") + 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 51fe41177e..a26ae1db6b 100644 --- a/zerver/management/commands/rate_limit.py +++ b/zerver/management/commands/rate_limit.py @@ -24,7 +24,6 @@ class Command(ZulipBaseCommand): parser.add_argument('-b', '--all-bots', dest='bots', action='store_true', - default=False, help="Whether or not to also block all bots for this user.") parser.add_argument('operation', metavar='', type=str, choices=['block', 'unblock'], help="operation to perform (block or unblock)") diff --git a/zerver/management/commands/realm_domain.py b/zerver/management/commands/realm_domain.py index 1ea248ab3e..ce608b9c75 100644 --- a/zerver/management/commands/realm_domain.py +++ b/zerver/management/commands/realm_domain.py @@ -20,7 +20,6 @@ class Command(ZulipBaseCommand): help='What operation to do (add, show, remove).') parser.add_argument('--allow-subdomains', action="store_true", - default=False, help='Whether subdomains are allowed or not.') parser.add_argument('domain', metavar='', type=str, nargs='?', help="domain to add or remove") diff --git a/zerver/management/commands/register_server.py b/zerver/management/commands/register_server.py index 61d23897e0..5979df11f2 100644 --- a/zerver/management/commands/register_server.py +++ b/zerver/management/commands/register_server.py @@ -21,11 +21,9 @@ class Command(ZulipBaseCommand): def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument('--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', action='store_true', - default=False, help="Automatically rotate your server's zulip_org_key") def handle(self, **options: Any) -> None: diff --git a/zerver/management/commands/runtornado.py b/zerver/management/commands/runtornado.py index e82f3d52dd..1f7ffa67a9 100644 --- a/zerver/management/commands/runtornado.py +++ b/zerver/management/commands/runtornado.py @@ -46,11 +46,11 @@ class Command(BaseCommand): '(use multiple ports to start multiple servers)') parser.add_argument('--nokeepalive', action='store_true', - dest='no_keep_alive', default=False, + dest='no_keep_alive', help="Tells Tornado to NOT keep alive http connections.") parser.add_argument('--noxheaders', action='store_false', - dest='xheaders', default=True, + dest='xheaders', help="Tells Tornado to NOT override remote IP with X-Real-IP.") def handle(self, addrport: str, **options: bool) -> None: diff --git a/zerver/management/commands/send_custom_email.py b/zerver/management/commands/send_custom_email.py index 72d58de06c..d22b2a265f 100644 --- a/zerver/management/commands/send_custom_email.py +++ b/zerver/management/commands/send_custom_email.py @@ -16,7 +16,7 @@ class Command(ZulipBaseCommand): document used to generate the email, or on the command line.""" def add_arguments(self, parser: ArgumentParser) -> None: - parser.add_argument('--entire-server', action="store_true", default=False, + parser.add_argument('--entire-server', action="store_true", help="Send to every user on the server.") parser.add_argument('--markdown-template-path', '--path', required=True, diff --git a/zerver/management/commands/send_password_reset_email.py b/zerver/management/commands/send_password_reset_email.py index 45e28ae0ae..a1a707b8bb 100644 --- a/zerver/management/commands/send_password_reset_email.py +++ b/zerver/management/commands/send_password_reset_email.py @@ -13,7 +13,7 @@ class Command(ZulipBaseCommand): help = """Send email to specified email address.""" def add_arguments(self, parser: ArgumentParser) -> None: - parser.add_argument('--entire-server', action="store_true", default=False, + parser.add_argument('--entire-server', action="store_true", help="Send to every user on the server. ") self.add_user_list_args(parser, help="Email addresses of user(s) to send password reset emails to.", diff --git a/zerver/management/commands/set_message_flags.py b/zerver/management/commands/set_message_flags.py index 9fb5258698..7faca0f37f 100644 --- a/zerver/management/commands/set_message_flags.py +++ b/zerver/management/commands/set_message_flags.py @@ -17,7 +17,6 @@ class Command(ZulipBaseCommand): def add_arguments(self, parser: CommandParser) -> None: parser.add_argument('-l', '--for-real', action='store_true', - default=False, help="Actually change message flags. Default is a dry run.") parser.add_argument('-f', '--flag', diff --git a/zerver/management/commands/soft_deactivate_users.py b/zerver/management/commands/soft_deactivate_users.py index 2425983d8f..615f50a672 100644 --- a/zerver/management/commands/soft_deactivate_users.py +++ b/zerver/management/commands/soft_deactivate_users.py @@ -39,11 +39,9 @@ class Command(ZulipBaseCommand): self.add_realm_args(parser) parser.add_argument('-d', '--deactivate', action='store_true', - default=False, help='Used to deactivate user/users.') parser.add_argument('-a', '--activate', action='store_true', - default=False, help='Used to activate user/users.') parser.add_argument('--inactive-for', type=int, diff --git a/zerver/management/commands/sync_ldap_user_data.py b/zerver/management/commands/sync_ldap_user_data.py index 35f6450f8e..e4b956bc9c 100644 --- a/zerver/management/commands/sync_ldap_user_data.py +++ b/zerver/management/commands/sync_ldap_user_data.py @@ -54,7 +54,6 @@ class Command(ZulipBaseCommand): def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument('-f', '--force', action="store_true", - default=False, help='Disable the protection against deactivating all users.') self.add_realm_args(parser) diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py index 5ea2a7ae3d..4e1de6dfcc 100644 --- a/zilencer/management/commands/populate_db.py +++ b/zilencer/management/commands/populate_db.py @@ -223,12 +223,10 @@ class Command(BaseCommand): parser.add_argument('--nodelete', action="store_false", - default=True, dest='delete', help='Whether to delete all the existing messages.') parser.add_argument('--test-suite', - default=False, action="store_true", help='Configures populate_db to create a deterministic ' 'data set for the backend tests.')