Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Lib/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def main(args=None):

parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('infile', nargs='?', default='-',
help='the file to parse; defaults to stdin')
help='the file to parse; defaults to `stdin`')
parser.add_argument('-m', '--mode', default='exec',
choices=('exec', 'single', 'eval', 'func_type'),
help='specify what kind of code must be parsed')
Expand All @@ -679,8 +679,8 @@ def main(args=None):
help='indentation of nodes (number of spaces)')
parser.add_argument('--feature-version',
type=str, default=None, metavar='VERSION',
help='Python version in the format 3.x '
'(for example, 3.10)')
help='Python version in the format `3.x` '
'(for example, `3.10`)')
parser.add_argument('-O', '--optimize',
type=int, default=-1, metavar='LEVEL',
help='optimization level for parser')
Expand Down
1 change: 0 additions & 1 deletion Lib/asyncio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def interrupt(self) -> None:
parser = argparse.ArgumentParser(
prog="python3 -m asyncio",
description="Interactive asyncio shell and CLI tools",
color=True,
)
subparsers = parser.add_subparsers(help="sub-commands", dest="command")
ps = subparsers.add_parser(
Expand Down
2 changes: 1 addition & 1 deletion Lib/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ def main(args=None):
"-t", "--type",
default="text",
choices=("text", "html"),
help="output type (text or html)"
help="output type (`text` or `html`)"
)
parser.add_argument(
"-f", "--first-weekday",
Expand Down
2 changes: 1 addition & 1 deletion Lib/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def interact(banner=None, readfunc=None, local=None, exitmsg=None, local_exit=Fa
if __name__ == "__main__":
import argparse

parser = argparse.ArgumentParser(color=True)
parser = argparse.ArgumentParser()
parser.add_argument('-q', action='store_true',
help="don't print version and copyright messages")
args = parser.parse_args()
Expand Down
23 changes: 11 additions & 12 deletions Lib/compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ def main():

parser = argparse.ArgumentParser(
description='Utilities to support installing Python libraries.',
color=True,
)
parser.add_argument('-l', action='store_const', const=0,
default=None, dest='maxlevels',
Expand All @@ -338,10 +337,10 @@ def main():
parser.add_argument('-f', action='store_true', dest='force',
help='force rebuild even if timestamps are up to date')
parser.add_argument('-q', action='count', dest='quiet', default=0,
help='output only error messages; -qq will suppress '
help='output only error messages; `-qq` will suppress '
'the error messages as well.')
parser.add_argument('-b', action='store_true', dest='legacy',
help='use legacy (pre-PEP3147) compiled file locations')
help='use legacy (pre-PEP 3147) compiled file locations')
parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None,
help=('directory to prepend to file paths for use in '
'compile-time tracebacks and in runtime '
Expand All @@ -367,28 +366,28 @@ def main():
'of each file considered for compilation'))
parser.add_argument('-i', metavar='FILE', dest='flist',
help=('add all the files and directories listed in '
'FILE to the list considered for compilation; '
'if "-", names are read from stdin'))
'`FILE` to the list considered for compilation; '
'if `"-"`, names are read from `stdin`'))
parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*',
help=('zero or more file and directory names '
'to compile; if no arguments given, defaults '
'to the equivalent of -l sys.path'))
'to the equivalent of `-l` `sys.path`'))
parser.add_argument('-j', '--workers', default=1,
type=int, help='Run compileall concurrently')
invalidation_modes = [mode.name.lower().replace('_', '-')
for mode in py_compile.PycInvalidationMode]
parser.add_argument('--invalidation-mode',
choices=sorted(invalidation_modes),
help=('set .pyc invalidation mode; defaults to '
'"checked-hash" if the SOURCE_DATE_EPOCH '
help=('set `.pyc` invalidation mode; defaults to '
'`"checked-hash"` if the `SOURCE_DATE_EPOCH` '
'environment variable is set, and '
'"timestamp" otherwise.'))
'`"timestamp"` otherwise.'))
parser.add_argument('-o', action='append', type=int, dest='opt_levels',
help=('Optimization levels to run compilation with. '
'Default is -1 which uses the optimization level '
'of the Python interpreter itself (see -O).'))
'Default is `-1` which uses the optimization level '
'of the Python interpreter itself (see `-O`).'))
parser.add_argument('-e', metavar='DIR', dest='limit_sl_dest',
help='Ignore symlinks pointing outsite of the DIR')
help='Ignore symlinks pointing outsite of the `DIR`')
parser.add_argument('--hardlink-dupes', action='store_true',
dest='hardlink_dupes',
help='Hardlink duplicated pyc files')
Expand Down
2 changes: 1 addition & 1 deletion Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ def dis(self):
def main(args=None):
import argparse

parser = argparse.ArgumentParser(color=True)
parser = argparse.ArgumentParser()
parser.add_argument('-C', '--show-caches', action='store_true',
help='show inline caches')
parser.add_argument('-O', '--show-offsets', action='store_true',
Expand Down
6 changes: 3 additions & 3 deletions Lib/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2951,7 +2951,7 @@ def get(self):
def _test():
import argparse

parser = argparse.ArgumentParser(description="doctest runner", color=True)
parser = argparse.ArgumentParser(description="doctest runner")
parser.add_argument('-v', '--verbose', action='store_true', default=False,
help='print very verbose output for all tests')
parser.add_argument('-o', '--option', action='append',
Expand All @@ -2961,8 +2961,8 @@ def _test():
' than once to apply multiple options'))
parser.add_argument('-f', '--fail-fast', action='store_true',
help=('stop running tests after first failure (this'
' is a shorthand for -o FAIL_FAST, and is'
' in addition to any other -o options)'))
' is a shorthand for `-o FAIL_FAST`, and is'
' in addition to any other `-o` options)'))
parser.add_argument('file', nargs='+',
help='file containing the tests to run')
args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion Lib/ensurepip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _uninstall_helper(*, verbosity=0):

def _main(argv=None):
import argparse
parser = argparse.ArgumentParser(color=True)
parser = argparse.ArgumentParser()
parser.add_argument(
"--version",
action="version",
Expand Down
5 changes: 2 additions & 3 deletions Lib/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,14 @@ def decompress(data):
def main():
from argparse import ArgumentParser
parser = ArgumentParser(description=
"A simple command line interface for the gzip module: act like gzip, "
"A simple command line interface for the `gzip` module: act like `gzip`, "
"but do not delete the input file.",
color=True,
)
group = parser.add_mutually_exclusive_group()
group.add_argument('--fast', action='store_true', help='compress faster')
group.add_argument('--best', action='store_true', help='compress better')
group.add_argument("-d", "--decompress", action="store_true",
help="act like gunzip instead of gzip")
help="act like `gunzip` instead of `gzip`")

parser.add_argument("args", nargs="*", default=["-"], metavar='file')
args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion Lib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ def _main(args=None):
import argparse
import contextlib

parser = argparse.ArgumentParser(color=True)
parser = argparse.ArgumentParser()
parser.add_argument('-b', '--bind', metavar='ADDRESS',
help='bind to this address '
'(default: all interfaces)')
Expand Down
4 changes: 2 additions & 2 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3445,11 +3445,11 @@ def _main():
import argparse
import importlib

parser = argparse.ArgumentParser(color=True)
parser = argparse.ArgumentParser()
parser.add_argument(
'object',
help="The object to be analysed. "
"It supports the 'module:qualname' syntax")
"It supports the `module:qualname` syntax")
parser.add_argument(
'-d', '--details', action='store_true',
help='Display info about the module rather than its source code')
Expand Down
8 changes: 4 additions & 4 deletions Lib/json/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ def _replace_match_callback(match):
def main():
description = ('A simple command line interface for json module '
'to validate and pretty-print JSON objects.')
parser = argparse.ArgumentParser(description=description, color=True)
parser = argparse.ArgumentParser(description=description)
parser.add_argument('infile', nargs='?',
help='a JSON file to be validated or pretty-printed; '
'defaults to stdin',
'defaults to `stdin`',
default='-')
parser.add_argument('outfile', nargs='?',
help='write the output of infile to outfile',
help='write the output of `infile` to `outfile`',
default=None)
parser.add_argument('--sort-keys', action='store_true', default=False,
help='sort the output of dictionaries alphabetically by key')
parser.add_argument('--no-ensure-ascii', dest='ensure_ascii', action='store_false',
help='disable escaping of non-ASCII characters')
parser.add_argument('--json-lines', action='store_true', default=False,
help='parse input using the JSON Lines format. '
'Use with --no-indent or --compact to produce valid JSON Lines output.')
'Use with `--no-indent` or `--compact` to produce valid JSON Lines output.')
group = parser.add_mutually_exclusive_group()
group.add_argument('--indent', default=4, type=int,
help='separate items with newlines and use this number '
Expand Down
2 changes: 1 addition & 1 deletion Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def _parse_args(args):
from argparse import ArgumentParser

parser = ArgumentParser(
description='map filename extensions to MIME types', color=True
description='map filename extensions to MIME types',
)
parser.add_argument(
'-e', '--extension',
Expand Down
3 changes: 1 addition & 2 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3757,13 +3757,12 @@ def parse_args():
description=_usage,
formatter_class=argparse.RawDescriptionHelpFormatter,
allow_abbrev=False,
color=True,
)

# Get all the commands out first. For backwards compatibility, we allow
# -c commands to be after the target.
parser.add_argument('-c', '--command', action='append', default=[], metavar='command', dest='commands',
help='pdb commands to execute as if given in a .pdbrc file')
help='pdb commands to execute as if given in a `.pdbrc` file')

opts, args = parser.parse_known_args()

Expand Down
1 change: 0 additions & 1 deletion Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,6 @@ def _main(args=None):
import pprint
parser = argparse.ArgumentParser(
description='display contents of the pickle files',
color=True,
)
parser.add_argument(
'pickle_file',
Expand Down
2 changes: 1 addition & 1 deletion Lib/pickletools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ def _main(args=None):
help='preserve memo between disassemblies')
parser.add_argument(
'-l', '--indentlevel', default=4, type=int,
help='the number of blanks by which to indent a new MARK level')
help='the number of blanks by which to indent a new `MARK` level')
parser.add_argument(
'-a', '--annotate', action='store_true',
help='annotate each line with a short opcode description')
Expand Down
2 changes: 1 addition & 1 deletion Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ def invalidate_caches():
def _parse_args(args: list[str] | None):
import argparse

parser = argparse.ArgumentParser(color=True)
parser = argparse.ArgumentParser()
parser.add_argument("args", nargs="*", choices=["nonaliased", "terse"])
parser.add_argument(
"--terse",
Expand Down
26 changes: 13 additions & 13 deletions Lib/profiling/sampling/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,13 @@ def _add_sampling_options(parser):
sampling_group.add_argument(
"--native",
action="store_true",
help='Include artificial "<native>" frames to denote calls to non-Python code',
help='Include artificial `<native>` frames to denote calls to non-Python code',
)
sampling_group.add_argument(
"--no-gc",
action="store_false",
dest="gc",
help='Don\'t include artificial "<GC>" frames to denote active garbage collection',
help='Don\'t include artificial `<GC>` frames to denote active garbage collection',
)
sampling_group.add_argument(
"--opcodes",
Expand Down Expand Up @@ -432,14 +432,14 @@ def _add_mode_options(parser):
help="Sampling mode: wall (all samples), cpu (only samples when thread is on CPU), "
"gil (only samples when thread holds the GIL), "
"exception (only samples when thread has an active exception). "
"Incompatible with --async-aware",
"Incompatible with `--async-aware`",
)
mode_group.add_argument(
"--async-mode",
choices=["running", "all"],
default="running",
help='Async profiling mode: "running" (only running task) '
'or "all" (all tasks including waiting). Requires --async-aware',
'or "all" (all tasks including waiting). Requires `--async-aware`',
)


Expand Down Expand Up @@ -486,15 +486,15 @@ def _add_format_options(parser, include_compression=True, include_binary=True):
"--diff-flamegraph",
metavar="BASELINE",
action=DiffFlamegraphAction,
help="Generate differential flamegraph comparing current profile to BASELINE binary file",
help="Generate differential flamegraph comparing current profile to `BASELINE` binary file",
)
if include_binary:
format_group.add_argument(
"--binary",
action="store_const",
const="binary",
dest="format",
help="Generate high-performance binary format (use 'replay' command to convert)",
help="Generate high-performance binary format (use `replay` command to convert)",
)
parser.set_defaults(format="pstats", diff_baseline=None)

Expand All @@ -510,14 +510,14 @@ def _add_format_options(parser, include_compression=True, include_binary=True):
"-o",
"--output",
dest="outfile",
help="Output path (default: stdout for pstats text; with -o, pstats is binary). "
"Auto-generated for other formats. For heatmap: directory name (default: heatmap_PID)",
help="Output path (default: `stdout` for `pstats` text; with `-o`, `pstats` is binary). "
"Auto-generated for other formats. For heatmap: directory name (default: `heatmap_PID`)",
)
output_group.add_argument(
"--browser",
action="store_true",
help="Automatically open HTML output (flamegraph, heatmap) in browser. "
"When using --subprocesses, only the main process opens the browser",
"When using `--subprocesses`, only the main process opens the browser",
)


Expand Down Expand Up @@ -564,13 +564,13 @@ def _add_dump_options(parser):
dump_group.add_argument(
"--native",
action="store_true",
help='Include artificial "<native>" frames to denote calls to non-Python code',
help='Include artificial `<native>` frames to denote calls to non-Python code',
)
dump_group.add_argument(
"--no-gc",
action="store_false",
dest="gc",
help='Don\'t include artificial "<GC>" frames to denote active garbage collection',
help='Don\'t include artificial `<GC>` frames to denote active garbage collection',
)
dump_group.add_argument(
"--opcodes",
Expand All @@ -588,7 +588,7 @@ def _add_dump_options(parser):
default=argparse.SUPPRESS,
help='Async stack mode: "running" (only running task) '
'or "all" (all tasks including waiting, default for dump). '
"Requires --async-aware",
"Requires `--async-aware`",
)
dump_group.add_argument(
"--blocking",
Expand Down Expand Up @@ -998,7 +998,7 @@ def _main():
"-m",
"--module",
action="store_true",
help="Run target as a module (like python -m)",
help="Run target as a module (like `python -m`)",
)
run_parser.add_argument(
"target",
Expand Down
2 changes: 1 addition & 1 deletion Lib/py_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def main():
import argparse

description = 'A simple command-line interface for py_compile module.'
parser = argparse.ArgumentParser(description=description, color=True)
parser = argparse.ArgumentParser(description=description)
parser.add_argument(
'-q', '--quiet',
action='store_true',
Expand Down
Loading
Loading