python: Remove redundant dest for argparse arguments.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-09-01 19:49:02 -07:00 committed by Tim Abbott
parent 4d583e3d41
commit a5dbab8fb0
60 changed files with 53 additions and 127 deletions

View File

@ -33,20 +33,16 @@ usage = """Usage: send-receive.py [options] [config]
parser = argparse.ArgumentParser(usage=usage) parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('--site', parser.add_argument('--site',
dest='site',
default="https://api.zulip.com", default="https://api.zulip.com",
action='store') action='store')
parser.add_argument('--nagios', parser.add_argument('--nagios',
dest='nagios',
action='store_true') action='store_true')
parser.add_argument('--insecure', parser.add_argument('--insecure',
dest='insecure',
action='store_true') action='store_true')
parser.add_argument('--munin', parser.add_argument('--munin',
dest='munin',
action='store_true') action='store_true')
parser.add_argument('config', nargs='?', default=None) parser.add_argument('config', nargs='?', default=None)

View File

@ -54,10 +54,10 @@ from urllib.request import Request, urlopen
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-r', '--recipient', dest="recipient", type=str, default='', parser.add_argument('-r', '--recipient', type=str, default='',
help="Original recipient.") 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.") help="Secret access key.")
parser.add_argument('-d', '--dst-host', dest="host", type=str, default='https://127.0.0.1', 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, parser.add_argument('-n', '--not-verify-ssl', dest="verify_ssl", action='store_false', default=True,
help="Disable ssl certificate verifying for self-signed certificates") 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.") help="Test mode.")
options = parser.parse_args() options = parser.parse_args()

View File

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

View File

@ -38,7 +38,7 @@ logging.basicConfig(format="%(asctime)s upgrade-zulip-from-git: %(message)s",
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("refname", help="Git reference, e.g. a branch, tag, or commit ID.") 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.") help="Override the Git remote URL configured in /etc/zulip/zulip.conf.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -71,17 +71,17 @@ os.umask(0o22)
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("deploy_path", metavar="deploy_path", parser.add_argument("deploy_path", metavar="deploy_path",
help="Path to deployment directory") 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.") 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.") 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.") 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.") 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.") 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.") action="store_true", help="Audit and fix full text search indexes.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -68,11 +68,11 @@ def parse_cache_script_args(description: str) -> argparse.Namespace:
"installation in dev) and older than threshold days will be " "installation in dev) and older than threshold days will be "
"deleted. (defaults to 14)") "deleted. (defaults to 14)")
parser.add_argument( 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 " help="If specified then script will only print the caches "
"that it will delete/keep back. It will not delete any cache.") "that it will delete/keep back. It will not delete any cache.")
parser.add_argument( parser.add_argument(
"--verbose", dest="verbose", action="store_true", "--verbose", action="store_true",
help="If specified then script will print a detailed report " help="If specified then script will print a detailed report "
"of what is being will deleted/kept back.") "of what is being will deleted/kept back.")
parser.add_argument( parser.add_argument(

View File

@ -20,11 +20,11 @@ def parse_args() -> argparse.Namespace:
nargs="?", metavar="<days>", help="Deployments older than " nargs="?", metavar="<days>", help="Deployments older than "
"threshold days will be deleted. (defaults to 14)") "threshold days will be deleted. (defaults to 14)")
parser.add_argument( 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 " help="If specified then script will only print the deployments and "
"caches that it will delete/keep back. It will not delete anything.") "caches that it will delete/keep back. It will not delete anything.")
parser.add_argument( parser.add_argument(
"--verbose", dest="verbose", action="store_true", "--verbose", action="store_true",
help="If specified then script will print a detailed report " help="If specified then script will print a detailed report "
"of what is going on.") "of what is going on.")

View File

@ -17,7 +17,7 @@ logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
level=logging.INFO) level=logging.INFO)
parser = argparse.ArgumentParser() 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') help='Fill the memcached caches')
args = parser.parse_args() args = parser.parse_args()

View File

@ -183,7 +183,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True) 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') help='For setting up the developer env for zulip')
group.add_argument('--production', action='store_false', dest='development', group.add_argument('--production', action='store_false', dest='development',
help='For setting up the production env for zulip') help='For setting up the production env for zulip')

View File

@ -21,11 +21,11 @@ DJANGO_PO_REGEX = re.compile('msgid "(.*?)"')
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--show-ignored', 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 ' help='Show strings that passed the check because they '
'contained ignored phrases.') 'contained ignored phrases.')
parser.add_argument('--no-generate', parser.add_argument('--no-generate',
action='store_true', dest='no_generate', default=False, action='store_true', default=False,
help="Don't run makemessages command.") help="Don't run makemessages command.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -26,7 +26,7 @@ def find_handlebars(translatable_strings: List[str]) -> List[str]:
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--no-generate', parser.add_argument('--no-generate',
action='store_true', dest='no_generate', default=False, action='store_true', default=False,
help="Don't run makemessages command.") help="Don't run makemessages command.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -44,7 +44,7 @@ def get_next_page_url(link_header: str) -> Optional[str]:
def check_issue_labels() -> None: def check_issue_labels() -> None:
parser = argparse.ArgumentParser() 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() args = parser.parse_args()
if not args.force: if not args.force:

View File

@ -30,7 +30,7 @@ import digitalocean
parser = argparse.ArgumentParser(description='Create a Zulip devopment VM DigitalOcean droplet.') 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("username", help="Github username for whom you want to create a Zulip dev droplet")
parser.add_argument('--tags', nargs='+', default=[]) 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: def get_config() -> configparser.ConfigParser:
config = configparser.ConfigParser() config = configparser.ConfigParser()

View File

@ -434,7 +434,6 @@ if __name__ == "__main__":
help="Provision needed to build release tarball.") help="Provision needed to build release tarball.")
parser.add_argument('--skip-dev-db-build', action='store_true', parser.add_argument('--skip-dev-db-build', action='store_true',
dest='skip_dev_db_build',
default=False, default=False,
help="Don't run migrations on dev database.") help="Don't run migrations on dev database.")

View File

@ -337,7 +337,6 @@ if __name__ == "__main__":
help="Provision for test suite with production settings.") help="Provision for test suite with production settings.")
parser.add_argument('--skip-dev-db-build', action='store_true', parser.add_argument('--skip-dev-db-build', action='store_true',
dest='skip_dev_db_build',
default=False, default=False,
help="Don't run migrations on dev database.") help="Don't run migrations on dev database.")

View File

@ -21,7 +21,7 @@ from tools.lib.test_server import test_server_running
usage = """test-api [options]""" usage = """test-api [options]"""
parser = argparse.ArgumentParser(usage) parser = argparse.ArgumentParser(usage)
parser.add_argument('--force', dest='force', parser.add_argument('--force',
action="store_true", action="store_true",
default=False, help='Run tests despite possible provisioning problems.') default=False, help='Run tests despite possible provisioning problems.')
options = parser.parse_args() options = parser.parse_args()

View File

@ -211,14 +211,14 @@ def main() -> None:
parser.add_argument('--nonfatal-errors', action="store_false", default=True, parser.add_argument('--nonfatal-errors', action="store_false", default=True,
dest="fatal_errors", help="Continue past test failures to run all tests") 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", action="store_true",
default=False, default=False,
help='Compute test coverage.') help='Compute test coverage.')
parser.add_argument('--verbose-coverage', dest='verbose_coverage', parser.add_argument('--verbose-coverage',
action="store_true", action="store_true",
default=False, help='Enable verbose print of coverage report.') 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', action='store_true',
default=False, default=False,
help="Do not clean generated coverage files.") help="Do not clean generated coverage files.")
@ -229,39 +229,39 @@ def main() -> None:
default=default_parallel, default=default_parallel,
help='Specify the number of processes to run the ' help='Specify the number of processes to run the '
'tests in. Default is the number of logical CPUs') 'tests in. Default is the number of logical CPUs')
parser.add_argument('--profile', dest='profile', parser.add_argument('--profile',
action="store_true", action="store_true",
default=False, help='Profile test runtime.') default=False, help='Profile test runtime.')
parser.add_argument('--force', dest='force', parser.add_argument('--force',
action="store_true", action="store_true",
default=False, help='Run tests despite possible problems.') default=False, help='Run tests despite possible problems.')
parser.add_argument('--no-shallow', dest='no_shallow', parser.add_argument('--no-shallow',
action="store_true", action="store_true",
default=False, default=False,
help="Don't allow shallow testing of templates (deprecated)") help="Don't allow shallow testing of templates (deprecated)")
parser.add_argument('--verbose', dest='verbose', parser.add_argument('--verbose',
action="store_true", action="store_true",
default=False, default=False,
help="Show detailed output") help="Show detailed output")
parser.add_argument('--reverse', dest='reverse', parser.add_argument('--reverse',
action="store_true", action="store_true",
default=False, default=False,
help="Run tests in reverse order.") help="Run tests in reverse order.")
parser.add_argument('--rerun', dest="rerun", parser.add_argument('--rerun',
action="store_true", action="store_true",
default=False, default=False,
help=("Run the tests which failed the last time " help=("Run the tests which failed the last time "
"test-backend was run. Implies --nonfatal-errors.")) "test-backend was run. Implies --nonfatal-errors."))
parser.add_argument('--include-webhooks', dest="include_webhooks", parser.add_argument('--include-webhooks',
action="store_true", action="store_true",
default=False, default=False,
help=("Include webhook tests. By default, they are skipped for performance.")) 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", action="store_true",
default=False, default=False,
help=("Generate Stripe test fixtures by making requests to Stripe test network")) help=("Generate Stripe test fixtures by making requests to Stripe test network"))
parser.add_argument('args', nargs='*') parser.add_argument('args', nargs='*')
parser.add_argument('--ban-console-output', dest='ban_console_output', parser.add_argument('--ban-console-output',
action="store_true", action="store_true",
default=False, help='Require stdout and stderr to be clean of unexpected output.') default=False, help='Require stdout and stderr to be clean of unexpected output.')

View File

@ -164,10 +164,10 @@ EXEMPT_FILES = {
} }
parser = argparse.ArgumentParser(USAGE) parser = argparse.ArgumentParser(USAGE)
parser.add_argument('--coverage', dest='coverage', parser.add_argument('--coverage',
action="store_true", action="store_true",
default=False, help='Get coverage report') default=False, help='Get coverage report')
parser.add_argument('--force', dest='force', parser.add_argument('--force',
action="store_true", action="store_true",
default=False, help='Run tests despite possible problems.') default=False, help='Run tests despite possible problems.')
parser.add_argument('args', nargs=argparse.REMAINDER) parser.add_argument('args', nargs=argparse.REMAINDER)

View File

@ -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""" test-js-with-puppeteer 01 03 # Run a few test files, 01-login.js and 03-narrow.js here"""
parser = argparse.ArgumentParser(usage) parser = argparse.ArgumentParser(usage)
parser.add_argument('--interactive', dest='interactive', parser.add_argument('--interactive',
action="store_true", action="store_true",
default=False, help='Run tests interactively') default=False, help='Run tests interactively')
parser.add_argument('--force', dest='force', parser.add_argument('--force',
action="store_true", action="store_true",
default=False, help='Run tests despite possible problems.') default=False, help='Run tests despite possible problems.')
parser.add_argument('tests', nargs=argparse.REMAINDER, parser.add_argument('tests', nargs=argparse.REMAINDER,

View File

@ -11,7 +11,7 @@ sanity_check.check_venv(__file__)
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--coverage', dest='coverage', parser.add_argument('--coverage',
action="store_true", action="store_true",
default=False, help='compute test coverage') default=False, help='compute test coverage')
args = parser.parse_args() args = parser.parse_args()

View File

@ -112,25 +112,25 @@ def build_for_most_tests() -> None:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--test', 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)') help='generate a stub webpack-stats.json file (for backend testing)')
parser.add_argument('--quiet', parser.add_argument('--quiet',
action='store_true', dest='quiet', default=False, action='store_true', default=False,
help='Minimizes webpack output while running') help='Minimizes webpack output while running')
parser.add_argument('--watch', 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)') help='watch for changes to source files (for development)')
parser.add_argument('--host', 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') default='127.0.0.1', help='set the host for the webpack server to run on')
parser.add_argument('--port', parser.add_argument('--port',
action='store', dest='port', action='store',
default='9994', help='set the port for the webpack server to run on') default='9994', help='set the port for the webpack server to run on')
parser.add_argument('--minify', parser.add_argument('--minify',
action='store_true', dest='minify', default=False, action='store_true', default=False,
help='Minify and optimize the assets (for development)') help='Minify and optimize the assets (for development)')
parser.add_argument('--disable-host-check', 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') help='Disable host check for webpack-dev-server')
args = parser.parse_args() args = parser.parse_args()

View File

@ -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: all_users_help: str="All users in realm.") -> None:
parser.add_argument( parser.add_argument(
'-u', '--users', '-u', '--users',
dest='users',
type=str, type=str,
help=help) help=help)
parser.add_argument( parser.add_argument(
'-a', '--all-users', '-a', '--all-users',
dest='all_users',
action="store_true", action="store_true",
default=False, default=False,
help=all_users_help) help=all_users_help)

View File

@ -16,15 +16,12 @@ class Command(BaseCommand):
def add_arguments(self, parser: argparse.ArgumentParser) -> None: def add_arguments(self, parser: argparse.ArgumentParser) -> None:
parser.add_argument('--api-key', parser.add_argument('--api-key',
dest='api_key',
type=str, type=str,
help='MailChimp API key.') help='MailChimp API key.')
parser.add_argument('--list-id', parser.add_argument('--list-id',
dest='list_id',
type=str, type=str,
help='List ID of the MailChimp mailing list.') help='List ID of the MailChimp mailing list.')
parser.add_argument('--optin-time', parser.add_argument('--optin-time',
dest='optin_time',
type=str, type=str,
default=datetime.isoformat(timezone_now().replace(microsecond=0)), default=datetime.isoformat(timezone_now().replace(microsecond=0)),
help='Opt-in time of the users.') help='Opt-in time of the users.')

View File

@ -15,7 +15,6 @@ class Command(ZulipBaseCommand):
parser.add_argument( parser.add_argument(
'-s', '--streams', '-s', '--streams',
dest='streams',
type=str, type=str,
required=True, required=True,
help='A comma-separated list of stream names.') help='A comma-separated list of stream names.')

View File

@ -17,7 +17,6 @@ class Command(BaseCommand):
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-t', '--trim', parser.add_argument('-t', '--trim',
dest='trim',
default=False, default=False,
action='store_true', action='store_true',
help="Actually trim excess") help="Actually trim excess")

View File

@ -22,7 +22,6 @@ class Command(BaseCommand):
help='Directory to write exported data to.') help='Directory to write exported data to.')
parser.add_argument('--threads', parser.add_argument('--threads',
dest='threads',
action="store", action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM, default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Threads to download avatars and attachments faster') help='Threads to download avatars and attachments faster')

View File

@ -42,7 +42,7 @@ class Command(BaseCommand):
action="store_true", action="store_true",
help='Mask the content for privacy during QA.') help='Mask the content for privacy during QA.')
parser.add_argument('--slim-mode', dest='slim_mode', parser.add_argument('--slim-mode',
action="store_true", action="store_true",
help="Default to no public stream subscriptions if no token is available." + help="Default to no public stream subscriptions if no token is available." +
" See import docs for details.") " See import docs for details.")

View File

@ -25,7 +25,6 @@ class Command(BaseCommand):
help='Directory to write exported data to.') help='Directory to write exported data to.')
parser.add_argument('--threads', parser.add_argument('--threads',
dest='threads',
action="store", action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM, default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Threads to use in exporting UserMessage objects in parallel') help='Threads to use in exporting UserMessage objects in parallel')

View File

@ -18,7 +18,6 @@ Create default stream groups which the users can choose during sign up.
parser.add_argument( parser.add_argument(
'-n', '--name', '-n', '--name',
dest='name',
type=str, type=str,
required=True, required=True,
help='Name of the group you want to create.', 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( parser.add_argument(
'-d', '--description', '-d', '--description',
dest='description',
type=str, type=str,
required=True, required=True,
help='Description of the group.', help='Description of the group.',
@ -34,7 +32,6 @@ Create default stream groups which the users can choose during sign up.
parser.add_argument( parser.add_argument(
'-s', '--streams', '-s', '--streams',
dest='streams',
type=str, type=str,
required=True, required=True,
help='A comma-separated list of stream names.') help='A comma-separated list of stream names.')

View File

@ -27,7 +27,6 @@ Omit both <email> and <full name> for interactive user creation.
default=False, default=False,
help='Acknowledgement that the user has already accepted the ToS.') help='Acknowledgement that the user has already accepted the ToS.')
parser.add_argument('--password', parser.add_argument('--password',
dest='password',
type=str, type=str,
default='', default='',
help='password of new user. For development only.' 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' 'on the server via `ps -ef` or by any superuser with'
'read access to the user\'s bash history.') 'read access to the user\'s bash history.')
parser.add_argument('--password-file', parser.add_argument('--password-file',
dest='password_file',
type=str, type=str,
default='', default='',
help='The file containing the password of the new user.') help='The file containing the password of the new user.')

View File

@ -12,7 +12,6 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('-f', '--for-real', parser.add_argument('-f', '--for-real',
dest='for_real',
action='store_true', action='store_true',
default=False, default=False,
help="Actually deactivate the user. Default is a dry run.") help="Actually deactivate the user. Default is a dry run.")

View File

@ -20,7 +20,6 @@ class Command(BaseCommand):
help="Limiting value of how old the file can be.") help="Limiting value of how old the file can be.")
parser.add_argument('-f', '--for-real', parser.add_argument('-f', '--for-real',
dest='for_real',
action='store_true', action='store_true',
default=False, default=False,
help="Actually remove the files from the storage.") help="Actually remove the files from the storage.")

View File

@ -15,7 +15,6 @@ class Command(ZulipBaseCommand):
default_cutoff = time.time() - 60 * 60 * 24 * 30 # 30 days. default_cutoff = time.time() - 60 * 60 * 24 * 30 # 30 days.
self.add_realm_args(parser, True) self.add_realm_args(parser, True)
parser.add_argument('--since', parser.add_argument('--since',
dest='since',
type=int, type=int,
default=default_cutoff, default=default_cutoff,
help='The time in epoch since from which to start the dump.') help='The time in epoch since from which to start the dump.')

View File

@ -83,7 +83,6 @@ class Command(ZulipBaseCommand):
default=None, default=None,
help='Directory to write exported data to.') help='Directory to write exported data to.')
parser.add_argument('--threads', parser.add_argument('--threads',
dest='threads',
action="store", action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM, default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Threads to use in exporting UserMessage objects in parallel') help='Threads to use in exporting UserMessage objects in parallel')
@ -94,7 +93,6 @@ class Command(ZulipBaseCommand):
action="store_true", action="store_true",
help='Deactivate the realm immediately before exporting') help='Deactivate the realm immediately before exporting')
parser.add_argument('--consent-message-id', parser.add_argument('--consent-message-id',
dest="consent_message_id",
action="store", action="store",
default=None, default=None,
type=int, type=int,

View File

@ -15,17 +15,14 @@ class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--path', parser.add_argument('--path',
dest='path',
action="store", action="store",
default=None, default=None,
help='Path to find messages.json archives') help='Path to find messages.json archives')
parser.add_argument('--thread', parser.add_argument('--thread',
dest='thread',
action="store", action="store",
default=None, default=None,
help='Thread ID') help='Thread ID')
parser.add_argument('--consent-message-id', parser.add_argument('--consent-message-id',
dest="consent_message_id",
action="store", action="store",
default=None, default=None,
type=int, type=int,

View File

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

View File

@ -21,7 +21,6 @@ class Command(ZulipBaseCommand):
help='email address to spelunk') help='email address to spelunk')
parser.add_argument('--all', parser.add_argument('--all',
action='store_true', action='store_true',
dest='all',
default=False, default=False,
help='fix all users in specified realm') help='fix all users in specified realm')
self.add_realm_args(parser) self.add_realm_args(parser)

View File

@ -14,7 +14,6 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--force', parser.add_argument('--force',
dest='force',
action="store_true", action="store_true",
default=False, default=False,
help='Override that the domain is restricted to external users.') help='Override that the domain is restricted to external users.')

View File

@ -14,13 +14,11 @@ class Command(ZulipBaseCommand):
parser.add_argument( parser.add_argument(
'-s', '--streams', '-s', '--streams',
dest='streams',
type=str, type=str,
help='A comma-separated list of stream names.') help='A comma-separated list of stream names.')
parser.add_argument( parser.add_argument(
'--referred-by', '--referred-by',
dest='referred_by',
type=str, type=str,
help='Email of referrer', help='Email of referrer',
required=True, required=True,

View File

@ -16,7 +16,7 @@ class Command(BaseCommand):
parser.add_argument('app_label', nargs='?', parser.add_argument('app_label', nargs='?',
help='App label of an application to synchronize the state.') 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. ' default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
'Defaults to the "default" database.') 'Defaults to the "default" database.')

View File

@ -19,13 +19,11 @@ import a database dump from one or more JSON files."""
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('--destroy-rebuild-database', parser.add_argument('--destroy-rebuild-database',
dest='destroy_rebuild_database',
default=False, default=False,
action="store_true", action="store_true",
help='Destroys and rebuilds the databases prior to import.') help='Destroys and rebuilds the databases prior to import.')
parser.add_argument('--import-into-nonempty', parser.add_argument('--import-into-nonempty',
dest='import_into_nonempty',
default=False, default=False,
action="store_true", action="store_true",
help='Import into an existing nonempty database.') help='Import into an existing nonempty database.')
@ -37,7 +35,6 @@ import a database dump from one or more JSON files."""
metavar='<export path>', metavar='<export path>',
help="list of export directories to import") help="list of export directories to import")
parser.add_argument('--processes', parser.add_argument('--processes',
dest='processes',
action="store", action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM, default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Number of processes to use for uploading Avatars to S3 in parallel') help='Number of processes to use for uploading Avatars to S3 in parallel')

View File

@ -26,7 +26,6 @@ ONLY perform this on customer request from an authorized person.
default=True, default=True,
help='Remove an administrator\'s rights.') help='Remove an administrator\'s rights.')
parser.add_argument('--permission', parser.add_argument('--permission',
dest='permission',
action="store", action="store",
default='administer', default='administer',
choices=['administer', 'api_super_user'], choices=['administer', 'api_super_user'],

View File

@ -16,7 +16,6 @@ Usage examples:
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument("--all", parser.add_argument("--all",
dest="all",
action="store_true", action="store_true",
default=False, default=False,
help="Print all the configuration settings of the realms.") help="Print all the configuration settings of the realms.")

View File

@ -19,7 +19,7 @@ class Command(BaseCommand):
help="queue to process") help="queue to process")
parser.add_argument('--worker_num', metavar='<worker number>', type=int, nargs='?', default=0, parser.add_argument('--worker_num', metavar='<worker number>', type=int, nargs='?', default=0,
help="worker label") 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") help="run all queues")
parser.add_argument('--multi_threaded', nargs='+', parser.add_argument('--multi_threaded', nargs='+',
metavar='<list of queue name>', metavar='<list of queue name>',

View File

@ -12,7 +12,7 @@ class Command(BaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument(dest="queue_name", type=str, nargs='?', parser.add_argument(dest="queue_name", type=str, nargs='?',
help="queue to purge", default=None) help="queue to purge", default=None)
parser.add_argument('--all', dest="all", action="store_true", parser.add_argument('--all', action="store_true",
default=False, help="purge all queues") default=False, help="purge all queues")
help = "Discards all messages from the given queue" help = "Discards all messages from the given queue"

View File

@ -11,18 +11,14 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('-e', '--email', parser.add_argument('-e', '--email',
dest='email',
help="Email account of user.") help="Email account of user.")
parser.add_argument('-a', '--api-key', parser.add_argument('-a', '--api-key',
dest='api_key',
help="API key of user.") help="API key of user.")
parser.add_argument('-s', '--seconds', parser.add_argument('-s', '--seconds',
dest='seconds',
default=60, default=60,
type=int, type=int,
help="Seconds to block for.") help="Seconds to block for.")
parser.add_argument('-d', '--domain', parser.add_argument('-d', '--domain',
dest='domain',
default='api_by_user', default='api_by_user',
help="Rate-limiting domain. Defaults to 'api_by_user'.") help="Rate-limiting domain. Defaults to 'api_by_user'.")
parser.add_argument('-b', '--all-bots', parser.add_argument('-b', '--all-bots',

View File

@ -15,12 +15,10 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--op', parser.add_argument('--op',
dest='op',
type=str, type=str,
default="show", default="show",
help='What operation to do (add, show, remove).') help='What operation to do (add, show, remove).')
parser.add_argument('--allow-subdomains', parser.add_argument('--allow-subdomains',
dest='allow_subdomains',
action="store_true", action="store_true",
default=False, default=False,
help='Whether subdomains are allowed or not.') help='Whether subdomains are allowed or not.')

View File

@ -24,7 +24,6 @@ Example: ./manage.py realm_filters --realm=zulip --op=show
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--op', parser.add_argument('--op',
dest='op',
type=str, type=str,
default="show", default="show",
help='What operation to do (add, show, remove).') help='What operation to do (add, show, remove).')

View File

@ -20,12 +20,10 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--agree_to_terms_of_service', parser.add_argument('--agree_to_terms_of_service',
dest='agree_to_terms_of_service',
action='store_true', action='store_true',
default=False, default=False,
help="Agree to the Zulipchat Terms of Service: https://zulip.com/terms/.") help="Agree to the Zulipchat Terms of Service: https://zulip.com/terms/.")
parser.add_argument('--rotate-key', parser.add_argument('--rotate-key',
dest="rotate_key",
action='store_true', action='store_true',
default=False, default=False,
help="Automatically rotate your server's zulip_org_key") help="Automatically rotate your server's zulip_org_key")

View File

@ -12,7 +12,6 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-s', '--stream', parser.add_argument('-s', '--stream',
dest='stream',
required=True, required=True,
type=str, type=str,
help='A stream name.') help='A stream name.')

View File

@ -29,11 +29,9 @@ To restore a specific ArchiveTransaction:
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-d', '--restore-deleted', parser.add_argument('-d', '--restore-deleted',
dest='restore_deleted',
action='store_true', action='store_true',
help='Restore manually deleted messages.') help='Restore manually deleted messages.')
parser.add_argument('-t', '--transaction-id', parser.add_argument('-t', '--transaction-id',
dest='transaction_id',
type=int, type=int,
help='Restore a specific ArchiveTransaction.') help='Restore a specific ArchiveTransaction.')

View File

@ -19,7 +19,6 @@ class Command(ZulipBaseCommand):
parser.add_argument('--entire-server', action="store_true", default=False, parser.add_argument('--entire-server', action="store_true", default=False,
help="Send to every user on the server.") help="Send to every user on the server.")
parser.add_argument('--markdown-template-path', '--path', parser.add_argument('--markdown-template-path', '--path',
dest='markdown_template_path',
required=True, required=True,
type=str, type=str,
help='Path to a Markdown-format body for the email.') help='Path to a Markdown-format body for the email.')

View File

@ -37,14 +37,12 @@ Example:
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-f', '--fixture', parser.add_argument('-f', '--fixture',
dest='fixture',
type=str, type=str,
help='The path to the email message you\'d like to send ' help='The path to the email message you\'d like to send '
'to the email mirror.\n' 'to the email mirror.\n'
'Accepted formats: json or raw email file. ' 'Accepted formats: json or raw email file. '
'See zerver/tests/fixtures/email/ for examples') 'See zerver/tests/fixtures/email/ for examples')
parser.add_argument('-s', '--stream', parser.add_argument('-s', '--stream',
dest='stream',
type=str, type=str,
help='The name of the stream to which you\'d like to send ' help='The name of the stream to which you\'d like to send '
'the message. Default: Denmark') 'the message. Default: Denmark')

View File

@ -32,19 +32,16 @@ approach shown above.
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-f', '--fixture', parser.add_argument('-f', '--fixture',
dest='fixture',
type=str, type=str,
help='The path to the fixture you\'d like to send ' help='The path to the fixture you\'d like to send '
'into Zulip') 'into Zulip')
parser.add_argument('-u', '--url', parser.add_argument('-u', '--url',
dest='url',
type=str, type=str,
help='The url on your Zulip server that you want ' help='The url on your Zulip server that you want '
'to post the fixture to') 'to post the fixture to')
parser.add_argument('-H', '--custom-headers', parser.add_argument('-H', '--custom-headers',
dest='custom-headers',
type=str, type=str,
help='The headers you want to provide along with ' help='The headers you want to provide along with '
'your mock request to Zulip.') 'your mock request to Zulip.')
@ -71,7 +68,7 @@ approach shown above.
if not self._does_fixture_path_exist(full_fixture_path): if not self._does_fixture_path_exist(full_fixture_path):
raise CommandError('Fixture {} does not exist'.format(options['fixture'])) 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) json = self._get_fixture_as_json(full_fixture_path)
realm = self.get_realm(options) realm = self.get_realm(options)
if realm is None: if realm is None:

View File

@ -16,18 +16,15 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-l', '--for-real', parser.add_argument('-l', '--for-real',
dest='for_real',
action='store_true', action='store_true',
default=False, default=False,
help="Actually change message flags. Default is a dry run.") help="Actually change message flags. Default is a dry run.")
parser.add_argument('-f', '--flag', parser.add_argument('-f', '--flag',
dest='flag',
type=str, type=str,
help="The flag to add of remove") help="The flag to add of remove")
parser.add_argument('-o', '--op', parser.add_argument('-o', '--op',
dest='op',
type=str, type=str,
help="The operation to do: 'add' or 'remove'") help="The operation to do: 'add' or 'remove'")
@ -37,7 +34,6 @@ class Command(ZulipBaseCommand):
help="Mark all messages <= specific usermessage id") help="Mark all messages <= specific usermessage id")
parser.add_argument('-m', '--email', parser.add_argument('-m', '--email',
dest='email',
type=str, type=str,
help="Email to set messages for") help="Email to set messages for")
self.add_realm_args(parser) self.add_realm_args(parser)

View File

@ -38,12 +38,10 @@ class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
self.add_realm_args(parser) self.add_realm_args(parser)
parser.add_argument('-d', '--deactivate', parser.add_argument('-d', '--deactivate',
dest='deactivate',
action='store_true', action='store_true',
default=False, default=False,
help='Used to deactivate user/users.') help='Used to deactivate user/users.')
parser.add_argument('-a', '--activate', parser.add_argument('-a', '--activate',
dest='activate',
action='store_true', action='store_true',
default=False, default=False,
help='Used to activate user/users.') help='Used to activate user/users.')

View File

@ -53,7 +53,6 @@ def sync_ldap_user_data(user_profiles: List[UserProfile], deactivation_protectio
class Command(ZulipBaseCommand): class Command(ZulipBaseCommand):
def add_arguments(self, parser: ArgumentParser) -> None: def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('-f', '--force', parser.add_argument('-f', '--force',
dest='force',
action="store_true", action="store_true",
default=False, default=False,
help='Disable the protection against deactivating all users.') help='Disable the protection against deactivating all users.')

View File

@ -11,7 +11,6 @@ class Command(BaseCommand):
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('--processes', parser.add_argument('--processes',
dest='processes',
action="store", action="store",
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM, default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
help='Processes to use for exporting uploads in parallel') help='Processes to use for exporting uploads in parallel')

View File

@ -14,7 +14,6 @@ class Command(ZulipBaseCommand):
self.add_realm_args(parser) self.add_realm_args(parser)
parser.add_argument( parser.add_argument(
'--lookback-hours', '--lookback-hours',
dest='lookback_hours',
type=int, type=int,
help="Period a bit larger than that of the cron job that runs " help="Period a bit larger than that of the cron job that runs "
"this command so that the lookback periods are sure to overlap.", "this command so that the lookback periods are sure to overlap.",

View File

@ -160,37 +160,31 @@ class Command(BaseCommand):
def add_arguments(self, parser: CommandParser) -> None: def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument('-n', '--num-messages', parser.add_argument('-n', '--num-messages',
dest='num_messages',
type=int, type=int,
default=500, default=500,
help='The number of messages to create.') help='The number of messages to create.')
parser.add_argument('-b', '--batch-size', parser.add_argument('-b', '--batch-size',
dest='batch_size',
type=int, type=int,
default=1000, default=1000,
help='How many messages to process in a single batch') help='How many messages to process in a single batch')
parser.add_argument('--extra-users', parser.add_argument('--extra-users',
dest='extra_users',
type=int, type=int,
default=0, default=0,
help='The number of extra users to create') help='The number of extra users to create')
parser.add_argument('--extra-bots', parser.add_argument('--extra-bots',
dest='extra_bots',
type=int, type=int,
default=0, default=0,
help='The number of extra bots to create') help='The number of extra bots to create')
parser.add_argument('--extra-streams', parser.add_argument('--extra-streams',
dest='extra_streams',
type=int, type=int,
default=0, default=0,
help='The number of extra streams to create') help='The number of extra streams to create')
parser.add_argument('--max-topics', parser.add_argument('--max-topics',
dest='max_topics',
type=int, type=int,
default=None, default=None,
help='The number of maximum topics to create') help='The number of maximum topics to create')
@ -208,25 +202,21 @@ class Command(BaseCommand):
help='The number of personal pairs to create.') help='The number of personal pairs to create.')
parser.add_argument('--threads', parser.add_argument('--threads',
dest='threads',
type=int, type=int,
default=1, default=1,
help='The number of threads to use.') help='The number of threads to use.')
parser.add_argument('--percent-huddles', parser.add_argument('--percent-huddles',
dest='percent_huddles',
type=float, type=float,
default=15, default=15,
help='The percent of messages to be huddles.') help='The percent of messages to be huddles.')
parser.add_argument('--percent-personals', parser.add_argument('--percent-personals',
dest='percent_personals',
type=float, type=float,
default=15, default=15,
help='The percent of messages to be personals.') help='The percent of messages to be personals.')
parser.add_argument('--stickyness', parser.add_argument('--stickyness',
dest='stickyness',
type=float, type=float,
default=20, default=20,
help='The percent of messages to repeat recent folks.') help='The percent of messages to repeat recent folks.')