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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b825477-249b-4d0e-848f-9e5a7aff4f54 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,499 | supabase-export-v2 | e4dd79100f1a0e0e | .. function:: mkdtemp(suffix=None, prefix=None, dir=None)
Creates a temporary directory in the most secure manner possible. There
are no race conditions in the directory's creation. The directory is
readable, writable, and searchable only by the creating user ID. | trusted_official_docs | CPython Docs | .. function:: mkdtemp(suffix=None, prefix=None, dir=None)
Creates a temporary directory in the most secure manner possible. There
are no race conditions in the directory's creation. The directory is
readable, writable, and searchable only by the creating user ID. | .. function:: mkdtemp(suffix=None, prefix=None, dir=None)
Creates a temporary directory in the most secure manner possible. There
are no race conditions in the directory's creation. The directory is
readable, writable, and searchable only by the creating user ID. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5eec15e4-8400-487e-9a31-8951c4e7db6a | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,509 | supabase-export-v2 | 1b373446b1a28490 | Return the name of the directory used for temporary files. This defines the default value for the *dir* argument to all functions in this module.
Python searches a standard list of directories to find one which
the calling user can create files in. The list is: | trusted_official_docs | CPython Docs | Return the name of the directory used for temporary files. This defines the default value for the *dir* argument to all functions in this module.
Python searches a standard list of directories to find one which
the calling user can create files in. The list is: | Return the name of the directory used for temporary files. This defines the default value for the *dir* argument to all functions in this module.
Python searches a standard list of directories to find one which
the calling user can create files in. The list is: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6808bb9a-8c71-4284-b0fa-34dd9553f8a7 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,548 | supabase-export-v2 | 18cc819c49f652f9 | .. warning::
Use of this function may introduce a security hole in your program. By
the time you get around to doing anything with the file name it returns,
someone else may have beaten you to the punch. :func:`mktemp` usage can
be replaced easily with :func:`NamedTemporaryFile`, passing it the
``delete=False`` par... | trusted_official_docs | CPython Docs | .. warning::
Use of this function may introduce a security hole in your program. By
the time you get around to doing anything with the file name it returns,
someone else may have beaten you to the punch. :func:`mktemp` usage can
be replaced easily with :func:`NamedTemporaryFile`, passing it the
``delete=False`` par... | .. warning::
Use of this function may introduce a security hole in your program. By
the time you get around to doing anything with the file name it returns,
someone else may have beaten you to the punch. :func:`mktemp` usage can
be replaced easily with :func:`NamedTemporaryFile`, passing it the
``delete=False`` par... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
720f9246-18e4-4928-85c7-6eb6f674c25d | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,458 | supabase-export-v2 | 48047008712e12dd | parameter to be false. The latter approach is recommended as it provides assistance in automatic cleaning of the temporary file upon the context manager exit.
Opening the temporary file again by its name while it is still open works as
follows: | trusted_official_docs | CPython Docs | parameter to be false. The latter approach is recommended as it provides assistance in automatic cleaning of the temporary file upon the context manager exit.
Opening the temporary file again by its name while it is still open works as
follows: | parameter to be false. The latter approach is recommended as it provides assistance in automatic cleaning of the temporary file upon the context manager exit.
Opening the temporary file again by its name while it is still open works as
follows: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
740b9fd0-d2f2-4e3a-b9f2-f133e6a18e98 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,528 | supabase-export-v2 | 779dd8c65eb65673 | .. versionadded:: 3.5
The module uses a global variable to store the name of the directory
used for temporary files returned by :func:`gettempdir`. It can be
set directly to override the selection process, but this is discouraged. All functions in this module take a *dir* argument which can be used
to specify the direc... | trusted_official_docs | CPython Docs | .. versionadded:: 3.5
The module uses a global variable to store the name of the directory
used for temporary files returned by :func:`gettempdir`. It can be
set directly to override the selection process, but this is discouraged. All functions in this module take a *dir* argument which can be used
to specify the direc... | .. versionadded:: 3.5
The module uses a global variable to store the name of the directory
used for temporary files returned by :func:`gettempdir`. It can be
set directly to override the selection process, but this is discouraged. All functions in this module take a *dir* argument which can be used
to specify the direc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
75159bda-03f8-483f-929e-e24d2e6b895c | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,531 | supabase-export-v2 | 6dd50d5f170b3f93 | default value for the *dir* argument to the functions defined in this module, including its type, bytes or str. It cannot be a :term:`path-like object`.
If ``tempdir`` is ``None`` (the default) at any call to any of the above
functions except :func:`gettempprefix` it is initialized following the
algorithm described i... | trusted_official_docs | CPython Docs | default value for the *dir* argument to the functions defined in this module, including its type, bytes or str. It cannot be a :term:`path-like object`.
If ``tempdir`` is ``None`` (the default) at any call to any of the above
functions except :func:`gettempprefix` it is initialized following the
algorithm described i... | default value for the *dir* argument to the functions defined in this module, including its type, bytes or str. It cannot be a :term:`path-like object`.
If ``tempdir`` is ``None`` (the default) at any call to any of the above
functions except :func:`gettempprefix` it is initialized following the
algorithm described i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7bf5065a-97c9-41c3-8f42-153e66acaa6a | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,461 | supabase-export-v2 | 2377364a794f5ec3 | created via builtin :func:`open`) must be closed before exiting the context manager, else the :func:`os.unlink` call on context manager exit will fail with a :exc:`PermissionError`.
On Windows, if *delete_on_close* is false, and the file is created in a
directory for which the user lacks delete access, then the :func:... | trusted_official_docs | CPython Docs | created via builtin :func:`open`) must be closed before exiting the context manager, else the :func:`os.unlink` call on context manager exit will fail with a :exc:`PermissionError`.
On Windows, if *delete_on_close* is false, and the file is created in a
directory for which the user lacks delete access, then the :func:... | created via builtin :func:`open`) must be closed before exiting the context manager, else the :func:`os.unlink` call on context manager exit will fail with a :exc:`PermissionError`.
On Windows, if *delete_on_close* is false, and the file is created in a
directory for which the user lacks delete access, then the :func:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a86a217-41eb-41b6-849c-a10e2d03228d | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,480 | supabase-export-v2 | 1763bb77c3c88790 | errors will be raised in whatever context cleanup occurs (the :meth:`!cleanup` call, exiting the context manager, when the object is garbage-collected or during interpreter shutdown).
The *delete* parameter can be used to disable cleanup of the directory tree
upon exiting the context. While it may seem unusual for a c... | trusted_official_docs | CPython Docs | errors will be raised in whatever context cleanup occurs (the :meth:`!cleanup` call, exiting the context manager, when the object is garbage-collected or during interpreter shutdown).
The *delete* parameter can be used to disable cleanup of the directory tree
upon exiting the context. While it may seem unusual for a c... | errors will be raised in whatever context cleanup occurs (the :meth:`!cleanup` call, exiting the context manager, when the object is garbage-collected or during interpreter shutdown).
The *delete* parameter can be used to disable cleanup of the directory tree
upon exiting the context. While it may seem unusual for a c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9e1c1209-99c3-4a55-8105-0c51bed09436 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,496 | supabase-export-v2 | c4914af29470b751 | .. audit-event:: tempfile.mkstemp fullpath tempfile.mkstemp
.. versionchanged:: 3.5
*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to
obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause
an appropriate default value t... | trusted_official_docs | CPython Docs | .. audit-event:: tempfile.mkstemp fullpath tempfile.mkstemp
.. versionchanged:: 3.5
*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to
obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause
an appropriate default value t... | .. audit-event:: tempfile.mkstemp fullpath tempfile.mkstemp
.. versionchanged:: 3.5
*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to
obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause
an appropriate default value t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ed4b9d5-985a-403c-849b-949be8fe15ce | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,497 | supabase-export-v2 | 945c557d26555fdb | Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause an appropriate default value to be used.
.. versionchanged:: 3.6
The *dir* parameter now accepts a :term:`path-like object`. | trusted_official_docs | CPython Docs | Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause an appropriate default value to be used.
.. versionchanged:: 3.6
The *dir* parameter now accepts a :term:`path-like object`. | Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause an appropriate default value to be used.
.. versionchanged:: 3.6
The *dir* parameter now accepts a :term:`path-like object`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9edbfcb9-e6a2-48e1-a836-1b0b64716469 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,494 | supabase-export-v2 | 3e027007784b59ef | If *text* is specified and true, the file is opened in text mode. Otherwise, (the default) the file is opened in binary mode.
:func:`mkstemp` returns a tuple containing an OS-level handle to an open
file (as would be returned by :func:`os.open`) and the absolute pathname
of that file, in that order. | trusted_official_docs | CPython Docs | If *text* is specified and true, the file is opened in text mode. Otherwise, (the default) the file is opened in binary mode.
:func:`mkstemp` returns a tuple containing an OS-level handle to an open
file (as would be returned by :func:`os.open`) and the absolute pathname
of that file, in that order. | If *text* is specified and true, the file is opened in text mode. Otherwise, (the default) the file is opened in binary mode.
:func:`mkstemp` returns a tuple containing an OS-level handle to an open
file (as would be returned by :func:`os.open`) and the absolute pathname
of that file, in that order. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6103efb-f92b-4baa-8c33-260938dcc198 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,538 | supabase-export-v2 | e95bea94ea740828 | tempfile.TemporaryFile() >>> fp.write(b'Hello world!') # read data from file >>> fp.seek(0) >>> fp.read() b'Hello world!' # close the file, it will be removed >>> fp.close()
# create a temporary file using a context manager
>>> with tempfile.TemporaryFile() as fp:
... fp.write(b'Hello world!')
... fp.seek(0)
... fp... | trusted_official_docs | CPython Docs | tempfile.TemporaryFile() >>> fp.write(b'Hello world!') # read data from file >>> fp.seek(0) >>> fp.read() b'Hello world!' # close the file, it will be removed >>> fp.close()
# create a temporary file using a context manager
>>> with tempfile.TemporaryFile() as fp:
... fp.write(b'Hello world!')
... fp.seek(0)
... fp... | tempfile.TemporaryFile() >>> fp.write(b'Hello world!') # read data from file >>> fp.seek(0) >>> fp.read() b'Hello world!' # close the file, it will be removed >>> fp.close()
# create a temporary file using a context manager
>>> with tempfile.TemporaryFile() as fp:
... fp.write(b'Hello world!')
... fp.seek(0)
... fp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a818d2fe-7a7d-4719-8715-16c4cf4c9d45 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,501 | supabase-export-v2 | 5487ee9be7ccd589 | The user of :func:`mkdtemp` is responsible for deleting the temporary directory and its contents when done with it.
The *prefix*, *suffix*, and *dir* arguments are the same as for
:func:`mkstemp`. | trusted_official_docs | CPython Docs | The user of :func:`mkdtemp` is responsible for deleting the temporary directory and its contents when done with it.
The *prefix*, *suffix*, and *dir* arguments are the same as for
:func:`mkstemp`. | The user of :func:`mkdtemp` is responsible for deleting the temporary directory and its contents when done with it.
The *prefix*, *suffix*, and *dir* arguments are the same as for
:func:`mkstemp`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a88e408e-74dc-44b0-85d4-92fec789d777 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,491 | supabase-export-v2 | 8de98a6aad8178fe | file name will begin with that prefix; otherwise, a default prefix is used. The default is the return value of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate.
If *dir* is not ``None``, the file will be created in that directory;
otherwise, a default directory is used. The default directory is chosen
... | trusted_official_docs | CPython Docs | file name will begin with that prefix; otherwise, a default prefix is used. The default is the return value of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate.
If *dir* is not ``None``, the file will be created in that directory;
otherwise, a default directory is used. The default directory is chosen
... | file name will begin with that prefix; otherwise, a default prefix is used. The default is the return value of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate.
If *dir* is not ``None``, the file will be created in that directory;
otherwise, a default directory is used. The default directory is chosen
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a968f0ba-21a3-407b-8261-faf78b1fbe39 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,479 | supabase-export-v2 | 201cb945060f39b9 | .. method:: TemporaryDirectory.cleanup
The directory can be explicitly cleaned up by calling the
:meth:`!cleanup` method. If *ignore_cleanup_errors* is true, any unhandled
exceptions during explicit or implicit cleanup (such as a
:exc:`PermissionError` removing open files on Windows) will be ignored,
and the remain... | trusted_official_docs | CPython Docs | .. method:: TemporaryDirectory.cleanup
The directory can be explicitly cleaned up by calling the
:meth:`!cleanup` method. If *ignore_cleanup_errors* is true, any unhandled
exceptions during explicit or implicit cleanup (such as a
:exc:`PermissionError` removing open files on Windows) will be ignored,
and the remain... | .. method:: TemporaryDirectory.cleanup
The directory can be explicitly cleaned up by calling the
:meth:`!cleanup` method. If *ignore_cleanup_errors* is true, any unhandled
exceptions during explicit or implicit cleanup (such as a
:exc:`PermissionError` removing open files on Windows) will be ignored,
and the remain... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa4c6c93-2f75-4e25-8d49-64ccd71065b3 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,439 | supabase-export-v2 | 9c2ef88da1972342 | securely created in shared temporary directories. To maintain backward compatibility, the argument order is somewhat odd; it is recommended to use keyword arguments for clarity.
The module defines the following user-callable items: | trusted_official_docs | CPython Docs | securely created in shared temporary directories. To maintain backward compatibility, the argument order is somewhat odd; it is recommended to use keyword arguments for clarity.
The module defines the following user-callable items: | securely created in shared temporary directories. To maintain backward compatibility, the argument order is somewhat odd; it is recommended to use keyword arguments for clarity.
The module defines the following user-callable items: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ac93f4b8-0623-4ed8-a15d-3219ac4fe6c6 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,549 | supabase-export-v2 | 1f312de77add5ad4 | name it returns, someone else may have beaten you to the punch. :func:`mktemp` usage can be replaced easily with :func:`NamedTemporaryFile`, passing it the ``delete=False`` parameter::
>>> f = NamedTemporaryFile(delete=False)
>>> f.name
'/tmp/tmptjujjt'
>>> f.write(b"Hello World!\n")
13
>>> f.close()
>>> os.unlin... | trusted_official_docs | CPython Docs | name it returns, someone else may have beaten you to the punch. :func:`mktemp` usage can be replaced easily with :func:`NamedTemporaryFile`, passing it the ``delete=False`` parameter::
>>> f = NamedTemporaryFile(delete=False)
>>> f.name
'/tmp/tmptjujjt'
>>> f.write(b"Hello World!\n")
13
>>> f.close()
>>> os.unlin... | name it returns, someone else may have beaten you to the punch. :func:`mktemp` usage can be replaced easily with :func:`NamedTemporaryFile`, passing it the ``delete=False`` parameter::
>>> f = NamedTemporaryFile(delete=False)
>>> f.name
'/tmp/tmptjujjt'
>>> f.write(b"Hello World!\n")
13
>>> f.close()
>>> os.unlin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
acfa120a-e15b-4f94-8084-31518a022ac6 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,446 | supabase-export-v2 | 3280088c34b94ed4 | is a true file object on POSIX platforms. On other platforms, it is a file-like object whose :attr:`!file` attribute is the underlying true file object.
The :py:const:`os.O_TMPFILE` flag is used if it is available and works
(Linux-specific, requires Linux kernel 3.11 or later). | trusted_official_docs | CPython Docs | is a true file object on POSIX platforms. On other platforms, it is a file-like object whose :attr:`!file` attribute is the underlying true file object.
The :py:const:`os.O_TMPFILE` flag is used if it is available and works
(Linux-specific, requires Linux kernel 3.11 or later). | is a true file object on POSIX platforms. On other platforms, it is a file-like object whose :attr:`!file` attribute is the underlying true file object.
The :py:const:`os.O_TMPFILE` flag is used if it is available and works
(Linux-specific, requires Linux kernel 3.11 or later). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad79a5a9-17a9-4ecb-97c2-ec152a1e87d3 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,475 | supabase-export-v2 | 7aa663c5949b1de8 | .. class:: TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, *, delete=True)
This class securely creates a temporary directory using the same rules as :func:`mkdtemp`. The resulting object can be used as a :term:`context manager` (see
:ref:`tempfile-examples`). On completion of the co... | trusted_official_docs | CPython Docs | .. class:: TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, *, delete=True)
This class securely creates a temporary directory using the same rules as :func:`mkdtemp`. The resulting object can be used as a :term:`context manager` (see
:ref:`tempfile-examples`). On completion of the co... | .. class:: TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, *, delete=True)
This class securely creates a temporary directory using the same rules as :func:`mkdtemp`. The resulting object can be used as a :term:`context manager` (see
:ref:`tempfile-examples`). On completion of the co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aef84359-25cc-4019-9846-3488f735f93d | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,460 | supabase-export-v2 | 5b0ddd6301198643 | * On POSIX the file can always be opened again. * On Windows, make sure that at least one of the following conditions are fulfilled:
* *delete* is false
* additional open shares delete access (e.g. by calling :func:`os.open`
with the flag ``O_TEMPORARY``)
* *delete* is true but *delete_on_close* is false. Note, that... | trusted_official_docs | CPython Docs | * On POSIX the file can always be opened again. * On Windows, make sure that at least one of the following conditions are fulfilled:
* *delete* is false
* additional open shares delete access (e.g. by calling :func:`os.open`
with the flag ``O_TEMPORARY``)
* *delete* is true but *delete_on_close* is false. Note, that... | * On POSIX the file can always be opened again. * On Windows, make sure that at least one of the following conditions are fulfilled:
* *delete* is false
* additional open shares delete access (e.g. by calling :func:`os.open`
with the flag ``O_TEMPORARY``)
* *delete* is true but *delete_on_close* is false. Note, that... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b68fb453-5515-4620-885b-6cc781f1947a | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,546 | supabase-export-v2 | 9f32ca8e5da4d95a | .. deprecated:: 2.3 Use :func:`mkstemp` instead.
Return an absolute pathname of a file that did not exist at the time the
call is made. The *prefix*, *suffix*, and *dir* arguments are similar
to those of :func:`mkstemp`, except that bytes file names, ``suffix=None``
and ``prefix=None`` are not supported. | trusted_official_docs | CPython Docs | .. deprecated:: 2.3 Use :func:`mkstemp` instead.
Return an absolute pathname of a file that did not exist at the time the
call is made. The *prefix*, *suffix*, and *dir* arguments are similar
to those of :func:`mkstemp`, except that bytes file names, ``suffix=None``
and ``prefix=None`` are not supported. | .. deprecated:: 2.3 Use :func:`mkstemp` instead.
Return an absolute pathname of a file that did not exist at the time the
call is made. The *prefix*, *suffix*, and *dir* arguments are similar
to those of :func:`mkstemp`, except that bytes file names, ``suffix=None``
and ``prefix=None`` are not supported. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bac283f0-92da-438a-b514-a6f1895979fd | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,490 | supabase-export-v2 | 10a0c5a6fe1d081c | suffix. :func:`mkstemp` does not put a dot between the file name and the suffix; if you need one, put it at the beginning of *suffix*.
If *prefix* is not ``None``, the file name will begin with that prefix;
otherwise, a default prefix is used. The default is the return value of
:func:`gettempprefix` or :func:`gettemp... | trusted_official_docs | CPython Docs | suffix. :func:`mkstemp` does not put a dot between the file name and the suffix; if you need one, put it at the beginning of *suffix*.
If *prefix* is not ``None``, the file name will begin with that prefix;
otherwise, a default prefix is used. The default is the return value of
:func:`gettempprefix` or :func:`gettemp... | suffix. :func:`mkstemp` does not put a dot between the file name and the suffix; if you need one, put it at the beginning of *suffix*.
If *prefix* is not ``None``, the file name will begin with that prefix;
otherwise, a default prefix is used. The default is the return value of
:func:`gettempprefix` or :func:`gettemp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2c3731f-3b08-4eb6-8ebf-a3efeafbaa75 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,471 | supabase-export-v2 | 5d90863cdda1438a | true file object, depending on whether :meth:`rollover` has been called. This file-like object can be used in a :keyword:`with` statement, just like a normal file.
.. versionchanged:: 3.3
the truncate method now accepts a *size* argument. | trusted_official_docs | CPython Docs | true file object, depending on whether :meth:`rollover` has been called. This file-like object can be used in a :keyword:`with` statement, just like a normal file.
.. versionchanged:: 3.3
the truncate method now accepts a *size* argument. | true file object, depending on whether :meth:`rollover` has been called. This file-like object can be used in a :keyword:`with` statement, just like a normal file.
.. versionchanged:: 3.3
the truncate method now accepts a *size* argument. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c3023a3a-c8e1-4fc4-a40d-4140eb5e004b | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,544 | supabase-export-v2 | 1b15eeb98400a390 | The solution is to combine the two steps and create the file immediately. This approach is used by :func:`mkstemp` and the other functions described above.
.. function:: mktemp(suffix='', prefix='tmp', dir=None) | trusted_official_docs | CPython Docs | The solution is to combine the two steps and create the file immediately. This approach is used by :func:`mkstemp` and the other functions described above.
.. function:: mktemp(suffix='', prefix='tmp', dir=None) | The solution is to combine the two steps and create the file immediately. This approach is used by :func:`mkstemp` and the other functions described above.
.. function:: mktemp(suffix='', prefix='tmp', dir=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ca369d17-cc3f-48cf-a5bc-abc3c4b9e9b5 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,489 | supabase-export-v2 | 821989dab6fbe92c | Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible for deleting the temporary file when done with it.
If *suffix* is not ``None``, the file name will end with that suffix,
otherwise there will be no suffix. :func:`mkstemp` does not put a dot
between the file name and the suffix; if you need one,... | trusted_official_docs | CPython Docs | Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible for deleting the temporary file when done with it.
If *suffix* is not ``None``, the file name will end with that suffix,
otherwise there will be no suffix. :func:`mkstemp` does not put a dot
between the file name and the suffix; if you need one,... | Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible for deleting the temporary file when done with it.
If *suffix* is not ``None``, the file name will end with that suffix,
otherwise there will be no suffix. :func:`mkstemp` does not put a dot
between the file name and the suffix; if you need one,... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc0a6d5d-82d3-472b-9b62-a0df23258817 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,500 | supabase-export-v2 | a77a6808a2bd5d0b | secure manner possible. There are no race conditions in the directory's creation. The directory is readable, writable, and searchable only by the creating user ID.
The user of :func:`mkdtemp` is responsible for deleting the temporary
directory and its contents when done with it. | trusted_official_docs | CPython Docs | secure manner possible. There are no race conditions in the directory's creation. The directory is readable, writable, and searchable only by the creating user ID.
The user of :func:`mkdtemp` is responsible for deleting the temporary
directory and its contents when done with it. | secure manner possible. There are no race conditions in the directory's creation. The directory is readable, writable, and searchable only by the creating user ID.
The user of :func:`mkdtemp` is responsible for deleting the temporary
directory and its contents when done with it. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e0452f0e-10dc-489f-8b66-fe6d0e7f4974 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,477 | supabase-export-v2 | 2c649d3e27a46b8f | .. attribute:: TemporaryDirectory.name
The directory name can be retrieved from the :attr:`!name` attribute of the
returned object. When the returned object is used as a :term:`context manager`, the
:attr:`!name` will be assigned to the target of the :keyword:`!as` clause in
the :keyword:`with` statement, if there i... | trusted_official_docs | CPython Docs | .. attribute:: TemporaryDirectory.name
The directory name can be retrieved from the :attr:`!name` attribute of the
returned object. When the returned object is used as a :term:`context manager`, the
:attr:`!name` will be assigned to the target of the :keyword:`!as` clause in
the :keyword:`with` statement, if there i... | .. attribute:: TemporaryDirectory.name
The directory name can be retrieved from the :attr:`!name` attribute of the
returned object. When the returned object is used as a :term:`context manager`, the
:attr:`!name` will be assigned to the target of the :keyword:`!as` clause in
the :keyword:`with` statement, if there i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e133eb1d-29b3-4119-b1f9-f3d6cb7b735e | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,462 | supabase-export-v2 | 0d7d966b3f3d787f | This cannot happen when *delete_on_close* is true because delete access is requested by the open, which fails immediately if the requested access is not granted.
On POSIX (only), a process that is terminated abruptly with SIGKILL
cannot automatically delete any NamedTemporaryFiles it created. | trusted_official_docs | CPython Docs | This cannot happen when *delete_on_close* is true because delete access is requested by the open, which fails immediately if the requested access is not granted.
On POSIX (only), a process that is terminated abruptly with SIGKILL
cannot automatically delete any NamedTemporaryFiles it created. | This cannot happen when *delete_on_close* is true because delete access is requested by the open, which fails immediately if the requested access is not granted.
On POSIX (only), a process that is terminated abruptly with SIGKILL
cannot automatically delete any NamedTemporaryFiles it created. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e1816d8b-178e-43b6-ba50-b50dbbc8ccd7 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,470 | supabase-export-v2 | f70cc9a24729869f | The resulting file has one additional method, :meth:`!rollover`, which causes the file to roll over to an on-disk file regardless of its size.
The returned object is a file-like object whose :attr:`!_file` attribute
is either an :class:`io.BytesIO` or :class:`io.TextIOWrapper` object
(depending on whether binary or t... | trusted_official_docs | CPython Docs | The resulting file has one additional method, :meth:`!rollover`, which causes the file to roll over to an on-disk file regardless of its size.
The returned object is a file-like object whose :attr:`!_file` attribute
is either an :class:`io.BytesIO` or :class:`io.TextIOWrapper` object
(depending on whether binary or t... | The resulting file has one additional method, :meth:`!rollover`, which causes the file to roll over to an on-disk file regardless of its size.
The returned object is a file-like object whose :attr:`!_file` attribute
is either an :class:`io.BytesIO` or :class:`io.TextIOWrapper` object
(depending on whether binary or t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e6445894-71cb-4584-a7e1-2b4379acd615 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,540 | supabase-export-v2 | 11ea597d8419250d | # open the file again by using its name ... with open(fp.name, mode='rb') as f: ... f.read() b'Hello world!' >>> # file is now removed
# create a temporary directory using the context manager
>>> with tempfile.TemporaryDirectory() as tmpdirname:
... print('created temporary directory', tmpdirname)
>>>
# directory a... | trusted_official_docs | CPython Docs | # open the file again by using its name ... with open(fp.name, mode='rb') as f: ... f.read() b'Hello world!' >>> # file is now removed
# create a temporary directory using the context manager
>>> with tempfile.TemporaryDirectory() as tmpdirname:
... print('created temporary directory', tmpdirname)
>>>
# directory a... | # open the file again by using its name ... with open(fp.name, mode='rb') as f: ... f.read() b'Hello world!' >>> # file is now removed
# create a temporary directory using the context manager
>>> with tempfile.TemporaryDirectory() as tmpdirname:
... print('created temporary directory', tmpdirname)
>>>
# directory a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e64578a3-09ab-47e1-82ee-3e1690660398 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,447 | supabase-export-v2 | 75e5c2dcc0e97248 | The :py:const:`os.O_TMPFILE` flag is used if it is available and works (Linux-specific, requires Linux kernel 3.11 or later).
On platforms that are neither Posix nor Cygwin, TemporaryFile is an alias
for NamedTemporaryFile. | trusted_official_docs | CPython Docs | The :py:const:`os.O_TMPFILE` flag is used if it is available and works (Linux-specific, requires Linux kernel 3.11 or later).
On platforms that are neither Posix nor Cygwin, TemporaryFile is an alias
for NamedTemporaryFile. | The :py:const:`os.O_TMPFILE` flag is used if it is available and works (Linux-specific, requires Linux kernel 3.11 or later).
On platforms that are neither Posix nor Cygwin, TemporaryFile is an alias
for NamedTemporaryFile. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e8c0490c-dc60-4b04-9044-228c1bb01f5a | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,481 | supabase-export-v2 | 47077940c8e9d330 | taken when exiting the context, it can be useful during debugging or when you need your cleanup behavior to be conditional based on other logic.
.. audit-event:: tempfile.mkdtemp fullpath tempfile.TemporaryDirectory | trusted_official_docs | CPython Docs | taken when exiting the context, it can be useful during debugging or when you need your cleanup behavior to be conditional based on other logic.
.. audit-event:: tempfile.mkdtemp fullpath tempfile.TemporaryDirectory | taken when exiting the context, it can be useful during debugging or when you need your cleanup behavior to be conditional based on other logic.
.. audit-event:: tempfile.mkdtemp fullpath tempfile.TemporaryDirectory | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ef83d691-a0de-4f1b-93ae-35d8e1d692b8 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,441 | supabase-export-v2 | b3a7d863c5afadfb | .. function:: TemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None)
Return a :term:`file-like object` that can be used as a temporary storage area. The file is created securely, using the same rules as :func:`mkstemp`. It will be destroyed as soon
as i... | trusted_official_docs | CPython Docs | .. function:: TemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None)
Return a :term:`file-like object` that can be used as a temporary storage area. The file is created securely, using the same rules as :func:`mkstemp`. It will be destroyed as soon
as i... | .. function:: TemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None)
Return a :term:`file-like object` that can be used as a temporary storage area. The file is created securely, using the same rules as :func:`mkstemp`. It will be destroyed as soon
as i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8e37e86-1c5b-481f-805a-319506f5ac33 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,530 | supabase-export-v2 | a501963336c5c2b1 | .. data:: tempdir
When set to a value other than ``None``, this variable defines the
default value for the *dir* argument to the functions defined in this
module, including its type, bytes or str. It cannot be a
:term:`path-like object`. | trusted_official_docs | CPython Docs | .. data:: tempdir
When set to a value other than ``None``, this variable defines the
default value for the *dir* argument to the functions defined in this
module, including its type, bytes or str. It cannot be a
:term:`path-like object`. | .. data:: tempdir
When set to a value other than ``None``, this variable defines the
default value for the *dir* argument to the functions defined in this
module, including its type, bytes or str. It cannot be a
:term:`path-like object`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9636bf8-c05d-4dc8-8b4b-c7eb94701e84 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,510 | supabase-export-v2 | a03cb8e763d03c0d | Python searches a standard list of directories to find one which the calling user can create files in. The list is:
#. The directory named by the :envvar:`TMPDIR` environment variable. | trusted_official_docs | CPython Docs | Python searches a standard list of directories to find one which the calling user can create files in. The list is:
#. The directory named by the :envvar:`TMPDIR` environment variable. | Python searches a standard list of directories to find one which the calling user can create files in. The list is:
#. The directory named by the :envvar:`TMPDIR` environment variable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fae5a947-208f-4133-a2b4-f02977adbfa5 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,495 | supabase-export-v2 | 49f88f6054bc656f | tuple containing an OS-level handle to an open file (as would be returned by :func:`os.open`) and the absolute pathname of that file, in that order.
.. audit-event:: tempfile.mkstemp fullpath tempfile.mkstemp | trusted_official_docs | CPython Docs | tuple containing an OS-level handle to an open file (as would be returned by :func:`os.open`) and the absolute pathname of that file, in that order.
.. audit-event:: tempfile.mkstemp fullpath tempfile.mkstemp | tuple containing an OS-level handle to an open file (as would be returned by :func:`os.open`) and the absolute pathname of that file, in that order.
.. audit-event:: tempfile.mkstemp fullpath tempfile.mkstemp | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fb5aeeae-f698-4154-89f7-15f61fa619a7 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,543 | supabase-export-v2 | 539ecd577d43e33f | Deprecated functions and variables ----------------------------------
A historical way to create temporary files was to first generate a
file name with the :func:`mktemp` function and then create a file
using this name. Unfortunately this is not secure, because a different
process may create a file with this name in th... | trusted_official_docs | CPython Docs | Deprecated functions and variables ----------------------------------
A historical way to create temporary files was to first generate a
file name with the :func:`mktemp` function and then create a file
using this name. Unfortunately this is not secure, because a different
process may create a file with this name in th... | Deprecated functions and variables ----------------------------------
A historical way to create temporary files was to first generate a
file name with the :func:`mktemp` function and then create a file
using this name. Unfortunately this is not secure, because a different
process may create a file with this name in th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fb8d5a87-2727-4921-8a16-05069d190f9d | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,492 | supabase-export-v2 | 2c678c5375776a3d | is thus no guarantee that the generated filename will have any nice properties, such as not requiring quoting when passed to external commands via ``os.popen()``.
If any of *suffix*, *prefix*, and *dir* are not
``None``, they must be the same type. If they are bytes, the returned name will be bytes instead of str. If ... | trusted_official_docs | CPython Docs | is thus no guarantee that the generated filename will have any nice properties, such as not requiring quoting when passed to external commands via ``os.popen()``.
If any of *suffix*, *prefix*, and *dir* are not
``None``, they must be the same type. If they are bytes, the returned name will be bytes instead of str. If ... | is thus no guarantee that the generated filename will have any nice properties, such as not requiring quoting when passed to external commands via ``os.popen()``.
If any of *suffix*, *prefix*, and *dir* are not
``None``, they must be the same type. If they are bytes, the returned name will be bytes instead of str. If ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe68c88c-4027-4e00-b39b-b9ed83ae557c | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,456 | supabase-export-v2 | e3457982524ac49b | :attr:`!name` attribute of the returned file-like object. On Unix, unlike with the :func:`TemporaryFile`, the directory entry does not get unlinked immediately after the file creation.
If *delete* is true (the default) and *delete_on_close* is true (the
default), the file is deleted as soon as it is closed. If *delete... | trusted_official_docs | CPython Docs | :attr:`!name` attribute of the returned file-like object. On Unix, unlike with the :func:`TemporaryFile`, the directory entry does not get unlinked immediately after the file creation.
If *delete* is true (the default) and *delete_on_close* is true (the
default), the file is deleted as soon as it is closed. If *delete... | :attr:`!name` attribute of the returned file-like object. On Unix, unlike with the :func:`TemporaryFile`, the directory entry does not get unlinked immediately after the file creation.
If *delete* is true (the default) and *delete_on_close* is true (the
default), the file is deleted as soon as it is closed. If *delete... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
feaed8b4-cea1-49d8-aced-1ea0c8795778 | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,504 | supabase-export-v2 | 1378931652b5fa79 | .. audit-event:: tempfile.mkdtemp fullpath tempfile.mkdtemp
.. versionchanged:: 3.5
*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to
obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause
an appropriate default value t... | trusted_official_docs | CPython Docs | .. audit-event:: tempfile.mkdtemp fullpath tempfile.mkdtemp
.. versionchanged:: 3.5
*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to
obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause
an appropriate default value t... | .. audit-event:: tempfile.mkdtemp fullpath tempfile.mkdtemp
.. versionchanged:: 3.5
*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to
obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to ``None`` to cause
an appropriate default value t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
feec7a28-2f1a-4237-b9cb-758d0491773c | CPython Docs | file://datasets/cpython/Doc/library/tempfile.rst | unknown | a460fbda-d280-4a6b-8f3a-16ce66b09edd | 16,443 | supabase-export-v2 | 2ee5aaa8208410c4 | a :term:`context manager` (see :ref:`tempfile-examples`). On completion of the context or destruction of the file object the temporary file will be removed from the filesystem.
The *mode* parameter defaults to ``'w+b'`` so that the file created can
be read and written without being closed. Binary mode is used so that ... | trusted_official_docs | CPython Docs | a :term:`context manager` (see :ref:`tempfile-examples`). On completion of the context or destruction of the file object the temporary file will be removed from the filesystem.
The *mode* parameter defaults to ``'w+b'`` so that the file created can
be read and written without being closed. Binary mode is used so that ... | a :term:`context manager` (see :ref:`tempfile-examples`). On completion of the context or destruction of the file object the temporary file will be removed from the filesystem.
The *mode* parameter defaults to ``'w+b'`` so that the file created can
be read and written without being closed. Binary mode is used so that ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
01980114-c58f-4eea-8d25-fe919a8123f3 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,604 | supabase-export-v2 | b9e52d5c409108fa | :func:`super` mechanism from the class that overrides it. This could be useful as an end-point for a super-call in a framework that uses cooperative multiple-inheritance.
The :mod:`!abc` module also supports the following legacy decorators: | trusted_official_docs | CPython Docs | :func:`super` mechanism from the class that overrides it. This could be useful as an end-point for a super-call in a framework that uses cooperative multiple-inheritance.
The :mod:`!abc` module also supports the following legacy decorators: | :func:`super` mechanism from the class that overrides it. This could be useful as an end-point for a super-call in a framework that uses cooperative multiple-inheritance.
The :mod:`!abc` module also supports the following legacy decorators: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
109c3d4c-82f7-48a4-9534-24414f808541 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,608 | supabase-export-v2 | d415cbf97fc74c02 | A subclass of the built-in :func:`classmethod`, indicating an abstract classmethod. Otherwise it is similar to :func:`abstractmethod`.
This special case is deprecated, as the :func:`classmethod` decorator
is now correctly identified as abstract when applied to an abstract
method:: | trusted_official_docs | CPython Docs | A subclass of the built-in :func:`classmethod`, indicating an abstract classmethod. Otherwise it is similar to :func:`abstractmethod`.
This special case is deprecated, as the :func:`classmethod` decorator
is now correctly identified as abstract when applied to an abstract
method:: | A subclass of the built-in :func:`classmethod`, indicating an abstract classmethod. Otherwise it is similar to :func:`abstractmethod`.
This special case is deprecated, as the :func:`classmethod` decorator
is now correctly identified as abstract when applied to an abstract
method:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17f72ebc-8189-445d-a9f6-33297b975b57 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,620 | supabase-export-v2 | edfdb40436b725b3 | class C(ABC): @property @abstractmethod def my_abstract_property(self): ...
The above example defines a read-only property; you can also define a
read-write abstract property by appropriately marking one or more of the
underlying methods as abstract:: | trusted_official_docs | CPython Docs | class C(ABC): @property @abstractmethod def my_abstract_property(self): ...
The above example defines a read-only property; you can also define a
read-write abstract property by appropriately marking one or more of the
underlying methods as abstract:: | class C(ABC): @property @abstractmethod def my_abstract_property(self): ...
The above example defines a read-only property; you can also define a
read-write abstract property by appropriately marking one or more of the
underlying methods as abstract:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18356839-0fd2-48e7-989b-15147d550e1b | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,556 | supabase-export-v2 | 55007cf6580a9ac4 | be used to test whether a class or instance provides a particular interface, for example, if it is :term:`hashable` or if it is a :term:`mapping`.
This module provides the metaclass :class:`ABCMeta` for defining ABCs and
a helper class :class:`ABC` to alternatively define ABCs through inheritance: | trusted_official_docs | CPython Docs | be used to test whether a class or instance provides a particular interface, for example, if it is :term:`hashable` or if it is a :term:`mapping`.
This module provides the metaclass :class:`ABCMeta` for defining ABCs and
a helper class :class:`ABC` to alternatively define ABCs through inheritance: | be used to test whether a class or instance provides a particular interface, for example, if it is :term:`hashable` or if it is a :term:`mapping`.
This module provides the metaclass :class:`ABCMeta` for defining ABCs and
a helper class :class:`ABC` to alternatively define ABCs through inheritance: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1be9edc5-c9fe-42e1-8359-a5649e3ceef6 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,621 | supabase-export-v2 | 0e36c27e2004e513 | example defines a read-only property; you can also define a read-write abstract property by appropriately marking one or more of the underlying methods as abstract::
class C(ABC):
@property
def x(self):
... | trusted_official_docs | CPython Docs | example defines a read-only property; you can also define a read-write abstract property by appropriately marking one or more of the underlying methods as abstract::
class C(ABC):
@property
def x(self):
... | example defines a read-only property; you can also define a read-write abstract property by appropriately marking one or more of the underlying methods as abstract::
class C(ABC):
@property
def x(self):
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1cfac43f-882d-475d-89dc-088b2cbdd5e2 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,628 | supabase-export-v2 | 3c14f22a468f2c18 | Returns the current abstract base class cache token.
The token is an opaque object (that supports equality testing) identifying
the current version of the abstract base class cache for virtual subclasses. The token changes with every call to :meth:`ABCMeta.register` on any ABC. | trusted_official_docs | CPython Docs | Returns the current abstract base class cache token.
The token is an opaque object (that supports equality testing) identifying
the current version of the abstract base class cache for virtual subclasses. The token changes with every call to :meth:`ABCMeta.register` on any ABC. | Returns the current abstract base class cache token.
The token is an opaque object (that supports equality testing) identifying
the current version of the abstract base class cache for virtual subclasses. The token changes with every call to :meth:`ABCMeta.register` on any ABC. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b2fceaf-ba48-4a6f-8031-250a489bb948 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,596 | supabase-export-v2 | db7af07b12382a13 | supported using the :func:`update_abstractmethods` function. The :func:`!abstractmethod` only affects subclasses derived using regular inheritance; "virtual subclasses" registered with the ABC's :meth:`~ABCMeta.register` method are not affected.
When :func:`!abstractmethod` is applied in combination with other method
... | trusted_official_docs | CPython Docs | supported using the :func:`update_abstractmethods` function. The :func:`!abstractmethod` only affects subclasses derived using regular inheritance; "virtual subclasses" registered with the ABC's :meth:`~ABCMeta.register` method are not affected.
When :func:`!abstractmethod` is applied in combination with other method
... | supported using the :func:`update_abstractmethods` function. The :func:`!abstractmethod` only affects subclasses derived using regular inheritance; "virtual subclasses" registered with the ABC's :meth:`~ABCMeta.register` method are not affected.
When :func:`!abstractmethod` is applied in combination with other method
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
42c14b8b-f7fd-480c-be17-de59bef50adb | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,580 | supabase-export-v2 | 3af999d8991a78f7 | a subclass of this ABC, even if it would normally be one. If it returns :data:`!NotImplemented`, the subclass check is continued with the usual mechanism.
.. XXX explain the "usual mechanism" | trusted_official_docs | CPython Docs | a subclass of this ABC, even if it would normally be one. If it returns :data:`!NotImplemented`, the subclass check is continued with the usual mechanism.
.. XXX explain the "usual mechanism" | a subclass of this ABC, even if it would normally be one. If it returns :data:`!NotImplemented`, the subclass check is continued with the usual mechanism.
.. XXX explain the "usual mechanism" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47c1a5a6-f5e2-4c38-be0b-9458253e0427 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,612 | supabase-export-v2 | 0b387a8ddb570604 | .. versionadded:: 3.2 .. deprecated:: 3.3 It is now possible to use :class:`staticmethod` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`staticmethod`, indicating an abstract
staticmethod. Otherwise it is similar to :func:`abstractmethod`. | trusted_official_docs | CPython Docs | .. versionadded:: 3.2 .. deprecated:: 3.3 It is now possible to use :class:`staticmethod` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`staticmethod`, indicating an abstract
staticmethod. Otherwise it is similar to :func:`abstractmethod`. | .. versionadded:: 3.2 .. deprecated:: 3.3 It is now possible to use :class:`staticmethod` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`staticmethod`, indicating an abstract
staticmethod. Otherwise it is similar to :func:`abstractmethod`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50c8fa4b-9302-4baf-a872-9ac6567fc781 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,566 | supabase-export-v2 | 38031e80a0523392 | Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and
then acts as a mix-in class. You can also register unrelated concrete
classes (even built-in classes) and unrelated ABCs as "virtual subclasses" --
these and their descendants will be cons... | trusted_official_docs | CPython Docs | Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and
then acts as a mix-in class. You can also register unrelated concrete
classes (even built-in classes) and unrelated ABCs as "virtual subclasses" --
these and their descendants will be cons... | Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and
then acts as a mix-in class. You can also register unrelated concrete
classes (even built-in classes) and unrelated ABCs as "virtual subclasses" --
these and their descendants will be cons... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50ff0332-60c8-440a-af2d-d97250f4bd8f | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,617 | supabase-export-v2 | 36abec677dc080f7 | .. deprecated:: 3.3 It is now possible to use :class:`property`, :meth:`property.getter`, :meth:`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`property`, indicating an abstract
property. | trusted_official_docs | CPython Docs | .. deprecated:: 3.3 It is now possible to use :class:`property`, :meth:`property.getter`, :meth:`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`property`, indicating an abstract
property. | .. deprecated:: 3.3 It is now possible to use :class:`property`, :meth:`property.getter`, :meth:`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`property`, indicating an abstract
property. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52d7aeab-8ad0-477f-baef-0c1affa5e293 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,597 | supabase-export-v2 | 5ca2d27f854da4e2 | When :func:`!abstractmethod` is applied in combination with other method descriptors, it should be applied as the innermost decorator, as shown in the following usage examples::
class C(ABC):
@abstractmethod
def my_abstract_method(self, arg1):
... @classmethod
@abstractmethod
def my_abstract_classmethod(cls, arg2)... | trusted_official_docs | CPython Docs | When :func:`!abstractmethod` is applied in combination with other method descriptors, it should be applied as the innermost decorator, as shown in the following usage examples::
class C(ABC):
@abstractmethod
def my_abstract_method(self, arg1):
... @classmethod
@abstractmethod
def my_abstract_classmethod(cls, arg2)... | When :func:`!abstractmethod` is applied in combination with other method descriptors, it should be applied as the innermost decorator, as shown in the following usage examples::
class C(ABC):
@abstractmethod
def my_abstract_method(self, arg1):
... @classmethod
@abstractmethod
def my_abstract_classmethod(cls, arg2)... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
53ccd1fa-dad1-4ed0-8668-267557181337 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,555 | supabase-export-v2 | 202adf0d37701669 | the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)
The :mod:`collections` module has some concrete classes that derive from
ABCs; these can, of course, be further derived. In addition, the
:mod:`collections.abc` submodule ... | trusted_official_docs | CPython Docs | the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)
The :mod:`collections` module has some concrete classes that derive from
ABCs; these can, of course, be further derived. In addition, the
:mod:`collections.abc` submodule ... | the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)
The :mod:`collections` module has some concrete classes that derive from
ABCs; these can, of course, be further derived. In addition, the
:mod:`collections.abc` submodule ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d9a17c3-39b7-42fc-b032-f61f536b5e3d | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,631 | supabase-export-v2 | 1d3c3579fe31ffd5 | .. function:: update_abstractmethods(cls)
A function to recalculate an abstract class's abstraction status. This
function should be called if a class's abstract methods have been
implemented or changed after it was created. Usually, this function should
be called from within a class decorator. | trusted_official_docs | CPython Docs | .. function:: update_abstractmethods(cls)
A function to recalculate an abstract class's abstraction status. This
function should be called if a class's abstract methods have been
implemented or changed after it was created. Usually, this function should
be called from within a class decorator. | .. function:: update_abstractmethods(cls)
A function to recalculate an abstract class's abstraction status. This
function should be called if a class's abstract methods have been
implemented or changed after it was created. Usually, this function should
be called from within a class decorator. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
604c47ae-fe62-426c-a1bc-bdbeaf738783 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,613 | supabase-export-v2 | f88b1bbf245dce13 | A subclass of the built-in :func:`staticmethod`, indicating an abstract staticmethod. Otherwise it is similar to :func:`abstractmethod`.
This special case is deprecated, as the :func:`staticmethod` decorator
is now correctly identified as abstract when applied to an abstract
method:: | trusted_official_docs | CPython Docs | A subclass of the built-in :func:`staticmethod`, indicating an abstract staticmethod. Otherwise it is similar to :func:`abstractmethod`.
This special case is deprecated, as the :func:`staticmethod` decorator
is now correctly identified as abstract when applied to an abstract
method:: | A subclass of the built-in :func:`staticmethod`, indicating an abstract staticmethod. Otherwise it is similar to :func:`abstractmethod`.
This special case is deprecated, as the :func:`staticmethod` decorator
is now correctly identified as abstract when applied to an abstract
method:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b0fe6a6-a267-49e4-887d-a90504920822 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,567 | supabase-export-v2 | cda37c79197e2948 | won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via :func:`super`). [#]_
Classes created with a metaclass of :class:`!ABCMeta` have the following method: | trusted_official_docs | CPython Docs | won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via :func:`super`). [#]_
Classes created with a metaclass of :class:`!ABCMeta` have the following method: | won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via :func:`super`). [#]_
Classes created with a metaclass of :class:`!ABCMeta` have the following method: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
711384dc-89e1-49e0-90f1-f6b5fc3e2c2f | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,618 | supabase-export-v2 | dea6221cb11adb34 | A subclass of the built-in :func:`property`, indicating an abstract property.
This special case is deprecated, as the :func:`property` decorator
is now correctly identified as abstract when applied to an abstract
method:: | trusted_official_docs | CPython Docs | A subclass of the built-in :func:`property`, indicating an abstract property.
This special case is deprecated, as the :func:`property` decorator
is now correctly identified as abstract when applied to an abstract
method:: | A subclass of the built-in :func:`property`, indicating an abstract property.
This special case is deprecated, as the :func:`property` decorator
is now correctly identified as abstract when applied to an abstract
method:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d55a8a9-d37e-4bfb-82a3-7bffe3dec98a | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,590 | supabase-export-v2 | 4593c08fac262bc1 | an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` (or in that of one of its base classes, accessed via the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too.
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
even though it does not define an :meth:`~object.__iter_... | trusted_official_docs | CPython Docs | an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` (or in that of one of its base classes, accessed via the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too.
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
even though it does not define an :meth:`~object.__iter_... | an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` (or in that of one of its base classes, accessed via the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too.
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
even though it does not define an :meth:`~object.__iter_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
82eabdc3-2b94-471d-9d8a-c690461d0ab8 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,601 | supabase-export-v2 | bb32c3d4fa427427 | attribute should be ``True`` if any of the methods used to compose the descriptor are abstract. For example, Python's built-in :class:`property` does the equivalent of::
class Descriptor:
... @property
def __isabstractmethod__(self):
return any(getattr(f, '__isabstractmethod__', False) for
f in (self._fget, self._f... | trusted_official_docs | CPython Docs | attribute should be ``True`` if any of the methods used to compose the descriptor are abstract. For example, Python's built-in :class:`property` does the equivalent of::
class Descriptor:
... @property
def __isabstractmethod__(self):
return any(getattr(f, '__isabstractmethod__', False) for
f in (self._fget, self._f... | attribute should be ``True`` if any of the methods used to compose the descriptor are abstract. For example, Python's built-in :class:`property` does the equivalent of::
class Descriptor:
... @property
def __isabstractmethod__(self):
return any(getattr(f, '__isabstractmethod__', False) for
f in (self._fget, self._f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86de5f75-40dd-4778-9854-36096a51a371 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,588 | supabase-export-v2 | 2441aef00f55575b | MyIterable.register(Foo)
The ABC ``MyIterable`` defines the standard iterable method,
:meth:`~object.__iter__`, as an abstract method. The implementation given
here can still be called from subclasses. The :meth:`!get_iterator` method
is also part of the ``MyIterable`` abstract base class, but it does not have
to b... | trusted_official_docs | CPython Docs | MyIterable.register(Foo)
The ABC ``MyIterable`` defines the standard iterable method,
:meth:`~object.__iter__`, as an abstract method. The implementation given
here can still be called from subclasses. The :meth:`!get_iterator` method
is also part of the ``MyIterable`` abstract base class, but it does not have
to b... | MyIterable.register(Foo)
The ABC ``MyIterable`` defines the standard iterable method,
:meth:`~object.__iter__`, as an abstract method. The implementation given
here can still be called from subclasses. The :meth:`!get_iterator` method
is also part of the ``MyIterable`` abstract base class, but it does not have
to b... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8883a4d2-6413-4737-8d8c-c52293123856 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,603 | supabase-export-v2 | f54ec85b1342b9ed | .. note::
Unlike Java abstract methods, these abstract
methods may have an implementation. This implementation can be
called via the :func:`super` mechanism from the class that
overrides it. This could be useful as an end-point for a
super-call in a framework that uses cooperative
multiple-inheritance. | trusted_official_docs | CPython Docs | .. note::
Unlike Java abstract methods, these abstract
methods may have an implementation. This implementation can be
called via the :func:`super` mechanism from the class that
overrides it. This could be useful as an end-point for a
super-call in a framework that uses cooperative
multiple-inheritance. | .. note::
Unlike Java abstract methods, these abstract
methods may have an implementation. This implementation can be
called via the :func:`super` mechanism from the class that
overrides it. This could be useful as an end-point for a
super-call in a framework that uses cooperative
multiple-inheritance. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90906c6a-a57c-41b2-b372-0d33b21f1b6e | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,591 | supabase-export-v2 | 22bc85a670977fa1 | defined in terms of :meth:`~object.__len__` and :meth:`~object.__getitem__`). Note that this will not make ``get_iterator`` available as a method of ``Foo``, so it is provided separately.
The :mod:`!abc` module also provides the following decorator: | trusted_official_docs | CPython Docs | defined in terms of :meth:`~object.__len__` and :meth:`~object.__getitem__`). Note that this will not make ``get_iterator`` available as a method of ``Foo``, so it is provided separately.
The :mod:`!abc` module also provides the following decorator: | defined in terms of :meth:`~object.__len__` and :meth:`~object.__getitem__`). Note that this will not make ``get_iterator`` available as a method of ``Foo``, so it is provided separately.
The :mod:`!abc` module also provides the following decorator: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
948ae8d2-4363-46bc-9df3-92d01dd9019e | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,554 | supabase-export-v2 | 2b64f2576b3b14ef | --------------
This module provides the infrastructure for defining :term:`abstract base
classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`;
see the PEP for why this was added to Python. (See also :pep:`3141` and the
:mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.) | trusted_official_docs | CPython Docs | --------------
This module provides the infrastructure for defining :term:`abstract base
classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`;
see the PEP for why this was added to Python. (See also :pep:`3141` and the
:mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.) | --------------
This module provides the infrastructure for defining :term:`abstract base
classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`;
see the PEP for why this was added to Python. (See also :pep:`3141` and the
:mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9e5c36b7-15ab-4406-b554-64092e5477ed | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,561 | supabase-export-v2 | 03e50bfc5849f76f | class MyABC(ABC): pass
Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore
inheriting from :class:`!ABC` requires the usual precautions regarding
metaclass usage, as multiple inheritance may lead to metaclass conflicts. One may also define an abstract base class by passing the metaclass
keyword ... | trusted_official_docs | CPython Docs | class MyABC(ABC): pass
Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore
inheriting from :class:`!ABC` requires the usual precautions regarding
metaclass usage, as multiple inheritance may lead to metaclass conflicts. One may also define an abstract base class by passing the metaclass
keyword ... | class MyABC(ABC): pass
Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore
inheriting from :class:`!ABC` requires the usual precautions regarding
metaclass usage, as multiple inheritance may lead to metaclass conflicts. One may also define an abstract base class by passing the metaclass
keyword ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a758aaad-3e91-4d85-98a5-da0636f9cfb9 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,607 | supabase-export-v2 | 980978e7b61e3294 | .. versionadded:: 3.2 .. deprecated:: 3.3 It is now possible to use :class:`classmethod` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`classmethod`, indicating an abstract
classmethod. Otherwise it is similar to :func:`abstractmethod`. | trusted_official_docs | CPython Docs | .. versionadded:: 3.2 .. deprecated:: 3.3 It is now possible to use :class:`classmethod` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`classmethod`, indicating an abstract
classmethod. Otherwise it is similar to :func:`abstractmethod`. | .. versionadded:: 3.2 .. deprecated:: 3.3 It is now possible to use :class:`classmethod` with :func:`abstractmethod`, making this decorator redundant.
A subclass of the built-in :func:`classmethod`, indicating an abstract
classmethod. Otherwise it is similar to :func:`abstractmethod`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a89c7f9f-8031-46c0-a2e4-2d8320a82aea | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,632 | supabase-export-v2 | 7fda49013f5872f3 | if a class's abstract methods have been implemented or changed after it was created. Usually, this function should be called from within a class decorator.
Returns *cls*, to allow usage as a class decorator. | trusted_official_docs | CPython Docs | if a class's abstract methods have been implemented or changed after it was created. Usually, this function should be called from within a class decorator.
Returns *cls*, to allow usage as a class decorator. | if a class's abstract methods have been implemented or changed after it was created. Usually, this function should be called from within a class decorator.
Returns *cls*, to allow usage as a class decorator. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b7c9b63f-3968-4777-aa79-8ddf85a530a1 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,578 | supabase-export-v2 | 4984bc4d38acdfe7 | (Must be defined as a class method.)
Check whether *subclass* is considered a subclass of this ABC. This means
that you can customize the behavior of :func:`issubclass` further without the
need to call :meth:`register` on every class you want to consider a
subclass of the ABC. (This class method is called from the
... | trusted_official_docs | CPython Docs | (Must be defined as a class method.)
Check whether *subclass* is considered a subclass of this ABC. This means
that you can customize the behavior of :func:`issubclass` further without the
need to call :meth:`register` on every class you want to consider a
subclass of the ABC. (This class method is called from the
... | (Must be defined as a class method.)
Check whether *subclass* is considered a subclass of this ABC. This means
that you can customize the behavior of :func:`issubclass` further without the
need to call :meth:`register` on every class you want to consider a
subclass of the ABC. (This class method is called from the
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c7efa295-31a8-4508-b0b5-fe9bd48494cf | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,594 | supabase-export-v2 | c2e461f24ce6f8ae | A decorator indicating abstract methods.
Using this decorator requires that the class's metaclass is :class:`ABCMeta`
or is derived from it. A class that has a metaclass derived from
:class:`!ABCMeta` cannot be instantiated unless all of its abstract methods
and properties are overridden. The abstract methods can be... | trusted_official_docs | CPython Docs | A decorator indicating abstract methods.
Using this decorator requires that the class's metaclass is :class:`ABCMeta`
or is derived from it. A class that has a metaclass derived from
:class:`!ABCMeta` cannot be instantiated unless all of its abstract methods
and properties are overridden. The abstract methods can be... | A decorator indicating abstract methods.
Using this decorator requires that the class's metaclass is :class:`ABCMeta`
or is derived from it. A class that has a metaclass derived from
:class:`!ABCMeta` cannot be instantiated unless all of its abstract methods
and properties are overridden. The abstract methods can be... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d0f1465e-768e-406f-b466-6f1ec29c6a03 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,600 | supabase-export-v2 | c16ae71bcb53a7ca | @abstractmethod def _get_x(self): ... @abstractmethod def _set_x(self, val): ... x = property(_get_x, _set_x)
In order to correctly interoperate with the abstract base class machinery,
the descriptor must identify itself as abstract using
:attr:`!__isabstractmethod__`. In general, this attribute should be ``True``
i... | trusted_official_docs | CPython Docs | @abstractmethod def _get_x(self): ... @abstractmethod def _set_x(self, val): ... x = property(_get_x, _set_x)
In order to correctly interoperate with the abstract base class machinery,
the descriptor must identify itself as abstract using
:attr:`!__isabstractmethod__`. In general, this attribute should be ``True``
i... | @abstractmethod def _get_x(self): ... @abstractmethod def _set_x(self, val): ... x = property(_get_x, _set_x)
In order to correctly interoperate with the abstract base class machinery,
the descriptor must identify itself as abstract using
:attr:`!__isabstractmethod__`. In general, this attribute should be ``True``
i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ddf5108b-32b3-48f6-a909-29aff4327d69 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,589 | supabase-export-v2 | 859afc50801c61e2 | subclasses. The :meth:`!get_iterator` method is also part of the ``MyIterable`` abstract base class, but it does not have to be overridden in non-abstract derived classes.
The :meth:`__subclasshook__` class method defined here says that any class
that has an :meth:`~object.__iter__` method in its
:attr:`~object.__dic... | trusted_official_docs | CPython Docs | subclasses. The :meth:`!get_iterator` method is also part of the ``MyIterable`` abstract base class, but it does not have to be overridden in non-abstract derived classes.
The :meth:`__subclasshook__` class method defined here says that any class
that has an :meth:`~object.__iter__` method in its
:attr:`~object.__dic... | subclasses. The :meth:`!get_iterator` method is also part of the ``MyIterable`` abstract base class, but it does not have to be overridden in non-abstract derived classes.
The :meth:`__subclasshook__` class method defined here says that any class
that has an :meth:`~object.__iter__` method in its
:attr:`~object.__dic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5970e9e-1c53-4f00-bdf2-24a0d5e17610 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,579 | supabase-export-v2 | 672751030ae1b4c3 | :meth:`register` on every class you want to consider a subclass of the ABC. (This class method is called from the :meth:`~type.__subclasscheck__` method of the ABC.)
This method should return ``True``, ``False`` or :data:`NotImplemented`. If
it returns ``True``, the *subclass* is considered a subclass of this ABC. If ... | trusted_official_docs | CPython Docs | :meth:`register` on every class you want to consider a subclass of the ABC. (This class method is called from the :meth:`~type.__subclasscheck__` method of the ABC.)
This method should return ``True``, ``False`` or :data:`NotImplemented`. If
it returns ``True``, the *subclass* is considered a subclass of this ABC. If ... | :meth:`register` on every class you want to consider a subclass of the ABC. (This class method is called from the :meth:`~type.__subclasscheck__` method of the ABC.)
This method should return ``True``, ``False`` or :data:`NotImplemented`. If
it returns ``True``, the *subclass* is considered a subclass of this ABC. If ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5e6f172-c53a-4530-bc38-66496f32c181 | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,558 | supabase-export-v2 | fefc4760fd415e20 | .. class:: ABC
A helper class that has :class:`ABCMeta` as its metaclass. With this class,
an abstract base class can be created by simply deriving from :class:`!ABC`
avoiding sometimes confusing metaclass usage, for example:: | trusted_official_docs | CPython Docs | .. class:: ABC
A helper class that has :class:`ABCMeta` as its metaclass. With this class,
an abstract base class can be created by simply deriving from :class:`!ABC`
avoiding sometimes confusing metaclass usage, for example:: | .. class:: ABC
A helper class that has :class:`ABCMeta` as its metaclass. With this class,
an abstract base class can be created by simply deriving from :class:`!ABC`
avoiding sometimes confusing metaclass usage, for example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ec6f9f5e-9ee5-4af1-84d9-a64841c6e43c | CPython Docs | file://datasets/cpython/Doc/library/abc.rst | unknown | 7f7377d8-dffd-42be-9ed3-96c9e3e31fc3 | 16,595 | supabase-export-v2 | bb6d7983a2a2a4c7 | abstract methods can be called using any of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used to declare abstract methods for properties and descriptors.
Dynamically adding abstract methods to a class, or attempting to modify the
abstraction status of a method or class once it is created, are onl... | trusted_official_docs | CPython Docs | abstract methods can be called using any of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used to declare abstract methods for properties and descriptors.
Dynamically adding abstract methods to a class, or attempting to modify the
abstraction status of a method or class once it is created, are onl... | abstract methods can be called using any of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used to declare abstract methods for properties and descriptors.
Dynamically adding abstract methods to a class, or attempting to modify the
abstraction status of a method or class once it is created, are onl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05e33659-23ef-48a8-8540-c3b9b217578a | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,725 | supabase-export-v2 | 7b5678bc0bd51802 | .. code-block:: shell-session
$ python -m timeit -s "text = 'sample string'; char = 'g'" "char in text"
5000000 loops, best of 5: 0.0877 usec per loop
$ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)"
1000000 loops, best of 5: 0.342 usec per loop | trusted_official_docs | CPython Docs | .. code-block:: shell-session
$ python -m timeit -s "text = 'sample string'; char = 'g'" "char in text"
5000000 loops, best of 5: 0.0877 usec per loop
$ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)"
1000000 loops, best of 5: 0.342 usec per loop | .. code-block:: shell-session
$ python -m timeit -s "text = 'sample string'; char = 'g'" "char in text"
5000000 loops, best of 5: 0.0877 usec per loop
$ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)"
1000000 loops, best of 5: 0.342 usec per loop | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
115340ff-1ead-479b-ba14-f7ed65c16a1c | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,652 | supabase-export-v2 | 9944247ac888a730 | >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000) 0.19665591977536678
Note however that :func:`.timeit` will automatically determine the number of
repetitions only when the command-line interface is used. In the
:ref:`timeit-examples` section you can find more advanced examples. | trusted_official_docs | CPython Docs | >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000) 0.19665591977536678
Note however that :func:`.timeit` will automatically determine the number of
repetitions only when the command-line interface is used. In the
:ref:`timeit-examples` section you can find more advanced examples. | >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000) 0.19665591977536678
Note however that :func:`.timeit` will automatically determine the number of
repetitions only when the command-line interface is used. In the
:ref:`timeit-examples` section you can find more advanced examples. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
204ef9a3-90ac-4677-9ae9-253c8b960506 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,680 | supabase-export-v2 | 41a1f963e46fbf37 | Automatically determine how many times to call :meth:`.timeit`.
This is a convenience function that calls :meth:`.timeit` repeatedly
so that the total time >= *Timer.target_time* seconds, returning the eventual
(number of loops, time taken for that number of loops). It calls
:meth:`.timeit` with increasing numbers f... | trusted_official_docs | CPython Docs | Automatically determine how many times to call :meth:`.timeit`.
This is a convenience function that calls :meth:`.timeit` repeatedly
so that the total time >= *Timer.target_time* seconds, returning the eventual
(number of loops, time taken for that number of loops). It calls
:meth:`.timeit` with increasing numbers f... | Automatically determine how many times to call :meth:`.timeit`.
This is a convenience function that calls :meth:`.timeit` repeatedly
so that the total time >= *Timer.target_time* seconds, returning the eventual
(number of loops, time taken for that number of loops). It calls
:meth:`.timeit` with increasing numbers f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21124c54-8ddd-4c06-922d-c826f81702d5 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,737 | supabase-export-v2 | e187821fb3854ce3 | try: ... int.__bool__ ... except AttributeError: ... pass ... """ >>> timeit.timeit(stmt=s, number=100000) 0.04215312199994514 >>> s = "if hasattr(int, '__bool__'): pass" >>> timeit.timeit(stmt=s, number=100000) 0.08588060699912603
To give the :mod:`!timeit` module access to functions you define, you can pass a
*setup*... | trusted_official_docs | CPython Docs | try: ... int.__bool__ ... except AttributeError: ... pass ... """ >>> timeit.timeit(stmt=s, number=100000) 0.04215312199994514 >>> s = "if hasattr(int, '__bool__'): pass" >>> timeit.timeit(stmt=s, number=100000) 0.08588060699912603
To give the :mod:`!timeit` module access to functions you define, you can pass a
*setup*... | try: ... int.__bool__ ... except AttributeError: ... pass ... """ >>> timeit.timeit(stmt=s, number=100000) 0.04215312199994514 >>> s = "if hasattr(int, '__bool__'): pass" >>> timeit.timeit(stmt=s, number=100000) 0.08588060699912603
To give the :mod:`!timeit` module access to functions you define, you can pass a
*setup*... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21b93310-536e-438e-bc63-d35ede09128b | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,736 | supabase-export-v2 | eab5691d06e9493a | ::
>>> import timeit
>>> # attribute is missing
>>> s = """\
... try:
... str.__bool__
... except AttributeError:
... pass
... """
>>> timeit.timeit(stmt=s, number=100000)
0.9138244460009446
>>> s = "if hasattr(str, '__bool__'): pass"
>>> timeit.timeit(stmt=s, number=100000)
0.5829014980008651
>>>
>>> # a... | trusted_official_docs | CPython Docs | ::
>>> import timeit
>>> # attribute is missing
>>> s = """\
... try:
... str.__bool__
... except AttributeError:
... pass
... """
>>> timeit.timeit(stmt=s, number=100000)
0.9138244460009446
>>> s = "if hasattr(str, '__bool__'): pass"
>>> timeit.timeit(stmt=s, number=100000)
0.5829014980008651
>>>
>>> # a... | ::
>>> import timeit
>>> # attribute is missing
>>> s = """\
... try:
... str.__bool__
... except AttributeError:
... pass
... """
>>> timeit.timeit(stmt=s, number=100000)
0.9138244460009446
>>> s = "if hasattr(str, '__bool__'): pass"
>>> timeit.timeit(stmt=s, number=100000)
0.5829014980008651
>>>
>>> # a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
233ee309-2f8f-46c8-9dee-bf342a3c884d | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,681 | supabase-export-v2 | a2976a1ae8a8c567 | It calls :meth:`.timeit` with increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the time taken is at least *target_time* seconds.
If *callback* is given and is not ``None``, it will be called after
each trial with two arguments: ``callback(number, time_taken)``. | trusted_official_docs | CPython Docs | It calls :meth:`.timeit` with increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the time taken is at least *target_time* seconds.
If *callback* is given and is not ``None``, it will be called after
each trial with two arguments: ``callback(number, time_taken)``. | It calls :meth:`.timeit` with increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the time taken is at least *target_time* seconds.
If *callback* is given and is not ``None``, it will be called after
each trial with two arguments: ``callback(number, time_taken)``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
249496e1-af73-4a30-bd20-45bfa6bb0915 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,731 | supabase-export-v2 | 1397ce215bd1f1a6 | import timeit >>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"') >>> t.timeit() 0.3955516149999312 >>> t.repeat() [0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250654886]
The following examples show how to time expressions that contain multip... | trusted_official_docs | CPython Docs | import timeit >>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"') >>> t.timeit() 0.3955516149999312 >>> t.repeat() [0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250654886]
The following examples show how to time expressions that contain multip... | import timeit >>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"') >>> t.timeit() 0.3955516149999312 >>> t.repeat() [0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250654886]
The following examples show how to time expressions that contain multip... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26bf8ebf-6e5a-4963-bb9a-ebf8fe797058 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,650 | supabase-export-v2 | cf977822ba17f7f0 | >>> import timeit >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000) 0.3018611848820001 >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000) 0.2727368790656328 >>> timeit.timeit('"-".join(map(str, range(100)))', number=10000) 0.23702679807320237
A callable can also be passed fr... | trusted_official_docs | CPython Docs | >>> import timeit >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000) 0.3018611848820001 >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000) 0.2727368790656328 >>> timeit.timeit('"-".join(map(str, range(100)))', number=10000) 0.23702679807320237
A callable can also be passed fr... | >>> import timeit >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000) 0.3018611848820001 >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000) 0.2727368790656328 >>> timeit.timeit('"-".join(map(str, range(100)))', number=10000) 0.23702679807320237
A callable can also be passed fr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d775e30-6bbb-4a18-8354-facf24e1bedd | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,738 | supabase-export-v2 | f07ff120d06da5bb | To give the :mod:`!timeit` module access to functions you define, you can pass a *setup* parameter which contains an import statement::
def test():
"""Stupid test function"""
L = [i for i in range(100)] | trusted_official_docs | CPython Docs | To give the :mod:`!timeit` module access to functions you define, you can pass a *setup* parameter which contains an import statement::
def test():
"""Stupid test function"""
L = [i for i in range(100)] | To give the :mod:`!timeit` module access to functions you define, you can pass a *setup* parameter which contains an import statement::
def test():
"""Stupid test function"""
L = [i for i in range(100)] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2dd7e259-3aea-4448-9ec9-8380245f854a | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,677 | supabase-export-v2 | dc3315ba7edd40b4 | component of the performance of the function being measured. If so, GC can be re-enabled as the first statement in the *setup* string. For example::
timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit() | trusted_official_docs | CPython Docs | component of the performance of the function being measured. If so, GC can be re-enabled as the first statement in the *setup* string. For example::
timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit() | component of the performance of the function being measured. If so, GC can be re-enabled as the first statement in the *setup* string. For example::
timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
36a424a5-6939-4e2c-9fc9-964e0f4ec4aa | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,741 | supabase-export-v2 | 42d5ca11be0b0b4e | the *globals* parameter, which will cause the code to be executed within your current global namespace. This can be more convenient than individually specifying imports::
def f(x):
return x**2
def g(x):
return x**4
def h(x):
return x**8 | trusted_official_docs | CPython Docs | the *globals* parameter, which will cause the code to be executed within your current global namespace. This can be more convenient than individually specifying imports::
def f(x):
return x**2
def g(x):
return x**4
def h(x):
return x**8 | the *globals* parameter, which will cause the code to be executed within your current global namespace. This can be more convenient than individually specifying imports::
def f(x):
return x**2
def g(x):
return x**4
def h(x):
return x**8 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
44920977-d2f3-4fba-9e05-ea397ccbe601 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,734 | supabase-export-v2 | 117790a7efb7e4df | loops, best of 5: 15.7 usec per loop $ python -m timeit "if hasattr(str, '__bool__'): pass" 50000 loops, best of 5: 4.26 usec per loop
$ python -m timeit "try:" " int.__bool__" "except AttributeError:" " pass"
200000 loops, best of 5: 1.43 usec per loop
$ python -m timeit "if hasattr(int, '__bool__'): pass"
100000 l... | trusted_official_docs | CPython Docs | loops, best of 5: 15.7 usec per loop $ python -m timeit "if hasattr(str, '__bool__'): pass" 50000 loops, best of 5: 4.26 usec per loop
$ python -m timeit "try:" " int.__bool__" "except AttributeError:" " pass"
200000 loops, best of 5: 1.43 usec per loop
$ python -m timeit "if hasattr(int, '__bool__'): pass"
100000 l... | loops, best of 5: 15.7 usec per loop $ python -m timeit "if hasattr(str, '__bool__'): pass" 50000 loops, best of 5: 4.26 usec per loop
$ python -m timeit "try:" " int.__bool__" "except AttributeError:" " pass"
200000 loops, best of 5: 1.43 usec per loop
$ python -m timeit "if hasattr(int, '__bool__'): pass"
100000 l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4be227f6-6724-4ced-afb3-e22bcc521c3b | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,694 | supabase-export-v2 | 8a4be0e884699710 | t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except Exception: t.print_exc()
The advantage over the standard traceback is that source lines in the
compiled template will be displayed. The optional *file* argument directs
where the traceback is sent; it defaults to :data:`sys.stderr`. | trusted_official_docs | CPython Docs | t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except Exception: t.print_exc()
The advantage over the standard traceback is that source lines in the
compiled template will be displayed. The optional *file* argument directs
where the traceback is sent; it defaults to :data:`sys.stderr`. | t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except Exception: t.print_exc()
The advantage over the standard traceback is that source lines in the
compiled template will be displayed. The optional *file* argument directs
where the traceback is sent; it defaults to :data:`sys.stderr`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52ec52aa-88df-4206-a3cc-de565d2fa196 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,648 | supabase-export-v2 | eafde4729dd7a965 | range(100)])" 10000 loops, best of 5: 27.5 usec per loop $ python -m timeit "'-'.join(map(str, range(100)))" 10000 loops, best of 5: 23.2 usec per loop
This can be achieved from the :ref:`python-interface` with:: | trusted_official_docs | CPython Docs | range(100)])" 10000 loops, best of 5: 27.5 usec per loop $ python -m timeit "'-'.join(map(str, range(100)))" 10000 loops, best of 5: 23.2 usec per loop
This can be achieved from the :ref:`python-interface` with:: | range(100)])" 10000 loops, best of 5: 27.5 usec per loop $ python -m timeit "'-'.join(map(str, range(100)))" 10000 loops, best of 5: 23.2 usec per loop
This can be achieved from the :ref:`python-interface` with:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b36301a-4a0a-4188-a57b-ac89698f98eb | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,660 | supabase-export-v2 | 3a03da1ce67d14aa | .. function:: repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=5, number=1000000, globals=None)
Create a :class:`Timer` instance with the given statement, *setup* code and
*timer* function and run its :meth:`.repeat` method with the given *repeat*
count and *number* executions. The optional *globals* a... | trusted_official_docs | CPython Docs | .. function:: repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=5, number=1000000, globals=None)
Create a :class:`Timer` instance with the given statement, *setup* code and
*timer* function and run its :meth:`.repeat` method with the given *repeat*
count and *number* executions. The optional *globals* a... | .. function:: repeat(stmt='pass', setup='pass', timer=<default timer>, repeat=5, number=1000000, globals=None)
Create a :class:`Timer` instance with the given statement, *setup* code and
*timer* function and run its :meth:`.repeat` method with the given *repeat*
count and *number* executions. The optional *globals* a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5de770f7-a6a9-4933-891e-88325bddc5e5 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,730 | supabase-export-v2 | 55e23f0e012d41bf | The same can be done using the :class:`Timer` class and its methods::
>>> import timeit
>>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"')
>>> t.timeit()
0.3955516149999312
>>> t.repeat()
[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250... | trusted_official_docs | CPython Docs | The same can be done using the :class:`Timer` class and its methods::
>>> import timeit
>>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"')
>>> t.timeit()
0.3955516149999312
>>> t.repeat()
[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250... | The same can be done using the :class:`Timer` class and its methods::
>>> import timeit
>>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"')
>>> t.timeit()
0.3955516149999312
>>> t.repeat()
[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
660299a6-e74d-492a-b991-e15b967f7d81 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,718 | supabase-export-v2 | 795c7e72b72a2d7b | as a separate statement argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple :option:`-s` options are treated similarly.
If :option:`-n` is not given, a suitable number of loops is calculated by trying
increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... u... | trusted_official_docs | CPython Docs | as a separate statement argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple :option:`-s` options are treated similarly.
If :option:`-n` is not given, a suitable number of loops is calculated by trying
increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... u... | as a separate statement argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple :option:`-s` options are treated similarly.
If :option:`-n` is not given, a suitable number of loops is calculated by trying
increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... u... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6800b8fc-aa16-49c8-ac22-e04fe1673f5c | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,698 | supabase-export-v2 | a17c2c7fa1800660 | When called as a program from the command line, the following form is used::
python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...] | trusted_official_docs | CPython Docs | When called as a program from the command line, the following form is used::
python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...] | When called as a program from the command line, the following form is used::
python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a50cbf8-016b-43dc-a0f5-5d8fb82010f2 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,717 | supabase-export-v2 | 61f875e74c1b61e3 | print a short usage message and exit
A multi-line statement may be given by specifying each line as a separate
statement argument; indented lines are possible by enclosing an argument in
quotes and using leading spaces. Multiple :option:`-s` options are treated
similarly. | trusted_official_docs | CPython Docs | print a short usage message and exit
A multi-line statement may be given by specifying each line as a separate
statement argument; indented lines are possible by enclosing an argument in
quotes and using leading spaces. Multiple :option:`-s` options are treated
similarly. | print a short usage message and exit
A multi-line statement may be given by specifying each line as a separate
statement argument; indented lines are possible by enclosing an argument in
quotes and using leading spaces. Multiple :option:`-s` options are treated
similarly. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7aee91c3-959d-4d64-861e-c92382988a6d | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,672 | supabase-export-v2 | e8aa633b40240bc9 | that will then be executed by :meth:`.timeit`. Note that the timing overhead is a little larger in this case because of the extra function calls.
.. versionchanged:: 3.5
The optional *globals* parameter was added. | trusted_official_docs | CPython Docs | that will then be executed by :meth:`.timeit`. Note that the timing overhead is a little larger in this case because of the extra function calls.
.. versionchanged:: 3.5
The optional *globals* parameter was added. | that will then be executed by :meth:`.timeit`. Note that the timing overhead is a little larger in this case because of the extra function calls.
.. versionchanged:: 3.5
The optional *globals* parameter was added. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7cd8875b-cd4f-45ca-82a6-9b92e78dd1ae | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,689 | supabase-export-v2 | b66450cd24c158ca | probably the only number you should be interested in. After that, you should look at the entire vector and apply common sense rather than statistics.
.. versionchanged:: 3.7
Default value of *repeat* changed from 3 to 5. | trusted_official_docs | CPython Docs | probably the only number you should be interested in. After that, you should look at the entire vector and apply common sense rather than statistics.
.. versionchanged:: 3.7
Default value of *repeat* changed from 3 to 5. | probably the only number you should be interested in. After that, you should look at the entire vector and apply common sense rather than statistics.
.. versionchanged:: 3.7
Default value of *repeat* changed from 3 to 5. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
803949cf-e148-4a22-b0b6-45848b3dfca9 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,647 | supabase-export-v2 | de56affc98af8b0a | .. code-block:: shell-session
$ python -m timeit "'-'.join(str(n) for n in range(100))"
10000 loops, best of 5: 30.2 usec per loop
$ python -m timeit "'-'.join([str(n) for n in range(100)])"
10000 loops, best of 5: 27.5 usec per loop
$ python -m timeit "'-'.join(map(str, range(100)))"
10000 loops, best of 5: 23.2 ... | trusted_official_docs | CPython Docs | .. code-block:: shell-session
$ python -m timeit "'-'.join(str(n) for n in range(100))"
10000 loops, best of 5: 30.2 usec per loop
$ python -m timeit "'-'.join([str(n) for n in range(100)])"
10000 loops, best of 5: 27.5 usec per loop
$ python -m timeit "'-'.join(map(str, range(100)))"
10000 loops, best of 5: 23.2 ... | .. code-block:: shell-session
$ python -m timeit "'-'.join(str(n) for n in range(100))"
10000 loops, best of 5: 30.2 usec per loop
$ python -m timeit "'-'.join([str(n) for n in range(100)])"
10000 loops, best of 5: 27.5 usec per loop
$ python -m timeit "'-'.join(map(str, range(100)))"
10000 loops, best of 5: 23.2 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c408941-885b-4065-b4c1-36ed60437dd0 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,721 | supabase-export-v2 | aed19d515ef10ee7 | .. note::
There is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should be aware of it. The
baseline overhead can be measured by invoking the program without arguments,
and it might differ between Python versions. | trusted_official_docs | CPython Docs | .. note::
There is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should be aware of it. The
baseline overhead can be measured by invoking the program without arguments,
and it might differ between Python versions. | .. note::
There is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should be aware of it. The
baseline overhead can be measured by invoking the program without arguments,
and it might differ between Python versions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90316b0e-8128-4951-a1f2-b8858ff11dc9 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,643 | supabase-export-v2 | 404de9bd1b180f54 | --------------
This module provides a simple way to time small bits of Python code. It has both
a :ref:`timeit-command-line-interface` as well as a :ref:`callable <python-interface>`
one. It avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the "Algorithms" chapter in t... | trusted_official_docs | CPython Docs | --------------
This module provides a simple way to time small bits of Python code. It has both
a :ref:`timeit-command-line-interface` as well as a :ref:`callable <python-interface>`
one. It avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the "Algorithms" chapter in t... | --------------
This module provides a simple way to time small bits of Python code. It has both
a :ref:`timeit-command-line-interface` as well as a :ref:`callable <python-interface>`
one. It avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the "Algorithms" chapter in t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
941bd78d-96ec-46bf-a17e-68a15e95f0f0 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,670 | supabase-export-v2 | c0471f734bbf8955 | measure the execution time of the first statement, use the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are convenience methods to call :meth:`.timeit` multiple times.
The execution time of *setup* is excluded from the overall timed execution run. | trusted_official_docs | CPython Docs | measure the execution time of the first statement, use the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are convenience methods to call :meth:`.timeit` multiple times.
The execution time of *setup* is excluded from the overall timed execution run. | measure the execution time of the first statement, use the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are convenience methods to call :meth:`.timeit` multiple times.
The execution time of *setup* is excluded from the overall timed execution run. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9b8b9eb3-d11e-41e1-b7db-d88134edf266 | CPython Docs | file://datasets/cpython/Doc/library/timeit.rst | unknown | 6f2dbd94-9a6e-4670-a512-3aa511f095fc | 16,726 | supabase-export-v2 | 65313285f33141bf | usec per loop $ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)" 1000000 loops, best of 5: 0.342 usec per loop
In the output, there are three fields. The loop count, which tells you how many
times the statement body was run per timing loop repetition. The repetition
count ('best of 5') which t... | trusted_official_docs | CPython Docs | usec per loop $ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)" 1000000 loops, best of 5: 0.342 usec per loop
In the output, there are three fields. The loop count, which tells you how many
times the statement body was run per timing loop repetition. The repetition
count ('best of 5') which t... | usec per loop $ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)" 1000000 loops, best of 5: 0.342 usec per loop
In the output, there are three fields. The loop count, which tells you how many
times the statement body was run per timing loop repetition. The repetition
count ('best of 5') which t... | 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.