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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
647f6b9e-bf8d-4cf9-bac5-5d349fc270dc | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,844 | supabase-export-v2 | 01b684b93634e184 | that this function has intimate knowledge of how different libc versions add symbols to the executable is probably only usable for executables compiled using :program:`gcc`.
The file is read and scanned in chunks of *chunksize* bytes. | trusted_official_docs | CPython Docs | that this function has intimate knowledge of how different libc versions add symbols to the executable is probably only usable for executables compiled using :program:`gcc`.
The file is read and scanned in chunks of *chunksize* bytes. | that this function has intimate knowledge of how different libc versions add symbols to the executable is probably only usable for executables compiled using :program:`gcc`.
The file is read and scanned in chunks of *chunksize* bytes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6678b843-05c5-46b8-aaa3-033abe592f06 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,826 | supabase-export-v2 | fce166f060a13097 | .. function:: win32_edition()
Returns a string representing the current Windows edition, or ``None`` if the
value cannot be determined. Possible values include but are not limited to
``'Enterprise'``, ``'IoTUAP'``, ``'ServerStandard'``, and ``'nanoserver'``. | trusted_official_docs | CPython Docs | .. function:: win32_edition()
Returns a string representing the current Windows edition, or ``None`` if the
value cannot be determined. Possible values include but are not limited to
``'Enterprise'``, ``'IoTUAP'``, ``'ServerStandard'``, and ``'nanoserver'``. | .. function:: win32_edition()
Returns a string representing the current Windows edition, or ``None`` if the
value cannot be determined. Possible values include but are not limited to
``'Enterprise'``, ``'IoTUAP'``, ``'ServerStandard'``, and ``'nanoserver'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d449797-709f-4b87-9744-58ce47b98db6 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,765 | supabase-export-v2 | 525d1b404decc78d | a tuple ``(bits, linkage)`` which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.
Values that cannot be determined are returned as given by the parameter presets. If bits is given as ``''``, the ``sizeof(pointer)`` (or
``sizeof(long)``... | trusted_official_docs | CPython Docs | a tuple ``(bits, linkage)`` which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.
Values that cannot be determined are returned as given by the parameter presets. If bits is given as ``''``, the ``sizeof(pointer)`` (or
``sizeof(long)``... | a tuple ``(bits, linkage)`` which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.
Values that cannot be determined are returned as given by the parameter presets. If bits is given as ``''``, the ``sizeof(pointer)`` (or
``sizeof(long)``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84417241-418f-42af-8c40-418152beb224 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,819 | supabase-export-v2 | f28436d5ca6ce3e7 | .. function:: invalidate_caches()
Clear out the internal cache of information, such as the :func:`uname`. This is typically useful when the platform's :func:`node` is changed
by an external process and one needs to retrieve the updated value. | trusted_official_docs | CPython Docs | .. function:: invalidate_caches()
Clear out the internal cache of information, such as the :func:`uname`. This is typically useful when the platform's :func:`node` is changed
by an external process and one needs to retrieve the updated value. | .. function:: invalidate_caches()
Clear out the internal cache of information, such as the :func:`uname`. This is typically useful when the platform's :func:`node` is changed
by an external process and one needs to retrieve the updated value. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ba23747-06d5-4c77-be51-b9f907b4f255 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,781 | supabase-export-v2 | c351287371fbf213 | Setting *terse* to true causes the function to return only the absolute minimum information needed to identify the platform.
.. versionchanged:: 3.8
On macOS, the function now uses :func:`mac_ver`, if it returns a
non-empty release string, to get the macOS version rather than the darwin
version. | trusted_official_docs | CPython Docs | Setting *terse* to true causes the function to return only the absolute minimum information needed to identify the platform.
.. versionchanged:: 3.8
On macOS, the function now uses :func:`mac_ver`, if it returns a
non-empty release string, to get the macOS version rather than the darwin
version. | Setting *terse* to true causes the function to return only the absolute minimum information needed to identify the platform.
.. versionchanged:: 3.8
On macOS, the function now uses :func:`mac_ver`, if it returns a
non-empty release string, to get the macOS version rather than the darwin
version. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
95263593-3d76-448d-9d63-1e4425c25efa | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,806 | supabase-export-v2 | 63d8a7218d94a0a4 | On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, ``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or ``'Linux'``), use :func:`os.uname`.
.. function:: system_alias(system, release, version) | trusted_official_docs | CPython Docs | On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, ``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or ``'Linux'``), use :func:`os.uname`.
.. function:: system_alias(system, release, version) | On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, ``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or ``'Linux'``), use :func:`os.uname`.
.. function:: system_alias(system, release, version) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9851a159-bf52-401b-9d20-fd8caf0b9dac | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,848 | supabase-export-v2 | 671fd998e9983f55 | a dict. The ``os-release`` file is a `freedesktop.org standard <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and is available in most Linux distributions. A noticeable exception is Android and Android-based distributions.
Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor
``/... | trusted_official_docs | CPython Docs | a dict. The ``os-release`` file is a `freedesktop.org standard <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and is available in most Linux distributions. A noticeable exception is Android and Android-based distributions.
Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor
``/... | a dict. The ``os-release`` file is a `freedesktop.org standard <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and is available in most Linux distributions. A noticeable exception is Android and Android-based distributions.
Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor
``/... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a8016e7-57f1-4573-9654-89f2ded9a361 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,838 | supabase-export-v2 | f475e624ead30be2 | Get iOS version information and return it as a :func:`~collections.namedtuple` with the following attributes:
* ``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``. * ``release`` is the iOS version number as a string (e.g., ``'17.2'``). * ``model`` is the device model identifier; this will be a string like
``'... | trusted_official_docs | CPython Docs | Get iOS version information and return it as a :func:`~collections.namedtuple` with the following attributes:
* ``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``. * ``release`` is the iOS version number as a string (e.g., ``'17.2'``). * ``model`` is the device model identifier; this will be a string like
``'... | Get iOS version information and return it as a :func:`~collections.namedtuple` with the following attributes:
* ``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``. * ``release`` is the iOS version number as a string (e.g., ``'17.2'``). * ``model`` is the device model identifier; this will be a string like
``'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9e09ec9a-f922-4585-8e46-b5316781614d | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,764 | supabase-export-v2 | 87f532cccd743b59 | Queries the given executable (defaults to the Python interpreter binary) for various architecture information.
Returns a tuple ``(bits, linkage)`` which contain information about the bit
architecture and the linkage format used for the executable. Both values are
returned as strings. | trusted_official_docs | CPython Docs | Queries the given executable (defaults to the Python interpreter binary) for various architecture information.
Returns a tuple ``(bits, linkage)`` which contain information about the bit
architecture and the linkage format used for the executable. Both values are
returned as strings. | Queries the given executable (defaults to the Python interpreter binary) for various architecture information.
Returns a tuple ``(bits, linkage)`` which contain information about the bit
architecture and the linkage format used for the executable. Both values are
returned as strings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a7d97f77-46d8-425b-9f2a-929f20675ef5 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,849 | supabase-export-v2 | dcf028ccdc60274f | Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/usr/lib/os-release`` can be read.
On success, the function returns a dictionary where keys and values are
strings. Values have their special characters like ``"`` and ``$``
unquoted. The fields ``NAME``, ``ID``, and ``PRETTY_NAME`` are always
... | trusted_official_docs | CPython Docs | Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/usr/lib/os-release`` can be read.
On success, the function returns a dictionary where keys and values are
strings. Values have their special characters like ``"`` and ``$``
unquoted. The fields ``NAME``, ``ID``, and ``PRETTY_NAME`` are always
... | Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/usr/lib/os-release`` can be read.
On success, the function returns a dictionary where keys and values are
strings. Values have their special characters like ``"`` and ``$``
unquoted. The fields ``NAME``, ``ID``, and ``PRETTY_NAME`` are always
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b23b6a2f-57c4-403e-8f92-4f5b001aea4a | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,834 | supabase-export-v2 | 90419548704cd157 | Get macOS version information and return it as tuple ``(release, versioninfo, machine)`` with *versioninfo* being a tuple ``(version, dev_stage, non_release_version)``.
Entries which cannot be determined are set to ``''``. All tuple entries are
strings. | trusted_official_docs | CPython Docs | Get macOS version information and return it as tuple ``(release, versioninfo, machine)`` with *versioninfo* being a tuple ``(version, dev_stage, non_release_version)``.
Entries which cannot be determined are set to ``''``. All tuple entries are
strings. | Get macOS version information and return it as tuple ``(release, versioninfo, machine)`` with *versioninfo* being a tuple ``(version, dev_stage, non_release_version)``.
Entries which cannot be determined are set to ``''``. All tuple entries are
strings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8a2cd0e-002e-413e-924b-21a4d4f0f36c | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,857 | supabase-export-v2 | beaf1e158bd7864d | Get Android device information. Returns a :func:`~collections.namedtuple` with the following attributes. Values which cannot be determined are set to the defaults given as parameters.
* ``release`` - Android version, as a string (e.g. ``"14"``). | trusted_official_docs | CPython Docs | Get Android device information. Returns a :func:`~collections.namedtuple` with the following attributes. Values which cannot be determined are set to the defaults given as parameters.
* ``release`` - Android version, as a string (e.g. ``"14"``). | Get Android device information. Returns a :func:`~collections.namedtuple` with the following attributes. Values which cannot be determined are set to the defaults given as parameters.
* ``release`` - Android version, as a string (e.g. ``"14"``). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cea805bf-1f58-46ba-8ec7-f8c535be2a7b | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,766 | supabase-export-v2 | badf92e51bf08fd5 | presets. If bits is given as ``''``, the ``sizeof(pointer)`` (or ``sizeof(long)`` on Python version < 1.5.2) is used as indicator for the supported pointer size.
The function relies on the system's :file:`file` command to do the actual work. This is available on most if not all Unix platforms and some non-Unix platform... | trusted_official_docs | CPython Docs | presets. If bits is given as ``''``, the ``sizeof(pointer)`` (or ``sizeof(long)`` on Python version < 1.5.2) is used as indicator for the supported pointer size.
The function relies on the system's :file:`file` command to do the actual work. This is available on most if not all Unix platforms and some non-Unix platform... | presets. If bits is given as ``''``, the ``sizeof(pointer)`` (or ``sizeof(long)`` on Python version < 1.5.2) is used as indicator for the supported pointer size.
The function relies on the system's :file:`file` command to do the actual work. This is available on most if not all Unix platforms and some non-Unix platform... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5f8cc12-8e79-4c0e-a4a8-96eaa1d9f8fe | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,859 | supabase-export-v2 | b4b28f99cad978f7 | level of the running device, as an integer (e.g. ``34`` for Android 14). To get the API level which Python was built against, see :func:`sys.getandroidapilevel`.
* ``manufacturer`` - `Manufacturer name
<https://developer.android.com/reference/android/os/Build#MANUFACTURER>`__. | trusted_official_docs | CPython Docs | level of the running device, as an integer (e.g. ``34`` for Android 14). To get the API level which Python was built against, see :func:`sys.getandroidapilevel`.
* ``manufacturer`` - `Manufacturer name
<https://developer.android.com/reference/android/os/Build#MANUFACTURER>`__. | level of the running device, as an integer (e.g. ``34`` for Android 14). To get the API level which Python was built against, see :func:`sys.getandroidapilevel`.
* ``manufacturer`` - `Manufacturer name
<https://developer.android.com/reference/android/os/Build#MANUFACTURER>`__. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e8cbd7dc-5153-49df-8749-fad696fa0a2d | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,858 | supabase-export-v2 | 70db1354124c899a | * ``release`` - Android version, as a string (e.g. ``"14"``).
* ``api_level`` - API level of the running device, as an integer (e.g. ``34``
for Android 14). To get the API level which Python was built against, see
:func:`sys.getandroidapilevel`. | trusted_official_docs | CPython Docs | * ``release`` - Android version, as a string (e.g. ``"14"``).
* ``api_level`` - API level of the running device, as an integer (e.g. ``34``
for Android 14). To get the API level which Python was built against, see
:func:`sys.getandroidapilevel`. | * ``release`` - Android version, as a string (e.g. ``"14"``).
* ``api_level`` - API level of the running device, as an integer (e.g. ``34``
for Android 14). To get the API level which Python was built against, see
:func:`sys.getandroidapilevel`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb1084f5-5ea0-4d6d-a137-2eda8a47e7ff | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,862 | supabase-export-v2 | 48c10ba27cc6741d | * ``device`` - `Device name <https://developer.android.com/reference/android/os/Build#DEVICE>`__ – typically the model number or a codename.
* ``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's
a physical device. | trusted_official_docs | CPython Docs | * ``device`` - `Device name <https://developer.android.com/reference/android/os/Build#DEVICE>`__ – typically the model number or a codename.
* ``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's
a physical device. | * ``device`` - `Device name <https://developer.android.com/reference/android/os/Build#DEVICE>`__ – typically the model number or a codename.
* ``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's
a physical device. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eca50d9e-9e59-479b-bde7-d7c349fda28c | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,805 | supabase-export-v2 | 6b85aeabcba6411d | Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, ``'Windows'``. An empty string is returned if the value cannot be determined.
On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``,
``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or
``'Linux'``), use... | trusted_official_docs | CPython Docs | Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, ``'Windows'``. An empty string is returned if the value cannot be determined.
On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``,
``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or
``'Linux'``), use... | Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, ``'Windows'``. An empty string is returned if the value cannot be determined.
On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``,
``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or
``'Linux'``), use... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ed2061b2-c573-4c59-8fa0-b8856f0f0c69 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,807 | supabase-export-v2 | 971e5e5cbf37c7de | .. function:: system_alias(system, release, version)
Returns ``(system, release, version)`` aliased to common marketing names used
for some systems. It also does some reordering of the information in some cases
where it would otherwise cause confusion. | trusted_official_docs | CPython Docs | .. function:: system_alias(system, release, version)
Returns ``(system, release, version)`` aliased to common marketing names used
for some systems. It also does some reordering of the information in some cases
where it would otherwise cause confusion. | .. function:: system_alias(system, release, version)
Returns ``(system, release, version)`` aliased to common marketing names used
for some systems. It also does some reordering of the information in some cases
where it would otherwise cause confusion. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5fd8484-bd7b-4073-80b9-aa6d619f50ef | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,847 | supabase-export-v2 | d8b3195683660a99 | .. function:: freedesktop_os_release()
Get operating system identification from ``os-release`` file and return
it as a dict. The ``os-release`` file is a `freedesktop.org standard
<https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and
is available in most Linux distributions. A noticeable exception... | trusted_official_docs | CPython Docs | .. function:: freedesktop_os_release()
Get operating system identification from ``os-release`` file and return
it as a dict. The ``os-release`` file is a `freedesktop.org standard
<https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and
is available in most Linux distributions. A noticeable exception... | .. function:: freedesktop_os_release()
Get operating system identification from ``os-release`` file and return
it as a dict. The ``os-release`` file is a `freedesktop.org standard
<https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and
is available in most Linux distributions. A noticeable exception... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f78aff82-932a-4942-8653-951be21608fc | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,839 | supabase-export-v2 | c04b026ad77acf47 | physical device, or ``'iPhone'`` on a simulator. * ``is_simulator`` is a boolean describing if the app is running on a simulator or a physical device.
Entries which cannot be determined are set to the defaults given as
parameters. | trusted_official_docs | CPython Docs | physical device, or ``'iPhone'`` on a simulator. * ``is_simulator`` is a boolean describing if the app is running on a simulator or a physical device.
Entries which cannot be determined are set to the defaults given as
parameters. | physical device, or ``'iPhone'`` on a simulator. * ``is_simulator`` is a boolean describing if the app is running on a simulator or a physical device.
Entries which cannot be determined are set to the defaults given as
parameters. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fd4e56a0-e836-4e9c-b6bd-dc5472641193 | CPython Docs | file://datasets/cpython/Doc/library/platform.rst | unknown | 1e7f2bcd-52f8-4256-9c17-363d47b8bb03 | 20,856 | supabase-export-v2 | 3ca8472fc3549a6a | .. function:: android_ver(release="", api_level=0, manufacturer="", \ model="", device="", is_emulator=False)
Get Android device information. Returns a :func:`~collections.namedtuple`
with the following attributes. Values which cannot be determined are set to
the defaults given as parameters. | trusted_official_docs | CPython Docs | .. function:: android_ver(release="", api_level=0, manufacturer="", \ model="", device="", is_emulator=False)
Get Android device information. Returns a :func:`~collections.namedtuple`
with the following attributes. Values which cannot be determined are set to
the defaults given as parameters. | .. function:: android_ver(release="", api_level=0, manufacturer="", \ model="", device="", is_emulator=False)
Get Android device information. Returns a :func:`~collections.namedtuple`
with the following attributes. Values which cannot be determined are set to
the defaults given as parameters. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
01baaa29-dcf0-4c07-bc45-1b439fe454f7 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,962 | supabase-export-v2 | aee1b4750a069936 | options: -h, --help show this help message and exit
:class:`RawTextHelpFormatter` maintains whitespace for all sorts of 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. | trusted_official_docs | CPython Docs | options: -h, --help show this help message and exit
:class:`RawTextHelpFormatter` maintains whitespace for all sorts of 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. | options: -h, --help show this help message and exit
:class:`RawTextHelpFormatter` maintains whitespace for all sorts of 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
01de05e6-fb4e-4acf-be29-025a2d5a3b30 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,005 | supabase-export-v2 | d4bb6feb363ccbfb | in which case ``-h`` and ``--help`` are not valid options. In this case, the first character in ``prefix_chars`` is used to prefix the help options::
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')
>>> parser.print_help()
usage: PROG [+h] | trusted_official_docs | CPython Docs | in which case ``-h`` and ``--help`` are not valid options. In this case, the first character in ``prefix_chars`` is used to prefix the help options::
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')
>>> parser.print_help()
usage: PROG [+h] | in which case ``-h`` and ``--help`` are not valid options. In this case, the first character in ``prefix_chars`` is used to prefix the help options::
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')
>>> parser.print_help()
usage: PROG [+h] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02269a20-153e-4f60-8308-ef55fd7919fd | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,108 | supabase-export-v2 | b8bed69325e5b320 | parser applies any type_ conversion argument, if provided, before setting the attribute on the :class:`Namespace` return value. Otherwise, the parser uses the value as is::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--length', default='10', type=int)
>>> parser.add_argument('--width', default=10.... | trusted_official_docs | CPython Docs | parser applies any type_ conversion argument, if provided, before setting the attribute on the :class:`Namespace` return value. Otherwise, the parser uses the value as is::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--length', default='10', type=int)
>>> parser.add_argument('--width', default=10.... | parser applies any type_ conversion argument, if provided, before setting the attribute on the :class:`Namespace` return value. Otherwise, the parser uses the value as is::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--length', default='10', type=int)
>>> parser.add_argument('--width', default=10.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
03a723a4-2e79-4ef9-a1b8-b3ebb2295a57 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,287 | supabase-export-v2 | 6dd2007c8aee171d | >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(dest='subparser_name') >>> subparser1 = subparsers.add_parser('1') >>> subparser1.add_argument('-x') >>> subparser2 = subparsers.add_parser('2') >>> subparser2.add_argument('y') >>> parser.parse_args(['2', 'frobble']) Namespace(subparser_name... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(dest='subparser_name') >>> subparser1 = subparsers.add_parser('1') >>> subparser1.add_argument('-x') >>> subparser2 = subparsers.add_parser('2') >>> subparser2.add_argument('y') >>> parser.parse_args(['2', 'frobble']) Namespace(subparser_name... | >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(dest='subparser_name') >>> subparser1 = subparsers.add_parser('1') >>> subparser1.add_argument('-x') >>> subparser2 = subparsers.add_parser('2') >>> subparser2.add_argument('y') >>> parser.parse_args(['2', 'frobble']) Namespace(subparser_name... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
040f5ffb-34ab-4be8-ba28-3d43a89c2fd2 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,146 | supabase-export-v2 | 310e054c41a957f1 | help ^^^^
The ``help`` value is a string containing a brief description of the 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. | trusted_official_docs | CPython Docs | help ^^^^
The ``help`` value is a string containing a brief description of the 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. | help ^^^^
The ``help`` value is a string containing a brief description of the 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05f82050-fc40-49af-aa3d-5683014a3ff8 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,989 | supabase-export-v2 | 873c8c3570253009 | Normally, when you pass an argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes abbreviations <prefix-matching>` of long options.
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: | trusted_official_docs | CPython Docs | Normally, when you pass an argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes abbreviations <prefix-matching>` of long options.
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: | Normally, when you pass an argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes abbreviations <prefix-matching>` of long options.
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07a7fe31-2c78-4e53-a156-9286a5b57c12 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,061 | supabase-export-v2 | 666b0f78bbd9a61f | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_const', const=42) >>> parser.parse_args(['--foo']) Namespace(foo=42)
* ``'store_true'`` and ``'store_false'`` - These are special cases of
``'store_const'`` that respectively store the values ``True`` and ``False``
with default valu... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_const', const=42) >>> parser.parse_args(['--foo']) Namespace(foo=42)
* ``'store_true'`` and ``'store_false'`` - These are special cases of
``'store_const'`` that respectively store the values ``True`` and ``False``
with default valu... | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action='store_const', const=42) >>> parser.parse_args(['--foo']) Namespace(foo=42)
* ``'store_true'`` and ``'store_false'`` - These are special cases of
``'store_const'`` that respectively store the values ``True`` and ``False``
with default valu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
089e63cd-ac2e-466c-8eed-08d6deac949b | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,325 | supabase-export-v2 | e22bfe5b9b411ec9 | a mutually exclusive group. :mod:`!argparse` will make sure that only one of the arguments in the mutually exclusive group was present on the command line::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> group = parser.add_mutually_exclusive_group()
>>> group.add_argument('--foo', action='store_true')
>>> gro... | trusted_official_docs | CPython Docs | a mutually exclusive group. :mod:`!argparse` will make sure that only one of the arguments in the mutually exclusive group was present on the command line::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> group = parser.add_mutually_exclusive_group()
>>> group.add_argument('--foo', action='store_true')
>>> gro... | a mutually exclusive group. :mod:`!argparse` will make sure that only one of the arguments in the mutually exclusive group was present on the command line::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> group = parser.add_mutually_exclusive_group()
>>> group.add_argument('--foo', action='store_true')
>>> gro... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09db496b-517f-4738-adb8-bcffb0310d0a | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,100 | supabase-export-v2 | 7ad2885f0002b371 | object returned by :meth:`~ArgumentParser.parse_args`. See the action_ description for examples. If ``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will receive a default value of ``None``.
* When :meth:`~ArgumentParser.add_argument` is called with option strings
(like ``-f`` or ``--foo``) and ``... | trusted_official_docs | CPython Docs | object returned by :meth:`~ArgumentParser.parse_args`. See the action_ description for examples. If ``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will receive a default value of ``None``.
* When :meth:`~ArgumentParser.add_argument` is called with option strings
(like ``-f`` or ``--foo``) and ``... | object returned by :meth:`~ArgumentParser.parse_args`. See the action_ description for examples. If ``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will receive a default value of ``None``.
* When :meth:`~ArgumentParser.add_argument` is called with option strings
(like ``-f`` or ``--foo``) and ``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ba52824-c35a-4a14-8ec6-b3c613b7943a | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,267 | supabase-export-v2 | d9575359a8293496 | is specified, only the ``foo`` and ``bar`` attributes are present, and when the ``b`` command is specified, only the ``foo`` and ``baz`` attributes are present.
Similarly, when a help message is requested from a subparser, only the help
for that particular parser will be printed. The help message will not
include par... | trusted_official_docs | CPython Docs | is specified, only the ``foo`` and ``bar`` attributes are present, and when the ``b`` command is specified, only the ``foo`` and ``baz`` attributes are present.
Similarly, when a help message is requested from a subparser, only the help
for that particular parser will be printed. The help message will not
include par... | is specified, only the ``foo`` and ``bar`` attributes are present, and when the ``b`` command is specified, only the ``foo`` and ``baz`` attributes are present.
Similarly, when a help message is requested from a subparser, only the help
for that particular parser will be printed. The help message will not
include par... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0c7faaaa-4036-4863-ad81-9e075077ee72 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,882 | supabase-export-v2 | b232abd3fb7b25a5 | This page contains the API reference information. For a more gentle introduction to Python command-line parsing, have a look at the :ref:`argparse tutorial <argparse-tutorial>`.
The :mod:`!argparse` module makes it easy to write user-friendly command-line
interfaces. The program defines what arguments it requires, and ... | trusted_official_docs | CPython Docs | This page contains the API reference information. For a more gentle introduction to Python command-line parsing, have a look at the :ref:`argparse tutorial <argparse-tutorial>`.
The :mod:`!argparse` module makes it easy to write user-friendly command-line
interfaces. The program defines what arguments it requires, and ... | This page contains the API reference information. For a more gentle introduction to Python command-line parsing, have a look at the :ref:`argparse tutorial <argparse-tutorial>`.
The :mod:`!argparse` module makes it easy to write user-friendly command-line
interfaces. The program defines what arguments it requires, and ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d03d444-c5a0-43ad-8ab6-b0307fca0edc | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,960 | supabase-export-v2 | 6c0c722a38bf9d53 | up this text! ... -------------------------------- ... I have indented it ... exactly the way ... I want it ... ''')) >>> parser.print_help() usage: PROG [-h]
Please do not mess up this text! --------------------------------
I have indented it
exactly the way
I want it | trusted_official_docs | CPython Docs | up this text! ... -------------------------------- ... I have indented it ... exactly the way ... I want it ... ''')) >>> parser.print_help() usage: PROG [-h]
Please do not mess up this text! --------------------------------
I have indented it
exactly the way
I want it | up this text! ... -------------------------------- ... I have indented it ... exactly the way ... I want it ... ''')) >>> parser.print_help() usage: PROG [-h]
Please do not mess up this text! --------------------------------
I have indented it
exactly the way
I want it | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d13ed75-4f9e-4799-af6f-c6c2941d44d0 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,380 | supabase-export-v2 | 60de5b46f472ccea | type=int) >>> parser.parse_known_args('doit 1 --foo bar 2 3'.split()) (Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3']) >>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split()) Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])
:meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple
c... | trusted_official_docs | CPython Docs | type=int) >>> parser.parse_known_args('doit 1 --foo bar 2 3'.split()) (Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3']) >>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split()) Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])
:meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple
c... | type=int) >>> parser.parse_known_args('doit 1 --foo bar 2 3'.split()) (Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3']) >>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split()) Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])
:meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple
c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ef07913-1aea-42c6-9771-a3a1974ee19e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,879 | supabase-export-v2 | 2419f4aea84a5554 | .. note::
While :mod:`!argparse` is the default recommended standard library module
for implementing basic command line applications, authors with more
exacting requirements for exactly how their command line applications
behave may find it doesn't provide the necessary level of control. Refer to :ref:`choosing-an-a... | trusted_official_docs | CPython Docs | .. note::
While :mod:`!argparse` is the default recommended standard library module
for implementing basic command line applications, authors with more
exacting requirements for exactly how their command line applications
behave may find it doesn't provide the necessary level of control. Refer to :ref:`choosing-an-a... | .. note::
While :mod:`!argparse` is the default recommended standard library module
for implementing basic command line applications, authors with more
exacting requirements for exactly how their command line applications
behave may find it doesn't provide the necessary level of control. Refer to :ref:`choosing-an-a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f1e2a7b-b87d-4e0a-a14d-fcad28e28a38 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,093 | supabase-export-v2 | 08ff411b3f19fad2 | argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='*') >>> parser.add_argument('--bar', nargs='*') >>> parser.add_argument('baz', nargs='*') >>> parser.parse_args('a b --foo x y --bar 1 2'.split()) Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])
.. index:: single: + (plus); in argparse module | trusted_official_docs | CPython Docs | argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='*') >>> parser.add_argument('--bar', nargs='*') >>> parser.add_argument('baz', nargs='*') >>> parser.parse_args('a b --foo x y --bar 1 2'.split()) Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])
.. index:: single: + (plus); in argparse module | argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='*') >>> parser.add_argument('--bar', nargs='*') >>> parser.add_argument('baz', nargs='*') >>> parser.parse_args('a b --foo x y --bar 1 2'.split()) Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])
.. index:: single: + (plus); in argparse module | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fbe537e-e324-48a0-89c7-0bee507f9352 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,161 | supabase-export-v2 | ba15dd8c94ae952e | An alternative name can be specified with ``metavar``::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', metavar='YYY')
>>> parser.add_argument('bar', metavar='XXX')
>>> parser.parse_args('X --foo Y'.split())
Namespace(bar='X', foo='Y')
>>> parser.print_help()
usage: [-h] [--foo YYY] XXX | trusted_official_docs | CPython Docs | An alternative name can be specified with ``metavar``::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', metavar='YYY')
>>> parser.add_argument('bar', metavar='XXX')
>>> parser.parse_args('X --foo Y'.split())
Namespace(bar='X', foo='Y')
>>> parser.print_help()
usage: [-h] [--foo YYY] XXX | An alternative name can be specified with ``metavar``::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', metavar='YYY')
>>> parser.add_argument('bar', metavar='XXX')
>>> parser.parse_args('X --foo Y'.split())
Namespace(bar='X', foo='Y')
>>> parser.print_help()
usage: [-h] [--foo YYY] XXX | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1170beda-c827-46d6-ac70-69599c2db20f | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,954 | supabase-export-v2 | 27253d5e82b3f11b | and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ and epilog_ texts in command-line help messages::
>>> parser = argparse.ArgumentParser(
... prog='PROG',
... description='''this description
... was ... | trusted_official_docs | CPython Docs | and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ and epilog_ texts in command-line help messages::
>>> parser = argparse.ArgumentParser(
... prog='PROG',
... description='''this description
... was ... | and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ and epilog_ texts in command-line help messages::
>>> parser = argparse.ArgumentParser(
... prog='PROG',
... description='''this description
... was ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11e30c46-b09e-4f6b-b9a6-075a883434af | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,085 | supabase-export-v2 | 332ba66d7b871a8d | Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced by itself.
.. index:: single: ? (question mark); in argparse module | trusted_official_docs | CPython Docs | Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced by itself.
.. index:: single: ? (question mark); in argparse module | Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced by itself.
.. index:: single: ? (question mark); in argparse module | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1486bfbf-dacf-477b-b3ff-db848da8ab0e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,019 | supabase-export-v2 | ffd2fc7bfc3cd5d2 | want plain text help messages, you can disable this :ref:`in your local environment <using-on-controlling-color>`, or in the argument parser itself by setting ``color`` to ``False``::
>>> parser = argparse.ArgumentParser(description='Process some integers.',
... color=False)
>>> parser.add_argument('--action', choice... | trusted_official_docs | CPython Docs | want plain text help messages, you can disable this :ref:`in your local environment <using-on-controlling-color>`, or in the argument parser itself by setting ``color`` to ``False``::
>>> parser = argparse.ArgumentParser(description='Process some integers.',
... color=False)
>>> parser.add_argument('--action', choice... | want plain text help messages, you can disable this :ref:`in your local environment <using-on-controlling-color>`, or in the argument parser itself by setting ``color`` to ``False``::
>>> parser = argparse.ArgumentParser(description='Process some integers.',
... color=False)
>>> parser.add_argument('--action', choice... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
14d14b34-6b49-4af4-bfa6-36c0433e6538 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,152 | supabase-export-v2 | c8c638bdeff7715d | As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``.
:mod:`!argparse` supports silencing the help entry for certain options, by
setting the ``help`` value to ``argparse.SUPPRESS``:: | trusted_official_docs | CPython Docs | As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``.
:mod:`!argparse` supports silencing the help entry for certain options, by
setting the ``help`` value to ``argparse.SUPPRESS``:: | As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``.
:mod:`!argparse` supports silencing the help entry for certain options, by
setting the ``help`` value to ``argparse.SUPPRESS``:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
166a85b1-6966-497f-af0b-7a391929e704 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,893 | supabase-export-v2 | 30f46678efa1d355 | new :class:`ArgumentParser` object. All parameters should be passed as keyword arguments. Each parameter has its own more detailed description below, but in short they are:
* prog_ - The name of the program (default: generated from the ``__main__``
module attributes and ``sys.argv[0]``) | trusted_official_docs | CPython Docs | new :class:`ArgumentParser` object. All parameters should be passed as keyword arguments. Each parameter has its own more detailed description below, but in short they are:
* prog_ - The name of the program (default: generated from the ``__main__``
module attributes and ``sys.argv[0]``) | new :class:`ArgumentParser` object. All parameters should be passed as keyword arguments. Each parameter has its own more detailed description below, but in short they are:
* prog_ - The name of the program (default: generated from the ``__main__``
module attributes and ``sys.argv[0]``) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
166e0341-5074-44b1-9484-c12c24114e69 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,973 | supabase-export-v2 | 34a98dffb754547a | to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')
>>> parser.add_argument('+f')
>>> parser.add_argument(... | trusted_official_docs | CPython Docs | to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')
>>> parser.add_argument('+f')
>>> parser.add_argument(... | to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')
>>> parser.add_argument('+f')
>>> parser.add_argument(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19fef579-4930-453f-a969-182b7b8657cc | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,326 | supabase-export-v2 | 5aad337ea95d4133 | parser.parse_args(['--foo']) Namespace(bar=True, foo=True) >>> parser.parse_args(['--bar']) Namespace(bar=False, foo=False) >>> parser.parse_args(['--foo', '--bar']) usage: PROG [-h] [--foo | --bar] PROG: error: argument --bar: not allowed with argument --foo
The :meth:`add_mutually_exclusive_group` method also accepts... | trusted_official_docs | CPython Docs | parser.parse_args(['--foo']) Namespace(bar=True, foo=True) >>> parser.parse_args(['--bar']) Namespace(bar=False, foo=False) >>> parser.parse_args(['--foo', '--bar']) usage: PROG [-h] [--foo | --bar] PROG: error: argument --bar: not allowed with argument --foo
The :meth:`add_mutually_exclusive_group` method also accepts... | parser.parse_args(['--foo']) Namespace(bar=True, foo=True) >>> parser.parse_args(['--bar']) Namespace(bar=False, foo=False) >>> parser.parse_args(['--foo', '--bar']) usage: PROG [-h] [--foo | --bar] PROG: error: argument --bar: not allowed with argument --foo
The :meth:`add_mutually_exclusive_group` method also accepts... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a408bd5-f452-473b-a2cf-b26486b51600 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,149 | supabase-export-v2 | 2e5ee2c411a4a38a | >>> parser = argparse.ArgumentParser(prog='frobble') >>> parser.add_argument('bar', nargs='?', type=int, default=42, ... help='the bar to %(prog)s (default: %(default)s)') >>> parser.print_help() usage: frobble [-h] [bar]
positional arguments:
bar the bar to frobble (default: 42) | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser(prog='frobble') >>> parser.add_argument('bar', nargs='?', type=int, default=42, ... help='the bar to %(prog)s (default: %(default)s)') >>> parser.print_help() usage: frobble [-h] [bar]
positional arguments:
bar the bar to frobble (default: 42) | >>> parser = argparse.ArgumentParser(prog='frobble') >>> parser.add_argument('bar', nargs='?', type=int, default=42, ... help='the bar to %(prog)s (default: %(default)s)') >>> parser.print_help() usage: frobble [-h] [bar]
positional arguments:
bar the bar to frobble (default: 42) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a4bf3fb-9c65-4d5c-a3fa-6abd0d66c1ba | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,083 | supabase-export-v2 | 76ddff34b566bc83 | * ``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::
>>> 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']) | trusted_official_docs | CPython Docs | * ``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::
>>> 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']) | * ``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::
>>> 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']) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a64c421-2b22-42af-8e27-67e71b28e95d | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,336 | supabase-export-v2 | cf6671ed540f31ca | .. method:: ArgumentParser.set_defaults(**kwargs)
Most of the time, the attributes of the object returned by :meth:`parse_args`
will be fully determined by inspecting the command-line arguments and the argument
actions. :meth:`set_defaults` allows some additional
attributes that are determined without any inspection... | trusted_official_docs | CPython Docs | .. method:: ArgumentParser.set_defaults(**kwargs)
Most of the time, the attributes of the object returned by :meth:`parse_args`
will be fully determined by inspecting the command-line arguments and the argument
actions. :meth:`set_defaults` allows some additional
attributes that are determined without any inspection... | .. method:: ArgumentParser.set_defaults(**kwargs)
Most of the time, the attributes of the object returned by :meth:`parse_args`
will be fully determined by inspecting the command-line arguments and the argument
actions. :meth:`set_defaults` allows some additional
attributes that are determined without any inspection... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a890dc6-2268-4ec0-9616-fa039291a04b | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,328 | supabase-export-v2 | 3f06cca589e28787 | parser.add_mutually_exclusive_group(required=True) >>> group.add_argument('--foo', action='store_true') >>> group.add_argument('--bar', action='store_false') >>> parser.parse_args([]) usage: PROG [-h] (--foo | --bar) PROG: error: one of the arguments --foo --bar is required
Note that currently mutually exclusive argume... | trusted_official_docs | CPython Docs | parser.add_mutually_exclusive_group(required=True) >>> group.add_argument('--foo', action='store_true') >>> group.add_argument('--bar', action='store_false') >>> parser.parse_args([]) usage: PROG [-h] (--foo | --bar) PROG: error: one of the arguments --foo --bar is required
Note that currently mutually exclusive argume... | parser.add_mutually_exclusive_group(required=True) >>> group.add_argument('--foo', action='store_true') >>> group.add_argument('--bar', action='store_false') >>> parser.parse_args([]) usage: PROG [-h] (--foo | --bar) PROG: error: one of the arguments --foo --bar is required
Note that currently mutually exclusive argume... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1aad25bf-90c3-4aa8-bdc4-885939f25112 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,013 | supabase-export-v2 | 6fdd257ef6220d00 | suggest_on_error ^^^^^^^^^^^^^^^^
By default, when a user passes an invalid argument choice or subparser name,
:class:`ArgumentParser` will exit with error info and provide suggestions for
mistyped arguments. The error message will list the permissible argument
choices (if specified) or subparser names, along with a "m... | trusted_official_docs | CPython Docs | suggest_on_error ^^^^^^^^^^^^^^^^
By default, when a user passes an invalid argument choice or subparser name,
:class:`ArgumentParser` will exit with error info and provide suggestions for
mistyped arguments. The error message will list the permissible argument
choices (if specified) or subparser names, along with a "m... | suggest_on_error ^^^^^^^^^^^^^^^^
By default, when a user passes an invalid argument choice or subparser name,
:class:`ArgumentParser` will exit with error info and provide suggestions for
mistyped arguments. The error message will list the permissible argument
choices (if specified) or subparser names, along with a "m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1bbe4510-598e-49e5-9d97-705e128a0385 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,974 | supabase-export-v2 | c48f23a3628e32c2 | >>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+') >>> parser.add_argument('+f') >>> parser.add_argument('++bar') >>> parser.parse_args('+f X ++bar Y'.split()) Namespace(bar='Y', f='X')
The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of
characters that does not include ``-`` will c... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+') >>> parser.add_argument('+f') >>> parser.add_argument('++bar') >>> parser.parse_args('+f X ++bar Y'.split()) Namespace(bar='Y', f='X')
The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of
characters that does not include ``-`` will c... | >>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+') >>> parser.add_argument('+f') >>> parser.add_argument('++bar') >>> parser.parse_args('+f X ++bar Y'.split()) Namespace(bar='Y', f='X')
The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of
characters that does not include ``-`` will c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1be89d44-3f00-4ecb-b94f-be336bcdce1e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,901 | supabase-export-v2 | f014e3e9cfe2d6a4 | * fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)
* argument_default_ - The global default value for arguments
(default: ``None``) | trusted_official_docs | CPython Docs | * fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)
* argument_default_ - The global default value for arguments
(default: ``None``) | * fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)
* argument_default_ - The global default value for arguments
(default: ``None``) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1dc21d5a-b00f-48a5-8383-096a402bf24f | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,210 | supabase-export-v2 | 5b5f8e3996f29d29 | >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('--foo') >>> parser.parse_args(['-x', 'X']) Namespace(foo=None, x='X') >>> parser.parse_args(['--foo', 'FOO']) Namespace(foo='FOO', x=None)
For long options (options with names longer than a single character), the op... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('--foo') >>> parser.parse_args(['-x', 'X']) Namespace(foo=None, x='X') >>> parser.parse_args(['--foo', 'FOO']) Namespace(foo='FOO', x=None)
For long options (options with names longer than a single character), the op... | >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-x') >>> parser.add_argument('--foo') >>> parser.parse_args(['-x', 'X']) Namespace(foo=None, x='X') >>> parser.parse_args(['--foo', 'FOO']) Namespace(foo='FOO', x=None)
For long options (options with names longer than a single character), the op... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1f01e7c1-9e55-4797-bf95-91b69f512dcb | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,894 | supabase-export-v2 | ccdead78e11fdd8b | * prog_ - The name of the program (default: generated from the ``__main__`` module attributes and ``sys.argv[0]``)
* usage_ - The string describing the program usage (default: generated from
arguments added to parser) | trusted_official_docs | CPython Docs | * prog_ - The name of the program (default: generated from the ``__main__`` module attributes and ``sys.argv[0]``)
* usage_ - The string describing the program usage (default: generated from
arguments added to parser) | * prog_ - The name of the program (default: generated from the ``__main__`` module attributes and ``sys.argv[0]``)
* usage_ - The string describing the program usage (default: generated from
arguments added to parser) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20206f71-0b90-498f-a1e8-610fbd1bf26e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,004 | supabase-export-v2 | 6ed1ca30473691d0 | options: --foo FOO foo help
The help option is typically ``-h/--help``. The exception to this is
if the ``prefix_chars=`` is specified and does not include ``-``, in
which case ``-h`` and ``--help`` are not valid options. In
this case, the first character in ``prefix_chars`` is used to prefix
the help options:: | trusted_official_docs | CPython Docs | options: --foo FOO foo help
The help option is typically ``-h/--help``. The exception to this is
if the ``prefix_chars=`` is specified and does not include ``-``, in
which case ``-h`` and ``--help`` are not valid options. In
this case, the first character in ``prefix_chars`` is used to prefix
the help options:: | options: --foo FOO foo help
The help option is typically ``-h/--help``. The exception to this is
if the ``prefix_chars=`` is specified and does not include ``-``, in
which case ``-h`` and ``--help`` are not valid options. In
this case, the first character in ``prefix_chars`` is used to prefix
the help options:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2036fde8-2189-4fe7-a5d3-a9c4348d619e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,883 | supabase-export-v2 | 18cf48bf5d0868be | of :data:`sys.argv`. The :mod:`!argparse` module also automatically generates help and usage messages. The module will also issue errors when users give the program invalid arguments.
The :mod:`!argparse` module's support for command-line interfaces is built
around an instance of :class:`argparse.ArgumentParser`. It is... | trusted_official_docs | CPython Docs | of :data:`sys.argv`. The :mod:`!argparse` module also automatically generates help and usage messages. The module will also issue errors when users give the program invalid arguments.
The :mod:`!argparse` module's support for command-line interfaces is built
around an instance of :class:`argparse.ArgumentParser`. It is... | of :data:`sys.argv`. The :mod:`!argparse` module also automatically generates help and usage messages. The module will also issue errors when users give the program invalid arguments.
The :mod:`!argparse` module's support for command-line interfaces is built
around an instance of :class:`argparse.ArgumentParser`. It is... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
25167dd3-ff35-4ec8-9c9d-9798cd6f7238 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,931 | supabase-export-v2 | 58d28ebfe61c6b9a | The ``%(prog)s`` format specifier is available to fill in the program name in your usage messages.
When a custom usage message is specified for the main parser, you may also want to
consider passing the ``prog`` argument to :meth:`~ArgumentParser.add_subparsers`
or the ``prog`` and the ``usage`` arguments to
:meth:`~_S... | trusted_official_docs | CPython Docs | The ``%(prog)s`` format specifier is available to fill in the program name in your usage messages.
When a custom usage message is specified for the main parser, you may also want to
consider passing the ``prog`` argument to :meth:`~ArgumentParser.add_subparsers`
or the ``prog`` and the ``usage`` arguments to
:meth:`~_S... | The ``%(prog)s`` format specifier is available to fill in the program name in your usage messages.
When a custom usage message is specified for the main parser, you may also want to
consider passing the ``prog`` argument to :meth:`~ArgumentParser.add_subparsers`
or the ``prog`` and the ``usage`` arguments to
:meth:`~_S... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
258023de-b435-4bb8-8040-315543f02bc1 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,995 | supabase-export-v2 | 3289a9d2cc49f788 | argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') Traceback (most recent call last): .. ArgumentError: argument --foo: conflicting option string(s): --foo
Sometimes (e.g. when using parents_) it may be useful to simply ... | trusted_official_docs | CPython Docs | argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') Traceback (most recent call last): .. ArgumentError: argument --foo: conflicting option string(s): --foo
Sometimes (e.g. when using parents_) it may be useful to simply ... | argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('-f', '--foo', help='old foo help') >>> parser.add_argument('--foo', help='new foo help') Traceback (most recent call last): .. ArgumentError: argument --foo: conflicting option string(s): --foo
Sometimes (e.g. when using parents_) it may be useful to simply ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26bcb501-309a-4b3e-be50-878ea33de54c | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,091 | supabase-export-v2 | 3fa1e287211d1891 | .. index:: single: * (asterisk); in argparse module
* ``'*'``. All command-line arguments present are gathered into a list. Note that
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:: | trusted_official_docs | CPython Docs | .. index:: single: * (asterisk); in argparse module
* ``'*'``. All command-line arguments present are gathered into a list. Note that
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:: | .. index:: single: * (asterisk); in argparse module
* ``'*'``. All command-line arguments present are gathered into a list. Note that
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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
276b2737-6b35-4e17-8e2a-3fca7a53a842 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,086 | supabase-export-v2 | f66ad265e71f7fb1 | .. index:: single: ? (question mark); in argparse module
* ``'?'``. One argument will be consumed from the command line if possible, and
produced as a single item. If no command-line argument is present, the value from
default_ will be produced. Note that for optional arguments, there is an
additional case - the opt... | trusted_official_docs | CPython Docs | .. index:: single: ? (question mark); in argparse module
* ``'?'``. One argument will be consumed from the command line if possible, and
produced as a single item. If no command-line argument is present, the value from
default_ will be produced. Note that for optional arguments, there is an
additional case - the opt... | .. index:: single: ? (question mark); in argparse module
* ``'?'``. One argument will be consumed from the command line if possible, and
produced as a single item. If no command-line argument is present, the value from
default_ will be produced. Note that for optional arguments, there is an
additional case - the opt... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2814d45b-f762-4a62-92f0-d296dbfc2e48 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,306 | supabase-export-v2 | 4c14421a8836e0f5 | .. note::
If one argument uses *FileType* and then a subsequent argument fails,
an error is reported but the file is not automatically closed. This can also clobber the output files. In this case, it would be better to wait until after the parser has
run and then use the :keyword:`with`-statement to manage the files. | trusted_official_docs | CPython Docs | .. note::
If one argument uses *FileType* and then a subsequent argument fails,
an error is reported but the file is not automatically closed. This can also clobber the output files. In this case, it would be better to wait until after the parser has
run and then use the :keyword:`with`-statement to manage the files. | .. note::
If one argument uses *FileType* and then a subsequent argument fails,
an error is reported but the file is not automatically closed. This can also clobber the output files. In this case, it would be better to wait until after the parser has
run and then use the :keyword:`with`-statement to manage the files. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28b4461d-c4f3-4f5e-98b2-d4153d053ebf | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,279 | supabase-export-v2 | 727e9ba47259edb7 | >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(title='subcommands', ... description='valid subcommands', ... help='additional help') >>> subparsers.add_parser('foo') >>> subparsers.add_parser('bar') >>> parser.parse_args(['-h']) usage: [-h] {foo,bar} ...
options:
-h, --help show this hel... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(title='subcommands', ... description='valid subcommands', ... help='additional help') >>> subparsers.add_parser('foo') >>> subparsers.add_parser('bar') >>> parser.parse_args(['-h']) usage: [-h] {foo,bar} ...
options:
-h, --help show this hel... | >>> parser = argparse.ArgumentParser() >>> subparsers = parser.add_subparsers(title='subcommands', ... description='valid subcommands', ... help='additional help') >>> subparsers.add_parser('foo') >>> subparsers.add_parser('bar') >>> parser.parse_args(['-h']) usage: [-h] {foo,bar} ...
options:
-h, --help show this hel... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2a453a9c-07dd-4066-a161-a4e09a27ca7c | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,197 | supabase-export-v2 | 5819a35f243190d2 | >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction) >>> parser.parse_args(['--no-foo']) Namespace(foo=False)
Single-dash long options are also supported. For example, negative option ``-nofoo`` is automatically added for
positive option ``-... | trusted_official_docs | CPython Docs | >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction) >>> parser.parse_args(['--no-foo']) Namespace(foo=False)
Single-dash long options are also supported. For example, negative option ``-nofoo`` is automatically added for
positive option ``-... | >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction) >>> parser.parse_args(['--no-foo']) Namespace(foo=False)
Single-dash long options are also supported. For example, negative option ``-nofoo`` is automatically added for
positive option ``-... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b191a35-9cde-441d-b002-6b07d6e0a0a5 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,098 | supabase-export-v2 | 2af6ab4b189218ec | const ^^^^^
The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to hold
constant 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: | trusted_official_docs | CPython Docs | const ^^^^^
The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to hold
constant 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: | const ^^^^^
The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to hold
constant 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: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c1831b3-b327-458f-9905-3cecee9dde35 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,238 | supabase-export-v2 | 69534ab79f1a84d5 | badger=None) >>> parser.parse_args('-bad WOOD'.split()) Namespace(bacon=None, badger='WOOD') >>> parser.parse_args('-ba BA'.split()) usage: PROG [-h] [-bacon BACON] [-badger BADGER] PROG: error: ambiguous option: -ba could match -badger, -bacon
An error is produced for arguments that could produce more than one options... | trusted_official_docs | CPython Docs | badger=None) >>> parser.parse_args('-bad WOOD'.split()) Namespace(bacon=None, badger='WOOD') >>> parser.parse_args('-ba BA'.split()) usage: PROG [-h] [-bacon BACON] [-badger BADGER] PROG: error: ambiguous option: -ba could match -badger, -bacon
An error is produced for arguments that could produce more than one options... | badger=None) >>> parser.parse_args('-bad WOOD'.split()) Namespace(bacon=None, badger='WOOD') >>> parser.parse_args('-ba BA'.split()) usage: PROG [-h] [-bacon BACON] [-badger BADGER] PROG: error: ambiguous option: -ba could match -badger, -bacon
An error is produced for arguments that could produce more than one options... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d5f2f5d-a47e-441d-8cf7-a9c1ee508582 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,983 | supabase-export-v2 | 470fc591790eaeab | The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that arguments will never be treated as file references.
.. versionchanged:: 3.12
:class:`ArgumentParser` changed encoding and errors to read arguments files
from default (e.g. :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>... | trusted_official_docs | CPython Docs | The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that arguments will never be treated as file references.
.. versionchanged:: 3.12
:class:`ArgumentParser` changed encoding and errors to read arguments files
from default (e.g. :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>... | The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that arguments will never be treated as file references.
.. versionchanged:: 3.12
:class:`ArgumentParser` changed encoding and errors to read arguments files
from default (e.g. :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d765c9a-aee0-4640-9452-737ce38314f0 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,094 | supabase-export-v2 | 28f5bf2317a76d6d | .. index:: single: + (plus); in argparse module
* ``'+'``. Just like ``'*'``, all command-line 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:: | trusted_official_docs | CPython Docs | .. index:: single: + (plus); in argparse module
* ``'+'``. Just like ``'*'``, all command-line 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:: | .. index:: single: + (plus); in argparse module
* ``'+'``. Just like ``'*'``, all command-line 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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f52a6c7-559d-45b0-b766-e64fd8715a88 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,284 | supabase-export-v2 | b779c7e7353e9c8b | >>> # subcommand functions >>> def foo(args): ... print(args.x * args.y) ... >>> def bar(args): ... print('((%s))' % args.z) ...
>>> # create the top-level parser
>>> parser = argparse.ArgumentParser()
>>> subparsers = parser.add_subparsers(required=True)
>>>
>>> # create the parser for the "foo" command
>>> parse... | trusted_official_docs | CPython Docs | >>> # subcommand functions >>> def foo(args): ... print(args.x * args.y) ... >>> def bar(args): ... print('((%s))' % args.z) ...
>>> # create the top-level parser
>>> parser = argparse.ArgumentParser()
>>> subparsers = parser.add_subparsers(required=True)
>>>
>>> # create the parser for the "foo" command
>>> parse... | >>> # subcommand functions >>> def foo(args): ... print(args.x * args.y) ... >>> def bar(args): ... print('((%s))' % args.z) ...
>>> # create the top-level parser
>>> parser = argparse.ArgumentParser()
>>> subparsers = parser.add_subparsers(required=True)
>>>
>>> # create the parser for the "foo" command
>>> parse... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f5371da-19be-4936-8ea7-a191968a7e71 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,075 | supabase-export-v2 | 7b5cd1a39ac2d481 | * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked::
>>> import argparse
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--version', action='version', version='%(prog)s 2.0')
... | trusted_official_docs | CPython Docs | * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked::
>>> import argparse
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--version', action='version', version='%(prog)s 2.0')
... | * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked::
>>> import argparse
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--version', action='version', version='%(prog)s 2.0')
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
30648ebb-5e46-4d49-abe1-096d0783ea42 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,985 | supabase-export-v2 | 82495fa62a5ea433 | argument_default ^^^^^^^^^^^^^^^^
Generally, argument defaults are specified either by passing a default to
:meth:`~ArgumentParser.add_argument` or by calling the
:meth:`~ArgumentParser.set_defaults` methods with a specific set of name-value
pairs. Sometimes however, it may be useful to specify a single parser-wide
def... | trusted_official_docs | CPython Docs | argument_default ^^^^^^^^^^^^^^^^
Generally, argument defaults are specified either by passing a default to
:meth:`~ArgumentParser.add_argument` or by calling the
:meth:`~ArgumentParser.set_defaults` methods with a specific set of name-value
pairs. Sometimes however, it may be useful to specify a single parser-wide
def... | argument_default ^^^^^^^^^^^^^^^^
Generally, argument defaults are specified either by passing a default to
:meth:`~ArgumentParser.add_argument` or by calling the
:meth:`~ArgumentParser.set_defaults` methods with a specific set of name-value
pairs. Sometimes however, it may be useful to specify a single parser-wide
def... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
30bacf5b-58c8-4d15-84c6-03c48e92ce58 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,116 | supabase-export-v2 | 3b6574860386d917 | interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and type conversions to be performed.
If the type_ keyword is used with the default_ keyword, the type converter
is only applied if the default is a str... | trusted_official_docs | CPython Docs | interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and type conversions to be performed.
If the type_ keyword is used with the default_ keyword, the type converter
is only applied if the default is a str... | interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and type conversions to be performed.
If the type_ keyword is used with the default_ keyword, the type converter
is only applied if the default is a str... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
315c225b-8b23-4d33-bc68-0fb9fd75201d | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,125 | supabase-export-v2 | 9a9699681c410884 | as a type converter. All it does is convert empty strings to ``False`` and non-empty strings to ``True``. This is usually not what is desired::
>>> parser = argparse.ArgumentParser()
>>> _ = parser.add_argument('--verbose', type=bool)
>>> parser.parse_args(['--verbose', 'False'])
Namespace(verbose=True) | trusted_official_docs | CPython Docs | as a type converter. All it does is convert empty strings to ``False`` and non-empty strings to ``True``. This is usually not what is desired::
>>> parser = argparse.ArgumentParser()
>>> _ = parser.add_argument('--verbose', type=bool)
>>> parser.parse_args(['--verbose', 'False'])
Namespace(verbose=True) | as a type converter. All it does is convert empty strings to ``False`` and non-empty strings to ``True``. This is usually not what is desired::
>>> parser = argparse.ArgumentParser()
>>> _ = parser.add_argument('--verbose', type=bool)
>>> parser.parse_args(['--verbose', 'False'])
Namespace(verbose=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3173f909-266c-48da-84ae-3e9510780de1 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,240 | supabase-export-v2 | 012cbb32630274ab | Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^
Sometimes it may be useful to have an :class:`ArgumentParser` parse arguments other 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:: | trusted_official_docs | CPython Docs | Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^
Sometimes it may be useful to have an :class:`ArgumentParser` parse arguments other 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:: | Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^
Sometimes it may be useful to have an :class:`ArgumentParser` parse arguments other 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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3219eaf0-f631-44e6-baa0-1a346ba3d5e8 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,934 | supabase-export-v2 | 98a42e510732c3e1 | does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for the various arguments.
By default, the description will be line-wrapped so that it fits within the
given space. To change this behavior, see the formatter_class_ argument. | trusted_official_docs | CPython Docs | does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for the various arguments.
By default, the description will be line-wrapped so that it fits within the
given space. To change this behavior, see the formatter_class_ argument. | does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for the various arguments.
By default, the description will be line-wrapped so that it fits within the
given space. To change this behavior, see the formatter_class_ argument. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32c505ae-47bb-4c00-814f-3b739f31e9bd | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,927 | supabase-export-v2 | a67987be87e80719 | By default, :class:`ArgumentParser` calculates the usage message from the arguments it contains. The default message can be overridden with the ``usage=`` keyword argument::
>>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]')
>>> parser.add_argument('--foo', nargs='?', help='foo help')
>>> p... | trusted_official_docs | CPython Docs | By default, :class:`ArgumentParser` calculates the usage message from the arguments it contains. The default message can be overridden with the ``usage=`` keyword argument::
>>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]')
>>> parser.add_argument('--foo', nargs='?', help='foo help')
>>> p... | By default, :class:`ArgumentParser` calculates the usage message from the arguments it contains. The default message can be overridden with the ``usage=`` keyword argument::
>>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]')
>>> parser.add_argument('--foo', nargs='?', help='foo help')
>>> p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
33627f11-1147-4c53-b82b-e3c33df58e82 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,014 | supabase-export-v2 | edacaa3504cdc08d | with a "maybe you meant" suggestion if a close match is found. Note that this only applies for arguments when the choices specified are strings::
>>> parser = argparse.ArgumentParser(suggest_on_error=True)
>>> parser.add_argument('--action', choices=['debug', 'dryrun'])
>>> parser.parse_args(['--action', 'debugg'])
... | trusted_official_docs | CPython Docs | with a "maybe you meant" suggestion if a close match is found. Note that this only applies for arguments when the choices specified are strings::
>>> parser = argparse.ArgumentParser(suggest_on_error=True)
>>> parser.add_argument('--action', choices=['debug', 'dryrun'])
>>> parser.parse_args(['--action', 'debugg'])
... | with a "maybe you meant" suggestion if a close match is found. Note that this only applies for arguments when the choices specified are strings::
>>> parser = argparse.ArgumentParser(suggest_on_error=True)
>>> parser.add_argument('--action', choices=['debug', 'dryrun'])
>>> parser.parse_args(['--action', 'debugg'])
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3497d755-22fa-483b-a731-7303caa1b26b | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,219 | supabase-export-v2 | 7e977a380cfe7152 | >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', type=int) >>> parser.add_argument('bar', nargs='?')
>>> # invalid type
>>> parser.parse_args(['--foo', 'spam'])
usage: PROG [-h] [--foo FOO] [bar]
PROG: error: argument --foo: invalid int value: 'spam' | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', type=int) >>> parser.add_argument('bar', nargs='?')
>>> # invalid type
>>> parser.parse_args(['--foo', 'spam'])
usage: PROG [-h] [--foo FOO] [bar]
PROG: error: argument --foo: invalid int value: 'spam' | >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo', type=int) >>> parser.add_argument('bar', nargs='?')
>>> # invalid type
>>> parser.parse_args(['--foo', 'spam'])
usage: PROG [-h] [--foo FOO] [bar]
PROG: error: argument --foo: invalid int value: 'spam' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
36324b75-6277-46a6-aaf3-21bb324f0219 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,906 | supabase-export-v2 | 065d6678e2817757 | * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)
* suggest_on_error_ - Enables suggestions for mistyped argument choices
and subparser names (default: ``True``) | trusted_official_docs | CPython Docs | * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)
* suggest_on_error_ - Enables suggestions for mistyped argument choices
and subparser names (default: ``True``) | * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)
* suggest_on_error_ - Enables suggestions for mistyped argument choices
and subparser names (default: ``True``) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3647e41d-da01-4db4-970f-a588a0fcf670 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,214 | supabase-export-v2 | 9bb312802dfe24cf | >>> parser.parse_args(['-xX']) Namespace(foo=None, x='X')
Several short options can be joined together, using only a single ``-`` prefix,
as long as only the last option (or none of them) requires a value:: | trusted_official_docs | CPython Docs | >>> parser.parse_args(['-xX']) Namespace(foo=None, x='X')
Several short options can be joined together, using only a single ``-`` prefix,
as long as only the last option (or none of them) requires a value:: | >>> parser.parse_args(['-xX']) Namespace(foo=None, x='X')
Several short options can be joined together, using only a single ``-`` prefix,
as long as only the last option (or none of them) requires a value:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
37092df8-dc1d-4b46-baa2-60faeab7751e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,367 | supabase-export-v2 | ea725eb5ea8d88cc | 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::
class MyArgumentParser(argparse.ArgumentParser):
def convert_arg_line_to_args(self, arg_line):
return arg_line.split() | trusted_official_docs | CPython Docs | 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::
class MyArgumentParser(argparse.ArgumentParser):
def convert_arg_line_to_args(self, arg_line):
return arg_line.split() | 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::
class MyArgumentParser(argparse.ArgumentParser):
def convert_arg_line_to_args(self, arg_line):
return arg_line.split() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
38f3a07c-0d15-45c2-be03-b13da9131b5e | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,266 | supabase-export-v2 | 28d9bc4318942cad | parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz help') >>> >>> # parse some argument lists >>> parser.parse_args(['a', '12']) Namespace(bar=12, foo=False) >>> parser.parse_args(['--foo', 'b', '--baz', 'Z']) Namespace(baz='Z', foo=True)
Note that the object returned by :meth:`~ArgumentParser.parse_args... | trusted_official_docs | CPython Docs | parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz help') >>> >>> # parse some argument lists >>> parser.parse_args(['a', '12']) Namespace(bar=12, foo=False) >>> parser.parse_args(['--foo', 'b', '--baz', 'Z']) Namespace(baz='Z', foo=True)
Note that the object returned by :meth:`~ArgumentParser.parse_args... | parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz help') >>> >>> # parse some argument lists >>> parser.parse_args(['a', '12']) Namespace(bar=12, foo=False) >>> parser.parse_args(['--foo', 'b', '--baz', 'Z']) Namespace(baz='Z', foo=True)
Note that the object returned by :meth:`~ArgumentParser.parse_args... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a8fa10e-6dfd-4eb8-a1f9-559e87235e65 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,088 | supabase-export-v2 | 36bdecdce3a9b2b9 | argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='?', const='c', default='d') >>> parser.add_argument('bar', nargs='?', default='d') >>> parser.parse_args(['XX', '--foo', 'YY']) Namespace(bar='XX', foo='YY') >>> parser.parse_args(['XX', '--foo']) Namespace(bar='XX', foo='c') >>> parser.parse_args([]) Na... | trusted_official_docs | CPython Docs | argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='?', const='c', default='d') >>> parser.add_argument('bar', nargs='?', default='d') >>> parser.parse_args(['XX', '--foo', 'YY']) Namespace(bar='XX', foo='YY') >>> parser.parse_args(['XX', '--foo']) Namespace(bar='XX', foo='c') >>> parser.parse_args([]) Na... | argparse.ArgumentParser() >>> parser.add_argument('--foo', nargs='?', const='c', default='d') >>> parser.add_argument('bar', nargs='?', default='d') >>> parser.parse_args(['XX', '--foo', 'YY']) Namespace(bar='XX', foo='YY') >>> parser.parse_args(['XX', '--foo']) Namespace(bar='XX', foo='c') >>> parser.parse_args([]) Na... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3b91ba03-990b-4ff3-aa8e-d827a3e76e8a | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,944 | supabase-export-v2 | 7dafbed1572db5df | takes a list of :class:`ArgumentParser` objects, collects all the positional and optional actions from them, and adds these actions to the :class:`ArgumentParser` object being constructed::
>>> parent_parser = argparse.ArgumentParser(add_help=False)
>>> parent_parser.add_argument('--parent', type=int) | trusted_official_docs | CPython Docs | takes a list of :class:`ArgumentParser` objects, collects all the positional and optional actions from them, and adds these actions to the :class:`ArgumentParser` object being constructed::
>>> parent_parser = argparse.ArgumentParser(add_help=False)
>>> parent_parser.add_argument('--parent', type=int) | takes a list of :class:`ArgumentParser` objects, collects all the positional and optional actions from them, and adds these actions to the :class:`ArgumentParser` object being constructed::
>>> parent_parser = argparse.ArgumentParser(add_help=False)
>>> parent_parser.add_argument('--parent', type=int) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c8e62a9-f745-4810-a42d-cc7ee5b64270 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,185 | supabase-export-v2 | d82e32a0cde1cb2e | parameter) should have attributes :attr:`!dest`, :attr:`!option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!help`, etc. defined. The easiest way to ensure these attributes are defined is to call :meth:`!Action.__init__`.
.. method:: __call__(parser, namespace, values, option_string=None) | trusted_official_docs | CPython Docs | parameter) should have attributes :attr:`!dest`, :attr:`!option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!help`, etc. defined. The easiest way to ensure these attributes are defined is to call :meth:`!Action.__init__`.
.. method:: __call__(parser, namespace, values, option_string=None) | parameter) should have attributes :attr:`!dest`, :attr:`!option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!help`, etc. defined. The easiest way to ensure these attributes are defined is to call :meth:`!Action.__init__`.
.. method:: __call__(parser, namespace, values, option_string=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d1c5cd8-0ac9-4db9-a1d4-6261ff581d69 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,223 | supabase-export-v2 | 8f71294973498f9c | Arguments containing ``-`` ^^^^^^^^^^^^^^^^^^^^^^^^^^
The :meth:`~ArgumentParser.parse_args` method attempts to give errors whenever
the user has clearly made a mistake, but some situations are inherently
ambiguous. For example, the command-line argument ``-1`` could either be an
attempt to specify an option or an atte... | trusted_official_docs | CPython Docs | Arguments containing ``-`` ^^^^^^^^^^^^^^^^^^^^^^^^^^
The :meth:`~ArgumentParser.parse_args` method attempts to give errors whenever
the user has clearly made a mistake, but some situations are inherently
ambiguous. For example, the command-line argument ``-1`` could either be an
attempt to specify an option or an atte... | Arguments containing ``-`` ^^^^^^^^^^^^^^^^^^^^^^^^^^
The :meth:`~ArgumentParser.parse_args` method attempts to give errors whenever
the user has clearly made a mistake, but some situations are inherently
ambiguous. For example, the command-line argument ``-1`` could either be an
attempt to specify an option or an atte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e884278-f0a8-42e3-8858-5d4674f3925c | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,111 | supabase-export-v2 | 08cbc0a3551fcf63 | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', nargs='?', default=42) >>> parser.parse_args(['a']) Namespace(foo='a') >>> parser.parse_args([]) Namespace(foo=42)
For required_ arguments, the ``default`` value is ignored. For example, this
applies to positional arguments with nargs_ values other t... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', nargs='?', default=42) >>> parser.parse_args(['a']) Namespace(foo='a') >>> parser.parse_args([]) Namespace(foo=42)
For required_ arguments, the ``default`` value is ignored. For example, this
applies to positional arguments with nargs_ values other t... | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', nargs='?', default=42) >>> parser.parse_args(['a']) Namespace(foo='a') >>> parser.parse_args([]) Namespace(foo=42)
For required_ arguments, the ``default`` value is ignored. For example, this
applies to positional arguments with nargs_ values other t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
40459c7a-d51d-4989-95da-c61e179d1aad | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,164 | supabase-export-v2 | 710a0184e59d13d3 | options: -h, --help show this help message and exit --foo YYY
Note that ``metavar`` only changes the *displayed* name - the name of the
attribute on the :meth:`~ArgumentParser.parse_args` object is still determined
by the dest_ value. | trusted_official_docs | CPython Docs | options: -h, --help show this help message and exit --foo YYY
Note that ``metavar`` only changes the *displayed* name - the name of the
attribute on the :meth:`~ArgumentParser.parse_args` object is still determined
by the dest_ value. | options: -h, --help show this help message and exit --foo YYY
Note that ``metavar`` only changes the *displayed* name - the name of the
attribute on the :meth:`~ArgumentParser.parse_args` object is still determined
by the dest_ value. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4072e110-e067-49cd-8468-f8e78eb2b499 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,256 | supabase-export-v2 | bcc416d489eea4c7 | * *title* - title for the sub-parser group in help output; by default "subcommands" if description is provided, otherwise uses title for positional arguments
* *description* - description for the sub-parser group in help output, by
default ``None`` | trusted_official_docs | CPython Docs | * *title* - title for the sub-parser group in help output; by default "subcommands" if description is provided, otherwise uses title for positional arguments
* *description* - description for the sub-parser group in help output, by
default ``None`` | * *title* - title for the sub-parser group in help output; by default "subcommands" if description is provided, otherwise uses title for positional arguments
* *description* - description for the sub-parser group in help output, by
default ``None`` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
40ee11ca-af53-42d1-8a6a-32b1988427c1 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,318 | supabase-export-v2 | 111007e3ace4ba97 | argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the entire parser.
Note that any arguments not in your user-defined groups will end up back
in the usual "positional arguments" and "optional arguments" section... | trusted_official_docs | CPython Docs | argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the entire parser.
Note that any arguments not in your user-defined groups will end up back
in the usual "positional arguments" and "optional arguments" section... | argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the entire parser.
Note that any arguments not in your user-defined groups will end up back
in the usual "positional arguments" and "optional arguments" section... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4135a66a-33bd-49f0-b590-1d46b6cf1c66 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,304 | supabase-export-v2 | 242a9a156bb0b5eb | FileType objects understand the pseudo-argument ``'-'`` and automatically convert this into :data:`sys.stdin` for readable :class:`FileType` objects and :data:`sys.stdout` for writable :class:`FileType` objects::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('infile', type=argparse.FileType('r'))
>>>... | trusted_official_docs | CPython Docs | FileType objects understand the pseudo-argument ``'-'`` and automatically convert this into :data:`sys.stdin` for readable :class:`FileType` objects and :data:`sys.stdout` for writable :class:`FileType` objects::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('infile', type=argparse.FileType('r'))
>>>... | FileType objects understand the pseudo-argument ``'-'`` and automatically convert this into :data:`sys.stdin` for readable :class:`FileType` objects and :data:`sys.stdout` for writable :class:`FileType` objects::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('infile', type=argparse.FileType('r'))
>>>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
41b3c1fc-f81a-44fd-b274-7523e7fc04d2 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,141 | supabase-export-v2 | a37dbdfede851958 | which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', required=True)
>>> parser.parse_args(['--foo', 'BAR'])
Name... | trusted_official_docs | CPython Docs | which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', required=True)
>>> parser.parse_args(['--foo', 'BAR'])
Name... | which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', required=True)
>>> parser.parse_args(['--foo', 'BAR'])
Name... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4318ae07-22d0-4eca-8f40-23cac789e62c | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 20,885 | supabase-export-v2 | cd3350f41cf4a6d1 | parser = argparse.ArgumentParser( prog='ProgramName', description='What the program does', epilog='Text at the bottom of help')
The :meth:`ArgumentParser.add_argument` method attaches individual argument
specifications to the parser. It supports positional arguments, options that
accept values, and on/off flags:: | trusted_official_docs | CPython Docs | parser = argparse.ArgumentParser( prog='ProgramName', description='What the program does', epilog='Text at the bottom of help')
The :meth:`ArgumentParser.add_argument` method attaches individual argument
specifications to the parser. It supports positional arguments, options that
accept values, and on/off flags:: | parser = argparse.ArgumentParser( prog='ProgramName', description='What the program does', epilog='Text at the bottom of help')
The :meth:`ArgumentParser.add_argument` method attaches individual argument
specifications to the parser. It supports positional arguments, options that
accept values, and on/off flags:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
432058bd-19f5-4c0e-8fb0-dce6a73b41f4 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,000 | supabase-export-v2 | e6624e1189f40ec5 | add_help ^^^^^^^^
By default, :class:`ArgumentParser` objects add 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. | trusted_official_docs | CPython Docs | add_help ^^^^^^^^
By default, :class:`ArgumentParser` objects add 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. | add_help ^^^^^^^^
By default, :class:`ArgumentParser` objects add 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4341a960-25f9-45b9-9b1d-5d90b2a11dbc | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,259 | supabase-export-v2 | 0cdcf5cdad06fbe1 | * *parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)
* action_ - the basic type of action to be taken when this argument is
encountered at the command line | trusted_official_docs | CPython Docs | * *parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)
* action_ - the basic type of action to be taken when this argument is
encountered at the command line | * *parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)
* action_ - the basic type of action to be taken when this argument is
encountered at the command line | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
459ceee8-2f97-47ea-b0fa-6336cccaa162 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,046 | supabase-export-v2 | 57f44dae7e33b7e8 | name or flags ^^^^^^^^^^^^^
The :meth:`~ArgumentParser.add_argument` method must know whether an optional
argument, like ``-f`` or ``--foo``, or a positional argument, like a list of
filenames, is expected. The first arguments passed to
:meth:`~ArgumentParser.add_argument` must therefore be either a series of
flags, or... | trusted_official_docs | CPython Docs | name or flags ^^^^^^^^^^^^^
The :meth:`~ArgumentParser.add_argument` method must know whether an optional
argument, like ``-f`` or ``--foo``, or a positional argument, like a list of
filenames, is expected. The first arguments passed to
:meth:`~ArgumentParser.add_argument` must therefore be either a series of
flags, or... | name or flags ^^^^^^^^^^^^^
The :meth:`~ArgumentParser.add_argument` method must know whether an optional
argument, like ``-f`` or ``--foo``, or a positional argument, like a list of
filenames, is expected. The first arguments passed to
:meth:`~ArgumentParser.add_argument` must therefore be either a series of
flags, or... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46c620de-9d29-48c8-ac42-b3bb11104ec1 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,117 | supabase-export-v2 | 62d55138324a4a6b | If the type_ keyword is used with the default_ keyword, the type converter is only applied if the default is a string.
The argument to ``type`` can be a callable that accepts a single string or
the name of a registered type (see :meth:`~ArgumentParser.register`)
If the function raises :exc:`ArgumentTypeError`, :exc:`Ty... | trusted_official_docs | CPython Docs | If the type_ keyword is used with the default_ keyword, the type converter is only applied if the default is a string.
The argument to ``type`` can be a callable that accepts a single string or
the name of a registered type (see :meth:`~ArgumentParser.register`)
If the function raises :exc:`ArgumentTypeError`, :exc:`Ty... | If the type_ keyword is used with the default_ keyword, the type converter is only applied if the default is a string.
The argument to ``type`` can be a callable that accepts a single string or
the name of a registered type (see :meth:`~ArgumentParser.register`)
If the function raises :exc:`ArgumentTypeError`, :exc:`Ty... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4713261b-70ee-4bf2-9368-64fe4dbfddfd | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,020 | supabase-export-v2 | f31ac93274028015 | >>> parser = argparse.ArgumentParser(description='Process some integers.', ... color=False) >>> parser.add_argument('--action', choices=['sum', 'max']) >>> parser.add_argument('integers', metavar='N', type=int, nargs='+', ... help='an integer for the accumulator') >>> parser.parse_args(['--help'])
Note that when ``colo... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser(description='Process some integers.', ... color=False) >>> parser.add_argument('--action', choices=['sum', 'max']) >>> parser.add_argument('integers', metavar='N', type=int, nargs='+', ... help='an integer for the accumulator') >>> parser.parse_args(['--help'])
Note that when ``colo... | >>> parser = argparse.ArgumentParser(description='Process some integers.', ... color=False) >>> parser.add_argument('--action', choices=['sum', 'max']) >>> parser.add_argument('integers', metavar='N', type=int, nargs='+', ... help='an integer for the accumulator') >>> parser.parse_args(['--help'])
Note that when ``colo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47dade9e-4358-4ebd-807c-930387d1e494 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,031 | supabase-export-v2 | 9d3f6158709b1c1a | Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
* `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'``
or ``'-f', '--foo'``. | trusted_official_docs | CPython Docs | Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
* `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'``
or ``'-f', '--foo'``. | Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
* `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'``
or ``'-f', '--foo'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
48116942-1467-48fc-8c35-c9fcf8d457ed | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,358 | supabase-export-v2 | 8b2f90fca237e400 | 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.
This method works similarly to :meth:`~ArgumentParser.parse_args`, but it does
not raise an error for extra, unrecognized... | trusted_official_docs | CPython Docs | 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.
This method works similarly to :meth:`~ArgumentParser.parse_args`, but it does
not raise an error for extra, unrecognized... | 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.
This method works similarly to :meth:`~ArgumentParser.parse_args`, but it does
not raise an error for extra, unrecognized... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
48a2232f-bb88-4bf5-a6d9-e12cc47af3e5 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,107 | supabase-export-v2 | 8f413b4049865c60 | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default=42) >>> parser.parse_args([], namespace=argparse.Namespace(foo=101)) Namespace(foo=101)
If the ``default`` value is a string, the parser parses the value as if it
were a command-line argument. In particular, the parser applies any type_
con... | trusted_official_docs | CPython Docs | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default=42) >>> parser.parse_args([], namespace=argparse.Namespace(foo=101)) Namespace(foo=101)
If the ``default`` value is a string, the parser parses the value as if it
were a command-line argument. In particular, the parser applies any type_
con... | >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo', default=42) >>> parser.parse_args([], namespace=argparse.Namespace(foo=101)) Namespace(foo=101)
If the ``default`` value is a string, the parser parses the value as if it
were a command-line argument. In particular, the parser applies any type_
con... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4ac3d5d8-0faf-4ddb-ae1a-346f89aef026 | CPython Docs | file://datasets/cpython/Doc/library/argparse.rst | unknown | 001a8019-557f-4048-beb6-3b9035272f92 | 21,181 | supabase-export-v2 | a85fbf4a0138631d | Action classes ^^^^^^^^^^^^^^
:class:`!Action` classes implement the Action API, a callable 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`. | trusted_official_docs | CPython Docs | Action classes ^^^^^^^^^^^^^^
:class:`!Action` classes implement the Action API, a callable 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`. | Action classes ^^^^^^^^^^^^^^
:class:`!Action` classes implement the Action API, a callable 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`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.