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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e51e3870-ab6b-4e7a-94c5-acfc2c533be3 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,377 | supabase-export-v2 | de37057a34cd5861 | parser.add_option("-c", action="callback", callback=my_callback)
``callback`` is a function (or other callable object), so you must have already
defined ``my_callback()`` when you create this callback option. In this simple
case, :mod:`!optparse` doesn't even know if ``-c`` takes any arguments,
which usually means that... | trusted_official_docs | CPython Docs | parser.add_option("-c", action="callback", callback=my_callback)
``callback`` is a function (or other callable object), so you must have already
defined ``my_callback()`` when you create this callback option. In this simple
case, :mod:`!optparse` doesn't even know if ``-c`` takes any arguments,
which usually means that... | parser.add_option("-c", action="callback", callback=my_callback)
``callback`` is a function (or other callable object), so you must have already
defined ``my_callback()`` when you create this callback option. In this simple
case, :mod:`!optparse` doesn't even know if ``-c`` takes any arguments,
which usually means that... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e528ab46-9a41-49fd-95d8-f0b2cda2561c | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,145 | supabase-export-v2 | 0b1c1c96e39e7d48 | reformats this paragraph to fit the current terminal width and prints it when the user requests help (after ``usage``, but before the list of options).
``formatter`` (default: a new :class:`IndentedHelpFormatter`)
An instance of optparse.HelpFormatter that will be used for printing help
text. :mod:`!optparse` provide... | trusted_official_docs | CPython Docs | reformats this paragraph to fit the current terminal width and prints it when the user requests help (after ``usage``, but before the list of options).
``formatter`` (default: a new :class:`IndentedHelpFormatter`)
An instance of optparse.HelpFormatter that will be used for printing help
text. :mod:`!optparse` provide... | reformats this paragraph to fit the current terminal width and prints it when the user requests help (after ``usage``, but before the list of options).
``formatter`` (default: a new :class:`IndentedHelpFormatter`)
An instance of optparse.HelpFormatter that will be used for printing help
text. :mod:`!optparse` provide... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e6041284-26a4-4c59-8e37-1930cf49b6af | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,180 | supabase-export-v2 | fc12848d5754765c | .. class:: Values
An object holding parsed argument names and values as attributes. Normally created by calling when calling :meth:`OptionParser.parse_args`,
and can be overridden by a custom subclass passed to the *values* argument of
:meth:`OptionParser.parse_args` (as described in :ref:`optparse-parsing-arguments`... | trusted_official_docs | CPython Docs | .. class:: Values
An object holding parsed argument names and values as attributes. Normally created by calling when calling :meth:`OptionParser.parse_args`,
and can be overridden by a custom subclass passed to the *values* argument of
:meth:`OptionParser.parse_args` (as described in :ref:`optparse-parsing-arguments`... | .. class:: Values
An object holding parsed argument names and values as attributes. Normally created by calling when calling :meth:`OptionParser.parse_args`,
and can be overridden by a custom subclass passed to the *values* argument of
:meth:`OptionParser.parse_args` (as described in :ref:`optparse-parsing-arguments`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e765a5f4-a2ed-42b3-9411-d7be4696011b | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,102 | supabase-export-v2 | e3a6db7771a493c3 | parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 1.0")
``%prog`` is expanded just like it is in ``usage``. Apart from that,
``version`` can contain anything you like. When you supply it, :mod:`!optparse`
automatically adds a ``--version`` option to your parser. If it encounters
this option on the command l... | trusted_official_docs | CPython Docs | parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 1.0")
``%prog`` is expanded just like it is in ``usage``. Apart from that,
``version`` can contain anything you like. When you supply it, :mod:`!optparse`
automatically adds a ``--version`` option to your parser. If it encounters
this option on the command l... | parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 1.0")
``%prog`` is expanded just like it is in ``usage``. Apart from that,
``version`` can contain anything you like. When you supply it, :mod:`!optparse`
automatically adds a ``--version`` option to your parser. If it encounters
this option on the command l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e781cb72-cd66-4454-a207-5e367ed1b0e0 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,435 | supabase-export-v2 | 7d625fe4ecb7e550 | choose will be based on which trade-offs you're willing to make for your application (which is why :mod:`!optparse` doesn't support this sort of thing directly).
Nevertheless, here's a stab at a callback for an option with variable
arguments:: | trusted_official_docs | CPython Docs | choose will be based on which trade-offs you're willing to make for your application (which is why :mod:`!optparse` doesn't support this sort of thing directly).
Nevertheless, here's a stab at a callback for an option with variable
arguments:: | choose will be based on which trade-offs you're willing to make for your application (which is why :mod:`!optparse` doesn't support this sort of thing directly).
Nevertheless, here's a stab at a callback for an option with variable
arguments:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e946a90c-0420-4a4b-9013-1ed3e7fe6226 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,496 | supabase-export-v2 | 1cda51f62115e244 | values.ensure_value(attr, value)
If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then
ensure_value() first sets it to ``value``, and then returns ``value``. This is
very handy for actions like ``"extend"``, ``"append"``, and ``"count"``, all
of which accumulate data in a variable and expect tha... | trusted_official_docs | CPython Docs | values.ensure_value(attr, value)
If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then
ensure_value() first sets it to ``value``, and then returns ``value``. This is
very handy for actions like ``"extend"``, ``"append"``, and ``"count"``, all
of which accumulate data in a variable and expect tha... | values.ensure_value(attr, value)
If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then
ensure_value() first sets it to ``value``, and then returns ``value``. This is
very handy for actions like ``"extend"``, ``"append"``, and ``"count"``, all
of which accumulate data in a variable and expect tha... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea65b0ba-2def-432e-8361-ba433903ff0c | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,100 | supabase-export-v2 | d1f29e99420230de | Printing a version string ^^^^^^^^^^^^^^^^^^^^^^^^^
Similar to the brief usage string, :mod:`!optparse` can also print a version
string for your program. You have to supply the string as the ``version``
argument to OptionParser:: | trusted_official_docs | CPython Docs | Printing a version string ^^^^^^^^^^^^^^^^^^^^^^^^^
Similar to the brief usage string, :mod:`!optparse` can also print a version
string for your program. You have to supply the string as the ``version``
argument to OptionParser:: | Printing a version string ^^^^^^^^^^^^^^^^^^^^^^^^^
Similar to the brief usage string, :mod:`!optparse` can also print a version
string for your program. You have to supply the string as the ``version``
argument to OptionParser:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea79f5ab-e17d-4ee6-9245-7438f7768bbb | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 48,946 | supabase-export-v2 | 40bd19652989f932 | Options: -h, --help show this help message and exit -f FILE, --file=FILE write report to FILE -q, --quiet don't print status messages to stdout
where the value of *yourscript* is determined at runtime (normally from
``sys.argv[0]``). | trusted_official_docs | CPython Docs | Options: -h, --help show this help message and exit -f FILE, --file=FILE write report to FILE -q, --quiet don't print status messages to stdout
where the value of *yourscript* is determined at runtime (normally from
``sys.argv[0]``). | Options: -h, --help show this help message and exit -f FILE, --file=FILE write report to FILE -q, --quiet don't print status messages to stdout
where the value of *yourscript* is determined at runtime (normally from
``sys.argv[0]``). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb9dff8f-5b50-4a6d-a9c3-0835614da78d | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,024 | supabase-export-v2 | b5b77901b89fcdb6 | with two separate actions, ``store_true`` and ``store_false``. For example, you might have a ``verbose`` flag that is turned on with ``-v`` and off with ``-q``::
parser.add_option("-v", action="store_true", dest="verbose")
parser.add_option("-q", action="store_false", dest="verbose") | trusted_official_docs | CPython Docs | with two separate actions, ``store_true`` and ``store_false``. For example, you might have a ``verbose`` flag that is turned on with ``-v`` and off with ``-q``::
parser.add_option("-v", action="store_true", dest="verbose")
parser.add_option("-q", action="store_false", dest="verbose") | with two separate actions, ``store_true`` and ``store_false``. For example, you might have a ``verbose`` flag that is turned on with ``-v`` and off with ``-q``::
parser.add_option("-v", action="store_true", dest="verbose")
parser.add_option("-q", action="store_false", dest="verbose") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eba64e4d-9f51-4080-b3bb-5aa3b294121c | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,483 | supabase-export-v2 | 5a6235bb20782809 | single comma-delimited string, and extend an existing list with them. That is, if ``--names`` is an ``"extend"`` option of type ``"string"``, the command line ::
--names=foo,bar --names blah --names ding,dong | trusted_official_docs | CPython Docs | single comma-delimited string, and extend an existing list with them. That is, if ``--names`` is an ``"extend"`` option of type ``"string"``, the command line ::
--names=foo,bar --names blah --names ding,dong | single comma-delimited string, and extend an existing list with them. That is, if ``--names`` is an ``"extend"`` option of type ``"string"``, the command line ::
--names=foo,bar --names blah --names ding,dong | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ebd0f9b5-d804-47b1-81d7-cf40447c48ec | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,067 | supabase-export-v2 | 3b3ef9656917ec2b | -f FILE, --filename=FILE
This is important for more than just saving space, though: the manually
written help text uses the meta-variable ``FILE`` to clue the user in that
there's a connection between the semi-formal syntax ``-f FILE`` and the informal
semantic description "write output to FILE". This is a simple bu... | trusted_official_docs | CPython Docs | -f FILE, --filename=FILE
This is important for more than just saving space, though: the manually
written help text uses the meta-variable ``FILE`` to clue the user in that
there's a connection between the semi-formal syntax ``-f FILE`` and the informal
semantic description "write output to FILE". This is a simple bu... | -f FILE, --filename=FILE
This is important for more than just saving space, though: the manually
written help text uses the meta-variable ``FILE`` to clue the user in that
there's a connection between the semi-formal syntax ``-f FILE`` and the informal
semantic description "write output to FILE". This is a simple bu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ee94bd91-d895-4354-877f-7829a03932b4 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 48,971 | supabase-export-v2 | d004728c9e7891fb | What are options for? ^^^^^^^^^^^^^^^^^^^^^
Options are used to provide extra information to tune or customize the execution
of a program. In case it wasn't clear, options are usually *optional*. A
program should be able to run just fine with no options whatsoever. (Pick a
random program from the Unix or GNU toolsets. ... | trusted_official_docs | CPython Docs | What are options for? ^^^^^^^^^^^^^^^^^^^^^
Options are used to provide extra information to tune or customize the execution
of a program. In case it wasn't clear, options are usually *optional*. A
program should be able to run just fine with no options whatsoever. (Pick a
random program from the Unix or GNU toolsets. ... | What are options for? ^^^^^^^^^^^^^^^^^^^^^
Options are used to provide extra information to tune or customize the execution
of a program. In case it wasn't clear, options are usually *optional*. A
program should be able to run just fine with no options whatsoever. (Pick a
random program from the Unix or GNU toolsets. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
efa75fcb-e817-4664-b346-a99eea3584a4 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,364 | supabase-export-v2 | 4bd5b2e5ae04996b | destination. For example, if several "mode" options all set the same destination, any one of them can set the default, and the last one wins::
parser.add_option("--advanced", action="store_const",
dest="mode", const="advanced",
default="novice") # overridden below
parser.add_option("--novice", action="store_const",
... | trusted_official_docs | CPython Docs | destination. For example, if several "mode" options all set the same destination, any one of them can set the default, and the last one wins::
parser.add_option("--advanced", action="store_const",
dest="mode", const="advanced",
default="novice") # overridden below
parser.add_option("--novice", action="store_const",
... | destination. For example, if several "mode" options all set the same destination, any one of them can set the default, and the last one wins::
parser.add_option("--advanced", action="store_const",
dest="mode", const="advanced",
default="novice") # overridden below
parser.add_option("--novice", action="store_const",
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
efd228e0-9c42-44d7-8365-f504b0aa5ba2 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,318 | supabase-export-v2 | 76ab7f6e741793e4 | 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::
prog -a arg1 -b arg2 | trusted_official_docs | CPython Docs | 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::
prog -a arg1 -b arg2 | 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::
prog -a arg1 -b arg2 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f099f908-5e22-4808-a2e1-5d91d4108607 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,075 | supabase-export-v2 | 3ff6b0ccdffbea6a | :class:`OptionParser` instance the group will be inserted in to * title is the group title * description, optional, is a long description of the group
:class:`OptionGroup` inherits from :class:`OptionContainer` (like
:class:`OptionParser`) and so the :meth:`add_option` method can be used to add
an option to the group. | trusted_official_docs | CPython Docs | :class:`OptionParser` instance the group will be inserted in to * title is the group title * description, optional, is a long description of the group
:class:`OptionGroup` inherits from :class:`OptionContainer` (like
:class:`OptionParser`) and so the :meth:`add_option` method can be used to add
an option to the group. | :class:`OptionParser` instance the group will be inserted in to * title is the group title * description, optional, is a long description of the group
:class:`OptionGroup` inherits from :class:`OptionContainer` (like
:class:`OptionParser`) and so the :meth:`add_option` method can be used to add
an option to the group. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0adfd05-e99f-4fde-b17a-cb587949f44b | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,251 | supabase-export-v2 | 9738a878b0808dbc | first encounters this option on the command-line. If :attr:`~Option.nargs` > 1, multiple arguments are consumed, and a tuple of length :attr:`~Option.nargs` is appended to :attr:`~Option.dest`.
The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same as
for the ``"store"`` action. | trusted_official_docs | CPython Docs | first encounters this option on the command-line. If :attr:`~Option.nargs` > 1, multiple arguments are consumed, and a tuple of length :attr:`~Option.nargs` is appended to :attr:`~Option.dest`.
The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same as
for the ``"store"`` action. | first encounters this option on the command-line. If :attr:`~Option.nargs` > 1, multiple arguments are consumed, and a tuple of length :attr:`~Option.nargs` is appended to :attr:`~Option.dest`.
The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same as
for the ``"store"`` action. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0cb4f20-781e-4655-98de-e36d3a321b29 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 48,980 | supabase-export-v2 | e6afd2f63dcbd109 | is a command-line, a configuration file, or a GUI: if you make that many demands on your users, most of them will simply give up.
In short, try to minimize the amount of information that users are absolutely
required to supply---use sensible defaults whenever possible. Of course, you
also want to make your programs rea... | trusted_official_docs | CPython Docs | is a command-line, a configuration file, or a GUI: if you make that many demands on your users, most of them will simply give up.
In short, try to minimize the amount of information that users are absolutely
required to supply---use sensible defaults whenever possible. Of course, you
also want to make your programs rea... | is a command-line, a configuration file, or a GUI: if you make that many demands on your users, most of them will simply give up.
In short, try to minimize the amount of information that users are absolutely
required to supply---use sensible defaults whenever possible. Of course, you
also want to make your programs rea... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f10a030a-1c55-4afa-8349-6a8e1550fc74 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,420 | supabase-export-v2 | d3e268866e693a8d | 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::
def check_moon(option, opt_str, value, parser):
if is_moon_full():
raise OptionValueError("%s option invalid when moon is full"
% opt_str)
setattr(parser.values, option.dest, 1)
.... | trusted_official_docs | CPython Docs | 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::
def check_moon(option, opt_str, value, parser):
if is_moon_full():
raise OptionValueError("%s option invalid when moon is full"
% opt_str)
setattr(parser.values, option.dest, 1)
.... | 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::
def check_moon(option, opt_str, value, parser):
if is_moon_full():
raise OptionValueError("%s option invalid when moon is full"
% opt_str)
setattr(parser.values, option.dest, 1)
.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f160ed3d-cdb0-4ade-a581-ba04339d265a | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,001 | supabase-export-v2 | 35d221c61a50c118 | Understanding option actions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Actions tell :mod:`!optparse` what to do when it encounters an option on the
command line. There is a fixed set of actions hard-coded into :mod:`!optparse`;
adding new actions is an advanced topic covered in section
:ref:`optparse-extending-optparse`. Most actio... | trusted_official_docs | CPython Docs | Understanding option actions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Actions tell :mod:`!optparse` what to do when it encounters an option on the
command line. There is a fixed set of actions hard-coded into :mod:`!optparse`;
adding new actions is an advanced topic covered in section
:ref:`optparse-extending-optparse`. Most actio... | Understanding option actions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Actions tell :mod:`!optparse` what to do when it encounters an option on the
command line. There is a fixed set of actions hard-coded into :mod:`!optparse`;
adding new actions is an advanced topic covered in section
:ref:`optparse-extending-optparse`. Most actio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1c1d320-4afa-42d6-af99-e5af30f2aeb6 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,402 | supabase-export-v2 | 4974624bd987fb4b | Raising errors in a callback ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The callback function should raise :exc:`OptionValueError` if there are any
problems with the option or its argument(s). :mod:`!optparse` catches this and
terminates the program, printing the error message you supply to stderr. Your
message should be clear, conc... | trusted_official_docs | CPython Docs | Raising errors in a callback ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The callback function should raise :exc:`OptionValueError` if there are any
problems with the option or its argument(s). :mod:`!optparse` catches this and
terminates the program, printing the error message you supply to stderr. Your
message should be clear, conc... | Raising errors in a callback ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The callback function should raise :exc:`OptionValueError` if there are any
problems with the option or its argument(s). :mod:`!optparse` catches this and
terminates the program, printing the error message you supply to stderr. Your
message should be clear, conc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f4386fef-8f78-4720-91e0-f3ab036cd866 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,130 | supabase-export-v2 | 4f707761197f6d38 | Here's what :mod:`!optparse`\ -based scripts usually look like::
from optparse import OptionParser
... def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option("-f", "--file", dest="filename",
help="read data from FILENAME")
parser.add_option("-v", "--verbose",
action="stor... | trusted_official_docs | CPython Docs | Here's what :mod:`!optparse`\ -based scripts usually look like::
from optparse import OptionParser
... def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option("-f", "--file", dest="filename",
help="read data from FILENAME")
parser.add_option("-v", "--verbose",
action="stor... | Here's what :mod:`!optparse`\ -based scripts usually look like::
from optparse import OptionParser
... def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option("-f", "--file", dest="filename",
help="read data from FILENAME")
parser.add_option("-v", "--verbose",
action="stor... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5a9c18d-4579-4ed2-acb2-b625d2a0bf9c | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 48,966 | supabase-export-v2 | 2af6d5f2ad4615fb | the phrase "required option" is self-contradictory in English. :mod:`!optparse` doesn't prevent you from implementing required options, but doesn't give you much help at it either.
For example, consider this hypothetical command-line:: | trusted_official_docs | CPython Docs | the phrase "required option" is self-contradictory in English. :mod:`!optparse` doesn't prevent you from implementing required options, but doesn't give you much help at it either.
For example, consider this hypothetical command-line:: | the phrase "required option" is self-contradictory in English. :mod:`!optparse` doesn't prevent you from implementing required options, but doesn't give you much help at it either.
For example, consider this hypothetical command-line:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f681b61e-cb47-4211-b03c-405773d2d117 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,108 | supabase-export-v2 | 3dd0d5dea25941f6 | .. method:: OptionParser.print_version(file=None)
Print the version message for the current program (``self.version``) to
*file* (default stdout). As with :meth:`print_usage`, any occurrence
of ``%prog`` in ``self.version`` is replaced with the name of the current
program. Does nothing if ``self.version`` is empty o... | trusted_official_docs | CPython Docs | .. method:: OptionParser.print_version(file=None)
Print the version message for the current program (``self.version``) to
*file* (default stdout). As with :meth:`print_usage`, any occurrence
of ``%prog`` in ``self.version`` is replaced with the name of the current
program. Does nothing if ``self.version`` is empty o... | .. method:: OptionParser.print_version(file=None)
Print the version message for the current program (``self.version``) to
*file* (default stdout). As with :meth:`print_usage`, any occurrence
of ``%prog`` in ``self.version`` is replaced with the name of the current
program. Does nothing if ``self.version`` is empty o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6c909da-e6d5-4d72-821a-6495a05386bb | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,026 | supabase-export-v2 | 38cf4ca069b2ac3e | 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.)
When :mod:`!optparse` encounters ``-v`` on the command line, it sets
``options.verbose`` to ``True``; when it encounters ``-q``,
``options.verbose`` is set to ``False... | trusted_official_docs | CPython Docs | 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.)
When :mod:`!optparse` encounters ``-v`` on the command line, it sets
``options.verbose`` to ``True``; when it encounters ``-q``,
``options.verbose`` is set to ``False... | 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.)
When :mod:`!optparse` encounters ``-v`` on the command line, it sets
``options.verbose`` to ``True``; when it encounters ``-q``,
``options.verbose`` is set to ``False... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f7ce4b1e-ae86-4ff8-a3d2-36b4a1f6640d | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,481 | supabase-export-v2 | 4f7f931b395a3d73 | The only effect of this is that :mod:`!optparse` assigns the default type, ``"string"``, to options with no explicit type whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`.
In order to actually implement your new action, you must override Option's
:meth:`take_action` method and add a case that recognizes your acti... | trusted_official_docs | CPython Docs | The only effect of this is that :mod:`!optparse` assigns the default type, ``"string"``, to options with no explicit type whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`.
In order to actually implement your new action, you must override Option's
:meth:`take_action` method and add a case that recognizes your acti... | The only effect of this is that :mod:`!optparse` assigns the default type, ``"string"``, to options with no explicit type whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`.
In order to actually implement your new action, you must override Option's
:meth:`take_action` method and add a case that recognizes your acti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f7d01e72-ccd1-4fff-82b0-8822fe717694 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,010 | supabase-export-v2 | edf0bcd4e1dc21df | args = ["-f", "foo.txt"] (options, args) = parser.parse_args(args)
When :mod:`!optparse` sees the option string ``-f``, it consumes the next
argument, ``foo.txt``, and stores it in ``options.filename``. So, after this
call to :meth:`~OptionParser.parse_args`, ``options.filename`` is ``"foo.txt"``. | trusted_official_docs | CPython Docs | args = ["-f", "foo.txt"] (options, args) = parser.parse_args(args)
When :mod:`!optparse` sees the option string ``-f``, it consumes the next
argument, ``foo.txt``, and stores it in ``options.filename``. So, after this
call to :meth:`~OptionParser.parse_args`, ``options.filename`` is ``"foo.txt"``. | args = ["-f", "foo.txt"] (options, args) = parser.parse_args(args)
When :mod:`!optparse` sees the option string ``-f``, it consumes the next
argument, ``foo.txt``, and stores it in ``options.filename``. So, after this
call to :meth:`~OptionParser.parse_args`, ``options.filename`` is ``"foo.txt"``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9220181-7d1a-4d29-92a0-6cd7e5935a1d | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,115 | supabase-export-v2 | 362c4ab7ff84f6cb | the end of the command line, where ``-n`` takes an argument of any type). Also, you can call :func:`OptionParser.error` to signal an application-defined error condition::
(options, args) = parser.parse_args()
... if options.a and options.b:
parser.error("options -a and -b are mutually exclusive") | trusted_official_docs | CPython Docs | the end of the command line, where ``-n`` takes an argument of any type). Also, you can call :func:`OptionParser.error` to signal an application-defined error condition::
(options, args) = parser.parse_args()
... if options.a and options.b:
parser.error("options -a and -b are mutually exclusive") | the end of the command line, where ``-n`` takes an argument of any type). Also, you can call :func:`OptionParser.error` to signal an application-defined error condition::
(options, args) = parser.parse_args()
... if options.a and options.b:
parser.error("options -a and -b are mutually exclusive") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fa08fc73-90d0-4eb1-a219-0657458f01f1 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,357 | supabase-export-v2 | 17cee7dc79baa10c | .. method:: OptionParser.set_usage(usage)
Set the usage string according to the rules described above for the ``usage``
constructor keyword argument. Passing ``None`` sets the default usage
string; use :const:`optparse.SUPPRESS_USAGE` to suppress a usage message. | trusted_official_docs | CPython Docs | .. method:: OptionParser.set_usage(usage)
Set the usage string according to the rules described above for the ``usage``
constructor keyword argument. Passing ``None`` sets the default usage
string; use :const:`optparse.SUPPRESS_USAGE` to suppress a usage message. | .. method:: OptionParser.set_usage(usage)
Set the usage string according to the rules described above for the ``usage``
constructor keyword argument. Passing ``None`` sets the default usage
string; use :const:`optparse.SUPPRESS_USAGE` to suppress a usage message. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc3ec766-079f-4a68-9008-5dbc6f835755 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,040 | supabase-export-v2 | 908d95ee00ec8f68 | parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose")
Since default values apply to the *destination* rather than to any particular
option, and these two options happen to have the same destination, this is
exactly equivalent:: | trusted_official_docs | CPython Docs | parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose")
Since default values apply to the *destination* rather than to any particular
option, and these two options happen to have the same destination, this is
exactly equivalent:: | parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose")
Since default values apply to the *destination* rather than to any particular
option, and these two options happen to have the same destination, this is
exactly equivalent:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fcf8f1eb-7791-487b-b8e7-938fce8794df | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,083 | supabase-export-v2 | 61bde5f7dd4c3a1d | --quiet be vewwy quiet (I'm hunting wabbits) -f FILE, --filename=FILE write output to FILE -m MODE, --mode=MODE interaction mode: novice, intermediate, or expert [default: intermediate]
Dangerous Options:
Caution: use these options at your own risk. It is believed that some
of them bite. | trusted_official_docs | CPython Docs | --quiet be vewwy quiet (I'm hunting wabbits) -f FILE, --filename=FILE write output to FILE -m MODE, --mode=MODE interaction mode: novice, intermediate, or expert [default: intermediate]
Dangerous Options:
Caution: use these options at your own risk. It is believed that some
of them bite. | --quiet be vewwy quiet (I'm hunting wabbits) -f FILE, --filename=FILE write output to FILE -m MODE, --mode=MODE interaction mode: novice, intermediate, or expert [default: intermediate]
Dangerous Options:
Caution: use these options at your own risk. It is believed that some
of them bite. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fd33b09c-1bab-4b8a-986f-99aec7362c95 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 48,956 | supabase-export-v2 | e1e990092e0e6aa1 | hyphen followed by a whole word, e.g. ``-file`` (this is technically equivalent to the previous syntax, but they aren't usually seen in the same program)
* a plus sign followed by a single letter, or a few letters, or a word, e.g. ``+f``, ``+rgb`` | trusted_official_docs | CPython Docs | hyphen followed by a whole word, e.g. ``-file`` (this is technically equivalent to the previous syntax, but they aren't usually seen in the same program)
* a plus sign followed by a single letter, or a few letters, or a word, e.g. ``+f``, ``+rgb`` | hyphen followed by a whole word, e.g. ``-file`` (this is technically equivalent to the previous syntax, but they aren't usually seen in the same program)
* a plus sign followed by a single letter, or a few letters, or a word, e.g. ``+f``, ``+rgb`` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fdb7b7c9-6192-4b56-9909-72d1920b1cca | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,091 | supabase-export-v2 | bfe3858356637fdd | Usage: <yourscript> [options] arg1 arg2
Options:
-h, --help show this help message and exit
-v, --verbose make lots of noise [default]
-q, --quiet be vewwy quiet (I'm hunting wabbits)
-f FILE, --filename=FILE
write output to FILE
-m MODE, --mode=MODE interaction mode: novice, intermediate, or expert
[default: in... | trusted_official_docs | CPython Docs | Usage: <yourscript> [options] arg1 arg2
Options:
-h, --help show this help message and exit
-v, --verbose make lots of noise [default]
-q, --quiet be vewwy quiet (I'm hunting wabbits)
-f FILE, --filename=FILE
write output to FILE
-m MODE, --mode=MODE interaction mode: novice, intermediate, or expert
[default: in... | Usage: <yourscript> [options] arg1 arg2
Options:
-h, --help show this help message and exit
-v, --verbose make lots of noise [default]
-q, --quiet be vewwy quiet (I'm hunting wabbits)
-f FILE, --filename=FILE
write output to FILE
-m MODE, --mode=MODE interaction mode: novice, intermediate, or expert
[default: in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
feb6b600-6cc3-4fd7-bf1b-6f6aa5778687 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,425 | supabase-export-v2 | 9e36b01a17fe7620 | :attr:`~Option.type`, then the option takes one argument that must be convertible to that type; if you further define :attr:`~Option.nargs`, then the option takes :attr:`~Option.nargs` arguments.
Here's an example that just emulates the standard ``"store"`` action:: | trusted_official_docs | CPython Docs | :attr:`~Option.type`, then the option takes one argument that must be convertible to that type; if you further define :attr:`~Option.nargs`, then the option takes :attr:`~Option.nargs` arguments.
Here's an example that just emulates the standard ``"store"`` action:: | :attr:`~Option.type`, then the option takes one argument that must be convertible to that type; if you further define :attr:`~Option.nargs`, then the option takes :attr:`~Option.nargs` arguments.
Here's an example that just emulates the standard ``"store"`` action:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff28f9d7-fd22-4067-8706-c851f08547f0 | CPython Docs | file://datasets/cpython/Doc/library/optparse.rst | unknown | fb35db8d-6782-49dd-8f4e-89244d3635e0 | 49,346 | supabase-export-v2 | e7fadd4d015dd0f9 | Now ``--dry-run`` is the only way for the user to activate that option. If the user asks for help, the help message will reflect that::
Options:
--dry-run do no harm
... -n, --noisy be noisy | trusted_official_docs | CPython Docs | Now ``--dry-run`` is the only way for the user to activate that option. If the user asks for help, the help message will reflect that::
Options:
--dry-run do no harm
... -n, --noisy be noisy | Now ``--dry-run`` is the only way for the user to activate that option. If the user asks for help, the help message will reflect that::
Options:
--dry-run do no harm
... -n, --noisy be noisy | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
044d4b8d-57df-46b3-a008-a924cc56ea27 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,578 | supabase-export-v2 | 0ae4cfe9861512c3 | class TurtleShell(cmd.Cmd): intro = 'Welcome to the turtle shell. Type help or ? to list commands.\n' prompt = '(turtle) ' file = None
# ----- basic turtle commands -----
def do_forward(self, arg):
'Move the turtle forward by the specified distance: FORWARD 10'
forward(*parse(arg))
def do_right(self, arg):
'Turn t... | trusted_official_docs | CPython Docs | class TurtleShell(cmd.Cmd): intro = 'Welcome to the turtle shell. Type help or ? to list commands.\n' prompt = '(turtle) ' file = None
# ----- basic turtle commands -----
def do_forward(self, arg):
'Move the turtle forward by the specified distance: FORWARD 10'
forward(*parse(arg))
def do_right(self, arg):
'Turn t... | class TurtleShell(cmd.Cmd): intro = 'Welcome to the turtle shell. Type help or ? to list commands.\n' prompt = '(turtle) ' file = None
# ----- basic turtle commands -----
def do_forward(self, arg):
'Move the turtle forward by the specified distance: FORWARD 10'
forward(*parse(arg))
def do_right(self, arg):
'Turn t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0c3a4ba5-976b-4b6a-ad0d-f6ade9ea1ba6 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,512 | supabase-export-v2 | 5630b689d7a71941 | writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface.
.. class:: Cmd(completekey='tab', stdin=None, stdout=None) | trusted_official_docs | CPython Docs | writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface.
.. class:: Cmd(completekey='tab', stdin=None, stdout=None) | writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface.
.. class:: Cmd(completekey='tab', stdin=None, stdout=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a5c3e62-8d29-4938-aa99-e439bfa47aa0 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,511 | supabase-export-v2 | dd0571e390c411f9 | --------------
The :class:`Cmd` class provides a simple framework for writing line-oriented
command interpreters. These are often useful for test harnesses, administrative
tools, and prototypes that will later be wrapped in a more sophisticated
interface. | trusted_official_docs | CPython Docs | --------------
The :class:`Cmd` class provides a simple framework for writing line-oriented
command interpreters. These are often useful for test harnesses, administrative
tools, and prototypes that will later be wrapped in a more sophisticated
interface. | --------------
The :class:`Cmd` class provides a simple framework for writing line-oriented
command interpreters. These are often useful for test harnesses, administrative
tools, and prototypes that will later be wrapped in a more sophisticated
interface. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20810df4-0fd0-4b3c-9237-236f23372388 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,591 | supabase-export-v2 | 3892ec34ac5dbdc5 | 80 (turtle) right 30 (turtle) circle 100 (turtle) right 30 (turtle) circle 120 (turtle) right 30 (turtle) circle 120 (turtle) heading Current heading is 180
(turtle) forward 100
(turtle)
(turtle) right 90
(turtle) forward 100
(turtle)
(turtle) right 90
(turtle) forward 400
(turtle) right 90
(turtle) forward 500... | trusted_official_docs | CPython Docs | 80 (turtle) right 30 (turtle) circle 100 (turtle) right 30 (turtle) circle 120 (turtle) right 30 (turtle) circle 120 (turtle) heading Current heading is 180
(turtle) forward 100
(turtle)
(turtle) right 90
(turtle) forward 100
(turtle)
(turtle) right 90
(turtle) forward 400
(turtle) right 90
(turtle) forward 500... | 80 (turtle) right 30 (turtle) circle 100 (turtle) right 30 (turtle) circle 120 (turtle) right 30 (turtle) circle 120 (turtle) heading Current heading is 180
(turtle) forward 100
(turtle)
(turtle) right 90
(turtle) forward 100
(turtle)
(turtle) right 90
(turtle) forward 400
(turtle) right 90
(turtle) forward 500... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ac98d22-3553-4287-ae28-0a58a98dbe03 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,517 | supabase-export-v2 | 2bd83898a361163b | file objects that the Cmd instance or subclass instance will use for input and output. If not specified, they will default to :data:`sys.stdin` and :data:`sys.stdout`.
If you want a given *stdin* to be used, make sure to set the instance's
:attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be
ignored... | trusted_official_docs | CPython Docs | file objects that the Cmd instance or subclass instance will use for input and output. If not specified, they will default to :data:`sys.stdin` and :data:`sys.stdout`.
If you want a given *stdin* to be used, make sure to set the instance's
:attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be
ignored... | file objects that the Cmd instance or subclass instance will use for input and output. If not specified, they will default to :data:`sys.stdin` and :data:`sys.stdout`.
If you want a given *stdin* to be used, make sure to set the instance's
:attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be
ignored... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c22c8a5-782d-4497-b663-10e40a2a3b60 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,575 | supabase-export-v2 | 5bcd07190fa5a714 | The argument is converted to a number and dispatched to the turtle module. The docstring is used in the help utility provided by the shell.
The example also includes a basic record and playback facility implemented with
the :meth:`~Cmd.precmd` method which is responsible for converting the input to
lowercase and writin... | trusted_official_docs | CPython Docs | The argument is converted to a number and dispatched to the turtle module. The docstring is used in the help utility provided by the shell.
The example also includes a basic record and playback facility implemented with
the :meth:`~Cmd.precmd` method which is responsible for converting the input to
lowercase and writin... | The argument is converted to a number and dispatched to the turtle module. The docstring is used in the help utility provided by the shell.
The example also includes a basic record and playback facility implemented with
the :meth:`~Cmd.precmd` method which is responsible for converting the input to
lowercase and writin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
39364f72-76b0-4f0d-8f4f-f47e4a6ed7c2 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,524 | supabase-export-v2 | 2f085d1b4491197e | The optional argument is a banner or intro string to be issued before the first prompt (this overrides the :attr:`intro` class attribute).
If the :mod:`readline` module is loaded, input will automatically inherit
:program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back
to the last command, :kbd... | trusted_official_docs | CPython Docs | The optional argument is a banner or intro string to be issued before the first prompt (this overrides the :attr:`intro` class attribute).
If the :mod:`readline` module is loaded, input will automatically inherit
:program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back
to the last command, :kbd... | The optional argument is a banner or intro string to be issued before the first prompt (this overrides the :attr:`intro` class attribute).
If the :mod:`readline` module is loaded, input will automatically inherit
:program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back
to the last command, :kbd... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
39d20fcc-8901-4b54-8577-8b1a9e0555a5 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,558 | supabase-export-v2 | b55f732f43834c95 | .. attribute:: Cmd.cmdqueue
A list of queued input lines. The cmdqueue list is checked in
:meth:`cmdloop` when new input is needed; if it is nonempty, its elements
will be processed in order, as if entered at the prompt. | trusted_official_docs | CPython Docs | .. attribute:: Cmd.cmdqueue
A list of queued input lines. The cmdqueue list is checked in
:meth:`cmdloop` when new input is needed; if it is nonempty, its elements
will be processed in order, as if entered at the prompt. | .. attribute:: Cmd.cmdqueue
A list of queued input lines. The cmdqueue list is checked in
:meth:`cmdloop` when new input is needed; if it is nonempty, its elements
will be processed in order, as if entered at the prompt. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e7cf46e-ce6b-442e-9a5c-13ed88717e51 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,573 | supabase-export-v2 | 396efda4fd1e6984 | The :mod:`!cmd` module is mainly useful for building custom shells that let a user work with a program interactively.
This section presents a simple example of how to build a shell around a few of
the commands in the :mod:`turtle` module. | trusted_official_docs | CPython Docs | The :mod:`!cmd` module is mainly useful for building custom shells that let a user work with a program interactively.
This section presents a simple example of how to build a shell around a few of
the commands in the :mod:`turtle` module. | The :mod:`!cmd` module is mainly useful for building custom shells that let a user work with a program interactively.
This section presents a simple example of how to build a shell around a few of
the commands in the :mod:`turtle` module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3ece8493-3071-45dd-a4e0-22693bfe0e05 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,513 | supabase-export-v2 | 3ea54f5d27e6d586 | .. class:: Cmd(completekey='tab', stdin=None, stdout=None)
A :class:`Cmd` instance or subclass instance is a line-oriented interpreter
framework. There is no good reason to instantiate :class:`Cmd` itself; rather,
it's useful as a superclass of an interpreter class you define yourself in order
to inherit :class:`Cmd... | trusted_official_docs | CPython Docs | .. class:: Cmd(completekey='tab', stdin=None, stdout=None)
A :class:`Cmd` instance or subclass instance is a line-oriented interpreter
framework. There is no good reason to instantiate :class:`Cmd` itself; rather,
it's useful as a superclass of an interpreter class you define yourself in order
to inherit :class:`Cmd... | .. class:: Cmd(completekey='tab', stdin=None, stdout=None)
A :class:`Cmd` instance or subclass instance is a line-oriented interpreter
framework. There is no good reason to instantiate :class:`Cmd` itself; rather,
it's useful as a superclass of an interpreter class you define yourself in order
to inherit :class:`Cmd... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b29856f-699a-4086-9008-c6d03f2e74b9 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,577 | supabase-export-v2 | f2865dffed0b9545 | import cmd, sys from turtle import *
class TurtleShell(cmd.Cmd):
intro = 'Welcome to the turtle shell. Type help or ? to list commands.\n'
prompt = '(turtle) '
file = None | trusted_official_docs | CPython Docs | import cmd, sys from turtle import *
class TurtleShell(cmd.Cmd):
intro = 'Welcome to the turtle shell. Type help or ? to list commands.\n'
prompt = '(turtle) '
file = None | import cmd, sys from turtle import *
class TurtleShell(cmd.Cmd):
intro = 'Welcome to the turtle shell. Type help or ? to list commands.\n'
prompt = '(turtle) '
file = None | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fc5ec10-7dcc-4490-b00a-d5180aad278f | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,527 | supabase-export-v2 | 05843230e5d567ae | .. index:: single: ? (question mark); in a command interpreter single: ! (exclamation); in a command interpreter
An interpreter instance will recognize a command name ``foo`` if and only if it
has a method :meth:`!do_foo`. As a special case, a line beginning with the
character ``'?'`` is dispatched to the method :met... | trusted_official_docs | CPython Docs | .. index:: single: ? (question mark); in a command interpreter single: ! (exclamation); in a command interpreter
An interpreter instance will recognize a command name ``foo`` if and only if it
has a method :meth:`!do_foo`. As a special case, a line beginning with the
character ``'?'`` is dispatched to the method :met... | .. index:: single: ? (question mark); in a command interpreter single: ! (exclamation); in a command interpreter
An interpreter instance will recognize a command name ``foo`` if and only if it
has a method :meth:`!do_foo`. As a special case, a line beginning with the
character ``'?'`` is dispatched to the method :met... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5aea65b5-306c-4c8f-bbc0-2ad93cfd9a78 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,518 | supabase-export-v2 | 7def73fb14eeed7c | If you want a given *stdin* to be used, make sure to set the instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be ignored.
.. versionchanged:: 3.13
``completekey='tab'`` is replaced by ``'^I'`` for ``editline``. | trusted_official_docs | CPython Docs | If you want a given *stdin* to be used, make sure to set the instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be ignored.
.. versionchanged:: 3.13
``completekey='tab'`` is replaced by ``'^I'`` for ``editline``. | If you want a given *stdin* to be used, make sure to set the instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be ignored.
.. versionchanged:: 3.13
``completekey='tab'`` is replaced by ``'^I'`` for ``editline``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
721a6e13-e859-499c-bd80-7ffdacc724ba | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,538 | supabase-export-v2 | de6c0a5b3bec1d03 | called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns.
.. method:: Cmd.completedefault(text, line, begidx, endidx) | trusted_official_docs | CPython Docs | called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns.
.. method:: Cmd.completedefault(text, line, begidx, endidx) | called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns.
.. method:: Cmd.completedefault(text, line, begidx, endidx) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e8bd75f-144e-48c3-b69a-0e1803c54ee9 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,580 | supabase-export-v2 | 631889f98e3e99ff | to center: RESET' reset() def do_bye(self, arg): 'Stop recording, close the turtle window, and exit: BYE' print('Thank you for using Turtle') self.close() bye() return True
# ----- record and playback -----
def do_record(self, arg):
'Save future commands to filename: RECORD rose.cmd'
self.file = open(arg, 'w')
def ... | trusted_official_docs | CPython Docs | to center: RESET' reset() def do_bye(self, arg): 'Stop recording, close the turtle window, and exit: BYE' print('Thank you for using Turtle') self.close() bye() return True
# ----- record and playback -----
def do_record(self, arg):
'Save future commands to filename: RECORD rose.cmd'
self.file = open(arg, 'w')
def ... | to center: RESET' reset() def do_bye(self, arg): 'Stop recording, close the turtle window, and exit: BYE' print('Thank you for using Turtle') self.close() bye() return True
# ----- record and playback -----
def do_record(self, arg):
'Save future commands to filename: RECORD rose.cmd'
self.file = open(arg, 'w')
def ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80a74cde-0ffd-4cd2-ab0a-8410be7c68af | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,525 | supabase-export-v2 | a6cb8bbea2df67d6 | last command, :kbd:`Control-N` forward to the next one, :kbd:`Control-F` moves the cursor to the right non-destructively, :kbd:`Control-B` moves the cursor to the left non-destructively, etc.).
An end-of-file on input is passed back as the string ``'EOF'``. | trusted_official_docs | CPython Docs | last command, :kbd:`Control-N` forward to the next one, :kbd:`Control-F` moves the cursor to the right non-destructively, :kbd:`Control-B` moves the cursor to the left non-destructively, etc.).
An end-of-file on input is passed back as the string ``'EOF'``. | last command, :kbd:`Control-N` forward to the next one, :kbd:`Control-F` moves the cursor to the right non-destructively, :kbd:`Control-B` moves the cursor to the left non-destructively, etc.).
An end-of-file on input is passed back as the string ``'EOF'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
81a7719c-749a-49b0-a9e9-ad931b6ad044 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,576 | supabase-export-v2 | faa21d63eb9a88d2 | lowercase and writing the commands to a file. The :meth:`!do_playback` method reads the file and adds the recorded commands to the :attr:`~Cmd.cmdqueue` for immediate playback::
import cmd, sys
from turtle import * | trusted_official_docs | CPython Docs | lowercase and writing the commands to a file. The :meth:`!do_playback` method reads the file and adds the recorded commands to the :attr:`~Cmd.cmdqueue` for immediate playback::
import cmd, sys
from turtle import * | lowercase and writing the commands to a file. The :meth:`!do_playback` method reads the file and adds the recorded commands to the :attr:`~Cmd.cmdqueue` for immediate playback::
import cmd, sys
from turtle import * | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84f87c9d-c4e5-434a-9ac5-9e8c5baa8d6e | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,588 | supabase-export-v2 | 6e8c44764769162e | Documented commands (type help <topic>): ======================================== bye color goto home playback record right circle forward heading left position reset undo
(turtle) help forward
Move the turtle forward by the specified distance: FORWARD 10
(turtle) record spiral.cmd
(turtle) position
Current positio... | trusted_official_docs | CPython Docs | Documented commands (type help <topic>): ======================================== bye color goto home playback record right circle forward heading left position reset undo
(turtle) help forward
Move the turtle forward by the specified distance: FORWARD 10
(turtle) record spiral.cmd
(turtle) position
Current positio... | Documented commands (type help <topic>): ======================================== bye color goto home playback record right circle forward heading left position reset undo
(turtle) help forward
Move the turtle forward by the specified distance: FORWARD 10
(turtle) record spiral.cmd
(turtle) position
Current positio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
890a14ee-dfa1-4f64-b147-47a0a52ea6b5 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,533 | supabase-export-v2 | 0e5f578c20a4ce91 | .. method:: Cmd.onecmd(str)
Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the
:meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. The
return value is a flag indicating whether interpretation of commands ... | trusted_official_docs | CPython Docs | .. method:: Cmd.onecmd(str)
Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the
:meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. The
return value is a flag indicating whether interpretation of commands ... | .. method:: Cmd.onecmd(str)
Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the
:meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. The
return value is a flag indicating whether interpretation of commands ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b090b4e-0909-4838-928d-ed9645488fbc | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,574 | supabase-export-v2 | a9a436a300d9b14e | This section presents a simple example of how to build a shell around a few of the commands in the :mod:`turtle` module.
Basic turtle commands such as :meth:`~turtle.forward` are added to a
:class:`Cmd` subclass with method named :meth:`!do_forward`. The argument is
converted to a number and dispatched to the turtle mo... | trusted_official_docs | CPython Docs | This section presents a simple example of how to build a shell around a few of the commands in the :mod:`turtle` module.
Basic turtle commands such as :meth:`~turtle.forward` are added to a
:class:`Cmd` subclass with method named :meth:`!do_forward`. The argument is
converted to a number and dispatched to the turtle mo... | This section presents a simple example of how to build a shell around a few of the commands in the :mod:`turtle` module.
Basic turtle commands such as :meth:`~turtle.forward` are added to a
:class:`Cmd` subclass with method named :meth:`!do_forward`. The argument is
converted to a number and dispatched to the turtle mo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d80fd9d-25ab-4dc3-8148-58a3db9cb5f4 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,583 | supabase-export-v2 | 98ac9c1a0899d3bc | if __name__ == '__main__': TurtleShell().cmdloop()
Here is a sample session with the turtle shell showing the help functions, using
blank lines to repeat commands, and the simple record and playback facility: | trusted_official_docs | CPython Docs | if __name__ == '__main__': TurtleShell().cmdloop()
Here is a sample session with the turtle shell showing the help functions, using
blank lines to repeat commands, and the simple record and playback facility: | if __name__ == '__main__': TurtleShell().cmdloop()
Here is a sample session with the turtle shell showing the help functions, using
blank lines to repeat commands, and the simple record and playback facility: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90c25ae2-3cb8-4839-b1a2-4e162d6094e3 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,550 | supabase-export-v2 | c831685ac471c2ba | Hook method executed once when :meth:`cmdloop` is about to return. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses.
Instances of :class:`Cmd` subclasses have some public instance variables: | trusted_official_docs | CPython Docs | Hook method executed once when :meth:`cmdloop` is about to return. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses.
Instances of :class:`Cmd` subclasses have some public instance variables: | Hook method executed once when :meth:`cmdloop` is about to return. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses.
Instances of :class:`Cmd` subclasses have some public instance variables: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9166574e-d5cb-4b01-b2cc-5921516f01e6 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,529 | supabase-export-v2 | f9049f8fe0181bc6 | will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the command's corresponding :meth:`!do_\*` method.
If completion is enabled, completing commands will be done automatically, and
completing of commands args is done by calling :meth:`!compl... | trusted_official_docs | CPython Docs | will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the command's corresponding :meth:`!do_\*` method.
If completion is enabled, completing commands will be done automatically, and
completing of commands args is done by calling :meth:`!compl... | will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the command's corresponding :meth:`!do_\*` method.
If completion is enabled, completing commands will be done automatically, and
completing of commands args is done by calling :meth:`!compl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
93c4350f-35dc-469b-bc2c-7b6daa0d6b04 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,541 | supabase-export-v2 | 5693abd0991bbb9a | .. method:: Cmd.columnize(list, displaywidth=80)
Method called to display a list of strings as a compact set of columns. Each column is only as wide as necessary. Columns are separated by two spaces for readability. | trusted_official_docs | CPython Docs | .. method:: Cmd.columnize(list, displaywidth=80)
Method called to display a list of strings as a compact set of columns. Each column is only as wide as necessary. Columns are separated by two spaces for readability. | .. method:: Cmd.columnize(list, displaywidth=80)
Method called to display a list of strings as a compact set of columns. Each column is only as wide as necessary. Columns are separated by two spaces for readability. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9445895a-8eef-4d29-becd-7bf09a9c9d15 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,522 | supabase-export-v2 | 67702492012d7e2e | .. method:: Cmd.cmdloop(intro=None)
Repeatedly issue a prompt, accept input, parse an initial prefix off the
received input, and dispatch to action methods, passing them the remainder of
the line as argument. | trusted_official_docs | CPython Docs | .. method:: Cmd.cmdloop(intro=None)
Repeatedly issue a prompt, accept input, parse an initial prefix off the
received input, and dispatch to action methods, passing them the remainder of
the line as argument. | .. method:: Cmd.cmdloop(intro=None)
Repeatedly issue a prompt, accept input, parse an initial prefix off the
received input, and dispatch to action methods, passing them the remainder of
the line as argument. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b25adf82-9de7-4779-bbb7-065555efbdab | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,581 | supabase-export-v2 | 6ff0a4d586d24bff | def precmd(self, line): line = line.lower() if self.file and 'playback' not in line: print(line, file=self.file) return line def close(self): if self.file: self.file.close() self.file = None
def parse(arg):
'Convert a series of zero or more numbers to an argument tuple'
return tuple(map(int, arg.split())) | trusted_official_docs | CPython Docs | def precmd(self, line): line = line.lower() if self.file and 'playback' not in line: print(line, file=self.file) return line def close(self): if self.file: self.file.close() self.file = None
def parse(arg):
'Convert a series of zero or more numbers to an argument tuple'
return tuple(map(int, arg.split())) | def precmd(self, line): line = line.lower() if self.file and 'playback' not in line: print(line, file=self.file) return line def close(self): if self.file: self.file.close() self.file = None
def parse(arg):
'Convert a series of zero or more numbers to an argument tuple'
return tuple(map(int, arg.split())) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b52073db-fbcf-46e4-a67b-9e54c4fdd17d | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,528 | supabase-export-v2 | aaa2c3644d7f68dc | method :meth:`do_help`. As another special case, a line beginning with the character ``'!'`` is dispatched to the method :meth:`!do_shell` (if such a method is defined).
This method will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the comm... | trusted_official_docs | CPython Docs | method :meth:`do_help`. As another special case, a line beginning with the character ``'!'`` is dispatched to the method :meth:`!do_shell` (if such a method is defined).
This method will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the comm... | method :meth:`do_help`. As another special case, a line beginning with the character ``'!'`` is dispatched to the method :meth:`!do_shell` (if such a method is defined).
This method will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the comm... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b9db2422-e515-4aab-a1c1-6b9879f876b0 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,543 | supabase-export-v2 | 74083c8bb8f9dfa4 | .. method:: Cmd.precmd(line)
Hook method executed just before the command line *line* is interpreted, but
after the input prompt is generated and issued. This method is a stub in
:class:`Cmd`; it exists to be overridden by subclasses. The return value is
used as the command which will be executed by the :meth:`onecm... | trusted_official_docs | CPython Docs | .. method:: Cmd.precmd(line)
Hook method executed just before the command line *line* is interpreted, but
after the input prompt is generated and issued. This method is a stub in
:class:`Cmd`; it exists to be overridden by subclasses. The return value is
used as the command which will be executed by the :meth:`onecm... | .. method:: Cmd.precmd(line)
Hook method executed just before the command line *line* is interpreted, but
after the input prompt is generated and issued. This method is a stub in
:class:`Cmd`; it exists to be overridden by subclasses. The return value is
used as the command which will be executed by the :meth:`onecm... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bea0b46f-8788-42b4-91f6-d8c097dbf5a7 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,515 | supabase-export-v2 | 36e5492da07ced8c | the :mod:`readline` name of a completion key; it defaults to :kbd:`Tab`. If *completekey* is not :const:`None` and :mod:`readline` is available, command completion is done automatically.
The default, ``'tab'``, is treated specially, so that it refers to the
:kbd:`Tab` key on every :data:`readline.backend`. Specificall... | trusted_official_docs | CPython Docs | the :mod:`readline` name of a completion key; it defaults to :kbd:`Tab`. If *completekey* is not :const:`None` and :mod:`readline` is available, command completion is done automatically.
The default, ``'tab'``, is treated specially, so that it refers to the
:kbd:`Tab` key on every :data:`readline.backend`. Specificall... | the :mod:`readline` name of a completion key; it defaults to :kbd:`Tab`. If *completekey* is not :const:`None` and :mod:`readline` is available, command completion is done automatically.
The default, ``'tab'``, is treated specially, so that it refers to the
:kbd:`Tab` key on every :data:`readline.backend`. Specificall... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c524cc68-9254-473b-b90c-13d53c106e82 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,516 | supabase-export-v2 | 9091be46ef72eb47 | ``editline``, ``Cmd`` will use ``'^I'`` instead of ``'tab'``. Note that other values are not treated this way, and might only work with a specific backend.
The optional arguments *stdin* and *stdout* specify the input and output file
objects that the Cmd instance or subclass instance will use for input and
output. If... | trusted_official_docs | CPython Docs | ``editline``, ``Cmd`` will use ``'^I'`` instead of ``'tab'``. Note that other values are not treated this way, and might only work with a specific backend.
The optional arguments *stdin* and *stdout* specify the input and output file
objects that the Cmd instance or subclass instance will use for input and
output. If... | ``editline``, ``Cmd`` will use ``'^I'`` instead of ``'tab'``. Note that other values are not treated this way, and might only work with a specific backend.
The optional arguments *stdin* and *stdout* specify the input and output file
objects that the Cmd instance or subclass instance will use for input and
output. If... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8addf31-5e23-497a-b857-6d34de3c798d | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,590 | supabase-export-v2 | aafe3abb68b5faa0 | (turtle) heading Current heading is 0
(turtle) reset
(turtle) circle 20
(turtle) right 30
(turtle) circle 40
(turtle) right 30
(turtle) circle 60
(turtle) right 30
(turtle) circle 80
(turtle) right 30
(turtle) circle 100
(turtle) right 30
(turtle) circle 120
(turtle) right 30
(turtle) circle 120
(turtle) ... | trusted_official_docs | CPython Docs | (turtle) heading Current heading is 0
(turtle) reset
(turtle) circle 20
(turtle) right 30
(turtle) circle 40
(turtle) right 30
(turtle) circle 60
(turtle) right 30
(turtle) circle 80
(turtle) right 30
(turtle) circle 100
(turtle) right 30
(turtle) circle 120
(turtle) right 30
(turtle) circle 120
(turtle) ... | (turtle) heading Current heading is 0
(turtle) reset
(turtle) circle 20
(turtle) right 30
(turtle) circle 40
(turtle) right 30
(turtle) circle 60
(turtle) right 30
(turtle) circle 80
(turtle) right 30
(turtle) circle 100
(turtle) right 30
(turtle) circle 120
(turtle) right 30
(turtle) circle 120
(turtle) ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8ca3b0b-a4da-41de-94b0-07d3f2c4c229 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,514 | supabase-export-v2 | 89260659d12022c6 | :class:`Cmd` itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit :class:`Cmd`'s methods and encapsulate action methods.
The optional argument *completekey* is the :mod:`readline` name of a completion
key; it defaults to :kbd:`Tab`. If *completekey* is not :const:... | trusted_official_docs | CPython Docs | :class:`Cmd` itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit :class:`Cmd`'s methods and encapsulate action methods.
The optional argument *completekey* is the :mod:`readline` name of a completion
key; it defaults to :kbd:`Tab`. If *completekey* is not :const:... | :class:`Cmd` itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit :class:`Cmd`'s methods and encapsulate action methods.
The optional argument *completekey* is the :mod:`readline` name of a completion
key; it defaults to :kbd:`Tab`. If *completekey* is not :const:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d0546556-d496-40e6-b0f2-f20647675ef0 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,545 | supabase-export-v2 | cc145c3c8d2f7216 | .. method:: Cmd.postcmd(stop, line)
Hook method executed just after a command dispatch is finished. This method is
a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* is the
command line which was executed, and *stop* is a flag which indicates whether
execution will be terminated after the call ... | trusted_official_docs | CPython Docs | .. method:: Cmd.postcmd(stop, line)
Hook method executed just after a command dispatch is finished. This method is
a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* is the
command line which was executed, and *stop* is a flag which indicates whether
execution will be terminated after the call ... | .. method:: Cmd.postcmd(stop, line)
Hook method executed just after a command dispatch is finished. This method is
a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* is the
command line which was executed, and *stop* is a flag which indicates whether
execution will be terminated after the call ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d2904065-1a01-4f38-890b-7c65890c437c | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,523 | supabase-export-v2 | b0315ec0e30114f0 | prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
The optional argument is a banner or intro string to be issued before the first
prompt (this overrides the :attr:`intro` class attribute). | trusted_official_docs | CPython Docs | prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
The optional argument is a banner or intro string to be issued before the first
prompt (this overrides the :attr:`intro` class attribute). | prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
The optional argument is a banner or intro string to be issued before the first
prompt (this overrides the :attr:`intro` class attribute). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dca6bb43-9219-4784-b316-b6a06252a134 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,579 | supabase-export-v2 | ba386d102817ac91 | do_left(self, arg): 'Turn turtle left by given number of degrees: LEFT 90' left(*parse(arg)) def do_goto(self, arg): 'Move turtle to an absolute position with changing orientation.
GOTO 100 200'
goto(*parse(arg))
def do_home(self, arg):
'Return turtle to the home position: HOME'
home()
def do_circle(self, arg):
'... | trusted_official_docs | CPython Docs | do_left(self, arg): 'Turn turtle left by given number of degrees: LEFT 90' left(*parse(arg)) def do_goto(self, arg): 'Move turtle to an absolute position with changing orientation.
GOTO 100 200'
goto(*parse(arg))
def do_home(self, arg):
'Return turtle to the home position: HOME'
home()
def do_circle(self, arg):
'... | do_left(self, arg): 'Turn turtle left by given number of degrees: LEFT 90' left(*parse(arg)) def do_goto(self, arg): 'Move turtle to an absolute position with changing orientation.
GOTO 100 200'
goto(*parse(arg))
def do_home(self, arg):
'Return turtle to the home position: HOME'
home()
def do_circle(self, arg):
'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ebce1ea8-157a-416e-8c81-b2a0409c5801 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,570 | supabase-export-v2 | db767e39069f9aa5 | .. attribute:: Cmd.use_rawinput
A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to
display a prompt and read the next command; if false, :data:`sys.stdout.write() <sys.stdout>`
and :data:`sys.stdin.readline() <sys.stdin>` are used. (This means that by importing
:mod:`readline`, on systems tha... | trusted_official_docs | CPython Docs | .. attribute:: Cmd.use_rawinput
A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to
display a prompt and read the next command; if false, :data:`sys.stdout.write() <sys.stdout>`
and :data:`sys.stdin.readline() <sys.stdin>` are used. (This means that by importing
:mod:`readline`, on systems tha... | .. attribute:: Cmd.use_rawinput
A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to
display a prompt and read the next command; if false, :data:`sys.stdout.write() <sys.stdout>`
and :data:`sys.stdin.readline() <sys.stdin>` are used. (This means that by importing
:mod:`readline`, on systems tha... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1539cda-aab5-4b97-a4a4-5a0b15c29c34 | CPython Docs | file://datasets/cpython/Doc/library/cmd.rst | unknown | b20cf7a0-9c38-47a6-87ad-041446ebd666 | 49,531 | supabase-export-v2 | 9ba71f9b0d21a97c | .. method:: Cmd.do_help(arg)
All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This
method, called with an argument ``'bar'``, invokes the corresponding method
:meth:`!help_bar`, and if that is not present, prints the docstring of
:meth:`!do_bar`, if available. With no argument, :meth:`!do_help` ... | trusted_official_docs | CPython Docs | .. method:: Cmd.do_help(arg)
All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This
method, called with an argument ``'bar'``, invokes the corresponding method
:meth:`!help_bar`, and if that is not present, prints the docstring of
:meth:`!do_bar`, if available. With no argument, :meth:`!do_help` ... | .. method:: Cmd.do_help(arg)
All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This
method, called with an argument ``'bar'``, invokes the corresponding method
:meth:`!help_bar`, and if that is not present, prints the docstring of
:meth:`!do_bar`, if available. With no argument, :meth:`!do_help` ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
138d51a4-6c11-4a0b-8e70-6c716a96f5ab | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,702 | supabase-export-v2 | 385217701497d457 | A barrier object. Not thread-safe.
A barrier is a simple synchronization primitive that allows to block until
*parties* number of tasks are waiting on it. Tasks can wait on the :meth:`~Barrier.wait` method and would be blocked until
the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point ... | trusted_official_docs | CPython Docs | A barrier object. Not thread-safe.
A barrier is a simple synchronization primitive that allows to block until
*parties* number of tasks are waiting on it. Tasks can wait on the :meth:`~Barrier.wait` method and would be blocked until
the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point ... | A barrier object. Not thread-safe.
A barrier is a simple synchronization primitive that allows to block until
*parties* number of tasks are waiting on it. Tasks can wait on the :meth:`~Barrier.wait` method and would be blocked until
the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
231f53ac-0629-46ab-8ebf-3ea84e7155e1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,680 | supabase-export-v2 | 6066cbf99edf2882 | *value* argument gives the initial value for the internal counter (``1`` by default). If the given value is less than ``0`` a :exc:`ValueError` is raised.
.. versionchanged:: 3.10
Removed the *loop* parameter. | trusted_official_docs | CPython Docs | *value* argument gives the initial value for the internal counter (``1`` by default). If the given value is less than ``0`` a :exc:`ValueError` is raised.
.. versionchanged:: 3.10
Removed the *loop* parameter. | *value* argument gives the initial value for the internal counter (``1`` by default). If the given value is less than ``0`` a :exc:`ValueError` is raised.
.. versionchanged:: 3.10
Removed the *loop* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
23f7eb38-ce91-4d9b-8dce-592f60d8c806 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,613 | supabase-export-v2 | 27256586109c3223 | This method waits until the lock is *unlocked*, sets it to *locked* and returns ``True``.
When more than one coroutine is blocked in :meth:`acquire`
waiting for the lock to be unlocked, only one coroutine
eventually proceeds. | trusted_official_docs | CPython Docs | This method waits until the lock is *unlocked*, sets it to *locked* and returns ``True``.
When more than one coroutine is blocked in :meth:`acquire`
waiting for the lock to be unlocked, only one coroutine
eventually proceeds. | This method waits until the lock is *unlocked*, sets it to *locked* and returns ``True``.
When more than one coroutine is blocked in :meth:`acquire`
waiting for the lock to be unlocked, only one coroutine
eventually proceeds. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ed92487-78ac-4719-a5bd-1a8e9fad23d7 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,675 | supabase-export-v2 | 60a5916aaf4108c6 | Wait until a predicate becomes *true*.
The predicate must be a callable which result will be
interpreted as a boolean value. The method will repeatedly
:meth:`~Condition.wait` until the predicate evaluates to *true*. The final value is the
return value. | trusted_official_docs | CPython Docs | Wait until a predicate becomes *true*.
The predicate must be a callable which result will be
interpreted as a boolean value. The method will repeatedly
:meth:`~Condition.wait` until the predicate evaluates to *true*. The final value is the
return value. | Wait until a predicate becomes *true*.
The predicate must be a callable which result will be
interpreted as a boolean value. The method will repeatedly
:meth:`~Condition.wait` until the predicate evaluates to *true*. The final value is the
return value. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32050ba9-eb94-491f-af07-0df59f553cf7 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,719 | supabase-export-v2 | 5bab6471fdf0550e | in the range of 0 to ``parties-1``, different for each task. This can be used to select a task to do some special housekeeping, e.g.::
... async with barrier as position:
if position == 0:
# Only one task prints this
print('End of *draining phase*') | trusted_official_docs | CPython Docs | in the range of 0 to ``parties-1``, different for each task. This can be used to select a task to do some special housekeeping, e.g.::
... async with barrier as position:
if position == 0:
# Only one task prints this
print('End of *draining phase*') | in the range of 0 to ``parties-1``, different for each task. This can be used to select a task to do some special housekeeping, e.g.::
... async with barrier as position:
if position == 0:
# Only one task prints this
print('End of *draining phase*') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
33c8b7d0-1223-4c08-9ea3-4def5fe2fa68 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,671 | supabase-export-v2 | bb2b156e64965603 | If the calling task has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised.
This method releases the underlying lock, and then blocks until
it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method
returns ``True``. | trusted_official_docs | CPython Docs | If the calling task has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised.
This method releases the underlying lock, and then blocks until
it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method
returns ``True``. | If the calling task has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised.
This method releases the underlying lock, and then blocks until
it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method
returns ``True``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34ff9fb9-5399-4012-97b7-b9d936ea7a72 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,678 | supabase-export-v2 | f8b0d811f8e5444f | A Semaphore object. Not thread-safe.
A semaphore manages an internal counter which is decremented by each
:meth:`acquire` call and incremented by each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds
that it is zero, it blocks, waiting until some task calls
:meth:`release`. | trusted_official_docs | CPython Docs | A Semaphore object. Not thread-safe.
A semaphore manages an internal counter which is decremented by each
:meth:`acquire` call and incremented by each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds
that it is zero, it blocks, waiting until some task calls
:meth:`release`. | A Semaphore object. Not thread-safe.
A semaphore manages an internal counter which is decremented by each
:meth:`acquire` call and incremented by each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds
that it is zero, it blocks, waiting until some task calls
:meth:`release`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35d5b1af-0de7-4cdd-b1f0-b45e10847c88 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,624 | supabase-export-v2 | 96a965be0bf72040 | reset to *false* with the :meth:`clear` method. The :meth:`~Event.wait` method blocks until the flag is set to *true*. The flag is set to *false* initially.
.. versionchanged:: 3.10
Removed the *loop* parameter. | trusted_official_docs | CPython Docs | reset to *false* with the :meth:`clear` method. The :meth:`~Event.wait` method blocks until the flag is set to *true*. The flag is set to *false* initially.
.. versionchanged:: 3.10
Removed the *loop* parameter. | reset to *false* with the :meth:`clear` method. The :meth:`~Event.wait` method blocks until the flag is set to *true*. The flag is set to *false* initially.
.. versionchanged:: 3.10
Removed the *loop* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
39661bb3-70a2-408e-98c9-d7a13a1211c2 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,723 | supabase-export-v2 | 50691f2cdb56c401 | Return the barrier to the default, empty state. Any tasks waiting on it will receive the :class:`BrokenBarrierError` exception.
If a barrier is broken it may be better to just leave it and create a new one. | trusted_official_docs | CPython Docs | Return the barrier to the default, empty state. Any tasks waiting on it will receive the :class:`BrokenBarrierError` exception.
If a barrier is broken it may be better to just leave it and create a new one. | Return the barrier to the default, empty state. Any tasks waiting on it will receive the :class:`BrokenBarrierError` exception.
If a barrier is broken it may be better to just leave it and create a new one. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5c1f01f7-c7c0-4a9e-a478-a872649b55ea | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,699 | supabase-export-v2 | 64f12152904c550e | Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:`ValueError` in :meth:`~Semaphore.release` if it increases the internal counter above the initial *value*.
.. versionchanged:: 3.10
Removed the *loop* parameter. | trusted_official_docs | CPython Docs | Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:`ValueError` in :meth:`~Semaphore.release` if it increases the internal counter above the initial *value*.
.. versionchanged:: 3.10
Removed the *loop* parameter. | Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:`ValueError` in :meth:`~Semaphore.release` if it increases the internal counter above the initial *value*.
.. versionchanged:: 3.10
Removed the *loop* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e569b28-505a-413d-80ab-ed6732f6a793 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,646 | supabase-export-v2 | 2c5474e53c354534 | Condition objects share one Lock, which allows coordinating exclusive access to a shared resource between different tasks interested in particular states of that shared resource.
The optional *lock* argument must be a :class:`Lock` object or
``None``. In the latter case a new Lock object is created
automatically. | trusted_official_docs | CPython Docs | Condition objects share one Lock, which allows coordinating exclusive access to a shared resource between different tasks interested in particular states of that shared resource.
The optional *lock* argument must be a :class:`Lock` object or
``None``. In the latter case a new Lock object is created
automatically. | Condition objects share one Lock, which allows coordinating exclusive access to a shared resource between different tasks interested in particular states of that shared resource.
The optional *lock* argument must be a :class:`Lock` object or
``None``. In the latter case a new Lock object is created
automatically. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6426c714-2ac4-4bf2-84a9-18250f225c32 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,679 | supabase-export-v2 | f0a13120da4fd857 | each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds that it is zero, it blocks, waiting until some task calls :meth:`release`.
The optional *value* argument gives the initial value for the
internal counter (``1`` by default). If the given value is
less than ``0`` a :exc:`ValueEr... | trusted_official_docs | CPython Docs | each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds that it is zero, it blocks, waiting until some task calls :meth:`release`.
The optional *value* argument gives the initial value for the
internal counter (``1`` by default). If the given value is
less than ``0`` a :exc:`ValueEr... | each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds that it is zero, it blocks, waiting until some task calls :meth:`release`.
The optional *value* argument gives the initial value for the
internal counter (``1`` by default). If the given value is
less than ``0`` a :exc:`ValueEr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
670664c2-7460-4032-83eb-b0a0dba91cdc | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,725 | supabase-export-v2 | e9a32f74b194a74b | .. method:: abort() :async:
Put the barrier into a broken state. This causes any active or future
calls to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the tasks needs to abort, to avoid infinite
waiting tasks. | trusted_official_docs | CPython Docs | .. method:: abort() :async:
Put the barrier into a broken state. This causes any active or future
calls to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the tasks needs to abort, to avoid infinite
waiting tasks. | .. method:: abort() :async:
Put the barrier into a broken state. This causes any active or future
calls to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the tasks needs to abort, to avoid infinite
waiting tasks. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
685d0cb7-61c9-4b81-b436-ea0e7ed517a4 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,672 | supabase-export-v2 | dbbd14a3ad7302ad | and then blocks until it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method returns ``True``.
Note that a task *may* return from this call spuriously,
which is why the caller should always re-check the state
and be prepared to :meth:`~Conditio... | trusted_official_docs | CPython Docs | and then blocks until it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method returns ``True``.
Note that a task *may* return from this call spuriously,
which is why the caller should always re-check the state
and be prepared to :meth:`~Conditio... | and then blocks until it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method returns ``True``.
Note that a task *may* return from this call spuriously,
which is why the caller should always re-check the state
and be prepared to :meth:`~Conditio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6cfe960c-d753-4003-9b0c-061a300a4ed1 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,623 | supabase-export-v2 | 3a2c819e00f3b314 | An asyncio event can be used to notify multiple asyncio tasks that some event has happened.
An Event object manages an internal flag that can be set to *true*
with the :meth:`~Event.set` method and reset to *false* with the
:meth:`clear` method. The :meth:`~Event.wait` method blocks until the
flag is set to *true*. ... | trusted_official_docs | CPython Docs | An asyncio event can be used to notify multiple asyncio tasks that some event has happened.
An Event object manages an internal flag that can be set to *true*
with the :meth:`~Event.set` method and reset to *false* with the
:meth:`clear` method. The :meth:`~Event.wait` method blocks until the
flag is set to *true*. ... | An asyncio event can be used to notify multiple asyncio tasks that some event has happened.
An Event object manages an internal flag that can be set to *true*
with the :meth:`~Event.set` method and reset to *false* with the
:meth:`clear` method. The :meth:`~Event.wait` method blocks until the
flag is set to *true*. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7ae1430e-baef-4238-b430-390039b44a4a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,645 | supabase-export-v2 | 6c13c2018f5c3772 | asyncio condition primitive can be used by a task to wait for some event to happen and then get exclusive access to a shared resource.
In essence, a Condition object combines the functionality
of an :class:`Event` and a :class:`Lock`. It is possible to have
multiple Condition objects share one Lock, which allows coor... | trusted_official_docs | CPython Docs | asyncio condition primitive can be used by a task to wait for some event to happen and then get exclusive access to a shared resource.
In essence, a Condition object combines the functionality
of an :class:`Event` and a :class:`Lock`. It is possible to have
multiple Condition objects share one Lock, which allows coor... | asyncio condition primitive can be used by a task to wait for some event to happen and then get exclusive access to a shared resource.
In essence, a Condition object combines the functionality
of an :class:`Event` and a :class:`Lock`. It is possible to have
multiple Condition objects share one Lock, which allows coor... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
870e2919-a0f1-4628-918a-c558cbb6da21 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,694 | supabase-export-v2 | 64ce0408ee1aaac5 | Release a semaphore, incrementing the internal counter by one. Can wake up a task waiting to acquire the semaphore.
Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows
making more ``release()`` calls than ``acquire()`` calls. | trusted_official_docs | CPython Docs | Release a semaphore, incrementing the internal counter by one. Can wake up a task waiting to acquire the semaphore.
Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows
making more ``release()`` calls than ``acquire()`` calls. | Release a semaphore, incrementing the internal counter by one. Can wake up a task waiting to acquire the semaphore.
Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows
making more ``release()`` calls than ``acquire()`` calls. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9124c89d-f61f-4785-a395-7a42a9c0094e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,659 | supabase-export-v2 | 3be60e4d6295e683 | Wake up *n* tasks (1 by default) waiting on this condition. If fewer than *n* tasks are waiting they are all awakened.
The lock must be acquired before this method is called and
released shortly after. If called with an *unlocked* lock
a :exc:`RuntimeError` error is raised. | trusted_official_docs | CPython Docs | Wake up *n* tasks (1 by default) waiting on this condition. If fewer than *n* tasks are waiting they are all awakened.
The lock must be acquired before this method is called and
released shortly after. If called with an *unlocked* lock
a :exc:`RuntimeError` error is raised. | Wake up *n* tasks (1 by default) waiting on this condition. If fewer than *n* tasks are waiting they are all awakened.
The lock must be acquired before this method is called and
released shortly after. If called with an *unlocked* lock
a :exc:`RuntimeError` error is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a358922b-8244-4e77-96e0-dcca29d94810 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,720 | supabase-export-v2 | 34028ad30cc3b2cd | ... async with barrier as position: if position == 0: # Only one task prints this print('End of *draining phase*')
This method may raise a :class:`BrokenBarrierError` exception if the
barrier is broken or reset while a task is waiting. It could raise a :exc:`CancelledError` if a task is cancelled. | trusted_official_docs | CPython Docs | ... async with barrier as position: if position == 0: # Only one task prints this print('End of *draining phase*')
This method may raise a :class:`BrokenBarrierError` exception if the
barrier is broken or reset while a task is waiting. It could raise a :exc:`CancelledError` if a task is cancelled. | ... async with barrier as position: if position == 0: # Only one task prints this print('End of *draining phase*')
This method may raise a :class:`BrokenBarrierError` exception if the
barrier is broken or reset while a task is waiting. It could raise a :exc:`CancelledError` if a task is cancelled. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad8ad70f-cf94-4876-bced-548b63ff1f1a | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,717 | supabase-export-v2 | 0609360daa02c57e | Pass the barrier. When all the tasks party to the barrier have called this function, they are all unblocked simultaneously.
When a waiting or blocked task in the barrier is cancelled,
this task exits the barrier which stays in the same state. If the state of the barrier is "filling", the number of waiting task
decrea... | trusted_official_docs | CPython Docs | Pass the barrier. When all the tasks party to the barrier have called this function, they are all unblocked simultaneously.
When a waiting or blocked task in the barrier is cancelled,
this task exits the barrier which stays in the same state. If the state of the barrier is "filling", the number of waiting task
decrea... | Pass the barrier. When all the tasks party to the barrier have called this function, they are all unblocked simultaneously.
When a waiting or blocked task in the barrier is cancelled,
this task exits the barrier which stays in the same state. If the state of the barrier is "filling", the number of waiting task
decrea... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b1c399f3-7ebb-461b-8ff8-3404271d8ce9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,703 | supabase-export-v2 | bc82caa626aecb0b | would be blocked until the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the waiting tasks would unblock simultaneously.
:keyword:`async with` can be used as an alternative to awaiting on
:meth:`~Barrier.wait`. | trusted_official_docs | CPython Docs | would be blocked until the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the waiting tasks would unblock simultaneously.
:keyword:`async with` can be used as an alternative to awaiting on
:meth:`~Barrier.wait`. | would be blocked until the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the waiting tasks would unblock simultaneously.
:keyword:`async with` can be used as an alternative to awaiting on
:meth:`~Barrier.wait`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b3f038b4-78e5-46ed-825f-af91f718002d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,614 | supabase-export-v2 | ae5d348573189100 | When more than one coroutine is blocked in :meth:`acquire` waiting for the lock to be unlocked, only one coroutine eventually proceeds.
Acquiring a lock is *fair*: the coroutine that proceeds will be
the first coroutine that started waiting on the lock. | trusted_official_docs | CPython Docs | When more than one coroutine is blocked in :meth:`acquire` waiting for the lock to be unlocked, only one coroutine eventually proceeds.
Acquiring a lock is *fair*: the coroutine that proceeds will be
the first coroutine that started waiting on the lock. | When more than one coroutine is blocked in :meth:`acquire` waiting for the lock to be unlocked, only one coroutine eventually proceeds.
Acquiring a lock is *fair*: the coroutine that proceeds will be
the first coroutine that started waiting on the lock. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b48d9e94-fd97-4ab7-a631-267c89cbb5e7 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,644 | supabase-export-v2 | ae0ec56281607665 | A Condition object. Not thread-safe.
An asyncio condition primitive can be used by a task to wait for
some event to happen and then get exclusive access to a shared
resource. | trusted_official_docs | CPython Docs | A Condition object. Not thread-safe.
An asyncio condition primitive can be used by a task to wait for
some event to happen and then get exclusive access to a shared
resource. | A Condition object. Not thread-safe.
An asyncio condition primitive can be used by a task to wait for
some event to happen and then get exclusive access to a shared
resource. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd3a0f3b-7a33-4e55-a3ff-7892452c7b9b | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,689 | supabase-export-v2 | 95ddcdd71cae20e4 | Acquire a semaphore.
If the internal counter is greater than zero, decrement
it by one and return ``True`` immediately. If it is zero, wait
until a :meth:`release` is called and return ``True``. | trusted_official_docs | CPython Docs | Acquire a semaphore.
If the internal counter is greater than zero, decrement
it by one and return ``True`` immediately. If it is zero, wait
until a :meth:`release` is called and return ``True``. | Acquire a semaphore.
If the internal counter is greater than zero, decrement
it by one and return ``True`` immediately. If it is zero, wait
until a :meth:`release` is called and return ``True``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d0ed38b8-dd27-4e5d-ae21-d31db4889c26 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,718 | supabase-export-v2 | ac2c01e469bcce0b | exits the barrier which stays in the same state. If the state of the barrier is "filling", the number of waiting task decreases by 1.
The return value is an integer in the range of 0 to ``parties-1``, different
for each task. This can be used to select a task to do some special
housekeeping, e.g.:: | trusted_official_docs | CPython Docs | exits the barrier which stays in the same state. If the state of the barrier is "filling", the number of waiting task decreases by 1.
The return value is an integer in the range of 0 to ``parties-1``, different
for each task. This can be used to select a task to do some special
housekeeping, e.g.:: | exits the barrier which stays in the same state. If the state of the barrier is "filling", the number of waiting task decreases by 1.
The return value is an integer in the range of 0 to ``parties-1``, different
for each task. This can be used to select a task to do some special
housekeeping, e.g.:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e693bc28-2fbd-4bd5-ac1c-4db8e5d62fe8 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,599 | supabase-export-v2 | 9b22d7669b0d71c8 | * asyncio primitives are not thread-safe, therefore they should not be used for OS thread synchronization (use :mod:`threading` for that);
* methods of these synchronization primitives do not accept the *timeout*
argument; use the :func:`asyncio.wait_for` function to perform
operations with timeouts. | trusted_official_docs | CPython Docs | * asyncio primitives are not thread-safe, therefore they should not be used for OS thread synchronization (use :mod:`threading` for that);
* methods of these synchronization primitives do not accept the *timeout*
argument; use the :func:`asyncio.wait_for` function to perform
operations with timeouts. | * asyncio primitives are not thread-safe, therefore they should not be used for OS thread synchronization (use :mod:`threading` for that);
* methods of these synchronization primitives do not accept the *timeout*
argument; use the :func:`asyncio.wait_for` function to perform
operations with timeouts. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e8cbb02c-875a-421b-a4a6-266352eb7f38 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,665 | supabase-export-v2 | 3f9723a389f8a619 | This method acts like :meth:`notify`, but wakes up all waiting tasks.
The lock must be acquired before this method is called and
released shortly after. If called with an *unlocked* lock
a :exc:`RuntimeError` error is raised. | trusted_official_docs | CPython Docs | This method acts like :meth:`notify`, but wakes up all waiting tasks.
The lock must be acquired before this method is called and
released shortly after. If called with an *unlocked* lock
a :exc:`RuntimeError` error is raised. | This method acts like :meth:`notify`, but wakes up all waiting tasks.
The lock must be acquired before this method is called and
released shortly after. If called with an *unlocked* lock
a :exc:`RuntimeError` error is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea4f2928-e5f0-4849-a05e-27cccad6fafa | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,598 | supabase-export-v2 | 3d2868c426577244 | asyncio synchronization primitives are designed to be similar to those of the :mod:`threading` module with two important caveats:
* asyncio primitives are not thread-safe, therefore they should not
be used for OS thread synchronization (use :mod:`threading` for
that); | trusted_official_docs | CPython Docs | asyncio synchronization primitives are designed to be similar to those of the :mod:`threading` module with two important caveats:
* asyncio primitives are not thread-safe, therefore they should not
be used for OS thread synchronization (use :mod:`threading` for
that); | asyncio synchronization primitives are designed to be similar to those of the :mod:`threading` module with two important caveats:
* asyncio primitives are not thread-safe, therefore they should not
be used for OS thread synchronization (use :mod:`threading` for
that); | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f82d9037-1c6c-4824-b5cb-1a868eafca97 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-sync.rst | unknown | 090df7cc-4994-465d-8ff9-b29931db4f98 | 49,735 | supabase-export-v2 | ce67c6145fed1fd1 | .. versionchanged:: 3.9
Acquiring a lock using ``await lock`` or ``yield from lock`` and/or
:keyword:`with` statement (``with await lock``, ``with (yield from
lock)``) was removed. Use ``async with lock`` instead. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.9
Acquiring a lock using ``await lock`` or ``yield from lock`` and/or
:keyword:`with` statement (``with await lock``, ``with (yield from
lock)``) was removed. Use ``async with lock`` instead. | .. versionchanged:: 3.9
Acquiring a lock using ``await lock`` or ``yield from lock`` and/or
:keyword:`with` statement (``with await lock``, ``with (yield from
lock)``) was removed. Use ``async with lock`` instead. | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.