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
7a65094f-371c-4ddc-affe-a1ded25a08b3
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,126
supabase-export-v2
72a6a87be99b2a0e
messages take care always to mention the option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code. If :mod:`!optparse`'s default error-handling behaviour does not suit your needs, you'll need to subclass OptionParser and override its :meth:`~OptionParser.ex...
trusted_official_docs
CPython Docs
messages take care always to mention the option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code. If :mod:`!optparse`'s default error-handling behaviour does not suit your needs, you'll need to subclass OptionParser and override its :meth:`~OptionParser.ex...
messages take care always to mention the option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code. If :mod:`!optparse`'s default error-handling behaviour does not suit your needs, you'll need to subclass OptionParser and override its :meth:`~OptionParser.ex...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7a8924ed-7ca3-44f8-8f2d-6fe0b0258e73
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,988
supabase-export-v2
0c9fd48e53720d07
or ``--file``, and several option attributes that tell :mod:`!optparse` what to expect and what to do when it encounters that option on the command line. Typically, each option will have one short option string and one long option string, e.g.::
trusted_official_docs
CPython Docs
or ``--file``, and several option attributes that tell :mod:`!optparse` what to expect and what to do when it encounters that option on the command line. Typically, each option will have one short option string and one long option string, e.g.::
or ``--file``, and several option attributes that tell :mod:`!optparse` what to expect and what to do when it encounters that option on the command line. Typically, each option will have one short option string and one long option string, e.g.::
python, official-docs, cpython, P0
Local_Trusted_Corpus
7b3acce9-70f8-49f6-baa2-15e2bb97ed78
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,219
supabase-export-v2
5e00452fe388ff29
.. attribute:: Option.help Help text to print for this option when listing all available options after the user supplies a :attr:`~Option.help` option (such as ``--help``). If no help text is supplied, the option will be listed without help text. To hide this option, use the special value :const:`optparse.SUPPRESS_H...
trusted_official_docs
CPython Docs
.. attribute:: Option.help Help text to print for this option when listing all available options after the user supplies a :attr:`~Option.help` option (such as ``--help``). If no help text is supplied, the option will be listed without help text. To hide this option, use the special value :const:`optparse.SUPPRESS_H...
.. attribute:: Option.help Help text to print for this option when listing all available options after the user supplies a :attr:`~Option.help` option (such as ``--help``). If no help text is supplied, the option will be listed without help text. To hide this option, use the special value :const:`optparse.SUPPRESS_H...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7cf25773-fed3-4aff-a935-9ca4be724ec2
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,916
supabase-export-v2
50c935b8403cec95
compatibility reasons. However, it also serves a niche use case as a tool for prototyping and testing command line argument handling in ``getopt``-based C applications. :mod:`!optparse` should be considered as an alternative to :mod:`argparse` in the following cases:
trusted_official_docs
CPython Docs
compatibility reasons. However, it also serves a niche use case as a tool for prototyping and testing command line argument handling in ``getopt``-based C applications. :mod:`!optparse` should be considered as an alternative to :mod:`argparse` in the following cases:
compatibility reasons. However, it also serves a niche use case as a tool for prototyping and testing command line argument handling in ``getopt``-based C applications. :mod:`!optparse` should be considered as an alternative to :mod:`argparse` in the following cases:
python, official-docs, cpython, P0
Local_Trusted_Corpus
7d127151-f292-4866-bfd2-21e0d5f1bd02
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,951
supabase-export-v2
fcaab70983eafbde
or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` (``sys.argv[0]`` is the name of the program being executed). Unix shells also use the term "word". It is occasionally desirable to substitute an argument list other than ``sys.argv[1:]``, so you should read "argument" as "an element of ``sys.argv[1...
trusted_official_docs
CPython Docs
or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` (``sys.argv[0]`` is the name of the program being executed). Unix shells also use the term "word". It is occasionally desirable to substitute an argument list other than ``sys.argv[1:]``, so you should read "argument" as "an element of ``sys.argv[1...
or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` (``sys.argv[0]`` is the name of the program being executed). Unix shells also use the term "word". It is occasionally desirable to substitute an argument list other than ``sys.argv[1:]``, so you should read "argument" as "an element of ``sys.argv[1...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7d412598-6da8-4a26-b265-03cee35122a7
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,297
supabase-export-v2
0f1f7181f66e5e95
* otherwise, the number is parsed as a decimal number The conversion is done by calling :func:`int` with the appropriate base (2, 8, 10, or 16). If this fails, so will :mod:`!optparse`, although with a more useful error message.
trusted_official_docs
CPython Docs
* otherwise, the number is parsed as a decimal number The conversion is done by calling :func:`int` with the appropriate base (2, 8, 10, or 16). If this fails, so will :mod:`!optparse`, although with a more useful error message.
* otherwise, the number is parsed as a decimal number The conversion is done by calling :func:`int` with the appropriate base (2, 8, 10, or 16). If this fails, so will :mod:`!optparse`, although with a more useful error message.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7f3541b9-b01a-4282-9e3f-cd0da38efd88
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,384
supabase-export-v2
6693b72d3640f06f
1, :mod:`!optparse` will consume :attr:`~Option.nargs` arguments, each of which must be convertible to :attr:`~Option.type`. It then passes a tuple of converted values to your callback. :attr:`~Option.callback_args` a tuple of extra positional arguments to pass to the callback
trusted_official_docs
CPython Docs
1, :mod:`!optparse` will consume :attr:`~Option.nargs` arguments, each of which must be convertible to :attr:`~Option.type`. It then passes a tuple of converted values to your callback. :attr:`~Option.callback_args` a tuple of extra positional arguments to pass to the callback
1, :mod:`!optparse` will consume :attr:`~Option.nargs` arguments, each of which must be convertible to :attr:`~Option.type`. It then passes a tuple of converted values to your callback. :attr:`~Option.callback_args` a tuple of extra positional arguments to pass to the callback
python, official-docs, cpython, P0
Local_Trusted_Corpus
80c8d202-1708-489a-8ecc-821b47ccb670
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,312
supabase-export-v2
0b69daadf3704674
supply ``values``, it will be modified with repeated :func:`setattr` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`~OptionParser.parse_args`. If :meth:`~OptionParser.parse_args` encounters any errors in the argument list, it calls the OptionParser's :meth:`error` m...
trusted_official_docs
CPython Docs
supply ``values``, it will be modified with repeated :func:`setattr` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`~OptionParser.parse_args`. If :meth:`~OptionParser.parse_args` encounters any errors in the argument list, it calls the OptionParser's :meth:`error` m...
supply ``values``, it will be modified with repeated :func:`setattr` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`~OptionParser.parse_args`. If :meth:`~OptionParser.parse_args` encounters any errors in the argument list, it calls the OptionParser's :meth:`error` m...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8376ff29-985d-4985-9b96-91ee559e6a75
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,116
supabase-export-v2
2be51f95f02fdc78
(options, args) = parser.parse_args() ... if options.a and options.b: parser.error("options -a and -b are mutually exclusive") In either case, :mod:`!optparse` handles the error the same way: it prints the program's usage message and an error message to standard error and exits with error status 2.
trusted_official_docs
CPython Docs
(options, args) = parser.parse_args() ... if options.a and options.b: parser.error("options -a and -b are mutually exclusive") In either case, :mod:`!optparse` handles the error the same way: it prints the program's usage message and an error message to standard error and exits with error status 2.
(options, args) = parser.parse_args() ... if options.a and options.b: parser.error("options -a and -b are mutually exclusive") In either case, :mod:`!optparse` handles the error the same way: it prints the program's usage message and an error message to standard error and exits with error status 2.
python, official-docs, cpython, P0
Local_Trusted_Corpus
86538a76-c9d5-412e-8150-493e8f9e5def
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,139
supabase-export-v2
616fb339b5e39e97
of optional keyword arguments. You should always pass them as keyword arguments, i.e. do not rely on the order in which the arguments are declared. ``usage`` (default: ``"%prog [options]"``) The usage summary to print when your program is run incorrectly or with a help option. When :mod:`!optparse` prints the usage s...
trusted_official_docs
CPython Docs
of optional keyword arguments. You should always pass them as keyword arguments, i.e. do not rely on the order in which the arguments are declared. ``usage`` (default: ``"%prog [options]"``) The usage summary to print when your program is run incorrectly or with a help option. When :mod:`!optparse` prints the usage s...
of optional keyword arguments. You should always pass them as keyword arguments, i.e. do not rely on the order in which the arguments are declared. ``usage`` (default: ``"%prog [options]"``) The usage summary to print when your program is run incorrectly or with a help option. When :mod:`!optparse` prints the usage s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
87007daf-f08a-4f68-9134-c2876bbadf07
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,352
supabase-export-v2
b4609374e375fd45
Cleanup ^^^^^^^ OptionParser instances have several cyclic references. This should not be a problem for Python's garbage collector, but you may wish to break the cyclic references explicitly by calling :meth:`~OptionParser.destroy` on your OptionParser once you are done with it. This is particularly useful in long-runn...
trusted_official_docs
CPython Docs
Cleanup ^^^^^^^ OptionParser instances have several cyclic references. This should not be a problem for Python's garbage collector, but you may wish to break the cyclic references explicitly by calling :meth:`~OptionParser.destroy` on your OptionParser once you are done with it. This is particularly useful in long-runn...
Cleanup ^^^^^^^ OptionParser instances have several cyclic references. This should not be a problem for Python's garbage collector, but you may wish to break the cyclic references explicitly by calling :meth:`~OptionParser.destroy` on your OptionParser once you are done with it. This is particularly useful in long-runn...
python, official-docs, cpython, P0
Local_Trusted_Corpus
87d5c106-fccc-48e8-98af-d7f98b460b9e
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,991
supabase-export-v2
474bd58ae3fb9166
short option strings and as many long option strings as you like (including zero), as long as there is at least one option string overall. The option strings passed to :meth:`OptionParser.add_option` are effectively labels for the option defined by that call. For brevity, we will frequently refer to *encountering an op...
trusted_official_docs
CPython Docs
short option strings and as many long option strings as you like (including zero), as long as there is at least one option string overall. The option strings passed to :meth:`OptionParser.add_option` are effectively labels for the option defined by that call. For brevity, we will frequently refer to *encountering an op...
short option strings and as many long option strings as you like (including zero), as long as there is at least one option string overall. The option strings passed to :meth:`OptionParser.add_option` are effectively labels for the option defined by that call. For brevity, we will frequently refer to *encountering an op...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8889be5d-0a5b-4a34-9bdf-65a493754805
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,954
supabase-export-v2
4c8ed7155a2f1eb4
Some other option syntaxes that the world has seen include: * a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as multiple options merged into a single argument)
trusted_official_docs
CPython Docs
Some other option syntaxes that the world has seen include: * a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as multiple options merged into a single argument)
Some other option syntaxes that the world has seen include: * a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as multiple options merged into a single argument)
python, official-docs, cpython, P0
Local_Trusted_Corpus
88e3c489-3193-41b2-82d7-b8a0b784acfd
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,311
supabase-export-v2
6cf476a7a5f11fa4
``args`` the leftover positional arguments after all options have been processed The most common usage is to supply neither keyword argument. If you supply ``values``, it will be modified with repeated :func:`setattr` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`~...
trusted_official_docs
CPython Docs
``args`` the leftover positional arguments after all options have been processed The most common usage is to supply neither keyword argument. If you supply ``values``, it will be modified with repeated :func:`setattr` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`~...
``args`` the leftover positional arguments after all options have been processed The most common usage is to supply neither keyword argument. If you supply ``values``, it will be modified with repeated :func:`setattr` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`~...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8bbd06b9-29d6-4196-b4b9-bbca17350e32
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,039
supabase-export-v2
ddcc2259c9c7cd7b
First, consider the verbose/quiet example. If we want :mod:`!optparse` to set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this:: parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose")
trusted_official_docs
CPython Docs
First, consider the verbose/quiet example. If we want :mod:`!optparse` to set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this:: parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose")
First, consider the verbose/quiet example. If we want :mod:`!optparse` to set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this:: parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose")
python, official-docs, cpython, P0
Local_Trusted_Corpus
8c5be2e2-e0a1-4124-befb-735c05070051
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,044
supabase-export-v2
f72174046f897304
parser.add_option("-v", action="store_true", dest="verbose", default=False) parser.add_option("-q", action="store_false", dest="verbose", default=True) Again, the default value for ``verbose`` will be ``True``: the last default value supplied for any particular destination is the one that counts.
trusted_official_docs
CPython Docs
parser.add_option("-v", action="store_true", dest="verbose", default=False) parser.add_option("-q", action="store_false", dest="verbose", default=True) Again, the default value for ``verbose`` will be ``True``: the last default value supplied for any particular destination is the one that counts.
parser.add_option("-v", action="store_true", dest="verbose", default=False) parser.add_option("-q", action="store_false", dest="verbose", default=True) Again, the default value for ``verbose`` will be ``True``: the last default value supplied for any particular destination is the one that counts.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8c5de455-17b1-47c8-80f4-d932b2c5f9a2
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,914
supabase-export-v2
3b0ad83383fca60b
expense of reduced application flexibility in controlling exactly how arguments are processed. Included in the standard library since the Python 2.7 and Python 3.2 releases. In the absence of more specific argument parsing design constraints, :mod:`argparse` is the recommended choice for implementing command line appli...
trusted_official_docs
CPython Docs
expense of reduced application flexibility in controlling exactly how arguments are processed. Included in the standard library since the Python 2.7 and Python 3.2 releases. In the absence of more specific argument parsing design constraints, :mod:`argparse` is the recommended choice for implementing command line appli...
expense of reduced application flexibility in controlling exactly how arguments are processed. Included in the standard library since the Python 2.7 and Python 3.2 releases. In the absence of more specific argument parsing design constraints, :mod:`argparse` is the recommended choice for implementing command line appli...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8cba1037-74a8-473e-8bac-f53f3a327c93
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,205
supabase-export-v2
d674b6adfc38ba7f
(default: derived from option strings) If the option's action implies writing or modifying a value somewhere, this tells :mod:`!optparse` where to write it: :attr:`~Option.dest` names an attribute of the ``options`` object that :mod:`!optparse` builds as it parses the command line.
trusted_official_docs
CPython Docs
(default: derived from option strings) If the option's action implies writing or modifying a value somewhere, this tells :mod:`!optparse` where to write it: :attr:`~Option.dest` names an attribute of the ``options`` object that :mod:`!optparse` builds as it parses the command line.
(default: derived from option strings) If the option's action implies writing or modifying a value somewhere, this tells :mod:`!optparse` where to write it: :attr:`~Option.dest` names an attribute of the ``options`` object that :mod:`!optparse` builds as it parses the command line.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8d5fe8ba-8a24-439b-a315-54cb134ef192
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,347
supabase-export-v2
8c0dd7751c1120ef
Options: --dry-run do no harm ... -n, --noisy be noisy It's possible to whittle away the option strings for a previously added option until there are none left, and the user has no way of invoking that option from the command-line. In that case, :mod:`!optparse` removes that option completely, so it doesn't show up in ...
trusted_official_docs
CPython Docs
Options: --dry-run do no harm ... -n, --noisy be noisy It's possible to whittle away the option strings for a previously added option until there are none left, and the user has no way of invoking that option from the command-line. In that case, :mod:`!optparse` removes that option completely, so it doesn't show up in ...
Options: --dry-run do no harm ... -n, --noisy be noisy It's possible to whittle away the option strings for a previously added option until there are none left, and the user has no way of invoking that option from the command-line. In that case, :mod:`!optparse` removes that option completely, so it doesn't show up in ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8e41a2e7-d046-4bcf-943d-8a6b157dd67b
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,050
supabase-export-v2
5f53de038a9389e9
Generating help ^^^^^^^^^^^^^^^ :mod:`!optparse`'s ability to generate help and usage text automatically is useful for creating user-friendly command-line interfaces. All you have to do is supply a :attr:`~Option.help` value for each option, and optionally a short usage message for your whole program. Here's an OptionP...
trusted_official_docs
CPython Docs
Generating help ^^^^^^^^^^^^^^^ :mod:`!optparse`'s ability to generate help and usage text automatically is useful for creating user-friendly command-line interfaces. All you have to do is supply a :attr:`~Option.help` value for each option, and optionally a short usage message for your whole program. Here's an OptionP...
Generating help ^^^^^^^^^^^^^^^ :mod:`!optparse`'s ability to generate help and usage text automatically is useful for creating user-friendly command-line interfaces. All you have to do is supply a :attr:`~Option.help` value for each option, and optionally a short usage message for your whole program. Here's an OptionP...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8f29d7a2-24ce-4ae6-8b21-745b82c42752
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,307
supabase-export-v2
6f3db9f4cb060c54
``args`` the list of arguments to process (default: ``sys.argv[1:]``) ``values`` a :class:`Values` object to store option arguments in (default: a new instance of :class:`Values`) -- if you give an existing object, the option defaults will not be initialized on it
trusted_official_docs
CPython Docs
``args`` the list of arguments to process (default: ``sys.argv[1:]``) ``values`` a :class:`Values` object to store option arguments in (default: a new instance of :class:`Values`) -- if you give an existing object, the option defaults will not be initialized on it
``args`` the list of arguments to process (default: ``sys.argv[1:]``) ``values`` a :class:`Values` object to store option arguments in (default: a new instance of :class:`Values`) -- if you give an existing object, the option defaults will not be initialized on it
python, official-docs, cpython, P0
Local_Trusted_Corpus
9459bbfa-bf45-4f80-a0d3-db8c9e52d5f7
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,086
supabase-export-v2
09cd4f35e480c133
A bit more complete example might involve using more than one group: still extending the previous example:: group = OptionGroup(parser, "Dangerous Options", "Caution: use these options at your own risk. " "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.") par...
trusted_official_docs
CPython Docs
A bit more complete example might involve using more than one group: still extending the previous example:: group = OptionGroup(parser, "Dangerous Options", "Caution: use these options at your own risk. " "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.") par...
A bit more complete example might involve using more than one group: still extending the previous example:: group = OptionGroup(parser, "Dangerous Options", "Caution: use these options at your own risk. " "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.") par...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9512e55d-5250-4b57-b3fe-4b3312d25c10
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,155
supabase-export-v2
24976254c02111cf
The other alternative is to pass a list of pre-constructed Option instances to the OptionParser constructor, as in:: option_list = [ make_option("-f", "--filename", action="store", type="string", dest="filename"), make_option("-q", "--quiet", action="store_false", dest="verbose"), ] parser = OptionParser(option_l...
trusted_official_docs
CPython Docs
The other alternative is to pass a list of pre-constructed Option instances to the OptionParser constructor, as in:: option_list = [ make_option("-f", "--filename", action="store", type="string", dest="filename"), make_option("-q", "--quiet", action="store_false", dest="verbose"), ] parser = OptionParser(option_l...
The other alternative is to pass a list of pre-constructed Option instances to the OptionParser constructor, as in:: option_list = [ make_option("-f", "--filename", action="store", type="string", dest="filename"), make_option("-q", "--quiet", action="store_false", dest="verbose"), ] parser = OptionParser(option_l...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9680be0e-edd9-4632-9417-3413a1b78c9e
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,465
supabase-export-v2
8a3a27331b92a7a2
and pass it to OptionParser; if you don't use :meth:`add_option` in the above way, you don't need to tell OptionParser which option class to use:: option_list = [MyOption("-c", action="store", type="complex", dest="c")] parser = OptionParser(option_list=option_list)
trusted_official_docs
CPython Docs
and pass it to OptionParser; if you don't use :meth:`add_option` in the above way, you don't need to tell OptionParser which option class to use:: option_list = [MyOption("-c", action="store", type="complex", dest="c")] parser = OptionParser(option_list=option_list)
and pass it to OptionParser; if you don't use :meth:`add_option` in the above way, you don't need to tell OptionParser which option class to use:: option_list = [MyOption("-c", action="store", type="complex", dest="c")] parser = OptionParser(option_list=option_list)
python, official-docs, cpython, P0
Local_Trusted_Corpus
982ab6d3-0526-41b8-aa25-8658717c4332
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,392
supabase-export-v2
d11309a4fd195687
``option`` is the Option instance that's calling the callback ``opt_str`` is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, ``opt_str`` will be the full, canonical option string---e.g. if the user puts ``--foo`` on the command-line as an abbreviati...
trusted_official_docs
CPython Docs
``option`` is the Option instance that's calling the callback ``opt_str`` is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, ``opt_str`` will be the full, canonical option string---e.g. if the user puts ``--foo`` on the command-line as an abbreviati...
``option`` is the Option instance that's calling the callback ``opt_str`` is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, ``opt_str`` will be the full, canonical option string---e.g. if the user puts ``--foo`` on the command-line as an abbreviati...
python, official-docs, cpython, P0
Local_Trusted_Corpus
98f3bc63-fff2-466e-89a4-88a0280a2aac
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,051
supabase-export-v2
eb64734dc9334f6f
supply a :attr:`~Option.help` value for each option, and optionally a short usage message for your whole program. Here's an OptionParser populated with user-friendly (documented) options:: usage = "usage: %prog [options] arg1 arg2" parser = OptionParser(usage=usage) parser.add_option("-v", "--verbose", action="store...
trusted_official_docs
CPython Docs
supply a :attr:`~Option.help` value for each option, and optionally a short usage message for your whole program. Here's an OptionParser populated with user-friendly (documented) options:: usage = "usage: %prog [options] arg1 arg2" parser = OptionParser(usage=usage) parser.add_option("-v", "--verbose", action="store...
supply a :attr:`~Option.help` value for each option, and optionally a short usage message for your whole program. Here's an OptionParser populated with user-friendly (documented) options:: usage = "usage: %prog [options] arg1 arg2" parser = OptionParser(usage=usage) parser.add_option("-v", "--verbose", action="store...
python, official-docs, cpython, P0
Local_Trusted_Corpus
99201ad2-9df3-41e3-8d3a-e8754736d049
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,996
supabase-export-v2
97e546f78efad5a4
:meth:`~OptionParser.parse_args` returns two values: * ``options``, an object containing values for all of your options---e.g. if ``--file`` takes a single string argument, then ``options.file`` will be the filename supplied by the user, or ``None`` if the user did not supply that option
trusted_official_docs
CPython Docs
:meth:`~OptionParser.parse_args` returns two values: * ``options``, an object containing values for all of your options---e.g. if ``--file`` takes a single string argument, then ``options.file`` will be the filename supplied by the user, or ``None`` if the user did not supply that option
:meth:`~OptionParser.parse_args` returns two values: * ``options``, an object containing values for all of your options---e.g. if ``--file`` takes a single string argument, then ``options.file`` will be the filename supplied by the user, or ``None`` if the user did not supply that option
python, official-docs, cpython, P0
Local_Trusted_Corpus
9a6e62ea-aa48-4e70-81b8-3458c30926d8
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,322
supabase-export-v2
e6a476c979bde3bc
To disable this feature, call :meth:`disable_interspersed_args`. This restores traditional Unix syntax, where option parsing stops with the first non-option argument. Use this if you have a command processor which runs another command which has options of its own and you want to make sure these options don't get conf...
trusted_official_docs
CPython Docs
To disable this feature, call :meth:`disable_interspersed_args`. This restores traditional Unix syntax, where option parsing stops with the first non-option argument. Use this if you have a command processor which runs another command which has options of its own and you want to make sure these options don't get conf...
To disable this feature, call :meth:`disable_interspersed_args`. This restores traditional Unix syntax, where option parsing stops with the first non-option argument. Use this if you have a command processor which runs another command which has options of its own and you want to make sure these options don't get conf...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9bc9b6d9-1c10-45d3-8ff5-5fee8f7d4970
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,427
supabase-export-v2
5e6174c9fc34538e
def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) ... parser.add_option("--foo", action="callback", callback=store_value, type="int", nargs=3, dest="foo") Note that :mod:`!optparse` takes care of consuming 3 arguments and converting them to integers for you; all you have to do ...
trusted_official_docs
CPython Docs
def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) ... parser.add_option("--foo", action="callback", callback=store_value, type="int", nargs=3, dest="foo") Note that :mod:`!optparse` takes care of consuming 3 arguments and converting them to integers for you; all you have to do ...
def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) ... parser.add_option("--foo", action="callback", callback=store_value, type="int", nargs=3, dest="foo") Note that :mod:`!optparse` takes care of consuming 3 arguments and converting them to integers for you; all you have to do ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9d144d68-a250-4451-96da-b707e5a91209
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,078
supabase-export-v2
3e49ac5a2bbd0a55
Continuing with the parser defined in the previous section, adding an :class:`OptionGroup` to a parser is easy:: group = OptionGroup(parser, "Dangerous Options", "Caution: use these options at your own risk. " "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.")...
trusted_official_docs
CPython Docs
Continuing with the parser defined in the previous section, adding an :class:`OptionGroup` to a parser is easy:: group = OptionGroup(parser, "Dangerous Options", "Caution: use these options at your own risk. " "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.")...
Continuing with the parser defined in the previous section, adding an :class:`OptionGroup` to a parser is easy:: group = OptionGroup(parser, "Dangerous Options", "Caution: use these options at your own risk. " "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.")...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9da84404-1f49-4563-af1c-b481c25c9c2e
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,434
supabase-export-v2
0629d955511151a4
* bare ``-`` (if not the argument to some option): halt command-line processing but keep the ``-`` (append it to ``parser.largs``) If you want an option that takes a variable number of arguments, there are several subtle, tricky issues to worry about. The exact implementation you choose will be based on which trade-off...
trusted_official_docs
CPython Docs
* bare ``-`` (if not the argument to some option): halt command-line processing but keep the ``-`` (append it to ``parser.largs``) If you want an option that takes a variable number of arguments, there are several subtle, tricky issues to worry about. The exact implementation you choose will be based on which trade-off...
* bare ``-`` (if not the argument to some option): halt command-line processing but keep the ``-`` (append it to ``parser.largs``) If you want an option that takes a variable number of arguments, there are several subtle, tricky issues to worry about. The exact implementation you choose will be based on which trade-off...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9f2ef32a-23ae-4fa9-8982-50633a670d7e
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,146
supabase-export-v2
6e9e52b1ee035fb1
new :class:`IndentedHelpFormatter`) An instance of optparse.HelpFormatter that will be used for printing help text. :mod:`!optparse` provides two concrete classes for this purpose: IndentedHelpFormatter and TitledHelpFormatter. ``add_help_option`` (default: ``True``) If true, :mod:`!optparse` will add a help option (w...
trusted_official_docs
CPython Docs
new :class:`IndentedHelpFormatter`) An instance of optparse.HelpFormatter that will be used for printing help text. :mod:`!optparse` provides two concrete classes for this purpose: IndentedHelpFormatter and TitledHelpFormatter. ``add_help_option`` (default: ``True``) If true, :mod:`!optparse` will add a help option (w...
new :class:`IndentedHelpFormatter`) An instance of optparse.HelpFormatter that will be used for printing help text. :mod:`!optparse` provides two concrete classes for this purpose: IndentedHelpFormatter and TitledHelpFormatter. ``add_help_option`` (default: ``True``) If true, :mod:`!optparse` will add a help option (w...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a0a2a559-05dd-485e-96ed-42f740c6f5bb
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,025
supabase-export-v2
5a4d963a6b0f0332
parser.add_option("-v", action="store_true", dest="verbose") parser.add_option("-q", action="store_false", dest="verbose") Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting default values---see below.)
trusted_official_docs
CPython Docs
parser.add_option("-v", action="store_true", dest="verbose") parser.add_option("-q", action="store_false", dest="verbose") Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting default values---see below.)
parser.add_option("-v", action="store_true", dest="verbose") parser.add_option("-q", action="store_false", dest="verbose") Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting default values---see below.)
python, official-docs, cpython, P0
Local_Trusted_Corpus
a0da9cfa-8661-4571-ae09-ad940687c26f
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,972
supabase-export-v2
d8f1ac969c7245c4
main exceptions are ``find``, ``tar``, and ``dd``\ ---all of which are mutant oddballs that have been rightly criticized for their non-standard syntax and confusing interfaces.) Lots of people want their programs to have "required options". Think about it. If it's required, then it's *not optional*! If there is a piece...
trusted_official_docs
CPython Docs
main exceptions are ``find``, ``tar``, and ``dd``\ ---all of which are mutant oddballs that have been rightly criticized for their non-standard syntax and confusing interfaces.) Lots of people want their programs to have "required options". Think about it. If it's required, then it's *not optional*! If there is a piece...
main exceptions are ``find``, ``tar``, and ``dd``\ ---all of which are mutant oddballs that have been rightly criticized for their non-standard syntax and confusing interfaces.) Lots of people want their programs to have "required options". Think about it. If it's required, then it's *not optional*! If there is a piece...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a0dc8a13-11c0-4e0e-b16c-8c9eb1059149
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,103
supabase-export-v2
a96ea3ffec3051eb
your parser. If it encounters this option on the command line, it expands your ``version`` string (by replacing ``%prog``), prints it to stdout, and exits. For example, if your script is called ``/usr/bin/foo``:
trusted_official_docs
CPython Docs
your parser. If it encounters this option on the command line, it expands your ``version`` string (by replacing ``%prog``), prints it to stdout, and exits. For example, if your script is called ``/usr/bin/foo``:
your parser. If it encounters this option on the command line, it expands your ``version`` string (by replacing ``%prog``), prints it to stdout, and exits. For example, if your script is called ``/usr/bin/foo``:
python, official-docs, cpython, P0
Local_Trusted_Corpus
a2256dcb-61f4-4e65-8541-884a027a99d3
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,114
supabase-export-v2
f54ad1fe4c9457ec
attributes, missing option attributes, etc. These are dealt with in the usual way: raise an exception (either :exc:`optparse.OptionError` or :exc:`TypeError`) and let the program crash. Handling user errors is much more important, since they are guaranteed to happen no matter how stable your code is. :mod:`!optparse` c...
trusted_official_docs
CPython Docs
attributes, missing option attributes, etc. These are dealt with in the usual way: raise an exception (either :exc:`optparse.OptionError` or :exc:`TypeError`) and let the program crash. Handling user errors is much more important, since they are guaranteed to happen no matter how stable your code is. :mod:`!optparse` c...
attributes, missing option attributes, etc. These are dealt with in the usual way: raise an exception (either :exc:`optparse.OptionError` or :exc:`TypeError`) and let the program crash. Handling user errors is much more important, since they are guaranteed to happen no matter how stable your code is. :mod:`!optparse` c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a38e5ac3-e800-41fa-8610-24dc6a9c8bd3
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,125
supabase-export-v2
2861986760ff1c3a
foo: error: -n option requires an argument :mod:`!optparse`\ -generated error messages take care always to mention the option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code.
trusted_official_docs
CPython Docs
foo: error: -n option requires an argument :mod:`!optparse`\ -generated error messages take care always to mention the option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code.
foo: error: -n option requires an argument :mod:`!optparse`\ -generated error messages take care always to mention the option involved in the error; be sure to do the same when calling :func:`OptionParser.error` from your application code.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a5c94ed9-d726-4db6-8ebf-970c2574f996
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,430
supabase-export-v2
3821ec12d0e34265
Callback example 6: variable arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Things get hairy when you want an option to take a variable number of arguments. For this case, you must write a callback, as :mod:`!optparse` doesn't provide any built-in capabilities for it. And you have to deal with certain intricacies of ...
trusted_official_docs
CPython Docs
Callback example 6: variable arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Things get hairy when you want an option to take a variable number of arguments. For this case, you must write a callback, as :mod:`!optparse` doesn't provide any built-in capabilities for it. And you have to deal with certain intricacies of ...
Callback example 6: variable arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Things get hairy when you want an option to take a variable number of arguments. For this case, you must write a callback, as :mod:`!optparse` doesn't provide any built-in capabilities for it. And you have to deal with certain intricacies of ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7147558-7914-4e7f-ab07-992820837a82
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,370
supabase-export-v2
ba6186a698910b89
a callback option. Extending :mod:`!optparse` is more general, but overkill for a lot of simple cases. Quite often a simple callback is all you need. There are two steps to defining a callback option:
trusted_official_docs
CPython Docs
a callback option. Extending :mod:`!optparse` is more general, but overkill for a lot of simple cases. Quite often a simple callback is all you need. There are two steps to defining a callback option:
a callback option. Extending :mod:`!optparse` is more general, but overkill for a lot of simple cases. Quite often a simple callback is all you need. There are two steps to defining a callback option:
python, official-docs, cpython, P0
Local_Trusted_Corpus
a78cffcb-3d10-46ba-827e-b4685320e32c
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,144
supabase-export-v2
9ff405a1cc10f63c
``conflict_handler`` (default: ``"error"``) Specifies what to do when options with conflicting option strings are added to the parser; see section :ref:`optparse-conflicts-between-options`. ``description`` (default: ``None``) A paragraph of text giving a brief overview of your program. :mod:`!optparse` reformats this ...
trusted_official_docs
CPython Docs
``conflict_handler`` (default: ``"error"``) Specifies what to do when options with conflicting option strings are added to the parser; see section :ref:`optparse-conflicts-between-options`. ``description`` (default: ``None``) A paragraph of text giving a brief overview of your program. :mod:`!optparse` reformats this ...
``conflict_handler`` (default: ``"error"``) Specifies what to do when options with conflicting option strings are added to the parser; see section :ref:`optparse-conflicts-between-options`. ``description`` (default: ``None``) A paragraph of text giving a brief overview of your program. :mod:`!optparse` reformats this ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7ff0fb2-6c4e-4e4c-b79d-c70334fd0982
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,983
supabase-export-v2
d66aef73f3f47c05
flexible and powerful, it's also straightforward to use in most cases. This section covers the code patterns that are common to any :mod:`!optparse`\ -based program. First, you need to import the OptionParser class; then, early in the main program, create an OptionParser instance::
trusted_official_docs
CPython Docs
flexible and powerful, it's also straightforward to use in most cases. This section covers the code patterns that are common to any :mod:`!optparse`\ -based program. First, you need to import the OptionParser class; then, early in the main program, create an OptionParser instance::
flexible and powerful, it's also straightforward to use in most cases. This section covers the code patterns that are common to any :mod:`!optparse`\ -based program. First, you need to import the OptionParser class; then, early in the main program, create an OptionParser instance::
python, official-docs, cpython, P0
Local_Trusted_Corpus
a82ac16c-ada9-4ac4-a6bb-2b694b349681
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,228
supabase-export-v2
b01432fb39073f3c
will be consumed from the command line; all will be converted according to :attr:`~Option.type` and stored to :attr:`~Option.dest` as a tuple. See the :ref:`optparse-standard-option-types` section. If :attr:`~Option.choices` is supplied (a list or tuple of strings), the type defaults to ``"choice"``.
trusted_official_docs
CPython Docs
will be consumed from the command line; all will be converted according to :attr:`~Option.type` and stored to :attr:`~Option.dest` as a tuple. See the :ref:`optparse-standard-option-types` section. If :attr:`~Option.choices` is supplied (a list or tuple of strings), the type defaults to ``"choice"``.
will be consumed from the command line; all will be converted according to :attr:`~Option.type` and stored to :attr:`~Option.dest` as a tuple. See the :ref:`optparse-standard-option-types` section. If :attr:`~Option.choices` is supplied (a list or tuple of strings), the type defaults to ``"choice"``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a846046c-10ef-4328-9bf5-de61bb0e206f
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,443
supabase-export-v2
091c570d78f2fb2c
Extending :mod:`!optparse` -------------------------- Since the two major controlling factors in how :mod:`!optparse` interprets command-line options are the action and type of each option, the most likely direction of extension is to add new actions and new types.
trusted_official_docs
CPython Docs
Extending :mod:`!optparse` -------------------------- Since the two major controlling factors in how :mod:`!optparse` interprets command-line options are the action and type of each option, the most likely direction of extension is to add new actions and new types.
Extending :mod:`!optparse` -------------------------- Since the two major controlling factors in how :mod:`!optparse` interprets command-line options are the action and type of each option, the most likely direction of extension is to add new actions and new types.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9f8b0fe-11e8-4318-9bef-75f9935914f1
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,299
supabase-export-v2
e5149cc8f60097b9
``"float"`` and ``"complex"`` option arguments are converted directly with :func:`float` and :func:`complex`, with similar error-handling. ``"choice"`` options are a subtype of ``"string"`` options. The :attr:`~Option.choices` option attribute (a sequence of strings) defines the set of allowed option arguments. :func:`...
trusted_official_docs
CPython Docs
``"float"`` and ``"complex"`` option arguments are converted directly with :func:`float` and :func:`complex`, with similar error-handling. ``"choice"`` options are a subtype of ``"string"`` options. The :attr:`~Option.choices` option attribute (a sequence of strings) defines the set of allowed option arguments. :func:`...
``"float"`` and ``"complex"`` option arguments are converted directly with :func:`float` and :func:`complex`, with similar error-handling. ``"choice"`` options are a subtype of ``"string"`` options. The :attr:`~Option.choices` option attribute (a sequence of strings) defines the set of allowed option arguments. :func:`...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ac5dd22f-0091-42f2-be3b-fbb3c93d1e96
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,160
supabase-export-v2
9b1d1ac03063ae73
e.g. ``-f`` and ``--file``. You can specify any number of short or long option strings, but you must specify at least one overall option string. The canonical way to create an :class:`Option` instance is with the :meth:`add_option` method of :class:`OptionParser`.
trusted_official_docs
CPython Docs
e.g. ``-f`` and ``--file``. You can specify any number of short or long option strings, but you must specify at least one overall option string. The canonical way to create an :class:`Option` instance is with the :meth:`add_option` method of :class:`OptionParser`.
e.g. ``-f`` and ``--file``. You can specify any number of short or long option strings, but you must specify at least one overall option string. The canonical way to create an :class:`Option` instance is with the :meth:`add_option` method of :class:`OptionParser`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ac7617b7-1098-404a-abee-da06648afbee
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,261
supabase-export-v2
9422ee6fe43ad434
* ``"append_const"`` [required: :attr:`~Option.const`; relevant: :attr:`~Option.dest`] Like ``"store_const"``, but the value :attr:`~Option.const` is appended to :attr:`~Option.dest`; as with ``"append"``, :attr:`~Option.dest` defaults to ``None``, and an empty list is automatically created the first time the option ...
trusted_official_docs
CPython Docs
* ``"append_const"`` [required: :attr:`~Option.const`; relevant: :attr:`~Option.dest`] Like ``"store_const"``, but the value :attr:`~Option.const` is appended to :attr:`~Option.dest`; as with ``"append"``, :attr:`~Option.dest` defaults to ``None``, and an empty list is automatically created the first time the option ...
* ``"append_const"`` [required: :attr:`~Option.const`; relevant: :attr:`~Option.dest`] Like ``"store_const"``, but the value :attr:`~Option.const` is appended to :attr:`~Option.dest`; as with ``"append"``, :attr:`~Option.dest` defaults to ``None``, and an empty list is automatically created the first time the option ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
acabf1b6-822c-44d5-85a4-de9c8934db3b
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,415
supabase-export-v2
cf19c6226ad42687
Callback example 3: check option order (generalized) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to reuse this callback for several similar options (set a flag, but blow up if ``-b`` has already been seen), it needs a bit of work: the error message and the flag that it sets must be generalized. ::
trusted_official_docs
CPython Docs
Callback example 3: check option order (generalized) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to reuse this callback for several similar options (set a flag, but blow up if ``-b`` has already been seen), it needs a bit of work: the error message and the flag that it sets must be generalized. ::
Callback example 3: check option order (generalized) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to reuse this callback for several similar options (set a flag, but blow up if ``-b`` has already been seen), it needs a bit of work: the error message and the flag that it sets must be generalized. ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b0079ccb-ac42-4376-88b4-3b45c94be825
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,014
supabase-export-v2
520dc1b3c5488db0
Note that this option has no long option string, which is perfectly acceptable. Also, there's no explicit action, since the default is ``store``. Let's parse another fake command-line. This time, we'll jam the option argument right up against the option: since ``-n42`` (one argument) is equivalent to ``-n 42`` (two arg...
trusted_official_docs
CPython Docs
Note that this option has no long option string, which is perfectly acceptable. Also, there's no explicit action, since the default is ``store``. Let's parse another fake command-line. This time, we'll jam the option argument right up against the option: since ``-n42`` (one argument) is equivalent to ``-n 42`` (two arg...
Note that this option has no long option string, which is perfectly acceptable. Also, there's no explicit action, since the default is ``store``. Let's parse another fake command-line. This time, we'll jam the option argument right up against the option: since ``-n42`` (one argument) is equivalent to ``-n 42`` (two arg...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b089e70f-84db-48a2-8a66-daada2b5ea78
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,060
supabase-export-v2
de15c117dcbd103e
usage = "usage: %prog [options] arg1 arg2" :mod:`!optparse` expands ``%prog`` in the usage string to the name of the current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded string is then printed before the detailed option help.
trusted_official_docs
CPython Docs
usage = "usage: %prog [options] arg1 arg2" :mod:`!optparse` expands ``%prog`` in the usage string to the name of the current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded string is then printed before the detailed option help.
usage = "usage: %prog [options] arg1 arg2" :mod:`!optparse` expands ``%prog`` in the usage string to the name of the current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded string is then printed before the detailed option help.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b1c8a7d4-8d46-4c79-a79d-5861c2f71a13
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,973
supabase-export-v2
8ec56c7c654e6020
*not optional*! If there is a piece of information that your program absolutely requires in order to run successfully, that's what positional arguments are for. As an example of good command-line interface design, consider the humble ``cp`` utility, for copying files. It doesn't make much sense to try to copy files wit...
trusted_official_docs
CPython Docs
*not optional*! If there is a piece of information that your program absolutely requires in order to run successfully, that's what positional arguments are for. As an example of good command-line interface design, consider the humble ``cp`` utility, for copying files. It doesn't make much sense to try to copy files wit...
*not optional*! If there is a piece of information that your program absolutely requires in order to run successfully, that's what positional arguments are for. As an example of good command-line interface design, consider the humble ``cp`` utility, for copying files. It doesn't make much sense to try to copy files wit...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b75a777f-ee3d-4198-9e0c-57230af842de
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,330
supabase-export-v2
7628d23aab6aa8e7
.. method:: OptionParser.remove_option(opt_str) If the :class:`OptionParser` has an option corresponding to *opt_str*, that option is removed. If that option provided any other option strings, all of those option strings become invalid. If *opt_str* does not occur in any option belonging to this :class:`OptionParser...
trusted_official_docs
CPython Docs
.. method:: OptionParser.remove_option(opt_str) If the :class:`OptionParser` has an option corresponding to *opt_str*, that option is removed. If that option provided any other option strings, all of those option strings become invalid. If *opt_str* does not occur in any option belonging to this :class:`OptionParser...
.. method:: OptionParser.remove_option(opt_str) If the :class:`OptionParser` has an option corresponding to *opt_str*, that option is removed. If that option provided any other option strings, all of those option strings become invalid. If *opt_str* does not occur in any option belonging to this :class:`OptionParser...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b8905c32-7450-422c-98e4-611081a88ef2
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,131
supabase-export-v2
9f6a1ca74f79aed8
dest="verbose") parser.add_option("-q", "--quiet", action="store_false", dest="verbose") ... (options, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments") if options.verbose: print("reading %s..." % options.filename) ... if __name__ == "__main__": main()
trusted_official_docs
CPython Docs
dest="verbose") parser.add_option("-q", "--quiet", action="store_false", dest="verbose") ... (options, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments") if options.verbose: print("reading %s..." % options.filename) ... if __name__ == "__main__": main()
dest="verbose") parser.add_option("-q", "--quiet", action="store_false", dest="verbose") ... (options, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments") if options.verbose: print("reading %s..." % options.filename) ... if __name__ == "__main__": main()
python, official-docs, cpython, P0
Local_Trusted_Corpus
bbbe8a22-a2a6-49a3-823c-9523892f080f
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,416
supabase-export-v2
15a3ca4345abc52b
if ``-b`` has already been seen), it needs a bit of work: the error message and the flag that it sets must be generalized. :: def check_order(option, opt_str, value, parser): if parser.values.b: raise OptionValueError("can't use %s after -b" % opt_str) setattr(parser.values, option.dest, 1) ... parser.add_option("-...
trusted_official_docs
CPython Docs
if ``-b`` has already been seen), it needs a bit of work: the error message and the flag that it sets must be generalized. :: def check_order(option, opt_str, value, parser): if parser.values.b: raise OptionValueError("can't use %s after -b" % opt_str) setattr(parser.values, option.dest, 1) ... parser.add_option("-...
if ``-b`` has already been seen), it needs a bit of work: the error message and the flag that it sets must be generalized. :: def check_order(option, opt_str, value, parser): if parser.values.b: raise OptionValueError("can't use %s after -b" % opt_str) setattr(parser.values, option.dest, 1) ... parser.add_option("-...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bd1d36de-6083-40f9-bcc9-d3fa3e56d7bd
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,020
supabase-export-v2
efac422bf7e93a3a
destination is ``foo_bar``. If there are no long option strings, :mod:`!optparse` looks at the first short option string: the default destination for ``-f`` is ``f``. :mod:`!optparse` also includes the built-in ``complex`` type. Adding types is covered in section :ref:`optparse-extending-optparse`.
trusted_official_docs
CPython Docs
destination is ``foo_bar``. If there are no long option strings, :mod:`!optparse` looks at the first short option string: the default destination for ``-f`` is ``f``. :mod:`!optparse` also includes the built-in ``complex`` type. Adding types is covered in section :ref:`optparse-extending-optparse`.
destination is ``foo_bar``. If there are no long option strings, :mod:`!optparse` looks at the first short option string: the default destination for ``-f`` is ``f``. :mod:`!optparse` also includes the built-in ``complex`` type. Adding types is covered in section :ref:`optparse-extending-optparse`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
be7e51e0-1c67-4dcf-b7b1-71e501727179
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,394
supabase-export-v2
d25658aa4b4aec43
is ``None`` (no argument expected), then ``value`` will be ``None``. If :attr:`~Option.nargs` > 1, ``value`` will be a tuple of values of the appropriate type. ``parser`` is the OptionParser instance driving the whole thing, mainly useful because you can access some other interesting data through its instance attribu...
trusted_official_docs
CPython Docs
is ``None`` (no argument expected), then ``value`` will be ``None``. If :attr:`~Option.nargs` > 1, ``value`` will be a tuple of values of the appropriate type. ``parser`` is the OptionParser instance driving the whole thing, mainly useful because you can access some other interesting data through its instance attribu...
is ``None`` (no argument expected), then ``value`` will be ``None``. If :attr:`~Option.nargs` > 1, ``value`` will be a tuple of values of the appropriate type. ``parser`` is the OptionParser instance driving the whole thing, mainly useful because you can access some other interesting data through its instance attribu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bef6382d-c561-46e5-a7be-fe6ea82207fa
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,992
supabase-export-v2
b2f27e3627d2cecb
brevity, we will frequently refer to *encountering an option* on the command line; in reality, :mod:`!optparse` encounters *option strings* and looks up options from them. Once all of your options are defined, instruct :mod:`!optparse` to parse your program's command line::
trusted_official_docs
CPython Docs
brevity, we will frequently refer to *encountering an option* on the command line; in reality, :mod:`!optparse` encounters *option strings* and looks up options from them. Once all of your options are defined, instruct :mod:`!optparse` to parse your program's command line::
brevity, we will frequently refer to *encountering an option* on the command line; in reality, :mod:`!optparse` encounters *option strings* and looks up options from them. Once all of your options are defined, instruct :mod:`!optparse` to parse your program's command line::
python, official-docs, cpython, P0
Local_Trusted_Corpus
bf5a3725-dc0e-4d9e-9edd-c8655f5f4410
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,382
supabase-export-v2
fb28891c1438a6b0
There are several other option attributes that you can supply when you define a callback option: :attr:`~Option.type` has its usual meaning: as with the ``"store"`` or ``"append"`` actions, it instructs :mod:`!optparse` to consume one argument and convert it to :attr:`~Option.type`. Rather than storing the converted...
trusted_official_docs
CPython Docs
There are several other option attributes that you can supply when you define a callback option: :attr:`~Option.type` has its usual meaning: as with the ``"store"`` or ``"append"`` actions, it instructs :mod:`!optparse` to consume one argument and convert it to :attr:`~Option.type`. Rather than storing the converted...
There are several other option attributes that you can supply when you define a callback option: :attr:`~Option.type` has its usual meaning: as with the ``"store"`` or ``"append"`` actions, it instructs :mod:`!optparse` to consume one argument and convert it to :attr:`~Option.type`. Rather than storing the converted...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bfb250ad-0875-4b27-a4b7-36ffd79bfec8
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,017
supabase-export-v2
7c349f25e31a0cb4
will print ``42``. If you don't specify a type, :mod:`!optparse` assumes ``string``. Combined with the fact that the default action is ``store``, that means our first example can be a lot shorter::
trusted_official_docs
CPython Docs
will print ``42``. If you don't specify a type, :mod:`!optparse` assumes ``string``. Combined with the fact that the default action is ``store``, that means our first example can be a lot shorter::
will print ``42``. If you don't specify a type, :mod:`!optparse` assumes ``string``. Combined with the fact that the default action is ``store``, that means our first example can be a lot shorter::
python, official-docs, cpython, P0
Local_Trusted_Corpus
c09fda1e-f8ed-4a3a-a8c8-a26bc35160f6
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,141
supabase-export-v2
66ea8a6880418eda
(a class attribute that may be set by OptionParser subclasses), but before any version or help options. Deprecated; use :meth:`add_option` after creating the parser instead. ``option_class`` (default: optparse.Option) Class to use when adding options to the parser in :meth:`add_option`.
trusted_official_docs
CPython Docs
(a class attribute that may be set by OptionParser subclasses), but before any version or help options. Deprecated; use :meth:`add_option` after creating the parser instead. ``option_class`` (default: optparse.Option) Class to use when adding options to the parser in :meth:`add_option`.
(a class attribute that may be set by OptionParser subclasses), but before any version or help options. Deprecated; use :meth:`add_option` after creating the parser instead. ``option_class`` (default: optparse.Option) Class to use when adding options to the parser in :meth:`add_option`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c13a9f11-e9ef-401b-917b-9b7c3d78d05a
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,469
supabase-export-v2
97a856e535b5c5bf
Adding new actions is a bit trickier, because you have to understand that :mod:`!optparse` has a couple of classifications for actions: "store" actions actions that result in :mod:`!optparse` storing a value to an attribute of the current OptionValues instance; these options require a :attr:`~Option.dest` attribute ...
trusted_official_docs
CPython Docs
Adding new actions is a bit trickier, because you have to understand that :mod:`!optparse` has a couple of classifications for actions: "store" actions actions that result in :mod:`!optparse` storing a value to an attribute of the current OptionValues instance; these options require a :attr:`~Option.dest` attribute ...
Adding new actions is a bit trickier, because you have to understand that :mod:`!optparse` has a couple of classifications for actions: "store" actions actions that result in :mod:`!optparse` storing a value to an attribute of the current OptionValues instance; these options require a :attr:`~Option.dest` attribute ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c2e43afc-00fe-4f8d-a3fb-48f78203ec23
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,143
supabase-export-v2
57014849f2553e0a
value for ``version``, :mod:`!optparse` automatically adds a version option with the single option string ``--version``. The substring ``%prog`` is expanded the same as for ``usage``. ``conflict_handler`` (default: ``"error"``) Specifies what to do when options with conflicting option strings are added to the parser;...
trusted_official_docs
CPython Docs
value for ``version``, :mod:`!optparse` automatically adds a version option with the single option string ``--version``. The substring ``%prog`` is expanded the same as for ``usage``. ``conflict_handler`` (default: ``"error"``) Specifies what to do when options with conflicting option strings are added to the parser;...
value for ``version``, :mod:`!optparse` automatically adds a version option with the single option string ``--version``. The substring ``%prog`` is expanded the same as for ``usage``. ``conflict_handler`` (default: ``"error"``) Specifies what to do when options with conflicting option strings are added to the parser;...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c32a9752-34e0-4c29-8efa-863dbe719fcc
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,424
supabase-export-v2
23446d2ff7faa95c
Callback example 5: fixed arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Things get slightly more interesting when you define callback options that take a fixed number of arguments. Specifying that a callback option takes arguments is similar to defining a ``"store"`` or ``"append"`` option: if you define :attr:`~Option...
trusted_official_docs
CPython Docs
Callback example 5: fixed arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Things get slightly more interesting when you define callback options that take a fixed number of arguments. Specifying that a callback option takes arguments is similar to defining a ``"store"`` or ``"append"`` option: if you define :attr:`~Option...
Callback example 5: fixed arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Things get slightly more interesting when you define callback options that take a fixed number of arguments. Specifying that a callback option takes arguments is similar to defining a ``"store"`` or ``"append"`` option: if you define :attr:`~Option...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c36e73b5-19a8-418a-ab35-da4d3bb11d1c
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,412
supabase-export-v2
e93bf472e7e56399
Here's a slightly more interesting example: record the fact that ``-a`` is seen, but blow up if it comes after ``-b`` in the command-line. :: def check_order(option, opt_str, value, parser): if parser.values.b: raise OptionValueError("can't use -a after -b") parser.values.a = 1 ... parser.add_option("-a", action="c...
trusted_official_docs
CPython Docs
Here's a slightly more interesting example: record the fact that ``-a`` is seen, but blow up if it comes after ``-b`` in the command-line. :: def check_order(option, opt_str, value, parser): if parser.values.b: raise OptionValueError("can't use -a after -b") parser.values.a = 1 ... parser.add_option("-a", action="c...
Here's a slightly more interesting example: record the fact that ``-a`` is seen, but blow up if it comes after ``-b`` in the command-line. :: def check_order(option, opt_str, value, parser): if parser.values.b: raise OptionValueError("can't use -a after -b") parser.values.a = 1 ... parser.add_option("-a", action="c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c4617dec-22aa-488f-9e69-634ef692db30
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,047
supabase-export-v2
f429251353368a11
parser.set_defaults(verbose=True) parser.add_option(...) (options, args) = parser.parse_args() As before, the last value specified for a given option destination is the one that counts. For clarity, try to use one method or the other of setting default values, not both.
trusted_official_docs
CPython Docs
parser.set_defaults(verbose=True) parser.add_option(...) (options, args) = parser.parse_args() As before, the last value specified for a given option destination is the one that counts. For clarity, try to use one method or the other of setting default values, not both.
parser.set_defaults(verbose=True) parser.add_option(...) (options, args) = parser.parse_args() As before, the last value specified for a given option destination is the one that counts. For clarity, try to use one method or the other of setting default values, not both.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5ffb3c4-eac6-4cd4-9403-574c62f31d3f
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,446
supabase-export-v2
15d72ce7f3822fbf
Adding new types ^^^^^^^^^^^^^^^^ To add new types, you need to define your own subclass of :mod:`!optparse`'s :class:`Option` class. This class has a couple of attributes that define :mod:`!optparse`'s types: :attr:`~Option.TYPES` and :attr:`~Option.TYPE_CHECKER`.
trusted_official_docs
CPython Docs
Adding new types ^^^^^^^^^^^^^^^^ To add new types, you need to define your own subclass of :mod:`!optparse`'s :class:`Option` class. This class has a couple of attributes that define :mod:`!optparse`'s types: :attr:`~Option.TYPES` and :attr:`~Option.TYPE_CHECKER`.
Adding new types ^^^^^^^^^^^^^^^^ To add new types, you need to define your own subclass of :mod:`!optparse`'s :class:`Option` class. This class has a couple of attributes that define :mod:`!optparse`'s types: :attr:`~Option.TYPES` and :attr:`~Option.TYPE_CHECKER`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c8505c20-7558-4f45-8431-66291143678d
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,393
supabase-export-v2
afb47e2c484d55fa
will be the full, canonical option string---e.g. if the user puts ``--foo`` on the command-line as an abbreviation for ``--foobar``, then ``opt_str`` will be ``"--foobar"``.) ``value`` is the argument to this option seen on the command-line. :mod:`!optparse` will only expect an argument if :attr:`~Option.type` is set...
trusted_official_docs
CPython Docs
will be the full, canonical option string---e.g. if the user puts ``--foo`` on the command-line as an abbreviation for ``--foobar``, then ``opt_str`` will be ``"--foobar"``.) ``value`` is the argument to this option seen on the command-line. :mod:`!optparse` will only expect an argument if :attr:`~Option.type` is set...
will be the full, canonical option string---e.g. if the user puts ``--foo`` on the command-line as an abbreviation for ``--foobar``, then ``opt_str`` will be ``"--foobar"``.) ``value`` is the argument to this option seen on the command-line. :mod:`!optparse` will only expect an argument if :attr:`~Option.type` is set...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c8d6d54c-09da-440e-a2dc-310b34b189c5
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,997
supabase-export-v2
0fc748460764e392
takes a single string argument, then ``options.file`` will be the filename supplied by the user, or ``None`` if the user did not supply that option * ``args``, the list of positional arguments leftover after parsing options
trusted_official_docs
CPython Docs
takes a single string argument, then ``options.file`` will be the filename supplied by the user, or ``None`` if the user did not supply that option * ``args``, the list of positional arguments leftover after parsing options
takes a single string argument, then ``options.file`` will be the filename supplied by the user, or ``None`` if the user did not supply that option * ``args``, the list of positional arguments leftover after parsing options
python, official-docs, cpython, P0
Local_Trusted_Corpus
c9788d17-3b4d-48c9-828f-c2800ed4f01e
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,063
supabase-export-v2
6a68ec6005b6e1eb
* every option defines a help string, and doesn't worry about line-wrapping---\ :mod:`!optparse` takes care of wrapping lines and making the help output look good. * options that take a value indicate this fact in their automatically generated help message, e.g. for the "mode" option::
trusted_official_docs
CPython Docs
* every option defines a help string, and doesn't worry about line-wrapping---\ :mod:`!optparse` takes care of wrapping lines and making the help output look good. * options that take a value indicate this fact in their automatically generated help message, e.g. for the "mode" option::
* every option defines a help string, and doesn't worry about line-wrapping---\ :mod:`!optparse` takes care of wrapping lines and making the help output look good. * options that take a value indicate this fact in their automatically generated help message, e.g. for the "mode" option::
python, official-docs, cpython, P0
Local_Trusted_Corpus
caa2c0d8-68e4-486d-9dcc-70a664e031e2
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,439
supabase-export-v2
d16c72230b6b7638
2: break # stop on -a, but not on -3 or -3.0 if arg[:1] == "-" and len(arg) > 1 and not floatable(arg): break value.append(arg) del parser.rargs[:len(value)] setattr(parser.values, option.dest, value)
trusted_official_docs
CPython Docs
2: break # stop on -a, but not on -3 or -3.0 if arg[:1] == "-" and len(arg) > 1 and not floatable(arg): break value.append(arg) del parser.rargs[:len(value)] setattr(parser.values, option.dest, value)
2: break # stop on -a, but not on -3 or -3.0 if arg[:1] == "-" and len(arg) > 1 and not floatable(arg): break value.append(arg) del parser.rargs[:len(value)] setattr(parser.values, option.dest, value)
python, official-docs, cpython, P0
Local_Trusted_Corpus
cbd91521-0400-4c36-a6c2-f7be9509350f
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,336
supabase-export-v2
45cfd65cf02daaee
(This is particularly true if you've defined your own OptionParser subclass with some standard options.) Every time you add an option, :mod:`!optparse` checks for conflicts with existing options. If it finds any, it invokes the current conflict-handling mechanism. You can set the conflict-handling mechanism either in t...
trusted_official_docs
CPython Docs
(This is particularly true if you've defined your own OptionParser subclass with some standard options.) Every time you add an option, :mod:`!optparse` checks for conflicts with existing options. If it finds any, it invokes the current conflict-handling mechanism. You can set the conflict-handling mechanism either in t...
(This is particularly true if you've defined your own OptionParser subclass with some standard options.) Every time you add an option, :mod:`!optparse` checks for conflicts with existing options. If it finds any, it invokes the current conflict-handling mechanism. You can set the conflict-handling mechanism either in t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cbf98949-b9b5-427f-86aa-3b467a1903fa
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,095
supabase-export-v2
5d8f94c91652246f
Debug Options: -d, --debug Print debug information -s, --sql Print all SQL statements executed -e Print every action done Another interesting method, in particular when working programmatically with option groups is:
trusted_official_docs
CPython Docs
Debug Options: -d, --debug Print debug information -s, --sql Print all SQL statements executed -e Print every action done Another interesting method, in particular when working programmatically with option groups is:
Debug Options: -d, --debug Print debug information -s, --sql Print all SQL statements executed -e Print every action done Another interesting method, in particular when working programmatically with option groups is:
python, official-docs, cpython, P0
Local_Trusted_Corpus
cdc1067a-431d-41d9-a6af-9f49472aa30d
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,482
supabase-export-v2
66e39097ff7c5dad
In order to actually implement your new action, you must override Option's :meth:`take_action` method and add a case that recognizes your action. For example, let's add an ``"extend"`` action. This is similar to the standard ``"append"`` action, but instead of taking a single value from the command-line and appending i...
trusted_official_docs
CPython Docs
In order to actually implement your new action, you must override Option's :meth:`take_action` method and add a case that recognizes your action. For example, let's add an ``"extend"`` action. This is similar to the standard ``"append"`` action, but instead of taking a single value from the command-line and appending i...
In order to actually implement your new action, you must override Option's :meth:`take_action` method and add a case that recognizes your action. For example, let's add an ``"extend"`` action. This is similar to the standard ``"append"`` action, but instead of taking a single value from the command-line and appending i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ce34c9ce-0c40-4bf3-91c9-8dd03a79c65b
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,974
supabase-export-v2
e7459ec348481e25
Hence, ``cp`` fails if you run it with no arguments. However, it has a flexible, useful syntax that does not require any options at all:: cp SOURCE DEST cp SOURCE ... DEST-DIR
trusted_official_docs
CPython Docs
Hence, ``cp`` fails if you run it with no arguments. However, it has a flexible, useful syntax that does not require any options at all:: cp SOURCE DEST cp SOURCE ... DEST-DIR
Hence, ``cp`` fails if you run it with no arguments. However, it has a flexible, useful syntax that does not require any options at all:: cp SOURCE DEST cp SOURCE ... DEST-DIR
python, official-docs, cpython, P0
Local_Trusted_Corpus
ce90c260-c8d6-455d-bdbf-fe03f4f6387d
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,038
supabase-export-v2
c612327471c61b75
but sometimes you want more control. :mod:`!optparse` lets you supply a default value for each destination, which is assigned before the command line is parsed. First, consider the verbose/quiet example. If we want :mod:`!optparse` to set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::
trusted_official_docs
CPython Docs
but sometimes you want more control. :mod:`!optparse` lets you supply a default value for each destination, which is assigned before the command line is parsed. First, consider the verbose/quiet example. If we want :mod:`!optparse` to set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::
but sometimes you want more control. :mod:`!optparse` lets you supply a default value for each destination, which is assigned before the command line is parsed. First, consider the verbose/quiet example. If we want :mod:`!optparse` to set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::
python, official-docs, cpython, P0
Local_Trusted_Corpus
cea30c91-dcee-4c60-87c3-7eaa49cd4c98
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,492
supabase-export-v2
1cb87c549389ba5a
* ``"extend"`` both expects a value on the command-line and stores that value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:`~Option.TYPED_ACTIONS`. * to ensure that :mod:`!optparse` assigns the default type of ``"string"`` to ``"extend"`` actions, we put the ``"extend"`` action in :attr:`~Opt...
trusted_official_docs
CPython Docs
* ``"extend"`` both expects a value on the command-line and stores that value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:`~Option.TYPED_ACTIONS`. * to ensure that :mod:`!optparse` assigns the default type of ``"string"`` to ``"extend"`` actions, we put the ``"extend"`` action in :attr:`~Opt...
* ``"extend"`` both expects a value on the command-line and stores that value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:`~Option.TYPED_ACTIONS`. * to ensure that :mod:`!optparse` assigns the default type of ``"string"`` to ``"extend"`` actions, we put the ``"extend"`` action in :attr:`~Opt...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cf05da0c-c1a1-413e-8f79-c2b2d1d1855b
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,457
supabase-export-v2
2d113dfb989646ba
from copy import copy from optparse import Option, OptionValueError You need to define your type-checker first, since it's referred to later (in the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::
trusted_official_docs
CPython Docs
from copy import copy from optparse import Option, OptionValueError You need to define your type-checker first, since it's referred to later (in the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::
from copy import copy from optparse import Option, OptionValueError You need to define your type-checker first, since it's referred to later (in the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d0aff918-a2c5-4eda-8364-956adbe84965
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,930
supabase-export-v2
35c8916f37c86881
third party argument processing library (originally based on ``optparse``), which allows command line applications to be developed as a set of decorated command implementation functions. Other third party libraries, such as :pypi:`typer` or :pypi:`msgspec-click`, allow command line interfaces to be specified in ways t...
trusted_official_docs
CPython Docs
third party argument processing library (originally based on ``optparse``), which allows command line applications to be developed as a set of decorated command implementation functions. Other third party libraries, such as :pypi:`typer` or :pypi:`msgspec-click`, allow command line interfaces to be specified in ways t...
third party argument processing library (originally based on ``optparse``), which allows command line applications to be developed as a set of decorated command implementation functions. Other third party libraries, such as :pypi:`typer` or :pypi:`msgspec-click`, allow command line interfaces to be specified in ways t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2651f67-4463-45c2-88eb-4439761fb5b8
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,117
supabase-export-v2
a78d581ece21ad10
handles the error the same way: it prints the program's usage message and an error message to standard error and exits with error status 2. Consider the first example above, where the user passes ``4x`` to an option that takes an integer:
trusted_official_docs
CPython Docs
handles the error the same way: it prints the program's usage message and an error message to standard error and exits with error status 2. Consider the first example above, where the user passes ``4x`` to an option that takes an integer:
handles the error the same way: it prints the program's usage message and an error message to standard error and exits with error status 2. Consider the first example above, where the user passes ``4x`` to an option that takes an integer:
python, official-docs, cpython, P0
Local_Trusted_Corpus
d26a7b17-5dc5-48ad-adf4-7a8d5c84c818
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,396
supabase-export-v2
c5c4a57c203c6430
option arguments. Feel free to modify ``parser.largs``, e.g. by adding more arguments to it. (This list will become ``args``, the second return value of :meth:`~OptionParser.parse_args`.) ``parser.rargs`` the current list of remaining arguments, ie. with ``opt_str`` and ``value`` (if applicable) removed, and only the...
trusted_official_docs
CPython Docs
option arguments. Feel free to modify ``parser.largs``, e.g. by adding more arguments to it. (This list will become ``args``, the second return value of :meth:`~OptionParser.parse_args`.) ``parser.rargs`` the current list of remaining arguments, ie. with ``opt_str`` and ``value`` (if applicable) removed, and only the...
option arguments. Feel free to modify ``parser.largs``, e.g. by adding more arguments to it. (This list will become ``args``, the second return value of :meth:`~OptionParser.parse_args`.) ``parser.rargs`` the current list of remaining arguments, ie. with ``opt_str`` and ``value`` (if applicable) removed, and only the...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d26b6509-db1f-4983-8cee-9a7b097da50c
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,077
supabase-export-v2
7d73d991d6344a44
Once all the options are declared, using the :class:`OptionParser` method :meth:`add_option_group` the group is added to the previously defined parser. Continuing with the parser defined in the previous section, adding an :class:`OptionGroup` to a parser is easy::
trusted_official_docs
CPython Docs
Once all the options are declared, using the :class:`OptionParser` method :meth:`add_option_group` the group is added to the previously defined parser. Continuing with the parser defined in the previous section, adding an :class:`OptionGroup` to a parser is easy::
Once all the options are declared, using the :class:`OptionParser` method :meth:`add_option_group` the group is added to the previously defined parser. Continuing with the parser defined in the previous section, adding an :class:`OptionGroup` to a parser is easy::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d27ce904-456d-403a-9c5d-7832c7f74022
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,005
supabase-export-v2
e0625f8ba10347b5
The store action ^^^^^^^^^^^^^^^^ The most common option action is ``store``, which tells :mod:`!optparse` to take the next argument (or the remainder of the current argument), ensure that it is of the correct type, and store it to your chosen destination.
trusted_official_docs
CPython Docs
The store action ^^^^^^^^^^^^^^^^ The most common option action is ``store``, which tells :mod:`!optparse` to take the next argument (or the remainder of the current argument), ensure that it is of the correct type, and store it to your chosen destination.
The store action ^^^^^^^^^^^^^^^^ The most common option action is ``store``, which tells :mod:`!optparse` to take the next argument (or the remainder of the current argument), ensure that it is of the correct type, and store it to your chosen destination.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d31dfcc4-b207-4654-950d-06b1281f0de3
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,919
supabase-export-v2
c8b8e879fa2d3cfd
These considerations also mean that :mod:`!optparse` is likely to provide a better foundation for library authors writing third party command line argument processing libraries. As a concrete example, consider the following two command line argument parsing configurations, the first using ``optparse``, and the second u...
trusted_official_docs
CPython Docs
These considerations also mean that :mod:`!optparse` is likely to provide a better foundation for library authors writing third party command line argument processing libraries. As a concrete example, consider the following two command line argument parsing configurations, the first using ``optparse``, and the second u...
These considerations also mean that :mod:`!optparse` is likely to provide a better foundation for library authors writing third party command line argument processing libraries. As a concrete example, consider the following two command line argument parsing configurations, the first using ``optparse``, and the second u...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d47fe568-5751-40a0-9b09-4e360df036b0
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,419
supabase-export-v2
df4f380c90e407ea
Callback example 4: check arbitrary condition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Of course, you could put any condition in there---you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all you have to do is this...
trusted_official_docs
CPython Docs
Callback example 4: check arbitrary condition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Of course, you could put any condition in there---you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all you have to do is this...
Callback example 4: check arbitrary condition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Of course, you could put any condition in there---you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all you have to do is this...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d757c500-2cd6-4aa4-8d6c-5c6021bd8d5b
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,458
supabase-export-v2
c124d5dfe0473439
You need to define your type-checker first, since it's referred to later (in the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass):: def check_complex(option, opt, value): try: return complex(value) except ValueError: raise OptionValueError( "option %s: invalid complex value: %r" % (opt, value)...
trusted_official_docs
CPython Docs
You need to define your type-checker first, since it's referred to later (in the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass):: def check_complex(option, opt, value): try: return complex(value) except ValueError: raise OptionValueError( "option %s: invalid complex value: %r" % (opt, value)...
You need to define your type-checker first, since it's referred to later (in the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass):: def check_complex(option, opt, value): try: return complex(value) except ValueError: raise OptionValueError( "option %s: invalid complex value: %r" % (opt, value)...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d7bebc23-8c77-419b-b3c0-366eca70c3c0
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,975
supabase-export-v2
1d3b1133facb4258
cp SOURCE DEST cp SOURCE ... DEST-DIR You can get pretty far with just that. Most ``cp`` implementations provide a bunch of options to tweak exactly how the files are copied: you can preserve mode and modification time, avoid following symlinks, ask before clobbering existing files, etc. But none of this distracts from...
trusted_official_docs
CPython Docs
cp SOURCE DEST cp SOURCE ... DEST-DIR You can get pretty far with just that. Most ``cp`` implementations provide a bunch of options to tweak exactly how the files are copied: you can preserve mode and modification time, avoid following symlinks, ask before clobbering existing files, etc. But none of this distracts from...
cp SOURCE DEST cp SOURCE ... DEST-DIR You can get pretty far with just that. Most ``cp`` implementations provide a bunch of options to tweak exactly how the files are copied: you can preserve mode and modification time, avoid following symlinks, ask before clobbering existing files, etc. But none of this distracts from...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d7f20181-e174-4dd1-ad26-440cb03a1632
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,225
supabase-export-v2
ee692950547b1bf7
Standard option actions ^^^^^^^^^^^^^^^^^^^^^^^ The various option actions all have slightly different requirements and effects. Most actions have several relevant option attributes which you may specify to guide :mod:`!optparse`'s behaviour; a few have required attributes, which you must specify for any option using t...
trusted_official_docs
CPython Docs
Standard option actions ^^^^^^^^^^^^^^^^^^^^^^^ The various option actions all have slightly different requirements and effects. Most actions have several relevant option attributes which you may specify to guide :mod:`!optparse`'s behaviour; a few have required attributes, which you must specify for any option using t...
Standard option actions ^^^^^^^^^^^^^^^^^^^^^^^ The various option actions all have slightly different requirements and effects. Most actions have several relevant option attributes which you may specify to guide :mod:`!optparse`'s behaviour; a few have required attributes, which you must specify for any option using t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d98e2abb-4553-4e29-a8c3-6097b06b8533
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,166
supabase-export-v2
49df8754b58a6a63
parser.add_option("--foo", attr=value, ...) The keyword arguments define attributes of the new Option object. The most important option attribute is :attr:`~Option.action`, and it largely determines which other attributes are relevant or required. If you pass irrelevant option attributes, or fail to pass required on...
trusted_official_docs
CPython Docs
parser.add_option("--foo", attr=value, ...) The keyword arguments define attributes of the new Option object. The most important option attribute is :attr:`~Option.action`, and it largely determines which other attributes are relevant or required. If you pass irrelevant option attributes, or fail to pass required on...
parser.add_option("--foo", attr=value, ...) The keyword arguments define attributes of the new Option object. The most important option attribute is :attr:`~Option.action`, and it largely determines which other attributes are relevant or required. If you pass irrelevant option attributes, or fail to pass required on...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d9d4429e-8c06-4c68-a8c5-67e924938606
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,939
supabase-export-v2
b7ff6b433930244c
allows options to be associated with their arguments in a variety of ways. Thus, the following command lines are all equivalent to the above example:: <yourscript> -f outfile --quiet <yourscript> --quiet --file outfile <yourscript> -q -foutfile <yourscript> -qfoutfile
trusted_official_docs
CPython Docs
allows options to be associated with their arguments in a variety of ways. Thus, the following command lines are all equivalent to the above example:: <yourscript> -f outfile --quiet <yourscript> --quiet --file outfile <yourscript> -q -foutfile <yourscript> -qfoutfile
allows options to be associated with their arguments in a variety of ways. Thus, the following command lines are all equivalent to the above example:: <yourscript> -f outfile --quiet <yourscript> --quiet --file outfile <yourscript> -q -foutfile <yourscript> -qfoutfile
python, official-docs, cpython, P0
Local_Trusted_Corpus
db1880fa-19fd-4b87-8789-28b65133ebab
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,317
supabase-export-v2
abaf990a1c31ec2d
.. method:: OptionParser.disable_interspersed_args() Set parsing to stop on the first non-option. For example, if ``-a`` and ``-b`` are both simple options that take no arguments, :mod:`!optparse` normally accepts this syntax::
trusted_official_docs
CPython Docs
.. method:: OptionParser.disable_interspersed_args() Set parsing to stop on the first non-option. For example, if ``-a`` and ``-b`` are both simple options that take no arguments, :mod:`!optparse` normally accepts this syntax::
.. method:: OptionParser.disable_interspersed_args() Set parsing to stop on the first non-option. For example, if ``-a`` and ``-b`` are both simple options that take no arguments, :mod:`!optparse` normally accepts this syntax::
python, official-docs, cpython, P0
Local_Trusted_Corpus
db3588b9-640f-4aa4-9baf-80f38d8d9d8d
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,167
supabase-export-v2
2dac2305d5f3e262
attributes are relevant or required. If you pass irrelevant option attributes, or fail to pass required ones, :mod:`!optparse` raises an :exc:`OptionError` exception explaining your mistake. An option's *action* determines what :mod:`!optparse` does when it encounters this option on the command-line. The standard opti...
trusted_official_docs
CPython Docs
attributes are relevant or required. If you pass irrelevant option attributes, or fail to pass required ones, :mod:`!optparse` raises an :exc:`OptionError` exception explaining your mistake. An option's *action* determines what :mod:`!optparse` does when it encounters this option on the command-line. The standard opti...
attributes are relevant or required. If you pass irrelevant option attributes, or fail to pass required ones, :mod:`!optparse` raises an :exc:`OptionError` exception explaining your mistake. An option's *action* determines what :mod:`!optparse` does when it encounters this option on the command-line. The standard opti...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dcd7858c-810c-4b48-b096-aec8e67ba0ed
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,918
supabase-export-v2
16b2deb8683be62a
command line parameter processing behavior which ``argparse`` does not support, but which can be implemented in terms of the lower level interface offered by ``optparse`` These considerations also mean that :mod:`!optparse` is likely to provide a better foundation for library authors writing third party command line ar...
trusted_official_docs
CPython Docs
command line parameter processing behavior which ``argparse`` does not support, but which can be implemented in terms of the lower level interface offered by ``optparse`` These considerations also mean that :mod:`!optparse` is likely to provide a better foundation for library authors writing third party command line ar...
command line parameter processing behavior which ``argparse`` does not support, but which can be implemented in terms of the lower level interface offered by ``optparse`` These considerations also mean that :mod:`!optparse` is likely to provide a better foundation for library authors writing third party command line ar...
python, official-docs, cpython, P0
Local_Trusted_Corpus
decc9422-f94e-41b7-8854-d2eacf0671f2
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,258
supabase-export-v2
b808c1d43304fbd9
options.tracks.append(int("4")) The ``append`` action calls the ``append`` method on the current value of the option. This means that any default value specified must have an ``append`` method. It also means that if the default value is non-empty, the default elements will be present in the parsed value for the opti...
trusted_official_docs
CPython Docs
options.tracks.append(int("4")) The ``append`` action calls the ``append`` method on the current value of the option. This means that any default value specified must have an ``append`` method. It also means that if the default value is non-empty, the default elements will be present in the parsed value for the opti...
options.tracks.append(int("4")) The ``append`` action calls the ``append`` method on the current value of the option. This means that any default value specified must have an ``append`` method. It also means that if the default value is non-empty, the default elements will be present in the parsed value for the opti...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e08004ed-f0c1-4411-8f7c-6c7d1a2cf83c
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,154
supabase-export-v2
a29fbaeccf02d610
combination of positional and keyword arguments that are acceptable to :func:`make_option` (i.e., to the Option constructor), and it will create the Option instance for you The other alternative is to pass a list of pre-constructed Option instances to the OptionParser constructor, as in::
trusted_official_docs
CPython Docs
combination of positional and keyword arguments that are acceptable to :func:`make_option` (i.e., to the Option constructor), and it will create the Option instance for you The other alternative is to pass a list of pre-constructed Option instances to the OptionParser constructor, as in::
combination of positional and keyword arguments that are acceptable to :func:`make_option` (i.e., to the Option constructor), and it will create the Option instance for you The other alternative is to pass a list of pre-constructed Option instances to the OptionParser constructor, as in::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e194c99d-8e9c-42a3-bc56-4101834b0cde
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,461
supabase-export-v2
0f9740c85d5e55da
class MyOption (Option): TYPES = Option.TYPES + ("complex",) TYPE_CHECKER = copy(Option.TYPE_CHECKER) TYPE_CHECKER["complex"] = check_complex (If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:`!optparse`'s Option class. This be...
trusted_official_docs
CPython Docs
class MyOption (Option): TYPES = Option.TYPES + ("complex",) TYPE_CHECKER = copy(Option.TYPE_CHECKER) TYPE_CHECKER["complex"] = check_complex (If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:`!optparse`'s Option class. This be...
class MyOption (Option): TYPES = Option.TYPES + ("complex",) TYPE_CHECKER = copy(Option.TYPE_CHECKER) TYPE_CHECKER["complex"] = check_complex (If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:`!optparse`'s Option class. This be...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e26e51c4-255b-43b3-b3cd-db7b1c7d0512
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,953
supabase-export-v2
587d162709de8c1c
GNU project introduced ``--`` followed by a series of hyphen-separated words, e.g. ``--file`` or ``--dry-run``. These are the only two option syntaxes provided by :mod:`!optparse`. Some other option syntaxes that the world has seen include:
trusted_official_docs
CPython Docs
GNU project introduced ``--`` followed by a series of hyphen-separated words, e.g. ``--file`` or ``--dry-run``. These are the only two option syntaxes provided by :mod:`!optparse`. Some other option syntaxes that the world has seen include:
GNU project introduced ``--`` followed by a series of hyphen-separated words, e.g. ``--file`` or ``--dry-run``. These are the only two option syntaxes provided by :mod:`!optparse`. Some other option syntaxes that the world has seen include:
python, official-docs, cpython, P0
Local_Trusted_Corpus
e3073a1f-e3d6-4a7e-b146-ab2d6e13be57
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,074
supabase-export-v2
70316c056ad3cc7b
where * parser is the :class:`OptionParser` instance the group will be inserted in to * title is the group title * description, optional, is a long description of the group
trusted_official_docs
CPython Docs
where * parser is the :class:`OptionParser` instance the group will be inserted in to * title is the group title * description, optional, is a long description of the group
where * parser is the :class:`OptionParser` instance the group will be inserted in to * title is the group title * description, optional, is a long description of the group
python, official-docs, cpython, P0
Local_Trusted_Corpus
e38cf6ab-9a62-469c-a942-415ee1bb2f1e
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,285
supabase-export-v2
c310ce0af24872cd
Options: -h, --help Show this help message and exit -v Be moderately verbose --file=FILENAME Input file to read data from After printing the help message, :mod:`!optparse` terminates your process with ``sys.exit(0)``.
trusted_official_docs
CPython Docs
Options: -h, --help Show this help message and exit -v Be moderately verbose --file=FILENAME Input file to read data from After printing the help message, :mod:`!optparse` terminates your process with ``sys.exit(0)``.
Options: -h, --help Show this help message and exit -v Be moderately verbose --file=FILENAME Input file to read data from After printing the help message, :mod:`!optparse` terminates your process with ``sys.exit(0)``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e39f91e2-a090-4ae8-9140-0f7e4fa22c2c
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
48,932
supabase-export-v2
e805ff9ff6be2054
Introduction ------------ :mod:`!optparse` is a more convenient, flexible, and powerful library for parsing command-line options than the minimalist :mod:`getopt` module. :mod:`!optparse` uses a more declarative style of command-line parsing: you create an instance of :class:`OptionParser`, populate it with options, an...
trusted_official_docs
CPython Docs
Introduction ------------ :mod:`!optparse` is a more convenient, flexible, and powerful library for parsing command-line options than the minimalist :mod:`getopt` module. :mod:`!optparse` uses a more declarative style of command-line parsing: you create an instance of :class:`OptionParser`, populate it with options, an...
Introduction ------------ :mod:`!optparse` is a more convenient, flexible, and powerful library for parsing command-line options than the minimalist :mod:`getopt` module. :mod:`!optparse` uses a more declarative style of command-line parsing: you create an instance of :class:`OptionParser`, populate it with options, an...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e4081424-6c96-43af-8dd1-90fae7f53cde
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,489
supabase-export-v2
8cf85093ba3f7b5e
ACTIONS = Option.ACTIONS + ("extend",) STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) def take_action(self, action, dest, opt, value, values, parser): if action == "extend": lvalue = value.split(","...
trusted_official_docs
CPython Docs
ACTIONS = Option.ACTIONS + ("extend",) STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) def take_action(self, action, dest, opt, value, values, parser): if action == "extend": lvalue = value.split(","...
ACTIONS = Option.ACTIONS + ("extend",) STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) def take_action(self, action, dest, opt, value, values, parser): if action == "extend": lvalue = value.split(","...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e50560d1-ec6e-4696-9cde-4ff00680f1d3
CPython Docs
file://datasets/cpython/Doc/library/optparse.rst
unknown
fb35db8d-6782-49dd-8f4e-89244d3635e0
49,195
supabase-export-v2
397dd37c627699ef
.. class:: Option A single command line argument, with various attributes passed by keyword to the constructor. Normally created with :meth:`OptionParser.add_option` rather than directly, and can be overridden by a custom class via the *option_class* argument to :class:`OptionParser`.
trusted_official_docs
CPython Docs
.. class:: Option A single command line argument, with various attributes passed by keyword to the constructor. Normally created with :meth:`OptionParser.add_option` rather than directly, and can be overridden by a custom class via the *option_class* argument to :class:`OptionParser`.
.. class:: Option A single command line argument, with various attributes passed by keyword to the constructor. Normally created with :meth:`OptionParser.add_option` rather than directly, and can be overridden by a custom class via the *option_class* argument to :class:`OptionParser`.
python, official-docs, cpython, P0
Local_Trusted_Corpus