chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
4ac89b67-35a9-4ecd-9e23-b284aa1be90d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,068
supabase-export-v2
d3e55f7c417c6139
``'*'``. Note that when nargs_ is ``None`` (the default) or ``'?'``, each character of the argument string will be appended to the list. Example usage:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument("--foo", action="extend", nargs="+", type=str) >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f...
trusted_official_docs
CPython Docs
``'*'``. Note that when nargs_ is ``None`` (the default) or ``'?'``, each character of the argument string will be appended to the list. Example usage:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument("--foo", action="extend", nargs="+", type=str) >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f...
``'*'``. Note that when nargs_ is ``None`` (the default) or ``'?'``, each character of the argument string will be appended to the list. Example usage:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument("--foo", action="extend", nargs="+", type=str) >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4be5a00d-769c-4348-94d6-17b5ce932362
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,062
supabase-export-v2
4cb6087aa51f321e
``'store_true'`` and ``'store_false'`` - These are special cases of ``'store_const'`` that respectively store the values ``True`` and ``False`` with default values of ``False`` and ``True``:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('--bar', ...
trusted_official_docs
CPython Docs
``'store_true'`` and ``'store_false'`` - These are special cases of ``'store_const'`` that respectively store the values ``True`` and ``False`` with default values of ``False`` and ``True``:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('--bar', ...
``'store_true'`` and ``'store_false'`` - These are special cases of ``'store_const'`` that respectively store the values ``True`` and ``False`` with default values of ``False`` and ``True``:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('--bar', ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4c70a79d-c114-44eb-9811-481914a34386
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,064
supabase-export-v2
214abb45b493c716
parsed value will start with the default list's elements and any values from the command line will be appended after those default values. Example usage:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append', default=['0']) >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace...
trusted_official_docs
CPython Docs
parsed value will start with the default list's elements and any values from the command line will be appended after those default values. Example usage:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append', default=['0']) >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace...
parsed value will start with the default list's elements and any values from the command line will be appended after those default values. Example usage:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append', default=['0']) >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4ed5d2ac-45ba-4801-8468-00ea4ef2d281
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,953
supabase-export-v2
3f37114eb9de8839
.. class:: RawDescriptionHelpFormatter RawTextHelpFormatter ArgumentDefaultsHelpFormatter MetavarTypeHelpFormatter :class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ ...
trusted_official_docs
CPython Docs
.. class:: RawDescriptionHelpFormatter RawTextHelpFormatter ArgumentDefaultsHelpFormatter MetavarTypeHelpFormatter :class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ ...
.. class:: RawDescriptionHelpFormatter RawTextHelpFormatter ArgumentDefaultsHelpFormatter MetavarTypeHelpFormatter :class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4f14b180-e0f4-4376-8cf3-b76d70df20c4
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,967
supabase-export-v2
b230ce13a43b11ca
options: -h, --help show this help message and exit --foo FOO FOO! (default: 42) :class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does)::
trusted_official_docs
CPython Docs
options: -h, --help show this help message and exit --foo FOO FOO! (default: 42) :class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does)::
options: -h, --help show this help message and exit --foo FOO FOO! (default: 42) :class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does)::
python, official-docs, cpython, P0
Local_Trusted_Corpus
523cf16e-d99b-428c-b45e-899b4907d005
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,124
supabase-export-v2
1f320fc50ed1b13b
hyphenated(string): ... return '-'.join([word[:4] for word in string.casefold().split()]) ... >>> parser = argparse.ArgumentParser() >>> _ = parser.add_argument('short_title', type=hyphenated) >>> parser.parse_args(['"The Tale of Two Cities"']) Namespace(short_title='"the-tale-of-two-citi') The :func:`bool` function is...
trusted_official_docs
CPython Docs
hyphenated(string): ... return '-'.join([word[:4] for word in string.casefold().split()]) ... >>> parser = argparse.ArgumentParser() >>> _ = parser.add_argument('short_title', type=hyphenated) >>> parser.parse_args(['"The Tale of Two Cities"']) Namespace(short_title='"the-tale-of-two-citi') The :func:`bool` function is...
hyphenated(string): ... return '-'.join([word[:4] for word in string.casefold().split()]) ... >>> parser = argparse.ArgumentParser() >>> _ = parser.add_argument('short_title', type=hyphenated) >>> parser.parse_args(['"The Tale of Two Cities"']) Namespace(short_title='"the-tale-of-two-citi') The :func:`bool` function is...
python, official-docs, cpython, P0
Local_Trusted_Corpus
535b1421-dd4a-4677-98ba-6a64a315f29e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,054
supabase-export-v2
788139f8ff921f09
arguments, the dest_ parameter defaults to the argument name, with underscores ``_`` replacing hyphens ``-``. The metavar_ parameter defaults to the upper-cased name. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo-bar') >>> parser.parse_args(['--foo-bar', 'FOO-BAR']) N...
trusted_official_docs
CPython Docs
arguments, the dest_ parameter defaults to the argument name, with underscores ``_`` replacing hyphens ``-``. The metavar_ parameter defaults to the upper-cased name. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo-bar') >>> parser.parse_args(['--foo-bar', 'FOO-BAR']) N...
arguments, the dest_ parameter defaults to the argument name, with underscores ``_`` replacing hyphens ``-``. The metavar_ parameter defaults to the upper-cased name. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo-bar') >>> parser.parse_args(['--foo-bar', 'FOO-BAR']) N...
python, official-docs, cpython, P0
Local_Trusted_Corpus
580da127-b600-4b68-9201-e643d425d7cc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,996
supabase-export-v2
7e808793f74707e6
override any older arguments with the same option string. To get this behavior, the value ``'resolve'`` can be supplied to the ``conflict_handler=`` argument of :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve') >>> parser.add_argument('-f', '--foo', help='old foo h...
trusted_official_docs
CPython Docs
override any older arguments with the same option string. To get this behavior, the value ``'resolve'`` can be supplied to the ``conflict_handler=`` argument of :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve') >>> parser.add_argument('-f', '--foo', help='old foo h...
override any older arguments with the same option string. To get this behavior, the value ``'resolve'`` can be supplied to the ``conflict_handler=`` argument of :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve') >>> parser.add_argument('-f', '--foo', help='old foo h...
python, official-docs, cpython, P0
Local_Trusted_Corpus
589e2f73-5b87-49de-ae47-8984077242df
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,998
supabase-export-v2
001fc16ed0e59d4a
options: -h, --help show this help message and exit -f FOO old foo help --foo FOO new foo help Note that :class:`ArgumentParser` objects only remove an action if all of its option strings are overridden. So, in the example above, the old ``-f/--foo`` action is retained as the ``-f`` action, because only the ``--foo`` o...
trusted_official_docs
CPython Docs
options: -h, --help show this help message and exit -f FOO old foo help --foo FOO new foo help Note that :class:`ArgumentParser` objects only remove an action if all of its option strings are overridden. So, in the example above, the old ``-f/--foo`` action is retained as the ``-f`` action, because only the ``--foo`` o...
options: -h, --help show this help message and exit -f FOO old foo help --foo FOO new foo help Note that :class:`ArgumentParser` objects only remove an action if all of its option strings are overridden. So, in the example above, the old ``-f/--foo`` action is retained as the ``-f`` action, because only the ``--foo`` o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
59a4e7fe-5de8-4c56-99fa-7b996e1f33c4
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,321
supabase-export-v2
05f3e3b2b682f057
:meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance. .. deprecated:: 3.14 Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated.
trusted_official_docs
CPython Docs
:meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance. .. deprecated:: 3.14 Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated.
:meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance. .. deprecated:: 3.14 Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a26d47e-a185-4871-bbf7-9c9916692337
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,307
supabase-export-v2
1b2817c8944eb117
files. In this case, it would be better to wait until after the parser has run and then use the :keyword:`with`-statement to manage the files. .. versionchanged:: 3.4 Added the *encoding* and *errors* parameters.
trusted_official_docs
CPython Docs
files. In this case, it would be better to wait until after the parser has run and then use the :keyword:`with`-statement to manage the files. .. versionchanged:: 3.4 Added the *encoding* and *errors* parameters.
files. In this case, it would be better to wait until after the parser has run and then use the :keyword:`with`-statement to manage the files. .. versionchanged:: 3.4 Added the *encoding* and *errors* parameters.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a5c5171-159d-4d74-ad60-bafc4af76e5e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,997
supabase-export-v2
5e009af2d3870fa2
>>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') >>> parser.print_help() usage: PROG [-h] [-f FOO] [--foo FOO] options: -h, --help show this help message and exit -f FOO old f...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') >>> parser.print_help() usage: PROG [-h] [-f FOO] [--foo FOO] options: -h, --help show this help message and exit -f FOO old f...
>>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') >>> parser.print_help() usage: PROG [-h] [-f FOO] [--foo FOO] options: -h, --help show this help message and exit -f FOO old f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5af7ff2c-92be-431e-99b1-91bdc30e9c2d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,282
supabase-export-v2
92d35405af16309b
{foo,bar} additional help One particularly effective way of handling subcommands is to combine the use of the :meth:`~ArgumentParser.add_subparsers` method with calls to :meth:`~ArgumentParser.set_defaults` so that each subparser knows which Python function it should execute. For example::
trusted_official_docs
CPython Docs
{foo,bar} additional help One particularly effective way of handling subcommands is to combine the use of the :meth:`~ArgumentParser.add_subparsers` method with calls to :meth:`~ArgumentParser.set_defaults` so that each subparser knows which Python function it should execute. For example::
{foo,bar} additional help One particularly effective way of handling subcommands is to combine the use of the :meth:`~ArgumentParser.add_subparsers` method with calls to :meth:`~ArgumentParser.set_defaults` so that each subparser knows which Python function it should execute. For example::
python, official-docs, cpython, P0
Local_Trusted_Corpus
6028c337-9ad8-4f60-82f5-bd19694ace21
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,294
supabase-export-v2
9f0c8968824d728c
The *aliases* argument allows providing alternative names for this sub-command. For example:: >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers() >>> checkout = subparsers.add_parser('checkout', aliases=['co']) >>> checkout.add_argument('foo') >>> parser.parse_args(['co', 'bar']) Namesp...
trusted_official_docs
CPython Docs
The *aliases* argument allows providing alternative names for this sub-command. For example:: >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers() >>> checkout = subparsers.add_parser('checkout', aliases=['co']) >>> checkout.add_argument('foo') >>> parser.parse_args(['co', 'bar']) Namesp...
The *aliases* argument allows providing alternative names for this sub-command. For example:: >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers() >>> checkout = subparsers.add_parser('checkout', aliases=['co']) >>> checkout.add_argument('foo') >>> parser.parse_args(['co', 'bar']) Namesp...
python, official-docs, cpython, P0
Local_Trusted_Corpus
609ece37-7ed5-42a3-a4b6-f71b98f9fac0
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,047
supabase-export-v2
ca9a97c92e70276b
a list of filenames, is expected. The first arguments passed to :meth:`~ArgumentParser.add_argument` must therefore be either a series of flags, or a simple argument name. For example, an optional argument could be created like::
trusted_official_docs
CPython Docs
a list of filenames, is expected. The first arguments passed to :meth:`~ArgumentParser.add_argument` must therefore be either a series of flags, or a simple argument name. For example, an optional argument could be created like::
a list of filenames, is expected. The first arguments passed to :meth:`~ArgumentParser.add_argument` must therefore be either a series of flags, or a simple argument name. For example, an optional argument could be created like::
python, official-docs, cpython, P0
Local_Trusted_Corpus
62397421-8fe9-4764-8853-ed15e10eff43
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,378
supabase-export-v2
ae0b71b4f2eba770
and will raise exceptions if unsupported features are used. In particular, subparsers, and mutually exclusive groups that include both optionals and positionals are not supported. The following example shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_ar...
trusted_official_docs
CPython Docs
and will raise exceptions if unsupported features are used. In particular, subparsers, and mutually exclusive groups that include both optionals and positionals are not supported. The following example shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_ar...
and will raise exceptions if unsupported features are used. In particular, subparsers, and mutually exclusive groups that include both optionals and positionals are not supported. The following example shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_ar...
python, official-docs, cpython, P0
Local_Trusted_Corpus
627450a1-f63d-45a6-bbb2-5491597b5b43
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,993
supabase-export-v2
4f4300dce76b2692
conflict_handler ^^^^^^^^^^^^^^^^ :class:`ArgumentParser` objects do not allow two actions with the same option string. By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use::
trusted_official_docs
CPython Docs
conflict_handler ^^^^^^^^^^^^^^^^ :class:`ArgumentParser` objects do not allow two actions with the same option string. By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use::
conflict_handler ^^^^^^^^^^^^^^^^ :class:`ArgumentParser` objects do not allow two actions with the same option string. By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use::
python, official-docs, cpython, P0
Local_Trusted_Corpus
63944048-d1cf-4224-a2d7-68c36a488791
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,171
supabase-export-v2
7b3955378b63a7c0
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('bar') >>> parser.parse_args(['XXX']) Namespace(bar='XXX') For optional argument actions, the value of ``dest`` is normally inferred from the option strings. :class:`ArgumentParser` generates the value of ``dest`` by taking the first double-dash long option...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('bar') >>> parser.parse_args(['XXX']) Namespace(bar='XXX') For optional argument actions, the value of ``dest`` is normally inferred from the option strings. :class:`ArgumentParser` generates the value of ``dest`` by taking the first double-dash long option...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('bar') >>> parser.parse_args(['XXX']) Namespace(bar='XXX') For optional argument actions, the value of ``dest`` is normally inferred from the option strings. :class:`ArgumentParser` generates the value of ``dest`` by taking the first double-dash long option...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6513b9c7-3703-4663-80eb-37bf7ccf7061
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,900
supabase-export-v2
8e39ef6173ca6257
* prefix_chars_ - The set of characters that prefix optional arguments (default: '-') * fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)
trusted_official_docs
CPython Docs
* prefix_chars_ - The set of characters that prefix optional arguments (default: '-') * fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)
* prefix_chars_ - The set of characters that prefix optional arguments (default: '-') * fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)
python, official-docs, cpython, P0
Local_Trusted_Corpus
655cf5d3-2c6a-49b2-bd56-4f901577d341
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,103
supabase-export-v2
2d63ee1b3cb38973
default ^^^^^^^ All optional arguments and some positional arguments may be omitted at the command line. The ``default`` keyword argument of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, specifies what value should be used if the command-line argument is not present. For optional arguments, th...
trusted_official_docs
CPython Docs
default ^^^^^^^ All optional arguments and some positional arguments may be omitted at the command line. The ``default`` keyword argument of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, specifies what value should be used if the command-line argument is not present. For optional arguments, th...
default ^^^^^^^ All optional arguments and some positional arguments may be omitted at the command line. The ``default`` keyword argument of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, specifies what value should be used if the command-line argument is not present. For optional arguments, th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
65881737-babb-440d-8339-d720bd223c36
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,196
supabase-export-v2
78f292df98a9da51
flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively:: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action=argparse.BooleanOptionalA...
trusted_official_docs
CPython Docs
flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively:: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action=argparse.BooleanOptionalA...
flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively:: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action=argparse.BooleanOptionalA...
python, official-docs, cpython, P0
Local_Trusted_Corpus
65c32741-59dd-43f2-bbb5-8b242fa0e682
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,303
supabase-export-v2
fdd465afeba08660
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0)) >>> parser.add_argument('out', type=argparse.FileType('w', encoding='UTF-8')) >>> parser.parse_args(['--raw', 'raw.dat', 'file.txt']) Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0)) >>> parser.add_argument('out', type=argparse.FileType('w', encoding='UTF-8')) >>> parser.parse_args(['--raw', 'raw.dat', 'file.txt']) Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0)) >>> parser.add_argument('out', type=argparse.FileType('w', encoding='UTF-8')) >>> parser.parse_args(['--raw', 'raw.dat', 'file.txt']) Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=...
python, official-docs, cpython, P0
Local_Trusted_Corpus
660c5252-e75b-4004-9cb7-2cc4b57b1347
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,082
supabase-export-v2
612ee1cb7c74b9ff
to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are: * ``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::
trusted_official_docs
CPython Docs
to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are: * ``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::
to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are: * ``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::
python, official-docs, cpython, P0
Local_Trusted_Corpus
668f52db-d4d8-484d-a294-0a7f08b5a4ba
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,009
supabase-export-v2
f8a5c31307de78bb
invalid argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will print a *message* to :data:`sys.stderr` and exit with a status code of 2. If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``::
trusted_official_docs
CPython Docs
invalid argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will print a *message* to :data:`sys.stderr` and exit with a status code of 2. If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``::
invalid argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will print a *message* to :data:`sys.stderr` and exit with a status code of 2. If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``::
python, official-docs, cpython, P0
Local_Trusted_Corpus
68362446-feb4-4b60-8bcd-9975e2de161e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,972
supabase-export-v2
8a0d3c4906fe1102
prefix_chars ^^^^^^^^^^^^ Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. Parsers that need to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::
trusted_official_docs
CPython Docs
prefix_chars ^^^^^^^^^^^^ Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. Parsers that need to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::
prefix_chars ^^^^^^^^^^^^ Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. Parsers that need to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::
python, official-docs, cpython, P0
Local_Trusted_Corpus
68fea55c-ae5a-4b7a-b4ed-edd87eaf66e8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,173
supabase-export-v2
f47e6700e22bac3d
parser.add_argument('-q', '-quz') >>> parser.add_argument('-x', '-y') >>> parser.parse_args('-f 1 -q 2 -x 3'.split()) Namespace(foo_bar='1', quz='2', x='3') >>> parser.parse_args('--foo 1 -quz 2 -y 3'.split()) Namespace(foo_bar='1', quz='2', x='2') ``dest`` allows a custom attribute name to be provided::
trusted_official_docs
CPython Docs
parser.add_argument('-q', '-quz') >>> parser.add_argument('-x', '-y') >>> parser.parse_args('-f 1 -q 2 -x 3'.split()) Namespace(foo_bar='1', quz='2', x='3') >>> parser.parse_args('--foo 1 -quz 2 -y 3'.split()) Namespace(foo_bar='1', quz='2', x='2') ``dest`` allows a custom attribute name to be provided::
parser.add_argument('-q', '-quz') >>> parser.add_argument('-x', '-y') >>> parser.parse_args('-f 1 -q 2 -x 3'.split()) Namespace(foo_bar='1', quz='2', x='3') >>> parser.parse_args('--foo 1 -quz 2 -y 3'.split()) Namespace(foo_bar='1', quz='2', x='2') ``dest`` allows a custom attribute name to be provided::
python, official-docs, cpython, P0
Local_Trusted_Corpus
6b1e220d-1d88-4784-ae19-6ef2703cd803
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,258
supabase-export-v2
965be5183b5a1cad
- usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument * *parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)
trusted_official_docs
CPython Docs
- usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument * *parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)
- usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument * *parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)
python, official-docs, cpython, P0
Local_Trusted_Corpus
6ba91ae3-0d4e-459a-a220-fa4e46da1977
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,379
supabase-export-v2
89e5fe789581da7b
shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns ``['2', '3']`` as unparsed arguments, while the latter collects all the positionals into ``rest``. :: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> ...
trusted_official_docs
CPython Docs
shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns ``['2', '3']`` as unparsed arguments, while the latter collects all the positionals into ``rest``. :: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> ...
shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns ``['2', '3']`` as unparsed arguments, while the latter collects all the positionals into ``rest``. :: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6c770410-78ce-4c5c-b369-c4bcc9c9fdb6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,090
supabase-export-v2
ccb707c14e48eb84
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('infile', nargs='?') >>> parser.add_argument('outfile', nargs='?') >>> parser.parse_args(['input.txt', 'output.txt']) Namespace(infile='input.txt', outfile='output.txt') >>> parser.parse_args(['input.txt']) Namespace(infile='input.txt', outfile=None) >>> pa...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('infile', nargs='?') >>> parser.add_argument('outfile', nargs='?') >>> parser.parse_args(['input.txt', 'output.txt']) Namespace(infile='input.txt', outfile='output.txt') >>> parser.parse_args(['input.txt']) Namespace(infile='input.txt', outfile=None) >>> pa...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('infile', nargs='?') >>> parser.add_argument('outfile', nargs='?') >>> parser.parse_args(['input.txt', 'output.txt']) Namespace(infile='input.txt', outfile='output.txt') >>> parser.parse_args(['input.txt']) Namespace(infile='input.txt', outfile=None) >>> pa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6c7b1456-e3ce-42d5-944f-efe7fe9659d3
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,118
supabase-export-v2
9763f24caf1b83c6
the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:`ValueError`, the exception is caught and a nicely formatted error message is displayed. Other exception types are not handled. Common built-in types and functions can be used as type converters:
trusted_official_docs
CPython Docs
the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:`ValueError`, the exception is caught and a nicely formatted error message is displayed. Other exception types are not handled. Common built-in types and functions can be used as type converters:
the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:`ValueError`, the exception is caught and a nicely formatted error message is displayed. Other exception types are not handled. Common built-in types and functions can be used as type converters:
python, official-docs, cpython, P0
Local_Trusted_Corpus
6c7b1f22-897f-4c29-b586-f12ab586ce28
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,959
supabase-export-v2
c115684eecbb54ac
Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped:: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.RawDescriptionHelpFormatter, ... description=textwrap.deden...
trusted_official_docs
CPython Docs
Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped:: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.RawDescriptionHelpFormatter, ... description=textwrap.deden...
Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped:: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.RawDescriptionHelpFormatter, ... description=textwrap.deden...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6cce6c93-9589-4358-be2c-0e6f3edafe8a
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,077
supabase-export-v2
b1cabe169beeb39c
the same interface. Only actions that consume command-line arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions with non-zero ``nargs``) can be used with positional arguments. The recommended way to create a custom action is to extend :class:`Action`, overriding the :meth:`!__call__` method and op...
trusted_official_docs
CPython Docs
the same interface. Only actions that consume command-line arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions with non-zero ``nargs``) can be used with positional arguments. The recommended way to create a custom action is to extend :class:`Action`, overriding the :meth:`!__call__` method and op...
the same interface. Only actions that consume command-line arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions with non-zero ``nargs``) can be used with positional arguments. The recommended way to create a custom action is to extend :class:`Action`, overriding the :meth:`!__call__` method and op...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6e1c5869-172d-41a4-b5a1-4267fb64e7c6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,943
supabase-export-v2
9a5501be529b4308
parents ^^^^^^^ Sometimes, several parsers share a common set of arguments. Rather than repeating the definitions of these arguments, a single parser with all the shared arguments and passed to ``parents=`` argument to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a list of :class:`ArgumentParser...
trusted_official_docs
CPython Docs
parents ^^^^^^^ Sometimes, several parsers share a common set of arguments. Rather than repeating the definitions of these arguments, a single parser with all the shared arguments and passed to ``parents=`` argument to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a list of :class:`ArgumentParser...
parents ^^^^^^^ Sometimes, several parsers share a common set of arguments. Rather than repeating the definitions of these arguments, a single parser with all the shared arguments and passed to ``parents=`` argument to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a list of :class:`ArgumentParser...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6f2b3452-968f-43e7-8919-da14cd40f3ed
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,195
supabase-export-v2
5d32f5114d5049fd
.. class:: BooleanOptionalAction A subclass of :class:`Action` for handling boolean flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively::
trusted_official_docs
CPython Docs
.. class:: BooleanOptionalAction A subclass of :class:`Action` for handling boolean flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively::
.. class:: BooleanOptionalAction A subclass of :class:`Action` for handling boolean flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively::
python, official-docs, cpython, P0
Local_Trusted_Corpus
6f35c6d9-8b4f-4da2-8c18-772efc0f3fd0
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,924
supabase-export-v2
67e9af5685ef82c4
options: -h, --help show this help message and exit --foo FOO foo of the myprogram program .. versionchanged:: 3.14 The default ``prog`` value now reflects how ``__main__`` was actually executed, rather than always being ``os.path.basename(sys.argv[0])``.
trusted_official_docs
CPython Docs
options: -h, --help show this help message and exit --foo FOO foo of the myprogram program .. versionchanged:: 3.14 The default ``prog`` value now reflects how ``__main__`` was actually executed, rather than always being ``os.path.basename(sys.argv[0])``.
options: -h, --help show this help message and exit --foo FOO foo of the myprogram program .. versionchanged:: 3.14 The default ``prog`` value now reflects how ``__main__`` was actually executed, rather than always being ``os.path.basename(sys.argv[0])``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
6f662a01-bdf1-4379-889d-bbd44542af94
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,193
supabase-export-v2
5467d182bd2788b7
.. method:: format_usage() :class:`!Action` subclasses can define a :meth:`!format_usage` method that takes no argument and return a string which will be used when printing the usage of the program. If such method is not provided, a sensible default will be used.
trusted_official_docs
CPython Docs
.. method:: format_usage() :class:`!Action` subclasses can define a :meth:`!format_usage` method that takes no argument and return a string which will be used when printing the usage of the program. If such method is not provided, a sensible default will be used.
.. method:: format_usage() :class:`!Action` subclasses can define a :meth:`!format_usage` method that takes no argument and return a string which will be used when printing the usage of the program. If such method is not provided, a sensible default will be used.
python, official-docs, cpython, P0
Local_Trusted_Corpus
6f9e0afc-538c-413d-974d-dc14a98c3658
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,032
supabase-export-v2
5df7150bd18a0f27
* `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` or ``'-f', '--foo'``. * action_ - The basic type of action to be taken when this argument is encountered at the command line.
trusted_official_docs
CPython Docs
* `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` or ``'-f', '--foo'``. * action_ - The basic type of action to be taken when this argument is encountered at the command line.
* `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` or ``'-f', '--foo'``. * action_ - The basic type of action to be taken when this argument is encountered at the command line.
python, official-docs, cpython, P0
Local_Trusted_Corpus
70cda275-af36-40ed-b09e-cef6baa03519
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,330
supabase-export-v2
395dff936933813a
title', 'Group description') >>> exclusive_group = group.add_mutually_exclusive_group(required=True) >>> exclusive_group.add_argument('--foo', help='foo help') >>> exclusive_group.add_argument('--bar', help='bar help') >>> parser.print_help() usage: PROG [-h] (--foo FOO | --bar BAR) options: -h, --help show this help ...
trusted_official_docs
CPython Docs
title', 'Group description') >>> exclusive_group = group.add_mutually_exclusive_group(required=True) >>> exclusive_group.add_argument('--foo', help='foo help') >>> exclusive_group.add_argument('--bar', help='bar help') >>> parser.print_help() usage: PROG [-h] (--foo FOO | --bar BAR) options: -h, --help show this help ...
title', 'Group description') >>> exclusive_group = group.add_mutually_exclusive_group(required=True) >>> exclusive_group.add_argument('--foo', help='foo help') >>> exclusive_group.add_argument('--bar', help='bar help') >>> parser.print_help() usage: PROG [-h] (--foo FOO | --bar BAR) options: -h, --help show this help ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
732124f6-dd87-436e-8904-7f4dacb0e110
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,076
supabase-export-v2
56b0a19c1f34ab27
>>> import argparse >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--version', action='version', version='%(prog)s 2.0') >>> parser.parse_args(['--version']) PROG 2.0 You may also specify an arbitrary action by passing an :class:`Action` subclass (e.g. :class:`BooleanOptionalAction`) or othe...
trusted_official_docs
CPython Docs
>>> import argparse >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--version', action='version', version='%(prog)s 2.0') >>> parser.parse_args(['--version']) PROG 2.0 You may also specify an arbitrary action by passing an :class:`Action` subclass (e.g. :class:`BooleanOptionalAction`) or othe...
>>> import argparse >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--version', action='version', version='%(prog)s 2.0') >>> parser.parse_args(['--version']) PROG 2.0 You may also specify an arbitrary action by passing an :class:`Action` subclass (e.g. :class:`BooleanOptionalAction`) or othe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7365b9a1-5aeb-4d33-b32f-1ef4fcfd30ee
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,205
supabase-export-v2
0188c50e2453b8ec
Previous calls to :meth:`add_argument` determine exactly what objects are created and how they are assigned. See the documentation for :meth:`!add_argument` for details. * args_ - List of strings to parse. The default is taken from :data:`sys.argv`.
trusted_official_docs
CPython Docs
Previous calls to :meth:`add_argument` determine exactly what objects are created and how they are assigned. See the documentation for :meth:`!add_argument` for details. * args_ - List of strings to parse. The default is taken from :data:`sys.argv`.
Previous calls to :meth:`add_argument` determine exactly what objects are created and how they are assigned. See the documentation for :meth:`!add_argument` for details. * args_ - List of strings to parse. The default is taken from :data:`sys.argv`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7521577f-5e6c-44b0-a634-be5a187db6b6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,136
supabase-export-v2
c94f11efba871d1c
Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages. Note that *choices* are checked after any type_ conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage...
trusted_official_docs
CPython Docs
Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages. Note that *choices* are checked after any type_ conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage...
Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages. Note that *choices* are checked after any type_ conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7579fedd-4482-4a08-9bd2-d98c57f71fa8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,148
supabase-export-v2
0ad7f833366d4d93
the program name or the argument default_. The available specifiers include the program name, ``%(prog)s`` and most keyword arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%(type)s``, etc.:: >>> parser = argparse.ArgumentParser(prog='frobble') >>> parser.add_argument('bar', nargs='?', type=i...
trusted_official_docs
CPython Docs
the program name or the argument default_. The available specifiers include the program name, ``%(prog)s`` and most keyword arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%(type)s``, etc.:: >>> parser = argparse.ArgumentParser(prog='frobble') >>> parser.add_argument('bar', nargs='?', type=i...
the program name or the argument default_. The available specifiers include the program name, ``%(prog)s`` and most keyword arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%(type)s``, etc.:: >>> parser = argparse.ArgumentParser(prog='frobble') >>> parser.add_argument('bar', nargs='?', type=i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
75bae507-dd77-462d-aca2-cf370cd1fd8b
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,370
supabase-export-v2
df1c7f833bc6a004
.. method:: ArgumentParser.exit(status=0, message=None) This method terminates the program, exiting with the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently::
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.exit(status=0, message=None) This method terminates the program, exiting with the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently::
.. method:: ArgumentParser.exit(status=0, message=None) This method terminates the program, exiting with the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently::
python, official-docs, cpython, P0
Local_Trusted_Corpus
76891751-c6a5-4e65-b4b6-8c734658ec03
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,129
supabase-export-v2
2e2044c9d3a945d0
than can be given by the ``type`` keyword. A :exc:`~json.JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` exception would not be handled at all. Even :class:`~argparse.FileType` has its limitations for use with the ``type`` keyword. If one argument uses :class:`~argparse.FileType` and then a ...
trusted_official_docs
CPython Docs
than can be given by the ``type`` keyword. A :exc:`~json.JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` exception would not be handled at all. Even :class:`~argparse.FileType` has its limitations for use with the ``type`` keyword. If one argument uses :class:`~argparse.FileType` and then a ...
than can be given by the ``type`` keyword. A :exc:`~json.JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` exception would not be handled at all. Even :class:`~argparse.FileType` has its limitations for use with the ``type`` keyword. If one argument uses :class:`~argparse.FileType` and then a ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
772d9cd1-5b54-4750-b7ab-fbaf536e4ac5
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,884
supabase-export-v2
64dcac1c5e6412ca
interfaces is built around an instance of :class:`argparse.ArgumentParser`. It is a container for argument specifications and has options that apply to the parser as whole:: parser = argparse.ArgumentParser( prog='ProgramName', description='What the program does', epilog='Text at the bottom of help')
trusted_official_docs
CPython Docs
interfaces is built around an instance of :class:`argparse.ArgumentParser`. It is a container for argument specifications and has options that apply to the parser as whole:: parser = argparse.ArgumentParser( prog='ProgramName', description='What the program does', epilog='Text at the bottom of help')
interfaces is built around an instance of :class:`argparse.ArgumentParser`. It is a container for argument specifications and has options that apply to the parser as whole:: parser = argparse.ArgumentParser( prog='ProgramName', description='What the program does', epilog='Text at the bottom of help')
python, official-docs, cpython, P0
Local_Trusted_Corpus
7875bd23-1ea5-4ef5-aa67-51aab3ab3129
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,371
supabase-export-v2
9e51b4bd1f78b4a2
the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently:: class ErrorCatchingArgumentParser(argparse.ArgumentParser): def exit(self, status=0, message=None): if status: raise Exception(f'Exiting because of an e...
trusted_official_docs
CPython Docs
the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently:: class ErrorCatchingArgumentParser(argparse.ArgumentParser): def exit(self, status=0, message=None): if status: raise Exception(f'Exiting because of an e...
the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently:: class ErrorCatchingArgumentParser(argparse.ArgumentParser): def exit(self, status=0, message=None): if status: raise Exception(f'Exiting because of an e...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7a654588-2136-4839-865a-7726628f5669
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,320
supabase-export-v2
61adda21bf6498d7
Within each argument group, arguments are displayed in help output in the order in which they are added. .. deprecated-removed:: 3.11 3.14 Calling :meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed...
trusted_official_docs
CPython Docs
Within each argument group, arguments are displayed in help output in the order in which they are added. .. deprecated-removed:: 3.11 3.14 Calling :meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed...
Within each argument group, arguments are displayed in help output in the order in which they are added. .. deprecated-removed:: 3.11 3.14 Calling :meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7a7011af-8ae7-42c2-9538-e17f0cd73aa8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,057
supabase-export-v2
0dd831ae29202574
action ^^^^^^ :class:`ArgumentParser` objects associate command-line arguments with actions. These actions can do just about anything with the command-line arguments associated with them, though most actions simply add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword arg...
trusted_official_docs
CPython Docs
action ^^^^^^ :class:`ArgumentParser` objects associate command-line arguments with actions. These actions can do just about anything with the command-line arguments associated with them, though most actions simply add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword arg...
action ^^^^^^ :class:`ArgumentParser` objects associate command-line arguments with actions. These actions can do just about anything with the command-line arguments associated with them, though most actions simply add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword arg...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7eebb8bb-8c29-4caa-bae8-69890eb501e9
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,958
supabase-export-v2
26f6c3ad876d689f
likewise for this epilog whose whitespace will be cleaned up and whose words will be wrapped across a couple lines Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped::
trusted_official_docs
CPython Docs
likewise for this epilog whose whitespace will be cleaned up and whose words will be wrapped across a couple lines Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped::
likewise for this epilog whose whitespace will be cleaned up and whose words will be wrapped across a couple lines Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped::
python, official-docs, cpython, P0
Local_Trusted_Corpus
7ef74d9b-49f8-4fc1-b2e1-fdfed5403b6d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,313
supabase-export-v2
e2dfbb7cff238646
>>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group = parser.add_argument_group('group') >>> group.add_argument('--foo', help='foo help') >>> group.add_argument('bar', help='bar help') >>> parser.print_help() usage: PROG [--foo FOO] bar group: bar bar help --foo FOO foo help
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group = parser.add_argument_group('group') >>> group.add_argument('--foo', help='foo help') >>> group.add_argument('bar', help='bar help') >>> parser.print_help() usage: PROG [--foo FOO] bar group: bar bar help --foo FOO foo help
>>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group = parser.add_argument_group('group') >>> group.add_argument('--foo', help='foo help') >>> group.add_argument('bar', help='bar help') >>> parser.print_help() usage: PROG [--foo FOO] bar group: bar bar help --foo FOO foo help
python, official-docs, cpython, P0
Local_Trusted_Corpus
7f099b65-44fc-46ca-bb91-aa36e8d2a6ea
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,035
supabase-export-v2
0b6f9286c5f3e0ae
* const_ - A constant value required by some action_ and nargs_ selections. * default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object.
trusted_official_docs
CPython Docs
* const_ - A constant value required by some action_ and nargs_ selections. * default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object.
* const_ - A constant value required by some action_ and nargs_ selections. * default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7faf6496-7f28-409f-9135-5c7273cd2e08
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,218
supabase-export-v2
1d14999e4bd0056c
invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usage message:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', type=int) >>> parser.add_argument('bar', nargs='?')
trusted_official_docs
CPython Docs
invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usage message:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', type=int) >>> parser.add_argument('bar', nargs='?')
invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usage message:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', type=int) >>> parser.add_argument('bar', nargs='?')
python, official-docs, cpython, P0
Local_Trusted_Corpus
82c2daad-e584-41cd-9581-329277dcb614
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,215
supabase-export-v2
7e8062ffe906f1fe
options can be joined together, using only a single ``-`` prefix, as long as only the last option (or none of them) requires a value:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x', action='store_true') >>> parser.add_argument('-y', action='store_true') >>> parser.add_argument('-z') ...
trusted_official_docs
CPython Docs
options can be joined together, using only a single ``-`` prefix, as long as only the last option (or none of them) requires a value:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x', action='store_true') >>> parser.add_argument('-y', action='store_true') >>> parser.add_argument('-z') ...
options can be joined together, using only a single ``-`` prefix, as long as only the last option (or none of them) requires a value:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x', action='store_true') >>> parser.add_argument('-y', action='store_true') >>> parser.add_argument('-z') ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8407f1a5-8b3f-43c2-b8ee-3a06275c0581
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,338
supabase-export-v2
8c85815545ba9a05
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int) >>> parser.set_defaults(bar=42, baz='badger') >>> parser.parse_args(['736']) Namespace(bar=42, baz='badger', foo=736) Note that defaults can be set at both the parser level using :meth:`set_defaults` and at the argument level using :meth:`...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int) >>> parser.set_defaults(bar=42, baz='badger') >>> parser.parse_args(['736']) Namespace(bar=42, baz='badger', foo=736) Note that defaults can be set at both the parser level using :meth:`set_defaults` and at the argument level using :meth:`...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int) >>> parser.set_defaults(bar=42, baz='badger') >>> parser.parse_args(['736']) Namespace(bar=42, baz='badger', foo=736) Note that defaults can be set at both the parser level using :meth:`set_defaults` and at the argument level using :meth:`...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8495ec59-62e6-4e7b-9d8f-5962e68e3d60
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,060
supabase-export-v2
6fb8478d05c6f71c
the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify some sort of flag. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_const', const=42) >>> parser.parse_args(['--foo']) Namespace...
trusted_official_docs
CPython Docs
the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify some sort of flag. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_const', const=42) >>> parser.parse_args(['--foo']) Namespace...
the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify some sort of flag. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_const', const=42) >>> parser.parse_args(['--foo']) Namespace...
python, official-docs, cpython, P0
Local_Trusted_Corpus
85114791-84a3-4634-be22-60bda243be31
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,066
supabase-export-v2
3409514dac0a122f
const_ keyword argument defaults to ``None``. The ``'append_const'`` action is typically useful when multiple arguments need to store constants to the same list. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--str', dest='types', action='append_const', const=str) >>> parser.add_argumen...
trusted_official_docs
CPython Docs
const_ keyword argument defaults to ``None``. The ``'append_const'`` action is typically useful when multiple arguments need to store constants to the same list. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--str', dest='types', action='append_const', const=str) >>> parser.add_argumen...
const_ keyword argument defaults to ``None``. The ``'append_const'`` action is typically useful when multiple arguments need to store constants to the same list. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--str', dest='types', action='append_const', const=str) >>> parser.add_argumen...
python, official-docs, cpython, P0
Local_Trusted_Corpus
851bea2a-0530-4a1e-ac18-18d503b79ac6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,140
supabase-export-v2
1f5d6bcb858a5599
required ^^^^^^^^ In general, the :mod:`!argparse` module assumes that flags like ``-f`` and ``--bar`` indicate *optional* arguments, which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::
trusted_official_docs
CPython Docs
required ^^^^^^^^ In general, the :mod:`!argparse` module assumes that flags like ``-f`` and ``--bar`` indicate *optional* arguments, which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::
required ^^^^^^^^ In general, the :mod:`!argparse` module assumes that flags like ``-f`` and ``--bar`` indicate *optional* arguments, which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::
python, official-docs, cpython, P0
Local_Trusted_Corpus
873d4e3e-5aeb-440e-9e43-43cfefa14a50
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,248
supabase-export-v2
c33717ebfa83389c
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> args = parser.parse_args(['--foo', 'BAR']) >>> vars(args) {'foo': 'BAR'} It may also be useful to have an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achiev...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> args = parser.parse_args(['--foo', 'BAR']) >>> vars(args) {'foo': 'BAR'} It may also be useful to have an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achiev...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> args = parser.parse_args(['--foo', 'BAR']) >>> vars(args) {'foo': 'BAR'} It may also be useful to have an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achiev...
python, official-docs, cpython, P0
Local_Trusted_Corpus
89347782-effc-4278-bf57-dc59124387cb
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,339
supabase-export-v2
f5c8d2a75df7496b
:meth:`set_defaults` and at the argument level using :meth:`add_argument`. If both are called for the same argument, the last default set for an argument is used:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default='bar') >>> parser.set_defaults(foo='spam') >>> parser.parse_args([]) Nam...
trusted_official_docs
CPython Docs
:meth:`set_defaults` and at the argument level using :meth:`add_argument`. If both are called for the same argument, the last default set for an argument is used:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default='bar') >>> parser.set_defaults(foo='spam') >>> parser.parse_args([]) Nam...
:meth:`set_defaults` and at the argument level using :meth:`add_argument`. If both are called for the same argument, the last default set for an argument is used:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default='bar') >>> parser.set_defaults(foo='spam') >>> parser.parse_args([]) Nam...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8a594d5a-6dae-4c74-b609-bb59a88a9df3
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,980
supabase-export-v2
1d6f2a42c2de547f
.. note:: Empty lines are treated as empty strings (``''``), which are allowed as values but not as arguments. Empty lines that are read as arguments will result in an "unrecognized arguments" error.
trusted_official_docs
CPython Docs
.. note:: Empty lines are treated as empty strings (``''``), which are allowed as values but not as arguments. Empty lines that are read as arguments will result in an "unrecognized arguments" error.
.. note:: Empty lines are treated as empty strings (``''``), which are allowed as values but not as arguments. Empty lines that are read as arguments will result in an "unrecognized arguments" error.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8a98a260-e2e5-4094-a914-0e6b7a7a015c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,311
supabase-export-v2
cd208ae04f103ca5
.. method:: ArgumentParser.add_argument_group(title=None, description=None, *, \ [argument_default], [conflict_handler]) By default, :class:`ArgumentParser` groups command-line arguments into "positional arguments" and "options" when displaying help messages. When there is a better conceptual grouping of arguments th...
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.add_argument_group(title=None, description=None, *, \ [argument_default], [conflict_handler]) By default, :class:`ArgumentParser` groups command-line arguments into "positional arguments" and "options" when displaying help messages. When there is a better conceptual grouping of arguments th...
.. method:: ArgumentParser.add_argument_group(title=None, description=None, *, \ [argument_default], [conflict_handler]) By default, :class:`ArgumentParser` groups command-line arguments into "positional arguments" and "options" when displaying help messages. When there is a better conceptual grouping of arguments th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8b0da2b1-f91f-46c4-a8a6-0203278bbad8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,887
supabase-export-v2
3d97e987a4878acd
parser.add_argument('filename') # positional argument parser.add_argument('-c', '--count') # option that takes a value parser.add_argument('-v', '--verbose', action='store_true') # on/off flag The :meth:`ArgumentParser.parse_args` method runs the parser and places the extracted data in a :class:`argparse.Namespace` obj...
trusted_official_docs
CPython Docs
parser.add_argument('filename') # positional argument parser.add_argument('-c', '--count') # option that takes a value parser.add_argument('-v', '--verbose', action='store_true') # on/off flag The :meth:`ArgumentParser.parse_args` method runs the parser and places the extracted data in a :class:`argparse.Namespace` obj...
parser.add_argument('filename') # positional argument parser.add_argument('-c', '--count') # option that takes a value parser.add_argument('-v', '--verbose', action='store_true') # on/off flag The :meth:`ArgumentParser.parse_args` method runs the parser and places the extracted data in a :class:`argparse.Namespace` obj...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8bc75e5d-44c6-4667-a7c6-49a88ea34f2c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,109
supabase-export-v2
ab20c17d50d92e69
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--length', default='10', type=int) >>> parser.add_argument('--width', default=10.5, type=int) >>> parser.parse_args() Namespace(length=10, width=10.5) For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no comma...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--length', default='10', type=int) >>> parser.add_argument('--width', default=10.5, type=int) >>> parser.parse_args() Namespace(length=10, width=10.5) For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no comma...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--length', default='10', type=int) >>> parser.add_argument('--width', default=10.5, type=int) >>> parser.parse_args() Namespace(length=10, width=10.5) For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no comma...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8c44bc52-c709-455a-829e-7e504d5ff741
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,365
supabase-export-v2
2f6ebd96595f9c03
from a file (see the *fromfile_prefix_chars* keyword argument to the :class:`ArgumentParser` constructor) are read one argument per line. :meth:`convert_arg_line_to_args` can be overridden for fancier reading. This method takes a single argument *arg_line* which is a string read from the argument file. It returns a li...
trusted_official_docs
CPython Docs
from a file (see the *fromfile_prefix_chars* keyword argument to the :class:`ArgumentParser` constructor) are read one argument per line. :meth:`convert_arg_line_to_args` can be overridden for fancier reading. This method takes a single argument *arg_line* which is a string read from the argument file. It returns a li...
from a file (see the *fromfile_prefix_chars* keyword argument to the :class:`ArgumentParser` constructor) are read one argument per line. :meth:`convert_arg_line_to_args` can be overridden for fancier reading. This method takes a single argument *arg_line* which is a string read from the argument file. It returns a li...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8ebfbced-59f8-41a1-9a87-ace96d607b08
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,923
supabase-export-v2
fc3b1ce1fedbf829
>>> parser = argparse.ArgumentParser(prog='myprogram') >>> parser.add_argument('--foo', help='foo of the %(prog)s program') >>> parser.print_help() usage: myprogram [-h] [--foo FOO] options: -h, --help show this help message and exit --foo FOO foo of the myprogram program
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser(prog='myprogram') >>> parser.add_argument('--foo', help='foo of the %(prog)s program') >>> parser.print_help() usage: myprogram [-h] [--foo FOO] options: -h, --help show this help message and exit --foo FOO foo of the myprogram program
>>> parser = argparse.ArgumentParser(prog='myprogram') >>> parser.add_argument('--foo', help='foo of the %(prog)s program') >>> parser.print_help() usage: myprogram [-h] [--foo FOO] options: -h, --help show this help message and exit --foo FOO foo of the myprogram program
python, official-docs, cpython, P0
Local_Trusted_Corpus
8f849ac1-6591-415a-bbfa-3acfd444e659
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,941
supabase-export-v2
323face7f1e14b9d
And that's how you'd foo a bar As with the description_ argument, the ``epilog=`` text is by default line-wrapped, but this behavior can be adjusted with the formatter_class_ argument to :class:`ArgumentParser`.
trusted_official_docs
CPython Docs
And that's how you'd foo a bar As with the description_ argument, the ``epilog=`` text is by default line-wrapped, but this behavior can be adjusted with the formatter_class_ argument to :class:`ArgumentParser`.
And that's how you'd foo a bar As with the description_ argument, the ``epilog=`` text is by default line-wrapped, but this behavior can be adjusted with the formatter_class_ argument to :class:`ArgumentParser`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
90321268-352d-412a-8d24-67dbeabd0d0b
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,329
supabase-export-v2
b24ecff24be08a2d
and *description* arguments of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive group can be added to an argument group that has a title and description. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> group = parser.add_argument_group('Group title', 'Group description') >...
trusted_official_docs
CPython Docs
and *description* arguments of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive group can be added to an argument group that has a title and description. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> group = parser.add_argument_group('Group title', 'Group description') >...
and *description* arguments of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive group can be added to an argument group that has a title and description. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> group = parser.add_argument_group('Group title', 'Group description') >...
python, official-docs, cpython, P0
Local_Trusted_Corpus
90d9712e-633a-4218-a2bd-d7a464b2103c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,385
supabase-export-v2
adb14f8013746038
to register custom actions or types with a parser and allow you to reference the type by their registered name instead of their callable name. The :meth:`!register` method accepts three arguments - a *registry_name*, specifying the internal registry where the object will be stored (e.g., ``action``, ``type``), *value...
trusted_official_docs
CPython Docs
to register custom actions or types with a parser and allow you to reference the type by their registered name instead of their callable name. The :meth:`!register` method accepts three arguments - a *registry_name*, specifying the internal registry where the object will be stored (e.g., ``action``, ``type``), *value...
to register custom actions or types with a parser and allow you to reference the type by their registered name instead of their callable name. The :meth:`!register` method accepts three arguments - a *registry_name*, specifying the internal registry where the object will be stored (e.g., ``action``, ``type``), *value...
python, official-docs, cpython, P0
Local_Trusted_Corpus
91a105cc-3231-414e-8149-7cb50afe1c89
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,918
supabase-export-v2
af5562517126aaf5
to invoke the program on the command line. However, to change this default behavior, another value can be supplied using the ``prog=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='myprogram') >>> parser.print_help() usage: myprogram [-h]
trusted_official_docs
CPython Docs
to invoke the program on the command line. However, to change this default behavior, another value can be supplied using the ``prog=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='myprogram') >>> parser.print_help() usage: myprogram [-h]
to invoke the program on the command line. However, to change this default behavior, another value can be supplied using the ``prog=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='myprogram') >>> parser.print_help() usage: myprogram [-h]
python, official-docs, cpython, P0
Local_Trusted_Corpus
91a45771-2cf6-479f-a6e4-f0de9d4eaa1d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,981
supabase-export-v2
b058523ea2faf0ce
strings (``''``), which are allowed as values but not as arguments. Empty lines that are read as arguments will result in an "unrecognized arguments" error. :class:`ArgumentParser` uses :term:`filesystem encoding and error handler` to read the file containing arguments.
trusted_official_docs
CPython Docs
strings (``''``), which are allowed as values but not as arguments. Empty lines that are read as arguments will result in an "unrecognized arguments" error. :class:`ArgumentParser` uses :term:`filesystem encoding and error handler` to read the file containing arguments.
strings (``''``), which are allowed as values but not as arguments. Empty lines that are read as arguments will result in an "unrecognized arguments" error. :class:`ArgumentParser` uses :term:`filesystem encoding and error handler` to read the file containing arguments.
python, official-docs, cpython, P0
Local_Trusted_Corpus
91bd8618-aace-4634-88fc-2eed1e189641
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,224
supabase-export-v2
a522f96877bcdf66
arguments may only begin with ``-`` if they look like negative numbers and there are no options in the parser that look like negative numbers:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('foo', nargs='?')
trusted_official_docs
CPython Docs
arguments may only begin with ``-`` if they look like negative numbers and there are no options in the parser that look like negative numbers:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('foo', nargs='?')
arguments may only begin with ``-`` if they look like negative numbers and there are no options in the parser that look like negative numbers:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('foo', nargs='?')
python, official-docs, cpython, P0
Local_Trusted_Corpus
9202bad6-853b-4782-9b65-ced78615b82e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,226
supabase-export-v2
8eefa365e1848ef5
>>> # no negative number options, so -1 is a positional argument >>> parser.parse_args(['-x', '-1']) Namespace(foo=None, x='-1') >>> # no negative number options, so -1 and -5 are positional arguments >>> parser.parse_args(['-x', '-1', '-5']) Namespace(foo='-5', x='-1')
trusted_official_docs
CPython Docs
>>> # no negative number options, so -1 is a positional argument >>> parser.parse_args(['-x', '-1']) Namespace(foo=None, x='-1') >>> # no negative number options, so -1 and -5 are positional arguments >>> parser.parse_args(['-x', '-1', '-5']) Namespace(foo='-5', x='-1')
>>> # no negative number options, so -1 is a positional argument >>> parser.parse_args(['-x', '-1']) Namespace(foo=None, x='-1') >>> # no negative number options, so -1 and -5 are positional arguments >>> parser.parse_args(['-x', '-1', '-5']) Namespace(foo='-5', x='-1')
python, official-docs, cpython, P0
Local_Trusted_Corpus
9210e657-7cc0-46af-9a88-c5be5f4d4411
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,263
supabase-export-v2
c62f2d1ba4f8451c
* help_ - help for sub-parser group in help output, by default ``None`` * metavar_ - string presenting available subcommands in help; by default it is ``None`` and presents subcommands in form {cmd1, cmd2, ..}
trusted_official_docs
CPython Docs
* help_ - help for sub-parser group in help output, by default ``None`` * metavar_ - string presenting available subcommands in help; by default it is ``None`` and presents subcommands in form {cmd1, cmd2, ..}
* help_ - help for sub-parser group in help output, by default ``None`` * metavar_ - string presenting available subcommands in help; by default it is ``None`` and presents subcommands in form {cmd1, cmd2, ..}
python, official-docs, cpython, P0
Local_Trusted_Corpus
94e8dde3-4d15-43a5-a4ba-3e5da0d87dda
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,071
supabase-export-v2
ece6a0a9b511ddf6
* ``'count'`` - This counts the number of times an argument occurs. For example, this is useful for increasing verbosity levels:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--verbose', '-v', action='count', default=0) >>> parser.parse_args(['-vvv']) Namespace(verbose=3)
trusted_official_docs
CPython Docs
* ``'count'`` - This counts the number of times an argument occurs. For example, this is useful for increasing verbosity levels:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--verbose', '-v', action='count', default=0) >>> parser.parse_args(['-vvv']) Namespace(verbose=3)
* ``'count'`` - This counts the number of times an argument occurs. For example, this is useful for increasing verbosity levels:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--verbose', '-v', action='count', default=0) >>> parser.parse_args(['-vvv']) Namespace(verbose=3)
python, official-docs, cpython, P0
Local_Trusted_Corpus
954d63bc-86ed-45b7-b6b9-eef73023863d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,994
supabase-export-v2
9b96f5fcab599935
By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') ...
trusted_official_docs
CPython Docs
By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') ...
By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
959f186d-ef58-41b1-be00-ae8dc8f20785
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,053
supabase-export-v2
b3817b95aec58f67
Namespace(bar='BAR', foo=None) >>> parser.parse_args(['BAR', '--foo', 'FOO']) Namespace(bar='BAR', foo='FOO') >>> parser.parse_args(['--foo', 'FOO']) usage: PROG [-h] [-f FOO] bar PROG: error: the following arguments are required: bar By default, :mod:`!argparse` automatically handles the internal naming and display na...
trusted_official_docs
CPython Docs
Namespace(bar='BAR', foo=None) >>> parser.parse_args(['BAR', '--foo', 'FOO']) Namespace(bar='BAR', foo='FOO') >>> parser.parse_args(['--foo', 'FOO']) usage: PROG [-h] [-f FOO] bar PROG: error: the following arguments are required: bar By default, :mod:`!argparse` automatically handles the internal naming and display na...
Namespace(bar='BAR', foo=None) >>> parser.parse_args(['BAR', '--foo', 'FOO']) Namespace(bar='BAR', foo='FOO') >>> parser.parse_args(['--foo', 'FOO']) usage: PROG [-h] [-f FOO] bar PROG: error: the following arguments are required: bar By default, :mod:`!argparse` automatically handles the internal naming and display na...
python, official-docs, cpython, P0
Local_Trusted_Corpus
96815055-c0ab-4080-a080-b60ee8c157bc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,229
supabase-export-v2
16d097f8a2f21f5f
>>> # negative number options present, so -1 is an option >>> parser.parse_args(['-1', 'X']) Namespace(foo=None, one='X') >>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: no such option: -2
trusted_official_docs
CPython Docs
>>> # negative number options present, so -1 is an option >>> parser.parse_args(['-1', 'X']) Namespace(foo=None, one='X') >>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: no such option: -2
>>> # negative number options present, so -1 is an option >>> parser.parse_args(['-1', 'X']) Namespace(foo=None, one='X') >>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: no such option: -2
python, official-docs, cpython, P0
Local_Trusted_Corpus
9846dee7-8cb1-429d-b2b1-19e98e242f46
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,237
supabase-export-v2
401ce7382b040489
:meth:`~ArgumentParser.parse_args` method :ref:`by default <allow_abbrev>` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option):: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-bacon') >>> parser.add_argument('-badger')...
trusted_official_docs
CPython Docs
:meth:`~ArgumentParser.parse_args` method :ref:`by default <allow_abbrev>` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option):: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-bacon') >>> parser.add_argument('-badger')...
:meth:`~ArgumentParser.parse_args` method :ref:`by default <allow_abbrev>` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option):: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-bacon') >>> parser.add_argument('-badger')...
python, official-docs, cpython, P0
Local_Trusted_Corpus
99075d01-4fed-498d-aaa8-79838acc64c4
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,002
supabase-export-v2
73b7110021290790
it may be useful to disable the addition of this help option. This can be achieved by passing ``False`` as the ``add_help=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> parser.add_argument('--foo', help='foo help') >>> parser.print_help() usage: PROG [-...
trusted_official_docs
CPython Docs
it may be useful to disable the addition of this help option. This can be achieved by passing ``False`` as the ``add_help=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> parser.add_argument('--foo', help='foo help') >>> parser.print_help() usage: PROG [-...
it may be useful to disable the addition of this help option. This can be achieved by passing ``False`` as the ``add_help=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> parser.add_argument('--foo', help='foo help') >>> parser.print_help() usage: PROG [-...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9b021027-5141-4cc8-b84c-1acd3aae5a55
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,886
supabase-export-v2
8a83f929e5ab9caa
The :meth:`ArgumentParser.add_argument` method attaches individual argument specifications to the parser. It supports positional arguments, options that accept values, and on/off flags:: parser.add_argument('filename') # positional argument parser.add_argument('-c', '--count') # option that takes a value parser.add_a...
trusted_official_docs
CPython Docs
The :meth:`ArgumentParser.add_argument` method attaches individual argument specifications to the parser. It supports positional arguments, options that accept values, and on/off flags:: parser.add_argument('filename') # positional argument parser.add_argument('-c', '--count') # option that takes a value parser.add_a...
The :meth:`ArgumentParser.add_argument` method attaches individual argument specifications to the parser. It supports positional arguments, options that accept values, and on/off flags:: parser.add_argument('filename') # positional argument parser.add_argument('-c', '--count') # option that takes a value parser.add_a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9b503681-1119-427a-93ec-eca244606fda
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,920
supabase-export-v2
e378345ee5a481fd
options: -h, --help show this help message and exit Note that the program name, whether determined from ``sys.argv[0]``, from the ``__main__`` module attributes or from the ``prog=`` argument, is available to help messages using the ``%(prog)s`` format specifier.
trusted_official_docs
CPython Docs
options: -h, --help show this help message and exit Note that the program name, whether determined from ``sys.argv[0]``, from the ``__main__`` module attributes or from the ``prog=`` argument, is available to help messages using the ``%(prog)s`` format specifier.
options: -h, --help show this help message and exit Note that the program name, whether determined from ``sys.argv[0]``, from the ``__main__`` module attributes or from the ``prog=`` argument, is available to help messages using the ``%(prog)s`` format specifier.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9b78b6e9-c497-49df-a0c0-e7360350f3e2
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,115
supabase-export-v2
7417a1bfaf9cfe5c
type ^^^^ By default, the parser reads command-line arguments in as simple strings. However, quite often the command-line string should instead be interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and t...
trusted_official_docs
CPython Docs
type ^^^^ By default, the parser reads command-line arguments in as simple strings. However, quite often the command-line string should instead be interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and t...
type ^^^^ By default, the parser reads command-line arguments in as simple strings. However, quite often the command-line string should instead be interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9cd68b8e-9de5-4e19-aa77-fec402ea0fb6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,296
supabase-export-v2
6a5226f4dc0df24d
The *deprecated* argument, if ``True``, marks the sub-command as deprecated and will issue a warning when used. For example:: >>> parser = argparse.ArgumentParser(prog='chicken.py') >>> subparsers = parser.add_subparsers() >>> fly = subparsers.add_parser('fly', deprecated=True) >>> args = parser.parse_args(['fly']) ...
trusted_official_docs
CPython Docs
The *deprecated* argument, if ``True``, marks the sub-command as deprecated and will issue a warning when used. For example:: >>> parser = argparse.ArgumentParser(prog='chicken.py') >>> subparsers = parser.add_subparsers() >>> fly = subparsers.add_parser('fly', deprecated=True) >>> args = parser.parse_args(['fly']) ...
The *deprecated* argument, if ``True``, marks the sub-command as deprecated and will issue a warning when used. For example:: >>> parser = argparse.ArgumentParser(prog='chicken.py') >>> subparsers = parser.add_subparsers() >>> fly = subparsers.add_parser('fly', deprecated=True) >>> args = parser.parse_args(['fly']) ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9e3fa478-9b7b-4d70-b2e8-88293d07e81e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,132
supabase-export-v2
97e1a525d6360956
choices ^^^^^^^ Some command-line arguments should be selected from a restricted set of values. These can be handled by passing a sequence object as the *choices* keyword argument to :meth:`~ArgumentParser.add_argument`. When the command line is parsed, argument values will be checked, and an error message will be disp...
trusted_official_docs
CPython Docs
choices ^^^^^^^ Some command-line arguments should be selected from a restricted set of values. These can be handled by passing a sequence object as the *choices* keyword argument to :meth:`~ArgumentParser.add_argument`. When the command line is parsed, argument values will be checked, and an error message will be disp...
choices ^^^^^^^ Some command-line arguments should be selected from a restricted set of values. These can be handled by passing a sequence object as the *choices* keyword argument to :meth:`~ArgumentParser.add_argument`. When the command line is parsed, argument values will be checked, and an error message will be disp...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9f3baeab-4487-40f5-b775-610e0625175f
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,170
supabase-export-v2
868b4886bcfbdcfc
this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as the first argument to :meth:`~ArgumentParser.add_argument`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('bar') >>> parser.parse_a...
trusted_official_docs
CPython Docs
this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as the first argument to :meth:`~ArgumentParser.add_argument`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('bar') >>> parser.parse_a...
this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as the first argument to :meth:`~ArgumentParser.add_argument`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('bar') >>> parser.parse_a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a0f10636-db31-47d4-b6bf-9e48065aba0c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,231
supabase-export-v2
784555cb72712ebb
negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: argument -1: expected one argument If you have positional arguments that must begin with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which...
trusted_official_docs
CPython Docs
negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: argument -1: expected one argument If you have positional arguments that must begin with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which...
negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: argument -1: expected one argument If you have positional arguments that must begin with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a1e022c9-0011-4e23-a324-d954b4820a3d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,156
supabase-export-v2
aab48993713ae64f
metavar ^^^^^^^ When :class:`ArgumentParser` generates help messages, it needs some way to refer to each expected argument. By default, :class:`!ArgumentParser` objects use the dest_ value as the "name" of each object. By default, for positional argument actions, the dest_ value is used directly, and for optional argum...
trusted_official_docs
CPython Docs
metavar ^^^^^^^ When :class:`ArgumentParser` generates help messages, it needs some way to refer to each expected argument. By default, :class:`!ArgumentParser` objects use the dest_ value as the "name" of each object. By default, for positional argument actions, the dest_ value is used directly, and for optional argum...
metavar ^^^^^^^ When :class:`ArgumentParser` generates help messages, it needs some way to refer to each expected argument. By default, :class:`!ArgumentParser` objects use the dest_ value as the "name" of each object. By default, for positional argument actions, the dest_ value is used directly, and for optional argum...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a21cd30c-4878-40d1-9217-9433a53b196f
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,968
supabase-export-v2
936c4ef902b701e0
name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does):: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.MetavarTypeHelpFormatter) >>> parser.add_argument('--foo', type=int) >>> parser.add_argume...
trusted_official_docs
CPython Docs
name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does):: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.MetavarTypeHelpFormatter) >>> parser.add_argument('--foo', type=int) >>> parser.add_argume...
name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does):: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.MetavarTypeHelpFormatter) >>> parser.add_argument('--foo', type=int) >>> parser.add_argume...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a24a2b12-884e-4a80-99a4-896bda9dfd5d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,976
supabase-export-v2
013881c6f9576bdd
fromfile_prefix_chars ^^^^^^^^^^^^^^^^^^^^^ Sometimes, when dealing with a particularly long argument list, it may make sense to keep the list of arguments in a file rather than typing it out at the command line. If the ``fromfile_prefix_chars=`` argument is given to the :class:`ArgumentParser` constructor, then argume...
trusted_official_docs
CPython Docs
fromfile_prefix_chars ^^^^^^^^^^^^^^^^^^^^^ Sometimes, when dealing with a particularly long argument list, it may make sense to keep the list of arguments in a file rather than typing it out at the command line. If the ``fromfile_prefix_chars=`` argument is given to the :class:`ArgumentParser` constructor, then argume...
fromfile_prefix_chars ^^^^^^^^^^^^^^^^^^^^^ Sometimes, when dealing with a particularly long argument list, it may make sense to keep the list of arguments in a file rather than typing it out at the command line. If the ``fromfile_prefix_chars=`` argument is given to the :class:`ArgumentParser` constructor, then argume...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a284a9a8-b36e-4974-8ca1-d644c15eae6e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,236
supabase-export-v2
243e8efb0821a5a0
Argument abbreviations (prefix matching) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The :meth:`~ArgumentParser.parse_args` method :ref:`by default <allow_abbrev>` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option)::
trusted_official_docs
CPython Docs
Argument abbreviations (prefix matching) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The :meth:`~ArgumentParser.parse_args` method :ref:`by default <allow_abbrev>` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option)::
Argument abbreviations (prefix matching) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The :meth:`~ArgumentParser.parse_args` method :ref:`by default <allow_abbrev>` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option)::
python, official-docs, cpython, P0
Local_Trusted_Corpus
a331c115-9a2d-45d0-9405-f7f5534791e8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,030
supabase-export-v2
a187e45ac549b40d
.. method:: ArgumentParser.add_argument(name or flags..., *, [action], [nargs], \ [const], [default], [type], [choices], [required], \ [help], [metavar], [dest], [deprecated]) Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.add_argument(name or flags..., *, [action], [nargs], \ [const], [default], [type], [choices], [required], \ [help], [metavar], [dest], [deprecated]) Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
.. method:: ArgumentParser.add_argument(name or flags..., *, [action], [nargs], \ [const], [default], [type], [choices], [required], \ [help], [metavar], [dest], [deprecated]) Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
python, official-docs, cpython, P0
Local_Trusted_Corpus
a3581abb-73d1-4beb-865d-b6d926ab333e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,947
supabase-export-v2
05312f42a845a1d4
>>> bar_parser = argparse.ArgumentParser(parents=[parent_parser]) >>> bar_parser.add_argument('--bar') >>> bar_parser.parse_args(['--bar', 'YYY']) Namespace(bar='YYY', parent=None) Note that most parent parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (o...
trusted_official_docs
CPython Docs
>>> bar_parser = argparse.ArgumentParser(parents=[parent_parser]) >>> bar_parser.add_argument('--bar') >>> bar_parser.parse_args(['--bar', 'YYY']) Namespace(bar='YYY', parent=None) Note that most parent parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (o...
>>> bar_parser = argparse.ArgumentParser(parents=[parent_parser]) >>> bar_parser.add_argument('--bar') >>> bar_parser.parse_args(['--bar', 'YYY']) Namespace(bar='YYY', parent=None) Note that most parent parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a47cc3cf-95ac-45cd-8605-1f5eacedcd27
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,230
supabase-export-v2
8b24073f03bc142a
>>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: no such option: -2 >>> # negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: argument -1: expected...
trusted_official_docs
CPython Docs
>>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: no such option: -2 >>> # negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: argument -1: expected...
>>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: no such option: -2 >>> # negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1']) usage: PROG [-h] [-1 ONE] [foo] PROG: error: argument -1: expected...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a55e4a51-2eab-4cc5-8710-d709f09fd98b
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,184
supabase-export-v2
c93414d1ffc3313f
from the command line. The :class:`!Action` class must accept the two positional arguments plus any keyword arguments passed to :meth:`ArgumentParser.add_argument` except for the ``action`` itself. Instances of :class:`!Action` (or return value of any callable to the ``action`` parameter) should have attributes :attr:...
trusted_official_docs
CPython Docs
from the command line. The :class:`!Action` class must accept the two positional arguments plus any keyword arguments passed to :meth:`ArgumentParser.add_argument` except for the ``action`` itself. Instances of :class:`!Action` (or return value of any callable to the ``action`` parameter) should have attributes :attr:...
from the command line. The :class:`!Action` class must accept the two positional arguments plus any keyword arguments passed to :meth:`ArgumentParser.add_argument` except for the ``action`` itself. Instances of :class:`!Action` (or return value of any callable to the ``action`` parameter) should have attributes :attr:...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a5b39726-f4ab-488d-a3cf-6e8f11932599
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,209
supabase-export-v2
9811a07f9ef946a9
specifying the value of an option (if it takes one). In the simplest case, the option and its value are passed as two separate arguments:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('--foo') >>> parser.parse_args(['-x', 'X']) Namespace(foo=None, x='X') >...
trusted_official_docs
CPython Docs
specifying the value of an option (if it takes one). In the simplest case, the option and its value are passed as two separate arguments:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('--foo') >>> parser.parse_args(['-x', 'X']) Namespace(foo=None, x='X') >...
specifying the value of an option (if it takes one). In the simplest case, the option and its value are passed as two separate arguments:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('--foo') >>> parser.parse_args(['-x', 'X']) Namespace(foo=None, x='X') >...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a6b6b3d1-19a5-4ea8-b7a1-773dcaafabfb
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,986
supabase-export-v2
554abe66c053041a
This can be accomplished by passing the ``argument_default=`` keyword argument to :class:`ArgumentParser`. For example, to globally suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we supply ``argument_default=SUPPRESS``:: >>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS) ...
trusted_official_docs
CPython Docs
This can be accomplished by passing the ``argument_default=`` keyword argument to :class:`ArgumentParser`. For example, to globally suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we supply ``argument_default=SUPPRESS``:: >>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS) ...
This can be accomplished by passing the ``argument_default=`` keyword argument to :class:`ArgumentParser`. For example, to globally suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we supply ``argument_default=SUPPRESS``:: >>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS) ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a753f907-a777-4b01-8e50-9de66c946144
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,319
supabase-export-v2
3a5404c4dd6056c5
Note that any arguments not in your user-defined groups will end up back in the usual "positional arguments" and "optional arguments" sections. Within each argument group, arguments are displayed in help output in the order in which they are added.
trusted_official_docs
CPython Docs
Note that any arguments not in your user-defined groups will end up back in the usual "positional arguments" and "optional arguments" sections. Within each argument group, arguments are displayed in help output in the order in which they are added.
Note that any arguments not in your user-defined groups will end up back in the usual "positional arguments" and "optional arguments" sections. Within each argument group, arguments are displayed in help output in the order in which they are added.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a83dd6b9-2298-4e94-bea9-0aee3c4c573b
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,023
supabase-export-v2
26e806da19528adc
To highlight inline code in your description or epilog text, you can use backticks:: >>> parser = argparse.ArgumentParser( ... formatter_class=argparse.RawDescriptionHelpFormatter, ... epilog='''Examples: ... `python -m myapp --verbose` ... `python -m myapp --config settings.json` ... ''')
trusted_official_docs
CPython Docs
To highlight inline code in your description or epilog text, you can use backticks:: >>> parser = argparse.ArgumentParser( ... formatter_class=argparse.RawDescriptionHelpFormatter, ... epilog='''Examples: ... `python -m myapp --verbose` ... `python -m myapp --config settings.json` ... ''')
To highlight inline code in your description or epilog text, you can use backticks:: >>> parser = argparse.ArgumentParser( ... formatter_class=argparse.RawDescriptionHelpFormatter, ... epilog='''Examples: ... `python -m myapp --verbose` ... `python -m myapp --config settings.json` ... ''')
python, official-docs, cpython, P0
Local_Trusted_Corpus
ab4e2621-2ce2-4b3c-abc9-2fee89851f98
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,081
supabase-export-v2
7b683bc0b4d2d375
nargs ^^^^^ :class:`ArgumentParser` objects usually associate a single command-line argument with a single action to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are:
trusted_official_docs
CPython Docs
nargs ^^^^^ :class:`ArgumentParser` objects usually associate a single command-line argument with a single action to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are:
nargs ^^^^^ :class:`ArgumentParser` objects usually associate a single command-line argument with a single action to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are:
python, official-docs, cpython, P0
Local_Trusted_Corpus
abcedb45-f682-4b12-b798-eedea78067a9
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,285
supabase-export-v2
b3e338c6a37c3b7c
-x 2'.split()) >>> args.func(args) 2.0 >>> >>> # parse the args and call whatever function was selected >>> args = parser.parse_args('bar XYZYX'.split()) >>> args.func(args) ((XYZYX)) This way, you can let :meth:`~ArgumentParser.parse_args` do the job of calling the appropriate function after argument parsing is compl...
trusted_official_docs
CPython Docs
-x 2'.split()) >>> args.func(args) 2.0 >>> >>> # parse the args and call whatever function was selected >>> args = parser.parse_args('bar XYZYX'.split()) >>> args.func(args) ((XYZYX)) This way, you can let :meth:`~ArgumentParser.parse_args` do the job of calling the appropriate function after argument parsing is compl...
-x 2'.split()) >>> args.func(args) 2.0 >>> >>> # parse the args and call whatever function was selected >>> args = parser.parse_args('bar XYZYX'.split()) >>> args.func(args) ((XYZYX)) This way, you can let :meth:`~ArgumentParser.parse_args` do the job of calling the appropriate function after argument parsing is compl...
python, official-docs, cpython, P0
Local_Trusted_Corpus