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
ad139359-ed07-4aa8-af47-4dee6c4cc2e4
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,036
supabase-export-v2
bb14574121870f13
* default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object. * type_ - The type to which the command-line argument should be converted.
trusted_official_docs
CPython Docs
* default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object. * type_ - The type to which the command-line argument should be converted.
* default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object. * type_ - The type to which the command-line argument should be converted.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ad46bd9d-c57a-43de-a931-922bf9d43653
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,147
supabase-export-v2
a471579a381191bd
argument. When a user requests help (usually by using ``-h`` or ``--help`` at the command line), these ``help`` descriptions will be displayed with each argument. The ``help`` strings can include various format specifiers to avoid repetition of things like the program name or the argument default_. The available specif...
trusted_official_docs
CPython Docs
argument. When a user requests help (usually by using ``-h`` or ``--help`` at the command line), these ``help`` descriptions will be displayed with each argument. The ``help`` strings can include various format specifiers to avoid repetition of things like the program name or the argument default_. The available specif...
argument. When a user requests help (usually by using ``-h`` or ``--help`` at the command line), these ``help`` descriptions will be displayed with each argument. The ``help`` strings can include various format specifiers to avoid repetition of things like the program name or the argument default_. The available specif...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ada6512d-a0e5-42b0-a185-08277ac68bd5
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,955
supabase-export-v2
c58ae3f6bd73dd0f
this epilog whose whitespace will ... be cleaned up and whose words will be wrapped ... across a couple lines''') >>> parser.print_help() usage: PROG [-h] this description was indented weird but that is okay
trusted_official_docs
CPython Docs
this epilog whose whitespace will ... be cleaned up and whose words will be wrapped ... across a couple lines''') >>> parser.print_help() usage: PROG [-h] this description was indented weird but that is okay
this epilog whose whitespace will ... be cleaned up and whose words will be wrapped ... across a couple lines''') >>> parser.print_help() usage: PROG [-h] this description was indented weird but that is okay
python, official-docs, cpython, P0
Local_Trusted_Corpus
ade5496d-6691-40bc-a5a5-62d46c2895c6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,074
supabase-export-v2
297622a451c1f36e
parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created. * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when inv...
trusted_official_docs
CPython Docs
parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created. * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when inv...
parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created. * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when inv...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ae1f3890-be6f-42c6-9450-71c1ae5017e8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,917
supabase-export-v2
5c2b6411a78de17f
was passed as argument. * The Python interpreter name followed by ``-m`` followed by the module or package name if the :option:`-m` option was used. This default is almost always desirable because it will make the help messages match the string that was used to invoke the program on the command line. However, to change...
trusted_official_docs
CPython Docs
was passed as argument. * The Python interpreter name followed by ``-m`` followed by the module or package name if the :option:`-m` option was used. This default is almost always desirable because it will make the help messages match the string that was used to invoke the program on the command line. However, to change...
was passed as argument. * The Python interpreter name followed by ``-m`` followed by the module or package name if the :option:`-m` option was used. This default is almost always desirable because it will make the help messages match the string that was used to invoke the program on the command line. However, to change...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ae8f57f7-eacf-4be9-9066-126c80b59fa2
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,364
supabase-export-v2
d2958a4ed1d13dbb
.. method:: ArgumentParser.convert_arg_line_to_args(arg_line) Arguments that are read 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.
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.convert_arg_line_to_args(arg_line) Arguments that are read 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.
.. method:: ArgumentParser.convert_arg_line_to_args(arg_line) Arguments that are read 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.
python, official-docs, cpython, P0
Local_Trusted_Corpus
afca2e8d-398a-4164-889c-dae30a4ae044
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,138
supabase-export-v2
c466b3c9eac4cd18
To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your application code. Formatted choices override the default *metavar* which is normally derived from *dest*. This is usually what you want because the user never sees the *dest* par...
trusted_official_docs
CPython Docs
To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your application code. Formatted choices override the default *metavar* which is normally derived from *dest*. This is usually what you want because the user never sees the *dest* par...
To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your application code. Formatted choices override the default *metavar* which is normally derived from *dest*. This is usually what you want because the user never sees the *dest* par...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b02920d9-6469-4cf2-8383-5b39f908b5b0
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,204
supabase-export-v2
e5fc7449cc4ae3fa
Convert argument strings to objects and assign them as attributes of the namespace. Return the populated namespace. 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.
trusted_official_docs
CPython Docs
Convert argument strings to objects and assign them as attributes of the namespace. Return the populated namespace. 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.
Convert argument strings to objects and assign them as attributes of the namespace. Return the populated namespace. 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.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b0a13b1d-77c3-4f7c-aa67-e63fd09998ea
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,008
supabase-export-v2
3cfbb151b9c165b0
exit_on_error ^^^^^^^^^^^^^ Normally, when you pass an 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.
trusted_official_docs
CPython Docs
exit_on_error ^^^^^^^^^^^^^ Normally, when you pass an 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.
exit_on_error ^^^^^^^^^^^^^ Normally, when you pass an 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.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b1137660-0a4f-46d6-b724-6ccbdda3bbbd
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,312
supabase-export-v2
1ff6fa65ed00ed0a
displaying help messages. When there is a better conceptual grouping of arguments than this default one, appropriate groups can be created using the :meth:`!add_argument_group` method:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group = parser.add_argument_group('group') >>> group.add_argum...
trusted_official_docs
CPython Docs
displaying help messages. When there is a better conceptual grouping of arguments than this default one, appropriate groups can be created using the :meth:`!add_argument_group` method:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group = parser.add_argument_group('group') >>> group.add_argum...
displaying help messages. When there is a better conceptual grouping of arguments than this default one, appropriate groups can be created using the :meth:`!add_argument_group` method:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group = parser.add_argument_group('group') >>> group.add_argum...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b19ead4f-bde3-42e3-8069-c47db3c257cf
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,208
supabase-export-v2
2913b350cb156ba1
Option value syntax ^^^^^^^^^^^^^^^^^^^ The :meth:`~ArgumentParser.parse_args` method supports several ways of 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::
trusted_official_docs
CPython Docs
Option value syntax ^^^^^^^^^^^^^^^^^^^ The :meth:`~ArgumentParser.parse_args` method supports several ways of 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::
Option value syntax ^^^^^^^^^^^^^^^^^^^ The :meth:`~ArgumentParser.parse_args` method supports several ways of 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::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b364e022-da14-4c75-9f53-dcb912a55173
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,189
supabase-export-v2
b83ce05a8742c772
* *namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`. * *values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword arg...
trusted_official_docs
CPython Docs
* *namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`. * *values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword arg...
* *namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`. * *values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword arg...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b3a15add-dfb8-49d1-8865-6f6f9cd6b287
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,182
supabase-export-v2
981449a41e351ff5
which returns a callable which processes arguments from the command-line. Any object which follows this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser.add_argument`. .. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=No...
trusted_official_docs
CPython Docs
which returns a callable which processes arguments from the command-line. Any object which follows this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser.add_argument`. .. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=No...
which returns a callable which processes arguments from the command-line. Any object which follows this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser.add_argument`. .. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=No...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b4117cf4-8899-4349-96be-473635380afd
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,301
supabase-export-v2
5d72deb354050edd
.. class:: FileType(mode='r', bufsize=-1, encoding=None, errors=None) The :class:`FileType` factory creates objects that can be passed to the type argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:`FileType` objects as their type will open command-line arguments as files with the requested ...
trusted_official_docs
CPython Docs
.. class:: FileType(mode='r', bufsize=-1, encoding=None, errors=None) The :class:`FileType` factory creates objects that can be passed to the type argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:`FileType` objects as their type will open command-line arguments as files with the requested ...
.. class:: FileType(mode='r', bufsize=-1, encoding=None, errors=None) The :class:`FileType` factory creates objects that can be passed to the type argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:`FileType` objects as their type will open command-line arguments as files with the requested ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b4ffecd0-13f3-4842-a7e1-71613b89f818
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,073
supabase-export-v2
4083c863f1338f3b
Note, the *default* will be ``None`` unless explicitly set to *0*. * ``'help'`` - This prints a complete help message for all the options in the current parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created.
trusted_official_docs
CPython Docs
Note, the *default* will be ``None`` unless explicitly set to *0*. * ``'help'`` - This prints a complete help message for all the options in the current parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created.
Note, the *default* will be ``None`` unless explicitly set to *0*. * ``'help'`` - This prints a complete help message for all the options in the current parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b55e530d-734f-44dd-b0d8-f806479ea315
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,079
supabase-export-v2
1014002b78b1dcf7
An example of a custom action:: >>> class FooAction(argparse.Action): ... def __init__(self, option_strings, dest, nargs=None, **kwargs): ... if nargs is not None: ... raise ValueError("nargs not allowed") ... super().__init__(option_strings, dest, **kwargs) ... def __call__(self, parser, namespace, values, option...
trusted_official_docs
CPython Docs
An example of a custom action:: >>> class FooAction(argparse.Action): ... def __init__(self, option_strings, dest, nargs=None, **kwargs): ... if nargs is not None: ... raise ValueError("nargs not allowed") ... super().__init__(option_strings, dest, **kwargs) ... def __call__(self, parser, namespace, values, option...
An example of a custom action:: >>> class FooAction(argparse.Action): ... def __init__(self, option_strings, dest, nargs=None, **kwargs): ... if nargs is not None: ... raise ValueError("nargs not allowed") ... super().__init__(option_strings, dest, **kwargs) ... def __call__(self, parser, namespace, values, option...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b88be90b-e8aa-41df-a241-ac56053dbd78
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,315
supabase-export-v2
1f61e74536ae229b
the argument in a separate group for help messages. The :meth:`!add_argument_group` method accepts *title* and *description* arguments which can be used to customize this display:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group1 = parser.add_argument_group('group1', 'group1 description') ...
trusted_official_docs
CPython Docs
the argument in a separate group for help messages. The :meth:`!add_argument_group` method accepts *title* and *description* arguments which can be used to customize this display:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group1 = parser.add_argument_group('group1', 'group1 description') ...
the argument in a separate group for help messages. The :meth:`!add_argument_group` method accepts *title* and *description* arguments which can be used to customize this display:: >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) >>> group1 = parser.add_argument_group('group1', 'group1 description') ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b8aa744f-d5e0-4e53-b82d-bdf5dd4ff5d6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,249
supabase-export-v2
190a7df9ab3c0f38
an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achieved by specifying the ``namespace=`` keyword argument:: >>> class C: ... pass ... >>> c = C() >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> parser....
trusted_official_docs
CPython Docs
an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achieved by specifying the ``namespace=`` keyword argument:: >>> class C: ... pass ... >>> c = C() >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> parser....
an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achieved by specifying the ``namespace=`` keyword argument:: >>> class C: ... pass ... >>> c = C() >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> parser....
python, official-docs, cpython, P0
Local_Trusted_Corpus
b8ebfd0e-a29d-461c-878e-948bcf00ccbf
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,905
supabase-export-v2
a0d02277fa2befbc
* allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is unambiguous (default: ``True``) * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)
trusted_official_docs
CPython Docs
* allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is unambiguous (default: ``True``) * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)
* allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is unambiguous (default: ``True``) * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)
python, official-docs, cpython, P0
Local_Trusted_Corpus
b8ee5682-4d05-4cf9-bf1e-17333873b0fc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,948
supabase-export-v2
cf4ccb91750600e3
parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the parent and one in the child) and raise an error. .. note:: You must fully initialize the parsers before passing them via ``parents=``. If you change the parent parsers after the child parser, ...
trusted_official_docs
CPython Docs
parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the parent and one in the child) and raise an error. .. note:: You must fully initialize the parsers before passing them via ``parents=``. If you change the parent parsers after the child parser, ...
parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the parent and one in the child) and raise an error. .. note:: You must fully initialize the parsers before passing them via ``parents=``. If you change the parent parsers after the child parser, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b9bf8a23-f42d-45ce-9625-32482915fcb9
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,892
supabase-export-v2
f7d84e3967b06310
.. class:: ArgumentParser(prog=None, usage=None, description=None, \ epilog=None, parents=[], \ formatter_class=argparse.HelpFormatter, \ prefix_chars='-', fromfile_prefix_chars=None, \ argument_default=None, conflict_handler='error', \ add_help=True, allow_abbrev=True, exit_on_error=True, \ *, suggest_on_error=True, c...
trusted_official_docs
CPython Docs
.. class:: ArgumentParser(prog=None, usage=None, description=None, \ epilog=None, parents=[], \ formatter_class=argparse.HelpFormatter, \ prefix_chars='-', fromfile_prefix_chars=None, \ argument_default=None, conflict_handler='error', \ add_help=True, allow_abbrev=True, exit_on_error=True, \ *, suggest_on_error=True, c...
.. class:: ArgumentParser(prog=None, usage=None, description=None, \ epilog=None, parents=[], \ formatter_class=argparse.HelpFormatter, \ prefix_chars='-', fromfile_prefix_chars=None, \ argument_default=None, conflict_handler='error', \ add_help=True, allow_abbrev=True, exit_on_error=True, \ *, suggest_on_error=True, c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ba081284-53b3-498e-b2c9-92006d63f503
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,001
supabase-export-v2
dc7fca71020294e7
an option which simply displays the parser's help message. If ``-h`` or ``--help`` is supplied at the command line, the :class:`!ArgumentParser` help will be printed. Occasionally, 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 :c...
trusted_official_docs
CPython Docs
an option which simply displays the parser's help message. If ``-h`` or ``--help`` is supplied at the command line, the :class:`!ArgumentParser` help will be printed. Occasionally, 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 :c...
an option which simply displays the parser's help message. If ``-h`` or ``--help`` is supplied at the command line, the :class:`!ArgumentParser` help will be printed. Occasionally, 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 :c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ba8c674f-a2d0-4ed2-8bf9-47ef40dd1692
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,059
supabase-export-v2
fcf84bd81c8b8a20
* ``'store'`` - This just stores the argument's value. This is the default action. * ``'store_const'`` - This stores the value specified by the const_ keyword argument; note that the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify ...
trusted_official_docs
CPython Docs
* ``'store'`` - This just stores the argument's value. This is the default action. * ``'store_const'`` - This stores the value specified by the const_ keyword argument; note that the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify ...
* ``'store'`` - This just stores the argument's value. This is the default action. * ``'store_const'`` - This stores the value specified by the const_ keyword argument; note that the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bad66c4a-d817-4c98-878d-4b045fb1c9de
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,384
supabase-export-v2
a9de9045fef08385
.. method:: ArgumentParser.register(registry_name, value, object) Sometimes it's desirable to use a custom string in error messages to provide more user-friendly output. In these cases, :meth:`!register` can be used to register custom actions or types with a parser and allow you to reference the type by their regist...
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.register(registry_name, value, object) Sometimes it's desirable to use a custom string in error messages to provide more user-friendly output. In these cases, :meth:`!register` can be used to register custom actions or types with a parser and allow you to reference the type by their regist...
.. method:: ArgumentParser.register(registry_name, value, object) Sometimes it's desirable to use a custom string in error messages to provide more user-friendly output. In these cases, :meth:`!register` can be used to register custom actions or types with a parser and allow you to reference the type by their regist...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bc29777f-ef6f-4790-aa28-f77bd364e7f4
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,220
supabase-export-v2
8aa43bd50db9e2a3
>>> # invalid type >>> parser.parse_args(['--foo', 'spam']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: argument --foo: invalid int value: 'spam' >>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: no such option: --bar
trusted_official_docs
CPython Docs
>>> # invalid type >>> parser.parse_args(['--foo', 'spam']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: argument --foo: invalid int value: 'spam' >>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: no such option: --bar
>>> # invalid type >>> parser.parse_args(['--foo', 'spam']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: argument --foo: invalid int value: 'spam' >>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: no such option: --bar
python, official-docs, cpython, P0
Local_Trusted_Corpus
bc4572c8-b98e-47a4-93e9-bfc83b756490
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,217
supabase-export-v2
9d8659e7c742e6ef
Invalid arguments ^^^^^^^^^^^^^^^^^ While parsing the command line, :meth:`~ArgumentParser.parse_args` checks for a variety of errors, including ambiguous options, invalid types, invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usag...
trusted_official_docs
CPython Docs
Invalid arguments ^^^^^^^^^^^^^^^^^ While parsing the command line, :meth:`~ArgumentParser.parse_args` checks for a variety of errors, including ambiguous options, invalid types, invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usag...
Invalid arguments ^^^^^^^^^^^^^^^^^ While parsing the command line, :meth:`~ArgumentParser.parse_args` checks for a variety of errors, including ambiguous options, invalid types, invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usag...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bc45b4ea-a7e4-4c80-b0e7-5432f70876b9
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,089
supabase-export-v2
565e406d4bc4a358
One of the more common uses of ``nargs='?'`` is to allow optional input and output files:: >>> 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='outpu...
trusted_official_docs
CPython Docs
One of the more common uses of ``nargs='?'`` is to allow optional input and output files:: >>> 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='outpu...
One of the more common uses of ``nargs='?'`` is to allow optional input and output files:: >>> 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='outpu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bcd98b22-1df3-4757-8c37-ef4297022218
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,247
supabase-export-v2
9fd2b76dbcf5f6cc
:class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python idiom, :func:`vars`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> args = parser.parse_args(['--foo', 'BAR']) >>> vars(args) {'foo': ...
trusted_official_docs
CPython Docs
:class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python idiom, :func:`vars`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> args = parser.parse_args(['--foo', 'BAR']) >>> vars(args) {'foo': ...
:class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python idiom, :func:`vars`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> args = parser.parse_args(['--foo', 'BAR']) >>> vars(args) {'foo': ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bd49d485-1982-40fb-bca6-e74cbce10044
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,895
supabase-export-v2
e9227912690342ae
* usage_ - The string describing the program usage (default: generated from arguments added to parser) * description_ - Text to display before the argument help (by default, no text)
trusted_official_docs
CPython Docs
* usage_ - The string describing the program usage (default: generated from arguments added to parser) * description_ - Text to display before the argument help (by default, no text)
* usage_ - The string describing the program usage (default: generated from arguments added to parser) * description_ - Text to display before the argument help (by default, no text)
python, official-docs, cpython, P0
Local_Trusted_Corpus
bd9914d7-2875-4e13-83b1-37bc73689d43
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,964
supabase-export-v2
a7006a9d9bce7d88
:class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages:: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.ArgumentDefaultsHelpFormatter) >>> parser.add_argument('--foo', type=int, default=42, help='FOO!') >>...
trusted_official_docs
CPython Docs
:class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages:: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.ArgumentDefaultsHelpFormatter) >>> parser.add_argument('--foo', type=int, default=42, help='FOO!') >>...
:class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages:: >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.ArgumentDefaultsHelpFormatter) >>> parser.add_argument('--foo', type=int, default=42, help='FOO!') >>...
python, official-docs, cpython, P0
Local_Trusted_Corpus
be044c07-2ac7-4d4b-886c-0f4b22e8f16b
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,990
supabase-export-v2
807ada012df796ca
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: >>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False) >>> parser.add_argument('--foobar', action='store_true') >>> parser.add_argument('--foonley', action='store_false') >>> parser.parse_args(['--foon']) usage: PROG [-h] [--foob...
trusted_official_docs
CPython Docs
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: >>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False) >>> parser.add_argument('--foobar', action='store_true') >>> parser.add_argument('--foonley', action='store_false') >>> parser.parse_args(['--foon']) usage: PROG [-h] [--foob...
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: >>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False) >>> parser.add_argument('--foobar', action='store_true') >>> parser.add_argument('--foonley', action='store_false') >>> parser.parse_args(['--foon']) usage: PROG [-h] [--foob...
python, official-docs, cpython, P0
Local_Trusted_Corpus
be2aaddc-73ab-4cbb-9688-7ef6aee5068a
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,188
supabase-export-v2
892d435e60e253e2
* *parser* - The :class:`ArgumentParser` object which contains this action. * *namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`.
trusted_official_docs
CPython Docs
* *parser* - The :class:`ArgumentParser` object which contains this action. * *namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`.
* *parser* - The :class:`ArgumentParser` object which contains this action. * *namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c06b003b-9da0-4751-962b-a8f7b8ae78b5
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,134
supabase-export-v2
c472f3596fdbd4d9
parser.add_argument('move', choices=['rock', 'paper', 'scissors']) >>> parser.parse_args(['rock']) Namespace(move='rock') >>> parser.parse_args(['fire']) usage: game.py [-h] {rock,paper,scissors} game.py: error: argument move: invalid choice: 'fire' (choose from 'rock', 'paper', 'scissors') Any sequence can be passed a...
trusted_official_docs
CPython Docs
parser.add_argument('move', choices=['rock', 'paper', 'scissors']) >>> parser.parse_args(['rock']) Namespace(move='rock') >>> parser.parse_args(['fire']) usage: game.py [-h] {rock,paper,scissors} game.py: error: argument move: invalid choice: 'fire' (choose from 'rock', 'paper', 'scissors') Any sequence can be passed a...
parser.add_argument('move', choices=['rock', 'paper', 'scissors']) >>> parser.parse_args(['rock']) Namespace(move='rock') >>> parser.parse_args(['fire']) usage: game.py [-h] {rock,paper,scissors} game.py: error: argument move: invalid choice: 'fire' (choose from 'rock', 'paper', 'scissors') Any sequence can be passed a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c0f81016-a2fe-4477-bcbc-4a9049ba41ba
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,327
supabase-export-v2
f67039e2c4553258
The :meth:`add_mutually_exclusive_group` method also accepts a *required* argument, to indicate that at least one of the mutually exclusive arguments is required:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> group = parser.add_mutually_exclusive_group(required=True) >>> group.add_argument('--foo', action='s...
trusted_official_docs
CPython Docs
The :meth:`add_mutually_exclusive_group` method also accepts a *required* argument, to indicate that at least one of the mutually exclusive arguments is required:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> group = parser.add_mutually_exclusive_group(required=True) >>> group.add_argument('--foo', action='s...
The :meth:`add_mutually_exclusive_group` method also accepts a *required* argument, to indicate that at least one of the mutually exclusive arguments is required:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> group = parser.add_mutually_exclusive_group(required=True) >>> group.add_argument('--foo', action='s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c1233982-a01d-43a8-b162-5ef88e7d6c83
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,135
supabase-export-v2
c9c05ffc2a088bff
Any sequence can be passed as the *choices* value, so :class:`list` objects, :class:`tuple` objects, and custom sequences are all supported. Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages.
trusted_official_docs
CPython Docs
Any sequence can be passed as the *choices* value, so :class:`list` objects, :class:`tuple` objects, and custom sequences are all supported. Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages.
Any sequence can be passed as the *choices* value, so :class:`list` objects, :class:`tuple` objects, and custom sequences are all supported. Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c138ddba-05e3-4959-b3a4-a3bcab9141e7
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,302
supabase-export-v2
0b874fd5136e4407
their type will open command-line arguments as files with the requested modes, buffer sizes, encodings and error handling (see the :func:`open` function for more details):: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0)) >>> parser.add_argument('out', type=argp...
trusted_official_docs
CPython Docs
their type will open command-line arguments as files with the requested modes, buffer sizes, encodings and error handling (see the :func:`open` function for more details):: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0)) >>> parser.add_argument('out', type=argp...
their type will open command-line arguments as files with the requested modes, buffer sizes, encodings and error handling (see the :func:`open` function for more details):: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0)) >>> parser.add_argument('out', type=argp...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c224467e-73eb-45f5-a7d9-1fa1ca12accf
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,916
supabase-export-v2
40f4e2622dc8a56c
By default, :class:`ArgumentParser` calculates the name of the program to display in help messages depending on the way the Python interpreter was run: * The :func:`base name <os.path.basename>` of ``sys.argv[0]`` if a file was passed as argument. * The Python interpreter name followed by ``sys.argv[0]`` if a director...
trusted_official_docs
CPython Docs
By default, :class:`ArgumentParser` calculates the name of the program to display in help messages depending on the way the Python interpreter was run: * The :func:`base name <os.path.basename>` of ``sys.argv[0]`` if a file was passed as argument. * The Python interpreter name followed by ``sys.argv[0]`` if a director...
By default, :class:`ArgumentParser` calculates the name of the program to display in help messages depending on the way the Python interpreter was run: * The :func:`base name <os.path.basename>` of ``sys.argv[0]`` if a file was passed as argument. * The Python interpreter name followed by ``sys.argv[0]`` if a director...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c3983ab8-b826-454a-8b78-996af8422242
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,965
supabase-export-v2
a364c5186872a423
... prog='PROG', ... formatter_class=argparse.ArgumentDefaultsHelpFormatter) >>> parser.add_argument('--foo', type=int, default=42, help='FOO!') >>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!') >>> parser.print_help() usage: PROG [-h] [--foo FOO] [bar ...] positional arguments: bar BAR! (defau...
trusted_official_docs
CPython Docs
... prog='PROG', ... formatter_class=argparse.ArgumentDefaultsHelpFormatter) >>> parser.add_argument('--foo', type=int, default=42, help='FOO!') >>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!') >>> parser.print_help() usage: PROG [-h] [--foo FOO] [bar ...] positional arguments: bar BAR! (defau...
... prog='PROG', ... formatter_class=argparse.ArgumentDefaultsHelpFormatter) >>> parser.add_argument('--foo', type=int, default=42, help='FOO!') >>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!') >>> parser.print_help() usage: PROG [-h] [--foo FOO] [bar ...] positional arguments: bar BAR! (defau...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c57b093d-bcc4-49b4-8cf4-c1b2f82190af
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,278
supabase-export-v2
d43966d2fa08a304
supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example:: >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(title='subcommands', ... description='valid subcommands', ... help=...
trusted_official_docs
CPython Docs
supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example:: >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(title='subcommands', ... description='valid subcommands', ... help=...
supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example:: >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(title='subcommands', ... description='valid subcommands', ... help=...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5c577e0-2651-45f3-905b-550a87fa4078
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,277
supabase-export-v2
1343a3d26e429b1c
options: -h, --help show this help message and exit --baz {X,Y,Z} baz help The :meth:`~ArgumentParser.add_subparsers` method also supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example::
trusted_official_docs
CPython Docs
options: -h, --help show this help message and exit --baz {X,Y,Z} baz help The :meth:`~ArgumentParser.add_subparsers` method also supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example::
options: -h, --help show this help message and exit --baz {X,Y,Z} baz help The :meth:`~ArgumentParser.add_subparsers` method also supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example::
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5e96197-5bb9-4399-ad12-296fec38fabb
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,387
supabase-export-v2
812eb409e92266a4
The following example shows how to register a custom type with a parser:: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16)) >>> parser.add_argument('--foo', type='hexadecimal integer') _StoreAction(option_strings=['--foo'], dest='foo'...
trusted_official_docs
CPython Docs
The following example shows how to register a custom type with a parser:: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16)) >>> parser.add_argument('--foo', type='hexadecimal integer') _StoreAction(option_strings=['--foo'], dest='foo'...
The following example shows how to register a custom type with a parser:: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16)) >>> parser.add_argument('--foo', type='hexadecimal integer') _StoreAction(option_strings=['--foo'], dest='foo'...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c99e303a-832c-4f70-a972-c12247c4df7f
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,232
supabase-export-v2
57788422fdc240a1
with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which tells :meth:`~ArgumentParser.parse_args` that everything after that is a positional argument:: >>> parser.parse_args(['--', '-f']) Namespace(foo='-f', one=None)
trusted_official_docs
CPython Docs
with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which tells :meth:`~ArgumentParser.parse_args` that everything after that is a positional argument:: >>> parser.parse_args(['--', '-f']) Namespace(foo='-f', one=None)
with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which tells :meth:`~ArgumentParser.parse_args` that everything after that is a positional argument:: >>> parser.parse_args(['--', '-f']) Namespace(foo='-f', one=None)
python, official-docs, cpython, P0
Local_Trusted_Corpus
cb9bd15b-3f68-404d-841b-e8b649a42664
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,361
supabase-export-v2
644c3d884ce82a0a
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('bar') >>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam']) (Namespace(bar='BAR', foo=True), ['--badger', 'spam']) .. warning:: :ref:`Prefix matching <prefix-matching>` rules apply to :met...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('bar') >>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam']) (Namespace(bar='BAR', foo=True), ['--badger', 'spam']) .. warning:: :ref:`Prefix matching <prefix-matching>` rules apply to :met...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('bar') >>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam']) (Namespace(bar='BAR', foo=True), ['--badger', 'spam']) .. warning:: :ref:`Prefix matching <prefix-matching>` rules apply to :met...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cc80644a-8ef1-4f75-8f39-b1bed3de9c2c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,241
supabase-export-v2
a9969daf3edf28ee
than those of :data:`sys.argv`. This can be accomplished by passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is useful for testing at the interactive prompt:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument( ... 'integers', metavar='int', type=int, choices=range(10), ... nargs='+'...
trusted_official_docs
CPython Docs
than those of :data:`sys.argv`. This can be accomplished by passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is useful for testing at the interactive prompt:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument( ... 'integers', metavar='int', type=int, choices=range(10), ... nargs='+'...
than those of :data:`sys.argv`. This can be accomplished by passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is useful for testing at the interactive prompt:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument( ... 'integers', metavar='int', type=int, choices=range(10), ... nargs='+'...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cdbef505-7f00-4e3c-bc69-89ee79498e63
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,084
supabase-export-v2
37cd8c04b340f4ee
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs=2) >>> parser.add_argument('bar', nargs=1) >>> parser.parse_args('c --foo a b'.split()) Namespace(bar=['c'], foo=['a', 'b']) Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs=2) >>> parser.add_argument('bar', nargs=1) >>> parser.parse_args('c --foo a b'.split()) Namespace(bar=['c'], foo=['a', 'b']) Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs=2) >>> parser.add_argument('bar', nargs=1) >>> parser.parse_args('c --foo a b'.split()) Namespace(bar=['c'], foo=['a', 'b']) Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ce93e2e9-5b91-4ccf-a0f3-0590e75bef4d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,157
supabase-export-v2
4d164dd07592cb26
to as ``bar``. A single optional argument ``--foo`` that should be followed by a single command-line argument will be referred to as ``FOO``. An example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> parser.add_argument('bar') >>> parser.parse_args('X --foo Y'.split()) Namespace(bar='...
trusted_official_docs
CPython Docs
to as ``bar``. A single optional argument ``--foo`` that should be followed by a single command-line argument will be referred to as ``FOO``. An example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> parser.add_argument('bar') >>> parser.parse_args('X --foo Y'.split()) Namespace(bar='...
to as ``bar``. A single optional argument ``--foo`` that should be followed by a single command-line argument will be referred to as ``FOO``. An example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo') >>> parser.add_argument('bar') >>> parser.parse_args('X --foo Y'.split()) Namespace(bar='...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cf4f7262-214e-45df-8f83-7b5bec7aa1f9
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,376
supabase-export-v2
f604f30ee2dd630b
.. method:: ArgumentParser.parse_intermixed_args(args=None, namespace=None) .. method:: ArgumentParser.parse_known_intermixed_args(args=None, namespace=None) A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`...
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.parse_intermixed_args(args=None, namespace=None) .. method:: ArgumentParser.parse_known_intermixed_args(args=None, namespace=None) A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`...
.. method:: ArgumentParser.parse_intermixed_args(args=None, namespace=None) .. method:: ArgumentParser.parse_known_intermixed_args(args=None, namespace=None) A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cfda6958-6b3e-4e72-bd12-16f1b354cbfc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,350
supabase-export-v2
56c1fd1f2100c925
Print a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`. If *file* is ``None``, :data:`sys.stdout` is assumed. There are also variants of these methods that simply return a string instead of printing it:
trusted_official_docs
CPython Docs
Print a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`. If *file* is ``None``, :data:`sys.stdout` is assumed. There are also variants of these methods that simply return a string instead of printing it:
Print a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`. If *file* is ``None``, :data:`sys.stdout` is assumed. There are also variants of these methods that simply return a string instead of printing it:
python, official-docs, cpython, P0
Local_Trusted_Corpus
d00c2a4a-a2e6-4458-b359-aab13efda9b4
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,963
supabase-export-v2
7011ae02fef9f25a
help text, including argument descriptions. However, multiple newlines are replaced with one. If you wish to preserve multiple blank lines, add spaces between the newlines. :class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages::
trusted_official_docs
CPython Docs
help text, including argument descriptions. However, multiple newlines are replaced with one. If you wish to preserve multiple blank lines, add spaces between the newlines. :class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages::
help text, including argument descriptions. However, multiple newlines are replaced with one. If you wish to preserve multiple blank lines, add spaces between the newlines. :class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d042d1aa-41cc-4981-acbf-70d7e43b0e2d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,110
supabase-export-v2
48193f6200ba7b8f
For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no command-line argument was present:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', nargs='?', default=42) >>> parser.parse_args(['a']) Namespace(foo='a') >>> parser.parse_args([]) Namespace(fo...
trusted_official_docs
CPython Docs
For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no command-line argument was present:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', nargs='?', default=42) >>> parser.parse_args(['a']) Namespace(foo='a') >>> parser.parse_args([]) Namespace(fo...
For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no command-line argument was present:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', nargs='?', default=42) >>> parser.parse_args(['a']) Namespace(foo='a') >>> parser.parse_args([]) Namespace(fo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d1f6bd48-7c0c-4382-80be-7dfea1830a9a
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,265
supabase-export-v2
cc3e86e96c41fc74
Some example usage:: >>> # create the top-level parser >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', action='store_true', help='foo help') >>> subparsers = parser.add_subparsers(help='subcommand help') >>> >>> # create the parser for the "a" command >>> parser_a = subparsers.a...
trusted_official_docs
CPython Docs
Some example usage:: >>> # create the top-level parser >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', action='store_true', help='foo help') >>> subparsers = parser.add_subparsers(help='subcommand help') >>> >>> # create the parser for the "a" command >>> parser_a = subparsers.a...
Some example usage:: >>> # create the top-level parser >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', action='store_true', help='foo help') >>> subparsers = parser.add_subparsers(help='subcommand help') >>> >>> # create the parser for the "a" command >>> parser_a = subparsers.a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2cbb2da-fdae-4404-b624-4531672c311e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,015
supabase-export-v2
25e709ab5ce65e5e
choices=['debug', 'dryrun']) >>> parser.parse_args(['--action', 'debugg']) usage: tester.py [-h] [--action {debug,dryrun}] tester.py: error: argument --action: invalid choice: 'debugg', maybe you meant 'debug'? (choose from debug, dryrun) You can disable suggestions by setting ``suggest_on_error`` to ``False``.
trusted_official_docs
CPython Docs
choices=['debug', 'dryrun']) >>> parser.parse_args(['--action', 'debugg']) usage: tester.py [-h] [--action {debug,dryrun}] tester.py: error: argument --action: invalid choice: 'debugg', maybe you meant 'debug'? (choose from debug, dryrun) You can disable suggestions by setting ``suggest_on_error`` to ``False``.
choices=['debug', 'dryrun']) >>> parser.parse_args(['--action', 'debugg']) usage: tester.py [-h] [--action {debug,dryrun}] tester.py: error: argument --action: invalid choice: 'debugg', maybe you meant 'debug'? (choose from debug, dryrun) You can disable suggestions by setting ``suggest_on_error`` to ``False``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2d0bf39-d520-4a46-aeaf-2f881febda94
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,169
supabase-export-v2
362584c038c7c9fc
dest ^^^^ Most :class:`ArgumentParser` actions add some value as an attribute of the object returned by :meth:`~ArgumentParser.parse_args`. The name of this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as...
trusted_official_docs
CPython Docs
dest ^^^^ Most :class:`ArgumentParser` actions add some value as an attribute of the object returned by :meth:`~ArgumentParser.parse_args`. The name of this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as...
dest ^^^^ Most :class:`ArgumentParser` actions add some value as an attribute of the object returned by :meth:`~ArgumentParser.parse_args`. The name of this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d31624fe-33ea-41e3-a7f8-e4ba99c63e3f
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,317
supabase-export-v2
1258dd06ceca14b1
--bar BAR bar help The optional, keyword-only parameters argument_default_ and conflict_handler_ allow for finer-grained control of the behavior of the argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the en...
trusted_official_docs
CPython Docs
--bar BAR bar help The optional, keyword-only parameters argument_default_ and conflict_handler_ allow for finer-grained control of the behavior of the argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the en...
--bar BAR bar help The optional, keyword-only parameters argument_default_ and conflict_handler_ allow for finer-grained control of the behavior of the argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the en...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d425d568-2d6f-4b7a-9585-a40c3fffc5f3
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,151
supabase-export-v2
3ec9a9bffce28502
options: -h, --help show this help message and exit As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``.
trusted_official_docs
CPython Docs
options: -h, --help show this help message and exit As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``.
options: -h, --help show this help message and exit As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d51555c2-9987-4e05-9bb4-167a824f980c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,067
supabase-export-v2
d93a87f61583a312
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--str', dest='types', action='append_const', const=str) >>> parser.add_argument('--int', dest='types', action='append_const', const=int) >>> parser.parse_args('--str --int'.split()) Namespace(types=[<class 'str'>, <class 'int'>]) * ``'extend'`` - This appe...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--str', dest='types', action='append_const', const=str) >>> parser.add_argument('--int', dest='types', action='append_const', const=int) >>> parser.parse_args('--str --int'.split()) Namespace(types=[<class 'str'>, <class 'int'>]) * ``'extend'`` - This appe...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--str', dest='types', action='append_const', const=str) >>> parser.add_argument('--int', dest='types', action='append_const', const=int) >>> parser.parse_args('--str --int'.split()) Namespace(types=[<class 'str'>, <class 'int'>]) * ``'extend'`` - This appe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d57ebd5d-95c9-461f-a0e3-473dd3468518
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,092
supabase-export-v2
84b31a77b9b3a5d1
it generally doesn't make much sense to have more than one positional argument with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is possible. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='*') >>> parser.add_argument('--bar', nargs='*') >>> parser.ad...
trusted_official_docs
CPython Docs
it generally doesn't make much sense to have more than one positional argument with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is possible. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='*') >>> parser.add_argument('--bar', nargs='*') >>> parser.ad...
it generally doesn't make much sense to have more than one positional argument with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is possible. For example:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='*') >>> parser.add_argument('--bar', nargs='*') >>> parser.ad...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d5c83536-2b8e-407a-beec-c01d8de325d6
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,024
supabase-export-v2
10345aa3e16ec37b
>>> parser = argparse.ArgumentParser( ... formatter_class=argparse.RawDescriptionHelpFormatter, ... epilog='''Examples: ... `python -m myapp --verbose` ... `python -m myapp --config settings.json` ... ''') When colors are enabled, the text inside backticks will be displayed in a distinct color to help examples stand ou...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser( ... formatter_class=argparse.RawDescriptionHelpFormatter, ... epilog='''Examples: ... `python -m myapp --verbose` ... `python -m myapp --config settings.json` ... ''') When colors are enabled, the text inside backticks will be displayed in a distinct color to help examples stand ou...
>>> parser = argparse.ArgumentParser( ... formatter_class=argparse.RawDescriptionHelpFormatter, ... epilog='''Examples: ... `python -m myapp --verbose` ... `python -m myapp --config settings.json` ... ''') When colors are enabled, the text inside backticks will be displayed in a distinct color to help examples stand ou...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d6157864-5688-4f5b-8f98-c9094b61b00c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,377
supabase-export-v2
1aadc15273d91d6f
A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`~ArgumentParser.parse_known_intermixed_args` methods support this parsing style. These parsers do not support all the :mod:`!argparse` features, and will raise ...
trusted_official_docs
CPython Docs
A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`~ArgumentParser.parse_known_intermixed_args` methods support this parsing style. These parsers do not support all the :mod:`!argparse` features, and will raise ...
A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`~ArgumentParser.parse_known_intermixed_args` methods support this parsing style. These parsers do not support all the :mod:`!argparse` features, and will raise ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d61f72df-a422-437b-9eb0-bcff146680e9
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,065
supabase-export-v2
490494e8624d4ed6
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append', default=['0']) >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace(foo=['0', '1', '2']) * ``'append_const'`` - This appends the value specified by the const_ keyword argument to a list; note that the const_ keyword argumen...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append', default=['0']) >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace(foo=['0', '1', '2']) * ``'append_const'`` - This appends the value specified by the const_ keyword argument to a list; note that the const_ keyword argumen...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='append', default=['0']) >>> parser.parse_args('--foo 1 --foo 2'.split()) Namespace(foo=['0', '1', '2']) * ``'append_const'`` - This appends the value specified by the const_ keyword argument to a list; note that the const_ keyword argumen...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d73cb581-040a-4065-8107-f3d75484e6db
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,221
supabase-export-v2
51ef63f3fe526ad9
>>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: no such option: --bar >>> # wrong number of arguments >>> parser.parse_args(['spam', 'badger']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: extra arguments found: badger
trusted_official_docs
CPython Docs
>>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: no such option: --bar >>> # wrong number of arguments >>> parser.parse_args(['spam', 'badger']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: extra arguments found: badger
>>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: no such option: --bar >>> # wrong number of arguments >>> parser.parse_args(['spam', 'badger']) usage: PROG [-h] [--foo FOO] [bar] PROG: error: extra arguments found: badger
python, official-docs, cpython, P0
Local_Trusted_Corpus
d75b895f-1fa6-4e8d-8b20-b5eceea631b2
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,260
supabase-export-v2
cfa6dbc53f29a6a2
* action_ - the basic type of action to be taken when this argument is encountered at the command line * dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored
trusted_official_docs
CPython Docs
* action_ - the basic type of action to be taken when this argument is encountered at the command line * dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored
* action_ - the basic type of action to be taken when this argument is encountered at the command line * dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored
python, official-docs, cpython, P0
Local_Trusted_Corpus
d7eacaa8-3c9f-4e4d-b707-ae1b99cd2429
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,357
supabase-export-v2
a204fb64285fefc8
.. method:: ArgumentParser.parse_known_args(args=None, namespace=None) Sometimes a script only needs to handle a specific set of command-line arguments, leaving any unrecognized arguments for another script or program. In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be useful.
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.parse_known_args(args=None, namespace=None) Sometimes a script only needs to handle a specific set of command-line arguments, leaving any unrecognized arguments for another script or program. In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be useful.
.. method:: ArgumentParser.parse_known_args(args=None, namespace=None) Sometimes a script only needs to handle a specific set of command-line arguments, leaving any unrecognized arguments for another script or program. In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be useful.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8908e9a-5183-4dfb-958c-079e5a8c070d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,130
supabase-export-v2
c9da256bc242257b
closed. 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. For type checkers that simply check against a fixed set of values, consider using the choices_ keyword instead.
trusted_official_docs
CPython Docs
closed. 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. For type checkers that simply check against a fixed set of values, consider using the choices_ keyword instead.
closed. 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. For type checkers that simply check against a fixed set of values, consider using the choices_ keyword instead.
python, official-docs, cpython, P0
Local_Trusted_Corpus
da5774a2-0e90-4422-8a6c-dd387d85af78
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,063
supabase-export-v2
66e80eb7231f7fe8
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('--bar', action='store_false') >>> parser.add_argument('--baz', action='store_false') >>> parser.parse_args('--foo --bar'.split()) Namespace(foo=True, bar=False, baz=True) * ``'append'`` - This appends e...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('--bar', action='store_false') >>> parser.add_argument('--baz', action='store_false') >>> parser.parse_args('--foo --bar'.split()) Namespace(foo=True, bar=False, baz=True) * ``'append'`` - This appends e...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_true') >>> parser.add_argument('--bar', action='store_false') >>> parser.add_argument('--baz', action='store_false') >>> parser.parse_args('--foo --bar'.split()) Namespace(foo=True, bar=False, baz=True) * ``'append'`` - This appends e...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dd158ce2-0188-4606-943c-466a2495b8cf
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,340
supabase-export-v2
49e87ea969129ead
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default='bar') >>> parser.set_defaults(foo='spam') >>> parser.parse_args([]) Namespace(foo='spam') Parser-level defaults can be particularly useful when working with multiple parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an e...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default='bar') >>> parser.set_defaults(foo='spam') >>> parser.parse_args([]) Namespace(foo='spam') Parser-level defaults can be particularly useful when working with multiple parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an e...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default='bar') >>> parser.set_defaults(foo='spam') >>> parser.parse_args([]) Namespace(foo='spam') Parser-level defaults can be particularly useful when working with multiple parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an e...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dd5db7e4-aa6a-42c1-85c1-d8226c2ab14f
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,101
supabase-export-v2
bee7b480bc6da136
if the option string is encountered with no command-line argument following it, the value from ``const`` will be used. See the nargs_ description for examples. .. versionchanged:: 3.11 ``const=None`` by default, including when ``action='append_const'`` or ``action='store_const'``.
trusted_official_docs
CPython Docs
if the option string is encountered with no command-line argument following it, the value from ``const`` will be used. See the nargs_ description for examples. .. versionchanged:: 3.11 ``const=None`` by default, including when ``action='append_const'`` or ``action='store_const'``.
if the option string is encountered with no command-line argument following it, the value from ``const`` will be used. See the nargs_ description for examples. .. versionchanged:: 3.11 ``const=None`` by default, including when ``action='append_const'`` or ``action='store_const'``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
dde11246-0f75-4b1c-8f00-92c58c1efeee
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,078
supabase-export-v2
a3f3a7befb18af64
method and optionally the :meth:`!__init__` and :meth:`!format_usage` methods. You can also register custom actions using the :meth:`~ArgumentParser.register` method and reference them by their registered name. An example of a custom action::
trusted_official_docs
CPython Docs
method and optionally the :meth:`!__init__` and :meth:`!format_usage` methods. You can also register custom actions using the :meth:`~ArgumentParser.register` method and reference them by their registered name. An example of a custom action::
method and optionally the :meth:`!__init__` and :meth:`!format_usage` methods. You can also register custom actions using the :meth:`~ArgumentParser.register` method and reference them by their registered name. An example of a custom action::
python, official-docs, cpython, P0
Local_Trusted_Corpus
dec843cf-5e6f-406d-872d-9e6f2f489b73
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,261
supabase-export-v2
6db66b18133754c7
* dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored * required_ - Whether or not a subcommand must be provided, by default ``False`` (added in 3.7)
trusted_official_docs
CPython Docs
* dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored * required_ - Whether or not a subcommand must be provided, by default ``False`` (added in 3.7)
* dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored * required_ - Whether or not a subcommand must be provided, by default ``False`` (added in 3.7)
python, official-docs, cpython, P0
Local_Trusted_Corpus
e0154b3f-c91b-4187-8242-3c94f60a706e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,183
supabase-export-v2
ec1c331ecd1b44ea
.. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=None, \ metavar=None) :class:`!Action` objects are used by an :class:`ArgumentParser` to represent the information needed to parse a single argument from one or more strings from the command l...
trusted_official_docs
CPython Docs
.. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=None, \ metavar=None) :class:`!Action` objects are used by an :class:`ArgumentParser` to represent the information needed to parse a single argument from one or more strings from the command l...
.. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=None, \ metavar=None) :class:`!Action` objects are used by an :class:`ArgumentParser` to represent the information needed to parse a single argument from one or more strings from the command l...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e08917df-cbf3-4200-a745-ee2031e3fb7d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,386
supabase-export-v2
590904bc259ebfb7
will be stored (e.g., ``action``, ``type``), *value*, which is the key under which the object will be registered, and object, the callable to be registered. The following example shows how to register a custom type with a parser::
trusted_official_docs
CPython Docs
will be stored (e.g., ``action``, ``type``), *value*, which is the key under which the object will be registered, and object, the callable to be registered. The following example shows how to register a custom type with a parser::
will be stored (e.g., ``action``, ``type``), *value*, which is the key under which the object will be registered, and object, the callable to be registered. The following example shows how to register a custom type with a parser::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e16ff88f-3213-4168-a67c-63fc28bf9c06
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,933
supabase-export-v2
0dcd3a0703fcbdd5
description ^^^^^^^^^^^ Most calls to the :class:`ArgumentParser` constructor will use the ``description=`` keyword argument. This argument gives a brief description of what the program does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for ...
trusted_official_docs
CPython Docs
description ^^^^^^^^^^^ Most calls to the :class:`ArgumentParser` constructor will use the ``description=`` keyword argument. This argument gives a brief description of what the program does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for ...
description ^^^^^^^^^^^ Most calls to the :class:`ArgumentParser` constructor will use the ``description=`` keyword argument. This argument gives a brief description of what the program does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e266559c-9746-4026-b331-deed88bd4b49
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,283
supabase-export-v2
854563aeeb1a4ef0
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:: >>> # subcommand functions >>> def foo(args): ... print(args.x * args.y) ... >>> def bar(args): ... print('((...
trusted_official_docs
CPython Docs
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:: >>> # subcommand functions >>> def foo(args): ... print(args.x * args.y) ... >>> def bar(args): ... print('((...
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:: >>> # subcommand functions >>> def foo(args): ... print(args.x * args.y) ... >>> def bar(args): ... print('((...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e4162354-e53f-4c01-9707-74d1fa79475c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,977
supabase-export-v2
16c2677c8775fbd3
arguments that start with any of the specified characters will be treated as files, and will be replaced by the arguments they contain. For example:: >>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp: ... fp.write('-f\nbar') ... >>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@') ...
trusted_official_docs
CPython Docs
arguments that start with any of the specified characters will be treated as files, and will be replaced by the arguments they contain. For example:: >>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp: ... fp.write('-f\nbar') ... >>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@') ...
arguments that start with any of the specified characters will be treated as files, and will be replaced by the arguments they contain. For example:: >>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp: ... fp.write('-f\nbar') ... >>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@') ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e4b7cbe9-a019-4b99-b635-30919fe9b1a2
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,010
supabase-export-v2
806d51b7d08f3d4a
If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``:: >>> parser = argparse.ArgumentParser(exit_on_error=False) >>> parser.add_argument('--integers', type=int) _StoreAction(option_strings=['--integers'], dest='integers', nargs=None, const=None, default...
trusted_official_docs
CPython Docs
If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``:: >>> parser = argparse.ArgumentParser(exit_on_error=False) >>> parser.add_argument('--integers', type=int) _StoreAction(option_strings=['--integers'], dest='integers', nargs=None, const=None, default...
If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``:: >>> parser = argparse.ArgumentParser(exit_on_error=False) >>> parser.add_argument('--integers', type=int) _StoreAction(option_strings=['--integers'], dest='integers', nargs=None, const=None, default...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e560988d-31c1-474a-9d29-62c3855ea5dd
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,052
supabase-export-v2
e231c7d81ea8da6d
When :meth:`~ArgumentParser.parse_args` is called, optional arguments will be identified by the ``-`` prefix, and the remaining arguments will be assumed to be positional:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo') >>> parser.add_argument('bar') >>> parser.parse_args(['...
trusted_official_docs
CPython Docs
When :meth:`~ArgumentParser.parse_args` is called, optional arguments will be identified by the ``-`` prefix, and the remaining arguments will be assumed to be positional:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo') >>> parser.add_argument('bar') >>> parser.parse_args(['...
When :meth:`~ArgumentParser.parse_args` is called, optional arguments will be identified by the ``-`` prefix, and the remaining arguments will be assumed to be positional:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo') >>> parser.add_argument('bar') >>> parser.parse_args(['...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e5ec95c1-0ea7-4681-9dfe-c53fab1080d1
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,295
supabase-export-v2
0edc172b1aeb7831
>>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers() >>> checkout = subparsers.add_parser('checkout', aliases=['co']) >>> checkout.add_argument('foo') >>> parser.parse_args(['co', 'bar']) Namespace(foo='bar') The *deprecated* argument, if ``True``, marks the sub-command as deprecated and wil...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers() >>> checkout = subparsers.add_parser('checkout', aliases=['co']) >>> checkout.add_argument('foo') >>> parser.parse_args(['co', 'bar']) Namespace(foo='bar') The *deprecated* argument, if ``True``, marks the sub-command as deprecated and wil...
>>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers() >>> checkout = subparsers.add_parser('checkout', aliases=['co']) >>> checkout.add_argument('foo') >>> parser.parse_args(['co', 'bar']) Namespace(foo='bar') The *deprecated* argument, if ``True``, marks the sub-command as deprecated and wil...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e61bcf2a-d4e8-4d31-911a-fec39c9994f3
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,099
supabase-export-v2
d25f4b92044bcff3
values that are not read from the command line but are required for the various :class:`ArgumentParser` actions. The two most common uses of it are: * When :meth:`~ArgumentParser.add_argument` is called with ``action='store_const'`` or ``action='append_const'``. These actions add the ``const`` value to one of the att...
trusted_official_docs
CPython Docs
values that are not read from the command line but are required for the various :class:`ArgumentParser` actions. The two most common uses of it are: * When :meth:`~ArgumentParser.add_argument` is called with ``action='store_const'`` or ``action='append_const'``. These actions add the ``const`` value to one of the att...
values that are not read from the command line but are required for the various :class:`ArgumentParser` actions. The two most common uses of it are: * When :meth:`~ArgumentParser.add_argument` is called with ``action='store_const'`` or ``action='append_const'``. These actions add the ``const`` value to one of the att...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e62fb78b-2f88-4861-a6fc-da997ab0ecaf
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,033
supabase-export-v2
44057b8094c84a2e
* action_ - The basic type of action to be taken when this argument is encountered at the command line. * nargs_ - The number of command-line arguments that should be consumed.
trusted_official_docs
CPython Docs
* action_ - The basic type of action to be taken when this argument is encountered at the command line. * nargs_ - The number of command-line arguments that should be consumed.
* action_ - The basic type of action to be taken when this argument is encountered at the command line. * nargs_ - The number of command-line arguments that should be consumed.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e75139d2-9954-490a-8cfd-f05b5d1f5c6d
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,080
supabase-export-v2
51b01c0190ee67bc
argparse.ArgumentParser() >>> parser.add_argument('--foo', action=FooAction) >>> parser.add_argument('bar', action=FooAction) >>> args = parser.parse_args('1 --foo 2'.split()) Namespace(bar=None, foo=None) '1' None Namespace(bar='1', foo=None) '2' '--foo' >>> args Namespace(bar='1', foo='2') For more details, see :clas...
trusted_official_docs
CPython Docs
argparse.ArgumentParser() >>> parser.add_argument('--foo', action=FooAction) >>> parser.add_argument('bar', action=FooAction) >>> args = parser.parse_args('1 --foo 2'.split()) Namespace(bar=None, foo=None) '1' None Namespace(bar='1', foo=None) '2' '--foo' >>> args Namespace(bar='1', foo='2') For more details, see :clas...
argparse.ArgumentParser() >>> parser.add_argument('--foo', action=FooAction) >>> parser.add_argument('bar', action=FooAction) >>> args = parser.parse_args('1 --foo 2'.split()) Namespace(bar=None, foo=None) '1' None Namespace(bar='1', foo=None) '2' '--foo' >>> args Namespace(bar='1', foo='2') For more details, see :clas...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e82b1d27-4963-48df-94d1-c8ec244cd031
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,177
supabase-export-v2
dda00015d84500e8
deprecated ^^^^^^^^^^ During a project's lifetime, some arguments may need to be removed from the command line. Before removing them, you should inform your users that the arguments are deprecated and will be removed. The ``deprecated`` keyword argument of :meth:`~ArgumentParser.add_argument`, which defaults to ``False...
trusted_official_docs
CPython Docs
deprecated ^^^^^^^^^^ During a project's lifetime, some arguments may need to be removed from the command line. Before removing them, you should inform your users that the arguments are deprecated and will be removed. The ``deprecated`` keyword argument of :meth:`~ArgumentParser.add_argument`, which defaults to ``False...
deprecated ^^^^^^^^^^ During a project's lifetime, some arguments may need to be removed from the command line. Before removing them, you should inform your users that the arguments are deprecated and will be removed. The ``deprecated`` keyword argument of :meth:`~ArgumentParser.add_argument`, which defaults to ``False...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e91736db-6b46-4540-86df-330020e04476
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,257
supabase-export-v2
ae5c715e79e62405
* *description* - description for the sub-parser group in help output, by default ``None`` * *prog* - usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument
trusted_official_docs
CPython Docs
* *description* - description for the sub-parser group in help output, by default ``None`` * *prog* - usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument
* *description* - description for the sub-parser group in help output, by default ``None`` * *prog* - usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument
python, official-docs, cpython, P0
Local_Trusted_Corpus
eb1adff3-b821-4350-a913-7ef753abb379
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,105
supabase-export-v2
abec6e5fae9ec9a5
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default=42) >>> parser.parse_args(['--foo', '2']) Namespace(foo='2') >>> parser.parse_args([]) Namespace(foo=42) If the target namespace already has an attribute set, the action *default* will not overwrite it::
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default=42) >>> parser.parse_args(['--foo', '2']) Namespace(foo='2') >>> parser.parse_args([]) Namespace(foo=42) If the target namespace already has an attribute set, the action *default* will not overwrite it::
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default=42) >>> parser.parse_args(['--foo', '2']) Namespace(foo='2') >>> parser.parse_args([]) Namespace(foo=42) If the target namespace already has an attribute set, the action *default* will not overwrite it::
python, official-docs, cpython, P0
Local_Trusted_Corpus
eb6040a2-e180-4f96-87c9-9400458aebf0
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,095
supabase-export-v2
1a2c794149b595cf
arguments present are gathered into a list. Additionally, an error message will be generated if there wasn't at least one command-line argument present. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('foo', nargs='+') >>> parser.parse_args(['a', 'b']) Namespace(foo=['a', 'b']...
trusted_official_docs
CPython Docs
arguments present are gathered into a list. Additionally, an error message will be generated if there wasn't at least one command-line argument present. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('foo', nargs='+') >>> parser.parse_args(['a', 'b']) Namespace(foo=['a', 'b']...
arguments present are gathered into a list. Additionally, an error message will be generated if there wasn't at least one command-line argument present. For example:: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('foo', nargs='+') >>> parser.parse_args(['a', 'b']) Namespace(foo=['a', 'b']...
python, official-docs, cpython, P0
Local_Trusted_Corpus
eba4d582-c1d1-4a17-8004-2f4339de0edc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,128
supabase-export-v2
8bb569dfb28ac4e8
only raise one of the three supported exceptions. Anything with more interesting error-handling or resource management should be done downstream after the arguments are parsed. For example, JSON or YAML conversions have complex error cases that require better reporting than can be given by the ``type`` keyword. A :exc:...
trusted_official_docs
CPython Docs
only raise one of the three supported exceptions. Anything with more interesting error-handling or resource management should be done downstream after the arguments are parsed. For example, JSON or YAML conversions have complex error cases that require better reporting than can be given by the ``type`` keyword. A :exc:...
only raise one of the three supported exceptions. Anything with more interesting error-handling or resource management should be done downstream after the arguments are parsed. For example, JSON or YAML conversions have complex error cases that require better reporting than can be given by the ``type`` keyword. A :exc:...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ebd2ce33-a0d2-474c-b2bb-6e8974a90ae7
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,137
supabase-export-v2
8889254546385794
conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage, help, or error messages. To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your applicatio...
trusted_official_docs
CPython Docs
conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage, help, or error messages. To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your applicatio...
conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage, help, or error messages. To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your applicatio...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ee223584-f780-4a9b-9d43-df581201b85a
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,337
supabase-export-v2
fb4049fc2304d075
the command-line arguments and the argument actions. :meth:`set_defaults` allows some additional attributes that are determined without any inspection of the command line to be added:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int) >>> parser.set_defaults(bar=42, baz='badger') >>> pa...
trusted_official_docs
CPython Docs
the command-line arguments and the argument actions. :meth:`set_defaults` allows some additional attributes that are determined without any inspection of the command line to be added:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int) >>> parser.set_defaults(bar=42, baz='badger') >>> pa...
the command-line arguments and the argument actions. :meth:`set_defaults` allows some additional attributes that are determined without any inspection of the command line to be added:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int) >>> parser.set_defaults(bar=42, baz='badger') >>> pa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ee32f9cc-f516-4b7d-85b1-0e1fbe7e0edc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,178
supabase-export-v2
90147aca28196a53
will be removed in the future. For arguments, if ``deprecated`` is ``True``, then a warning will be printed to :data:`sys.stderr` when the argument is used:: >>> import argparse >>> parser = argparse.ArgumentParser(prog='snake.py') >>> parser.add_argument('--legs', default=0, type=int, deprecated=True) >>> parser.pa...
trusted_official_docs
CPython Docs
will be removed in the future. For arguments, if ``deprecated`` is ``True``, then a warning will be printed to :data:`sys.stderr` when the argument is used:: >>> import argparse >>> parser = argparse.ArgumentParser(prog='snake.py') >>> parser.add_argument('--legs', default=0, type=int, deprecated=True) >>> parser.pa...
will be removed in the future. For arguments, if ``deprecated`` is ``True``, then a warning will be printed to :data:`sys.stderr` when the argument is used:: >>> import argparse >>> parser = argparse.ArgumentParser(prog='snake.py') >>> parser.add_argument('--legs', default=0, type=int, deprecated=True) >>> parser.pa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef523e04-edd2-46b4-9c11-16041a73c6fa
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,297
supabase-export-v2
055d75d6cf64ee06
>>> parser = argparse.ArgumentParser(prog='chicken.py') >>> subparsers = parser.add_subparsers() >>> fly = subparsers.add_parser('fly', deprecated=True) >>> args = parser.parse_args(['fly']) chicken.py: warning: command 'fly' is deprecated Namespace() All other keyword arguments are passed directly to the :class:`!Arg...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser(prog='chicken.py') >>> subparsers = parser.add_subparsers() >>> fly = subparsers.add_parser('fly', deprecated=True) >>> args = parser.parse_args(['fly']) chicken.py: warning: command 'fly' is deprecated Namespace() All other keyword arguments are passed directly to the :class:`!Arg...
>>> parser = argparse.ArgumentParser(prog='chicken.py') >>> subparsers = parser.add_subparsers() >>> fly = subparsers.add_parser('fly', deprecated=True) >>> args = parser.parse_args(['fly']) chicken.py: warning: command 'fly' is deprecated Namespace() All other keyword arguments are passed directly to the :class:`!Arg...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef81782a-e787-4346-9229-146636f96a01
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,246
supabase-export-v2
aae15d1202dd78b1
Simple class used by default by :meth:`~ArgumentParser.parse_args` to create an object holding attributes and return it. This class is deliberately simple, just an :class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python id...
trusted_official_docs
CPython Docs
Simple class used by default by :meth:`~ArgumentParser.parse_args` to create an object holding attributes and return it. This class is deliberately simple, just an :class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python id...
Simple class used by default by :meth:`~ArgumentParser.parse_args` to create an object holding attributes and return it. This class is deliberately simple, just an :class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python id...
python, official-docs, cpython, P0
Local_Trusted_Corpus
efa1d905-b88f-4abd-8af6-468800cd141f
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
20,937
supabase-export-v2
505e020ae76955fb
like to display additional description of the program after the description of the arguments. Such text can be specified using the ``epilog=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser( ... description='A foo that bars', ... epilog="And that's how you'd foo a bar") >>> parser.print_h...
trusted_official_docs
CPython Docs
like to display additional description of the program after the description of the arguments. Such text can be specified using the ``epilog=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser( ... description='A foo that bars', ... epilog="And that's how you'd foo a bar") >>> parser.print_h...
like to display additional description of the program after the description of the arguments. Such text can be specified using the ``epilog=`` argument to :class:`ArgumentParser`:: >>> parser = argparse.ArgumentParser( ... description='A foo that bars', ... epilog="And that's how you'd foo a bar") >>> parser.print_h...
python, official-docs, cpython, P0
Local_Trusted_Corpus
efd538db-4249-49b2-a922-62f9ca3e5b1c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,190
supabase-export-v2
e58e08a134cbacc8
* *values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword argument to :meth:`~ArgumentParser.add_argument`. * *option_string* - The option string that was used to invoke this action. The ``option_string`` argument is optional, and will b...
trusted_official_docs
CPython Docs
* *values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword argument to :meth:`~ArgumentParser.add_argument`. * *option_string* - The option string that was used to invoke this action. The ``option_string`` argument is optional, and will b...
* *values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword argument to :meth:`~ArgumentParser.add_argument`. * *option_string* - The option string that was used to invoke this action. The ``option_string`` argument is optional, and will b...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f043cb58-0a7f-46e0-89cb-aaf9d97e6921
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,366
supabase-export-v2
a2e036f46bf392cd
file. It returns a list of arguments parsed from this string. The method is called once per line read from the argument file, in order. A useful override of this method is one that treats each space-separated word as an argument. The following example demonstrates how to do this::
trusted_official_docs
CPython Docs
file. It returns a list of arguments parsed from this string. The method is called once per line read from the argument file, in order. A useful override of this method is one that treats each space-separated word as an argument. The following example demonstrates how to do this::
file. It returns a list of arguments parsed from this string. The method is called once per line read from the argument file, in order. A useful override of this method is one that treats each space-separated word as an argument. The following example demonstrates how to do this::
python, official-docs, cpython, P0
Local_Trusted_Corpus
f04dcf50-df72-4ba8-b06e-17d95c5315d2
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,142
supabase-export-v2
b7cd278b7f86d6c4
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', required=True) >>> parser.parse_args(['--foo', 'BAR']) Namespace(foo='BAR') >>> parser.parse_args([]) usage: [-h] --foo FOO : error: the following arguments are required: --foo As the example shows, if an option is marked as ``required``, :meth:`~A...
trusted_official_docs
CPython Docs
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', required=True) >>> parser.parse_args(['--foo', 'BAR']) Namespace(foo='BAR') >>> parser.parse_args([]) usage: [-h] --foo FOO : error: the following arguments are required: --foo As the example shows, if an option is marked as ``required``, :meth:`~A...
>>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', required=True) >>> parser.parse_args(['--foo', 'BAR']) Namespace(foo='BAR') >>> parser.parse_args([]) usage: [-h] --foo FOO : error: the following arguments are required: --foo As the example shows, if an option is marked as ``required``, :meth:`~A...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f13c5189-9d0b-4a4a-8a9a-f242ac5ce603
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,333
supabase-export-v2
0cd76972b5998604
--foo FOO foo help --bar BAR bar help .. deprecated-removed:: 3.11 3.14 Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` on a mutually exclusive group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inherita...
trusted_official_docs
CPython Docs
--foo FOO foo help --bar BAR bar help .. deprecated-removed:: 3.11 3.14 Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` on a mutually exclusive group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inherita...
--foo FOO foo help --bar BAR bar help .. deprecated-removed:: 3.11 3.14 Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` on a mutually exclusive group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inherita...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f16b7366-0947-470b-8464-944fef80397e
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,253
supabase-export-v2
cab1354074ecafbf
.. method:: ArgumentParser.add_subparsers(*, [title], [description], [prog], \ [parser_class], [action], \ [dest], [required], \ [help], [metavar]) Many programs split up their functionality into a number of subcommands, for example, the ``svn`` program can invoke subcommands like ``svn checkout``, ``svn update``, an...
trusted_official_docs
CPython Docs
.. method:: ArgumentParser.add_subparsers(*, [title], [description], [prog], \ [parser_class], [action], \ [dest], [required], \ [help], [metavar]) Many programs split up their functionality into a number of subcommands, for example, the ``svn`` program can invoke subcommands like ``svn checkout``, ``svn update``, an...
.. method:: ArgumentParser.add_subparsers(*, [title], [description], [prog], \ [parser_class], [action], \ [dest], [required], \ [help], [metavar]) Many programs split up their functionality into a number of subcommands, for example, the ``svn`` program can invoke subcommands like ``svn checkout``, ``svn update``, an...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f35aa3a1-baf7-4726-bc2d-1b61237ca87c
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,112
supabase-export-v2
d3fd37816f4957ce
``default`` value is ignored. For example, this applies to positional arguments with nargs_ values other than ``?`` or ``*``, or optional arguments marked as ``required=True``. Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the command-line argument was not present::
trusted_official_docs
CPython Docs
``default`` value is ignored. For example, this applies to positional arguments with nargs_ values other than ``?`` or ``*``, or optional arguments marked as ``required=True``. Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the command-line argument was not present::
``default`` value is ignored. For example, this applies to positional arguments with nargs_ values other than ``?`` or ``*``, or optional arguments marked as ``required=True``. Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the command-line argument was not present::
python, official-docs, cpython, P0
Local_Trusted_Corpus
f3684ed7-0588-49e0-9770-feb7673ad3fc
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,172
supabase-export-v2
98d3bcdf2ae158b4
internal ``-`` characters will be converted to ``_`` characters to make sure the string is a valid attribute name. The examples below illustrate this behavior:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('-f', '--foo-bar', '--foo') >>> parser.add_argument('-q', '-quz') >>> parser.add_argument('-x...
trusted_official_docs
CPython Docs
internal ``-`` characters will be converted to ``_`` characters to make sure the string is a valid attribute name. The examples below illustrate this behavior:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('-f', '--foo-bar', '--foo') >>> parser.add_argument('-q', '-quz') >>> parser.add_argument('-x...
internal ``-`` characters will be converted to ``_`` characters to make sure the string is a valid attribute name. The examples below illustrate this behavior:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('-f', '--foo-bar', '--foo') >>> parser.add_argument('-q', '-quz') >>> parser.add_argument('-x...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f3767893-78da-401a-8e09-f00e11124bf8
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,058
supabase-export-v2
2ada280941c0cde1
add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword argument specifies how the command-line arguments should be handled. The supplied actions are: * ``'store'`` - This just stores the argument's value. This is the default action.
trusted_official_docs
CPython Docs
add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword argument specifies how the command-line arguments should be handled. The supplied actions are: * ``'store'`` - This just stores the argument's value. This is the default action.
add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword argument specifies how the command-line arguments should be handled. The supplied actions are: * ``'store'`` - This just stores the argument's value. This is the default action.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f3d1bf78-8e2a-4b0f-8f3f-8e0e0a9bedea
CPython Docs
file://datasets/cpython/Doc/library/argparse.rst
unknown
001a8019-557f-4048-beb6-3b9035272f92
21,133
supabase-export-v2
8038ef9b920a99ea
line is parsed, argument values will be checked, and an error message will be displayed if the argument was not one of the acceptable values:: >>> parser = argparse.ArgumentParser(prog='game.py') >>> parser.add_argument('move', choices=['rock', 'paper', 'scissors']) >>> parser.parse_args(['rock']) Namespace(move='ro...
trusted_official_docs
CPython Docs
line is parsed, argument values will be checked, and an error message will be displayed if the argument was not one of the acceptable values:: >>> parser = argparse.ArgumentParser(prog='game.py') >>> parser.add_argument('move', choices=['rock', 'paper', 'scissors']) >>> parser.parse_args(['rock']) Namespace(move='ro...
line is parsed, argument values will be checked, and an error message will be displayed if the argument was not one of the acceptable values:: >>> parser = argparse.ArgumentParser(prog='game.py') >>> parser.add_argument('move', choices=['rock', 'paper', 'scissors']) >>> parser.parse_args(['rock']) Namespace(move='ro...
python, official-docs, cpython, P0
Local_Trusted_Corpus