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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e3a478e1-871a-4ccb-9549-cf835a206179 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,026 | supabase-export-v2 | 7b6cad2015cfbfc6 | be a dict in which each key is a logger name and each value is a dict describing how to configure the corresponding Logger instance.
The configuring dict is searched for the following keys: | trusted_official_docs | CPython Docs | be a dict in which each key is a logger name and each value is a dict describing how to configure the corresponding Logger instance.
The configuring dict is searched for the following keys: | be a dict in which each key is a logger name and each value is a dict describing how to configure the corresponding Logger instance.
The configuring dict is searched for the following keys: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e555677b-a8fc-4008-bd61-afd505ed60c2 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,011 | supabase-export-v2 | 57880a577628c080 | * ``format`` * ``datefmt`` * ``style`` * ``validate`` (since version >=3.8) * ``defaults`` (since version >=3.12)
An optional ``class`` key indicates the name of the formatter's
class (as a dotted module and class name). The instantiation
arguments are as for :class:`~logging.Formatter`, thus this key is
most useful... | trusted_official_docs | CPython Docs | * ``format`` * ``datefmt`` * ``style`` * ``validate`` (since version >=3.8) * ``defaults`` (since version >=3.12)
An optional ``class`` key indicates the name of the formatter's
class (as a dotted module and class name). The instantiation
arguments are as for :class:`~logging.Formatter`, thus this key is
most useful... | * ``format`` * ``datefmt`` * ``style`` * ``validate`` (since version >=3.8) * ``defaults`` (since version >=3.12)
An optional ``class`` key indicates the name of the formatter's
class (as a dotted module and class name). The instantiation
arguments are as for :class:`~logging.Formatter`, thus this key is
most useful... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e58f2937-937c-4451-bf62-a3507017e3b6 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,122 | supabase-export-v2 | 182d97644101512c | .. note::
The :func:`fileConfig` API is older than the :func:`dictConfig` API and does
not provide functionality to cover certain aspects of logging. For example,
you cannot configure :class:`~logging.Filter` objects, which provide for
filtering of messages beyond simple integer levels, using :func:`fileConfig`. If ... | trusted_official_docs | CPython Docs | .. note::
The :func:`fileConfig` API is older than the :func:`dictConfig` API and does
not provide functionality to cover certain aspects of logging. For example,
you cannot configure :class:`~logging.Filter` objects, which provide for
filtering of messages beyond simple integer levels, using :func:`fileConfig`. If ... | .. note::
The :func:`fileConfig` API is older than the :func:`dictConfig` API and does
not provide functionality to cover certain aspects of logging. For example,
you cannot configure :class:`~logging.Filter` objects, which provide for
filtering of messages beyond simple integer levels, using :func:`fileConfig`. If ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ec96d329-f0c6-4349-b40f-1ba18c82d260 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,055 | supabase-export-v2 | 5110972acc1ef37f | formatters. (Loggers do not need to have different types for different instances, so there is no support in this configuration schema for user-defined logger classes.)
Objects to be configured are described by dictionaries
which detail their configuration. In some places, the logging system
will be able to infer from t... | trusted_official_docs | CPython Docs | formatters. (Loggers do not need to have different types for different instances, so there is no support in this configuration schema for user-defined logger classes.)
Objects to be configured are described by dictionaries
which detail their configuration. In some places, the logging system
will be able to infer from t... | formatters. (Loggers do not need to have different types for different instances, so there is no support in this configuration schema for user-defined logger classes.)
Objects to be configured are described by dictionaries
which detail their configuration. In some places, the logging system
will be able to infer from t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f03ae53a-9553-4983-abfd-d511649bd8f9 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 29,976 | supabase-export-v2 | 14cd1617799cdb39 | .. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)
Reads the logging configuration from a :mod:`configparser`\-format file. The
format of the file should be as described in
:ref:`logging-config-fileformat`. This function can be called several times from an application, allowi... | trusted_official_docs | CPython Docs | .. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)
Reads the logging configuration from a :mod:`configparser`\-format file. The
format of the file should be as described in
:ref:`logging-config-fileformat`. This function can be called several times from an application, allowi... | .. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)
Reads the logging configuration from a :mod:`configparser`\-format file. The
format of the file should be as described in
:ref:`logging-config-fileformat`. This function can be called several times from an application, allowi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f67405ff-63c9-4e0f-b12f-a06d2125c0c0 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,021 | supabase-export-v2 | 12768c12ff74a9b6 | .. versionchanged:: 3.11 ``filters`` can take filter instances in addition to ids.
All *other* keys are passed through as keyword arguments to the
handler's constructor. For example, given the snippet: | trusted_official_docs | CPython Docs | .. versionchanged:: 3.11 ``filters`` can take filter instances in addition to ids.
All *other* keys are passed through as keyword arguments to the
handler's constructor. For example, given the snippet: | .. versionchanged:: 3.11 ``filters`` can take filter instances in addition to ids.
All *other* keys are passed through as keyword arguments to the
handler's constructor. For example, given the snippet: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f86b792a-1c5d-4d43-a709-5ace8a961c86 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,116 | supabase-export-v2 | eb52ce2cf734c3b2 | ``handlers`` key are the names of other handlers in the configuration (not shown in the above snippet) which will be passed to the queue listener.
Any custom queue handler and listener classes will need to be defined with the same
initialization signatures as :class:`~logging.handlers.QueueHandler` and
:class:`~logging... | trusted_official_docs | CPython Docs | ``handlers`` key are the names of other handlers in the configuration (not shown in the above snippet) which will be passed to the queue listener.
Any custom queue handler and listener classes will need to be defined with the same
initialization signatures as :class:`~logging.handlers.QueueHandler` and
:class:`~logging... | ``handlers`` key are the names of other handlers in the configuration (not shown in the above snippet) which will be passed to the queue listener.
Any custom queue handler and listener classes will need to be defined with the same
initialization signatures as :class:`~logging.handlers.QueueHandler` and
:class:`~logging... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f986ab18-59b7-499c-96ca-ef96e69f62a0 | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 29,965 | supabase-export-v2 | b32010a222c5f2f4 | Configuration functions ^^^^^^^^^^^^^^^^^^^^^^^
The following functions configure the logging module. They are located in the
:mod:`!logging.config` module. Their use is optional --- you can configure the
logging module using these functions or by making calls to the main API (defined
in :mod:`logging` itself) and defi... | trusted_official_docs | CPython Docs | Configuration functions ^^^^^^^^^^^^^^^^^^^^^^^
The following functions configure the logging module. They are located in the
:mod:`!logging.config` module. Their use is optional --- you can configure the
logging module using these functions or by making calls to the main API (defined
in :mod:`logging` itself) and defi... | Configuration functions ^^^^^^^^^^^^^^^^^^^^^^^
The following functions configure the logging module. They are located in the
:mod:`!logging.config` module. Their use is optional --- you can configure the
logging module using these functions or by making calls to the main API (defined
in :mod:`logging` itself) and defi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fda64e9d-6011-408f-8e6a-47dcf1bdf65a | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 30,035 | supabase-export-v2 | 9a9cb4b1f38a7528 | value defaults to ``False``, which means that the specified configuration replaces the existing configuration with the same semantics as used by the existing :func:`fileConfig` API.
If the specified value is ``True``, the configuration is processed
as described in the section on :ref:`logging-config-dict-incremental`. | trusted_official_docs | CPython Docs | value defaults to ``False``, which means that the specified configuration replaces the existing configuration with the same semantics as used by the existing :func:`fileConfig` API.
If the specified value is ``True``, the configuration is processed
as described in the section on :ref:`logging-config-dict-incremental`. | value defaults to ``False``, which means that the specified configuration replaces the existing configuration with the same semantics as used by the existing :func:`fileConfig` API.
If the specified value is ``True``, the configuration is processed
as described in the section on :ref:`logging-config-dict-incremental`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff2a9d3b-c520-4462-b767-5291272790aa | CPython Docs | file://datasets/cpython/Doc/library/logging.config.rst | unknown | e800cdf0-5c99-47e3-b083-38de35bdaf73 | 29,989 | supabase-export-v2 | bf8c6ebae825bd40 | be the same as the passed in bytes (e.g. when only verification is done), or they could be completely different (perhaps if decryption were performed).
To send a configuration to the socket, read in the configuration file and
send it to the socket as a sequence of bytes preceded by a four-byte length
string packed in... | trusted_official_docs | CPython Docs | be the same as the passed in bytes (e.g. when only verification is done), or they could be completely different (perhaps if decryption were performed).
To send a configuration to the socket, read in the configuration file and
send it to the socket as a sequence of bytes preceded by a four-byte length
string packed in... | be the same as the passed in bytes (e.g. when only verification is done), or they could be completely different (perhaps if decryption were performed).
To send a configuration to the socket, read in the configuration file and
send it to the socket as a sequence of bytes preceded by a four-byte length
string packed in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bfdbf3c-afdc-43e2-85e2-4effb01c6745 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,186 | supabase-export-v2 | 6cb95945cfcb2e2f | graphs that visualize call hierarchies, line-level source heatmaps that show exactly where time is spent in your code, and Firefox Profiler output for timeline-based analysis.
The profiler also provides insight into Python interpreter behavior that
deterministic profiling cannot capture. Use ``--mode gil`` to identify ... | trusted_official_docs | CPython Docs | graphs that visualize call hierarchies, line-level source heatmaps that show exactly where time is spent in your code, and Firefox Profiler output for timeline-based analysis.
The profiler also provides insight into Python interpreter behavior that
deterministic profiling cannot capture. Use ``--mode gil`` to identify ... | graphs that visualize call hierarchies, line-level source heatmaps that show exactly where time is spent in your code, and Firefox Profiler output for timeline-based analysis.
The profiler also provides insight into Python interpreter behavior that
deterministic profiling cannot capture. Use ``--mode gil`` to identify ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0dbdecb5-f948-4a5c-9b93-5cfa775c4164 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,212 | supabase-export-v2 | 5c90bfde6a8bfba7 | Understanding profile output ============================
Both profilers collect function-level statistics, though they present them in
different formats. The sampling profiler offers multiple visualizations
(flame graphs, heatmaps, Firefox Profiler, pstats tables), while the
deterministic profiler produces pstats-comp... | trusted_official_docs | CPython Docs | Understanding profile output ============================
Both profilers collect function-level statistics, though they present them in
different formats. The sampling profiler offers multiple visualizations
(flame graphs, heatmaps, Firefox Profiler, pstats tables), while the
deterministic profiler produces pstats-comp... | Understanding profile output ============================
Both profilers collect function-level statistics, though they present them in
different formats. The sampling profiler offers multiple visualizations
(flame graphs, heatmaps, Firefox Profiler, pstats tables), while the
deterministic profiler produces pstats-comp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
127e115c-0404-4896-b998-442c6dfe86de | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,215 | supabase-export-v2 | 421dbcfc049a551e | *tottime*) Time spent executing code in the function itself, excluding time spent in functions it called. High direct time indicates the function contains expensive operations.
**Cumulative time** (also called *total time* or *cumtime*)
Time spent in the function and all functions it called. This measures the
total c... | trusted_official_docs | CPython Docs | *tottime*) Time spent executing code in the function itself, excluding time spent in functions it called. High direct time indicates the function contains expensive operations.
**Cumulative time** (also called *total time* or *cumtime*)
Time spent in the function and all functions it called. This measures the
total c... | *tottime*) Time spent executing code in the function itself, excluding time spent in functions it called. High direct time indicates the function contains expensive operations.
**Cumulative time** (also called *total time* or *cumtime*)
Time spent in the function and all functions it called. This measures the
total c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
144968f5-4402-412a-bf95-df0b1b60929d | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,173 | supabase-export-v2 | 4dbee3e58251f375 | PID. Provides multiple output formats (flame graphs, heatmaps, Firefox Profiler), GIL analysis, GC tracking, and multiple profiling modes (wall-clock, CPU, GIL) with virtually no overhead.
:mod:`profiling.tracing`
A deterministic profiler that traces every function call, return, and
exception event. Provides exact ca... | trusted_official_docs | CPython Docs | PID. Provides multiple output formats (flame graphs, heatmaps, Firefox Profiler), GIL analysis, GC tracking, and multiple profiling modes (wall-clock, CPU, GIL) with virtually no overhead.
:mod:`profiling.tracing`
A deterministic profiler that traces every function call, return, and
exception event. Provides exact ca... | PID. Provides multiple output formats (flame graphs, heatmaps, Firefox Profiler), GIL analysis, GC tracking, and multiple profiling modes (wall-clock, CPU, GIL) with virtually no overhead.
:mod:`profiling.tracing`
A deterministic profiler that traces every function call, return, and
exception event. Provides exact ca... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3224a6a1-6e8a-4d37-9ba5-0c8006bb5226 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,182 | supabase-export-v2 | abc494e178cd8240 | Wall-clock | +--------------------+------------------------------+------------------------------+ | **Special frames** | GC, native (C extensions) | N/A | +--------------------+------------------------------+------------------------------+ | **Attach to PID** | Yes | No | +--------------------+-------------------------... | trusted_official_docs | CPython Docs | Wall-clock | +--------------------+------------------------------+------------------------------+ | **Special frames** | GC, native (C extensions) | N/A | +--------------------+------------------------------+------------------------------+ | **Attach to PID** | Yes | No | +--------------------+-------------------------... | Wall-clock | +--------------------+------------------------------+------------------------------+ | **Special frames** | GC, native (C extensions) | N/A | +--------------------+------------------------------+------------------------------+ | **Attach to PID** | Yes | No | +--------------------+-------------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
328492e8-46f7-4949-a4c9-4b83c5b8da6d | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,191 | supabase-export-v2 | f30f9de01ce1f179 | the number of function calls, or if you want to trace the complete call graph to understand caller-callee relationships, deterministic tracing is the right choice.
Deterministic tracing also excels at capturing functions that execute in
microseconds. Such functions may not appear frequently enough in statistical
sample... | trusted_official_docs | CPython Docs | the number of function calls, or if you want to trace the complete call graph to understand caller-callee relationships, deterministic tracing is the right choice.
Deterministic tracing also excels at capturing functions that execute in
microseconds. Such functions may not appear frequently enough in statistical
sample... | the number of function calls, or if you want to trace the complete call graph to understand caller-callee relationships, deterministic tracing is the right choice.
Deterministic tracing also excels at capturing functions that execute in
microseconds. Such functions may not appear frequently enough in statistical
sample... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f537fb0-11c2-40d6-9aba-c6147e790e5e | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,170 | supabase-export-v2 | 117034ec0b08c5b2 | Introduction to profiling =========================
A :dfn:`profile` is a set of statistics that describes how often and for how
long various parts of a program execute. These statistics help identify
performance bottlenecks and guide optimization efforts. Python provides two
fundamentally different approaches to colle... | trusted_official_docs | CPython Docs | Introduction to profiling =========================
A :dfn:`profile` is a set of statistics that describes how often and for how
long various parts of a program execute. These statistics help identify
performance bottlenecks and guide optimization efforts. Python provides two
fundamentally different approaches to colle... | Introduction to profiling =========================
A :dfn:`profile` is a set of statistics that describes how often and for how
long various parts of a program execute. These statistics help identify
performance bottlenecks and guide optimization efforts. Python provides two
fundamentally different approaches to colle... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f7a3a06-4f37-45ac-8463-a2c9328c3d2c | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,178 | supabase-export-v2 | d6e3494b45fd05db | Choosing a profiler ===================
For most performance analysis, use the statistical profiler
(:mod:`profiling.sampling`). It has minimal overhead, works for both development
and production, and provides rich visualization options including flame graphs,
heatmaps, GIL analysis, and more. | trusted_official_docs | CPython Docs | Choosing a profiler ===================
For most performance analysis, use the statistical profiler
(:mod:`profiling.sampling`). It has minimal overhead, works for both development
and production, and provides rich visualization options including flame graphs,
heatmaps, GIL analysis, and more. | Choosing a profiler ===================
For most performance analysis, use the statistical profiler
(:mod:`profiling.sampling`). It has minimal overhead, works for both development
and production, and provides rich visualization options including flame graphs,
heatmaps, GIL analysis, and more. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59986065-47a7-4c52-9a4d-0c9eed6a2230 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,197 | supabase-export-v2 | 7a7b50ec56968e1c | python -m profiling.sampling run script.py python -m profiling.sampling run -m mypackage.module
This runs the script under the profiler and prints a summary of where time was
spent. For an interactive flame graph:: | trusted_official_docs | CPython Docs | python -m profiling.sampling run script.py python -m profiling.sampling run -m mypackage.module
This runs the script under the profiler and prints a summary of where time was
spent. For an interactive flame graph:: | python -m profiling.sampling run script.py python -m profiling.sampling run -m mypackage.module
This runs the script under the profiler and prints a summary of where time was
spent. For an interactive flame graph:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
64b40e58-e81c-4d68-b01b-44540f695410 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,218 | supabase-export-v2 | 607cb6dcd4f8616d | call count includes recursive invocations, but primitive calls counts only the initial entry. Displayed as ``total/primitive`` (for example, ``3/1`` means three total calls, one primitive).
**Caller/Callee relationships**
Which functions called a given function (callers) and which functions it
called (callees). Flame... | trusted_official_docs | CPython Docs | call count includes recursive invocations, but primitive calls counts only the initial entry. Displayed as ``total/primitive`` (for example, ``3/1`` means three total calls, one primitive).
**Caller/Callee relationships**
Which functions called a given function (callers) and which functions it
called (callees). Flame... | call count includes recursive invocations, but primitive calls counts only the initial entry. Displayed as ``total/primitive`` (for example, ``3/1`` means three total calls, one primitive).
**Caller/Callee relationships**
Which functions called a given function (callers) and which functions it
called (callees). Flame... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6754273b-2008-4f9e-baf9-b39ec5e3bcdd | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,189 | supabase-export-v2 | 9b998675f4dd2bc0 | When to use deterministic tracing ---------------------------------
The deterministic profiler (:mod:`profiling.tracing`) instruments every function
call and return. This approach has higher overhead than sampling, but guarantees
complete coverage of program execution. | trusted_official_docs | CPython Docs | When to use deterministic tracing ---------------------------------
The deterministic profiler (:mod:`profiling.tracing`) instruments every function
call and return. This approach has higher overhead than sampling, but guarantees
complete coverage of program execution. | When to use deterministic tracing ---------------------------------
The deterministic profiler (:mod:`profiling.tracing`) instruments every function
call and return. This approach has higher overhead than sampling, but guarantees
complete coverage of program execution. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7330305f-11b0-456a-b8b3-3462ff3b2926 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,190 | supabase-export-v2 | e79a5c1a2090ff91 | The deterministic profiler (:mod:`profiling.tracing`) instruments every function call and return. This approach has higher overhead than sampling, but guarantees complete coverage of program execution.
The primary reason to choose deterministic tracing is when you need exact call
counts. Statistical profiling estimates... | trusted_official_docs | CPython Docs | The deterministic profiler (:mod:`profiling.tracing`) instruments every function call and return. This approach has higher overhead than sampling, but guarantees complete coverage of program execution.
The primary reason to choose deterministic tracing is when you need exact call
counts. Statistical profiling estimates... | The deterministic profiler (:mod:`profiling.tracing`) instruments every function call and return. This approach has higher overhead than sampling, but guarantees complete coverage of program execution.
The primary reason to choose deterministic tracing is when you need exact call
counts. Statistical profiling estimates... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
881eaa1d-807d-48e9-83d4-bdb4cbfa9223 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,181 | supabase-export-v2 | c8bb8cdf8b35335c | The following table summarizes the key differences:
+--------------------+------------------------------+------------------------------+
| Feature | Statistical sampling | Deterministic |
| | (:mod:`profiling.sampling`) | (:mod:`profiling.tracing`) |
+====================+==============================+================... | trusted_official_docs | CPython Docs | The following table summarizes the key differences:
+--------------------+------------------------------+------------------------------+
| Feature | Statistical sampling | Deterministic |
| | (:mod:`profiling.sampling`) | (:mod:`profiling.tracing`) |
+====================+==============================+================... | The following table summarizes the key differences:
+--------------------+------------------------------+------------------------------+
| Feature | Statistical sampling | Deterministic |
| | (:mod:`profiling.sampling`) | (:mod:`profiling.tracing`) |
+====================+==============================+================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9596a710-9049-41f7-ab73-4dea0710ed47 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,217 | supabase-export-v2 | 9e4f137cda2ab8f1 | or sampled (statistical). In deterministic profiling, this is exact. In statistical profiling, it represents the number of times the function appeared in a stack sample.
**Primitive calls**
Calls that are not induced by recursion. When a function recurses, the total
call count includes recursive invocations, but prim... | trusted_official_docs | CPython Docs | or sampled (statistical). In deterministic profiling, this is exact. In statistical profiling, it represents the number of times the function appeared in a stack sample.
**Primitive calls**
Calls that are not induced by recursion. When a function recurses, the total
call count includes recursive invocations, but prim... | or sampled (statistical). In deterministic profiling, this is exact. In statistical profiling, it represents the number of times the function appeared in a stack sample.
**Primitive calls**
Calls that are not induced by recursion. When a function recurses, the total
call count includes recursive invocations, but prim... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9c02c2ec-723b-4ea1-894a-639ac3471612 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,185 | supabase-export-v2 | 6e7aabc451d6ae9e | python -m profiling.sampling run script.py
One of the main strengths of the sampling profiler is its variety of output
formats. Beyond traditional pstats tables, it can generate interactive
flame graphs that visualize call hierarchies, line-level source heatmaps that
show exactly where time is spent in your code, and F... | trusted_official_docs | CPython Docs | python -m profiling.sampling run script.py
One of the main strengths of the sampling profiler is its variety of output
formats. Beyond traditional pstats tables, it can generate interactive
flame graphs that visualize call hierarchies, line-level source heatmaps that
show exactly where time is spent in your code, and F... | python -m profiling.sampling run script.py
One of the main strengths of the sampling profiler is its variety of output
formats. Beyond traditional pstats tables, it can generate interactive
flame graphs that visualize call hierarchies, line-level source heatmaps that
show exactly where time is spent in your code, and F... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f153078-e505-4fd1-ae6e-97895b1f6fa6 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,220 | supabase-export-v2 | c2002f1fdaf467d6 | Legacy compatibility ====================
For backward compatibility, the ``cProfile`` module remains available as an
alias to :mod:`profiling.tracing`. Existing code using ``import cProfile`` will
continue to work without modification in all future Python versions. | trusted_official_docs | CPython Docs | Legacy compatibility ====================
For backward compatibility, the ``cProfile`` module remains available as an
alias to :mod:`profiling.tracing`. Existing code using ``import cProfile`` will
continue to work without modification in all future Python versions. | Legacy compatibility ====================
For backward compatibility, the ``cProfile`` module remains available as an
alias to :mod:`profiling.tracing`. Existing code using ``import cProfile`` will
continue to work without modification in all future Python versions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a9160d95-14ff-45d5-885e-ff1680cb79ef | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,216 | supabase-export-v2 | 21a7b12b5fff32cc | *cumtime*) Time spent in the function and all functions it called. This measures the total cost of calling a function, including its entire call subtree.
**Call count** (also called *ncalls* or *samples*)
How many times the function was called (deterministic) or sampled
(statistical). In deterministic profiling, this... | trusted_official_docs | CPython Docs | *cumtime*) Time spent in the function and all functions it called. This measures the total cost of calling a function, including its entire call subtree.
**Call count** (also called *ncalls* or *samples*)
How many times the function was called (deterministic) or sampled
(statistical). In deterministic profiling, this... | *cumtime*) Time spent in the function and all functions it called. This measures the total cost of calling a function, including its entire call subtree.
**Call count** (also called *ncalls* or *samples*)
How many times the function was called (deterministic) or sampled
(statistical). In deterministic profiling, this... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a92b60bd-89b2-4fb9-a9c9-80dee3ad44b8 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,179 | supabase-export-v2 | 27938596e86f2bdc | profiler (:mod:`profiling.sampling`). It has minimal overhead, works for both development and production, and provides rich visualization options including flame graphs, heatmaps, GIL analysis, and more.
Use the deterministic profiler (:mod:`profiling.tracing`) when you need **exact
call counts** and cannot afford to m... | trusted_official_docs | CPython Docs | profiler (:mod:`profiling.sampling`). It has minimal overhead, works for both development and production, and provides rich visualization options including flame graphs, heatmaps, GIL analysis, and more.
Use the deterministic profiler (:mod:`profiling.tracing`) when you need **exact
call counts** and cannot afford to m... | profiler (:mod:`profiling.sampling`). It has minimal overhead, works for both development and production, and provides rich visualization options including flame graphs, heatmaps, GIL analysis, and more.
Use the deterministic profiler (:mod:`profiling.tracing`) when you need **exact
call counts** and cannot afford to m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c030e068-94ac-4857-b46d-b20b1e47301d | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,180 | supabase-export-v2 | b58a8970a1d8e6de | Since it instruments every function call and return, it will capture even very fast functions that complete between sampling intervals. The tradeoff is higher overhead.
The following table summarizes the key differences: | trusted_official_docs | CPython Docs | Since it instruments every function call and return, it will capture even very fast functions that complete between sampling intervals. The tradeoff is higher overhead.
The following table summarizes the key differences: | Since it instruments every function call and return, it will capture even very fast functions that complete between sampling intervals. The tradeoff is higher overhead.
The following table summarizes the key differences: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c283e7b6-5ae8-4337-8b22-543e1c88fc57 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,172 | supabase-export-v2 | fc65e4bfea922f45 | The :mod:`!profiling` package organizes Python's built-in profiling tools under a single namespace. It contains two submodules, each implementing a different profiling methodology:
:mod:`profiling.sampling`
A statistical profiler that periodically samples the call stack. Run scripts
directly or attach to running proc... | trusted_official_docs | CPython Docs | The :mod:`!profiling` package organizes Python's built-in profiling tools under a single namespace. It contains two submodules, each implementing a different profiling methodology:
:mod:`profiling.sampling`
A statistical profiler that periodically samples the call stack. Run scripts
directly or attach to running proc... | The :mod:`!profiling` package organizes Python's built-in profiling tools under a single namespace. It contains two submodules, each implementing a different profiling methodology:
:mod:`profiling.sampling`
A statistical profiler that periodically samples the call stack. Run scripts
directly or attach to running proc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c3544355-f086-46e4-9687-7f4a517367f9 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,171 | supabase-export-v2 | 0291967a21edc64f | These statistics help identify performance bottlenecks and guide optimization efforts. Python provides two fundamentally different approaches to collecting this information: statistical sampling and deterministic tracing.
The :mod:`!profiling` package organizes Python's built-in profiling tools under
a single namespace... | trusted_official_docs | CPython Docs | These statistics help identify performance bottlenecks and guide optimization efforts. Python provides two fundamentally different approaches to collecting this information: statistical sampling and deterministic tracing.
The :mod:`!profiling` package organizes Python's built-in profiling tools under
a single namespace... | These statistics help identify performance bottlenecks and guide optimization efforts. Python provides two fundamentally different approaches to collecting this information: statistical sampling and deterministic tracing.
The :mod:`!profiling` package organizes Python's built-in profiling tools under
a single namespace... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3f1733b-7376-44b1-b948-8eb03ea6671c | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,188 | supabase-export-v2 | 3a0aeafc69790ea6 | work is distributed. And for production debugging, the ``attach`` command connects to any running Python process by PID without requiring a restart or code changes.
When to use deterministic tracing
--------------------------------- | trusted_official_docs | CPython Docs | work is distributed. And for production debugging, the ``attach`` command connects to any running Python process by PID without requiring a restart or code changes.
When to use deterministic tracing
--------------------------------- | work is distributed. And for production debugging, the ``attach`` command connects to any running Python process by PID without requiring a restart or code changes.
When to use deterministic tracing
--------------------------------- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d4149b90-8e23-4f2a-aec1-1e3d35b9b6fe | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,214 | supabase-export-v2 | be00a90203c92ddc | Key profiling concepts:
**Direct time** (also called *self time* or *tottime*)
Time spent executing code in the function itself, excluding time spent in
functions it called. High direct time indicates the function contains
expensive operations. | trusted_official_docs | CPython Docs | Key profiling concepts:
**Direct time** (also called *self time* or *tottime*)
Time spent executing code in the function itself, excluding time spent in
functions it called. High direct time indicates the function contains
expensive operations. | Key profiling concepts:
**Direct time** (also called *self time* or *tottime*)
Time spent executing code in the function itself, excluding time spent in
functions it called. High direct time indicates the function contains
expensive operations. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e88c0911-1333-44d2-b381-a2a153d24938 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,175 | supabase-export-v2 | fa34962d106791d7 | .. note::
The profiler modules are designed to provide an execution profile for a
given program, not for benchmarking purposes. For benchmarking, use the
:mod:`timeit` module, which provides reasonably accurate timing
measurements. This distinction is particularly important when comparing
Python code against C code... | trusted_official_docs | CPython Docs | .. note::
The profiler modules are designed to provide an execution profile for a
given program, not for benchmarking purposes. For benchmarking, use the
:mod:`timeit` module, which provides reasonably accurate timing
measurements. This distinction is particularly important when comparing
Python code against C code... | .. note::
The profiler modules are designed to provide an execution profile for a
given program, not for benchmarking purposes. For benchmarking, use the
:mod:`timeit` module, which provides reasonably accurate timing
measurements. This distinction is particularly important when comparing
Python code against C code... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f42b8bdc-b400-4cc0-a205-fb6f4d8a41d5 | CPython Docs | file://datasets/cpython/Doc/library/profiling.rst | unknown | 99c72ca5-0d1d-4027-8710-147bd4b16e01 | 30,187 | supabase-export-v2 | b7128589d13d6646 | or inspect ``<GC>`` frames to understand garbage collection overhead. The ``--native`` option reveals time spent in C extensions, helping distinguish Python overhead from library performance.
For multi-threaded applications, the ``-a`` option samples all threads
simultaneously, showing how work is distributed. And for ... | trusted_official_docs | CPython Docs | or inspect ``<GC>`` frames to understand garbage collection overhead. The ``--native`` option reveals time spent in C extensions, helping distinguish Python overhead from library performance.
For multi-threaded applications, the ``-a`` option samples all threads
simultaneously, showing how work is distributed. And for ... | or inspect ``<GC>`` frames to understand garbage collection overhead. The ``--native`` option reveals time spent in C extensions, helping distinguish Python overhead from library performance.
For multi-threaded applications, the ``-a`` option samples all threads
simultaneously, showing how work is distributed. And for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17f68175-894d-4ee0-85c8-761fc3c8c799 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,241 | supabase-export-v2 | d09f70c470928866 | complex applications, and even then it should only be the high level structure in question, and not the details of how those structures are represented.
Since MIME content types are used widely in modern internet
software (not just email), this will be a familiar concept to many programmers. | trusted_official_docs | CPython Docs | complex applications, and even then it should only be the high level structure in question, and not the details of how those structures are represented.
Since MIME content types are used widely in modern internet
software (not just email), this will be a familiar concept to many programmers. | complex applications, and even then it should only be the high level structure in question, and not the details of how those structures are represented.
Since MIME content types are used widely in modern internet
software (not just email), this will be a familiar concept to many programmers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c3e4107-dc0a-48cc-8988-42d8f4eb6fc0 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,239 | supabase-export-v2 | 7b3e9d125d373e44 | characters, but this usage is discouraged as it is too easy to end up with messages that are not valid in one way or another.)
The control component is the :mod:`~email.policy` module. Every
:class:`~email.message.EmailMessage`, every :mod:`~email.generator`, and every
:mod:`~email.parser` has an associated :mod:`~emai... | trusted_official_docs | CPython Docs | characters, but this usage is discouraged as it is too easy to end up with messages that are not valid in one way or another.)
The control component is the :mod:`~email.policy` module. Every
:class:`~email.message.EmailMessage`, every :mod:`~email.generator`, and every
:mod:`~email.parser` has an associated :mod:`~emai... | characters, but this usage is discouraged as it is too easy to end up with messages that are not valid in one way or another.)
The control component is the :mod:`~email.policy` module. Every
:class:`~email.message.EmailMessage`, every :mod:`~email.generator`, and every
:mod:`~email.parser` has an associated :mod:`~emai... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ded42d6-e41f-40f3-bf28-ee8e652ff22c | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,238 | supabase-export-v2 | 53a3dbbd07f9e068 | the nature of email messages and their MIME subcomponents, the email object model is a tree structure of objects that all provide the :class:`~email.message.EmailMessage` API.
The other two major components of the package are the :mod:`~email.parser` and
the :mod:`~email.generator`. The parser takes the serialized vers... | trusted_official_docs | CPython Docs | the nature of email messages and their MIME subcomponents, the email object model is a tree structure of objects that all provide the :class:`~email.message.EmailMessage` API.
The other two major components of the package are the :mod:`~email.parser` and
the :mod:`~email.generator`. The parser takes the serialized vers... | the nature of email messages and their MIME subcomponents, the email object model is a tree structure of objects that all provide the :class:`~email.message.EmailMessage` API.
The other two major components of the package are the :mod:`~email.parser` and
the :mod:`~email.generator`. The parser takes the serialized vers... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35b57f31-206b-4be6-b834-fd169ccc8de5 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,243 | supabase-export-v2 | 02b761c95e3f1f31 | follow that with the :mod:`~email.parser` and :mod:`~email.generator` components. Then we cover the :mod:`~email.policy` controls, which completes the treatment of the main components of the library.
The next three sections cover the exceptions the package may raise and the
defects (non-compliance with the RFCs) that t... | trusted_official_docs | CPython Docs | follow that with the :mod:`~email.parser` and :mod:`~email.generator` components. Then we cover the :mod:`~email.policy` controls, which completes the treatment of the main components of the library.
The next three sections cover the exceptions the package may raise and the
defects (non-compliance with the RFCs) that t... | follow that with the :mod:`~email.parser` and :mod:`~email.generator` components. Then we cover the :mod:`~email.policy` controls, which completes the treatment of the main components of the library.
The next three sections cover the exceptions the package may raise and the
defects (non-compliance with the RFCs) that t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
37f1e223-f061-4b04-9596-9b03860afa53 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,237 | supabase-export-v2 | 86868343e7c64fcf | overall structure of the email package can be divided into three major components, plus a fourth component that controls the behavior of the other components.
The central component of the package is an "object model" that represents email
messages. An application interacts with the package primarily through the
object ... | trusted_official_docs | CPython Docs | overall structure of the email package can be divided into three major components, plus a fourth component that controls the behavior of the other components.
The central component of the package is an "object model" that represents email
messages. An application interacts with the package primarily through the
object ... | overall structure of the email package can be divided into three major components, plus a fourth component that controls the behavior of the other components.
The central component of the package is an "object model" that represents email
messages. An application interacts with the package primarily through the
object ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
402ea172-b73a-4724-9760-4b2775911d61 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,240 | supabase-export-v2 | c2305d67292a9923 | example, a generic email message to be parsed from disk, but to serialize it using standard SMTP settings when sending it to an email server.
The email package does its best to hide the details of the various governing
RFCs from the application. Conceptually the application should be able to
treat the email message as ... | trusted_official_docs | CPython Docs | example, a generic email message to be parsed from disk, but to serialize it using standard SMTP settings when sending it to an email server.
The email package does its best to hide the details of the various governing
RFCs from the application. Conceptually the application should be able to
treat the email message as ... | example, a generic email message to be parsed from disk, but to serialize it using standard SMTP settings when sending it to an email server.
The email package does its best to hide the details of the various governing
RFCs from the application. Conceptually the application should be able to
treat the email message as ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c5503b7-2c9f-4e33-ae1f-d89f6605fb15 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,245 | supabase-export-v2 | b5d4db900a5e0a59 | Following those is a set of examples of using the fundamental parts of the APIs covered in the preceding sections.
The foregoing represent the modern (unicode friendly) API of the email package. The remaining sections, starting with the :class:`~email.message.Message`
class, cover the legacy :data:`~email.policy.compat... | trusted_official_docs | CPython Docs | Following those is a set of examples of using the fundamental parts of the APIs covered in the preceding sections.
The foregoing represent the modern (unicode friendly) API of the email package. The remaining sections, starting with the :class:`~email.message.Message`
class, cover the legacy :data:`~email.policy.compat... | Following those is a set of examples of using the fundamental parts of the APIs covered in the preceding sections.
The foregoing represent the modern (unicode friendly) API of the email package. The remaining sections, starting with the :class:`~email.message.Message`
class, cover the legacy :data:`~email.policy.compat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b646077-3bfa-48c2-8f02-ccc6942e77c0 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,244 | supabase-export-v2 | 30516cdd4c5f9bc7 | these components contain features relevant to consuming and producing non-trivial messages, but also document their extensibility APIs, which will be of interest to advanced applications.
Following those is a set of examples of using the fundamental parts of the APIs
covered in the preceding sections. | trusted_official_docs | CPython Docs | these components contain features relevant to consuming and producing non-trivial messages, but also document their extensibility APIs, which will be of interest to advanced applications.
Following those is a set of examples of using the fundamental parts of the APIs
covered in the preceding sections. | these components contain features relevant to consuming and producing non-trivial messages, but also document their extensibility APIs, which will be of interest to advanced applications.
Following those is a set of examples of using the fundamental parts of the APIs
covered in the preceding sections. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6187222e-2e02-4d19-868b-b9e48dbb46d9 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,246 | supabase-export-v2 | 79d03bc5375ea9df | that level, they can be useful tools. This documentation is also relevant for applications that are still using the :mod:`~email.policy.compat32` API for backward compatibility reasons.
.. versionchanged:: 3.6
Docs reorganized and rewritten to promote the new
:class:`~email.message.EmailMessage`/:class:`~email.policy... | trusted_official_docs | CPython Docs | that level, they can be useful tools. This documentation is also relevant for applications that are still using the :mod:`~email.policy.compat32` API for backward compatibility reasons.
.. versionchanged:: 3.6
Docs reorganized and rewritten to promote the new
:class:`~email.message.EmailMessage`/:class:`~email.policy... | that level, they can be useful tools. This documentation is also relevant for applications that are still using the :mod:`~email.policy.compat32` API for backward compatibility reasons.
.. versionchanged:: 3.6
Docs reorganized and rewritten to promote the new
:class:`~email.message.EmailMessage`/:class:`~email.policy... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67b0397c-c768-477f-804a-0b3e0690a3d5 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,236 | supabase-export-v2 | 2133dec29ae775f6 | package attempts to be as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:`2231`.
The overall structure of the email package can be divided into three major
components, plus a fourth component that contr... | trusted_official_docs | CPython Docs | package attempts to be as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:`2231`.
The overall structure of the email package can be divided into three major
components, plus a fourth component that contr... | package attempts to be as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:`2231`.
The overall structure of the email package can be divided into three major
components, plus a fourth component that contr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73a44587-0473-4576-b433-24f089604142 | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,242 | supabase-export-v2 | e48dcbe96021e138 | Since MIME content types are used widely in modern internet software (not just email), this will be a familiar concept to many programmers.
The following sections describe the functionality of the :mod:`!email` package. We start with the :mod:`~email.message` object model, which is the primary
interface an application ... | trusted_official_docs | CPython Docs | Since MIME content types are used widely in modern internet software (not just email), this will be a familiar concept to many programmers.
The following sections describe the functionality of the :mod:`!email` package. We start with the :mod:`~email.message` object model, which is the primary
interface an application ... | Since MIME content types are used widely in modern internet software (not just email), this will be a familiar concept to many programmers.
The following sections describe the functionality of the :mod:`!email` package. We start with the :mod:`~email.message` object model, which is the primary
interface an application ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a52fad9a-13b5-4421-a274-3c7ae8615e6c | CPython Docs | file://datasets/cpython/Doc/library/email.rst | unknown | 54ba5176-7078-4d8f-910f-ade88149ee94 | 30,235 | supabase-export-v2 | 4c6422aa8502a7d9 | --------------
The :mod:`!email` package is a library for managing email messages. It is
specifically *not* designed to do any sending of email messages to SMTP
(:rfc:`2821`), NNTP, or other servers; those are functions of modules such as
:mod:`smtplib`. The :mod:`!email` package attempts to be as
RFC-compliant as poss... | trusted_official_docs | CPython Docs | --------------
The :mod:`!email` package is a library for managing email messages. It is
specifically *not* designed to do any sending of email messages to SMTP
(:rfc:`2821`), NNTP, or other servers; those are functions of modules such as
:mod:`smtplib`. The :mod:`!email` package attempts to be as
RFC-compliant as poss... | --------------
The :mod:`!email` package is a library for managing email messages. It is
specifically *not* designed to do any sending of email messages to SMTP
(:rfc:`2821`), NNTP, or other servers; those are functions of modules such as
:mod:`smtplib`. The :mod:`!email` package attempts to be as
RFC-compliant as poss... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0697ef70-bc4c-45bf-929b-00bbf689f4ea | CPython Docs | file://datasets/cpython/Doc/library/tkinter.dnd.rst | unknown | 6045a653-7315-4594-9172-a919744f8945 | 30,266 | supabase-export-v2 | 0aa179bc1d26a77d | #. Top-down search of area under mouse for target widget
* Target widget should have a callable *dnd_accept* attribute
* If *dnd_accept* is not present or returns ``None``, search moves to parent widget
* If no target widget is found, then the target object is ``None`` | trusted_official_docs | CPython Docs | #. Top-down search of area under mouse for target widget
* Target widget should have a callable *dnd_accept* attribute
* If *dnd_accept* is not present or returns ``None``, search moves to parent widget
* If no target widget is found, then the target object is ``None`` | #. Top-down search of area under mouse for target widget
* Target widget should have a callable *dnd_accept* attribute
* If *dnd_accept* is not present or returns ``None``, search moves to parent widget
* If no target widget is found, then the target object is ``None`` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7051cbb8-6e5b-4ce5-9437-0149fd7d6172 | CPython Docs | file://datasets/cpython/Doc/library/tkinter.dnd.rst | unknown | 6045a653-7315-4594-9172-a919744f8945 | 30,263 | supabase-export-v2 | 5637b41a4941088f | .. note:: This is experimental and due to be deprecated when it is replaced with the Tk DND.
The :mod:`!tkinter.dnd` module provides drag-and-drop support for objects within
a single application, within the same window or between windows. To enable an
object to be dragged, you must create an event binding for it that s... | trusted_official_docs | CPython Docs | .. note:: This is experimental and due to be deprecated when it is replaced with the Tk DND.
The :mod:`!tkinter.dnd` module provides drag-and-drop support for objects within
a single application, within the same window or between windows. To enable an
object to be dragged, you must create an event binding for it that s... | .. note:: This is experimental and due to be deprecated when it is replaced with the Tk DND.
The :mod:`!tkinter.dnd` module provides drag-and-drop support for objects within
a single application, within the same window or between windows. To enable an
object to be dragged, you must create an event binding for it that s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7b34a6a1-f608-43fa-8ce1-2c6f6e195e67 | CPython Docs | file://datasets/cpython/Doc/library/tkinter.dnd.rst | unknown | 6045a653-7315-4594-9172-a919744f8945 | 30,264 | supabase-export-v2 | 28e67a52a791a562 | call :func:`dnd_start`, where 'source' is the object to be dragged, and 'event' is the event that invoked the call (the argument to your callback function).
Selection of a target object occurs as follows: | trusted_official_docs | CPython Docs | call :func:`dnd_start`, where 'source' is the object to be dragged, and 'event' is the event that invoked the call (the argument to your callback function).
Selection of a target object occurs as follows: | call :func:`dnd_start`, where 'source' is the object to be dragged, and 'event' is the event that invoked the call (the argument to your callback function).
Selection of a target object occurs as follows: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cfc76142-17cc-4026-bd11-ede933859b39 | CPython Docs | file://datasets/cpython/Doc/library/tkinter.dnd.rst | unknown | 6045a653-7315-4594-9172-a919744f8945 | 30,267 | supabase-export-v2 | af637128e25824d4 | *dnd_accept* is not present or returns ``None``, search moves to parent widget * If no target widget is found, then the target object is ``None``
2. Call to *<old_target>.dnd_leave(source, event)*
#. Call to *<new_target>.dnd_enter(source, event)*
#. Call to *<target>.dnd_commit(source, event)* to notify of drop
#. Cal... | trusted_official_docs | CPython Docs | *dnd_accept* is not present or returns ``None``, search moves to parent widget * If no target widget is found, then the target object is ``None``
2. Call to *<old_target>.dnd_leave(source, event)*
#. Call to *<new_target>.dnd_enter(source, event)*
#. Call to *<target>.dnd_commit(source, event)* to notify of drop
#. Cal... | *dnd_accept* is not present or returns ``None``, search moves to parent widget * If no target widget is found, then the target object is ``None``
2. Call to *<old_target>.dnd_leave(source, event)*
#. Call to *<new_target>.dnd_enter(source, event)*
#. Call to *<target>.dnd_commit(source, event)* to notify of drop
#. Cal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91754e31-56ae-4c53-ba1c-23feedc6f402 | CPython Docs | file://datasets/cpython/Doc/library/archiving.rst | unknown | c3cbb968-a069-46f4-8d39-c6cf87a16cdf | 30,282 | supabase-export-v2 | dbcadea849d73241 | ****************************** Data Compression and Archiving ******************************
The modules described in this chapter support data compression with the zlib,
gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and tar-format
archives. See also :ref:`archiving-operations` provided by the :mod:`... | trusted_official_docs | CPython Docs | ****************************** Data Compression and Archiving ******************************
The modules described in this chapter support data compression with the zlib,
gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and tar-format
archives. See also :ref:`archiving-operations` provided by the :mod:`... | ****************************** Data Compression and Archiving ******************************
The modules described in this chapter support data compression with the zlib,
gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and tar-format
archives. See also :ref:`archiving-operations` provided by the :mod:`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
015276f0-1581-4695-aca9-fa5841e9e871 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,783 | supabase-export-v2 | 6185f6606f888d74 | Building generic types and type aliases """""""""""""""""""""""""""""""""""""""
The following classes should not be used directly as annotations. Their intended purpose is to be building blocks
for creating generic types and type aliases. | trusted_official_docs | CPython Docs | Building generic types and type aliases """""""""""""""""""""""""""""""""""""""
The following classes should not be used directly as annotations. Their intended purpose is to be building blocks
for creating generic types and type aliases. | Building generic types and type aliases """""""""""""""""""""""""""""""""""""""
The following classes should not be used directly as annotations. Their intended purpose is to be building blocks
for creating generic types and type aliases. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
032acdbc-301c-476c-8d64-3a1e683213e4 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,395 | supabase-export-v2 | e85f154c387a75c2 | above. Similarly, :class:`~collections.abc.Mapping` only accepts two type arguments: the first indicates the type of the keys, and the second indicates the type of the values.
Unlike most other Python containers, however, it is common in idiomatic Python
code for tuples to have elements which are not all of the same ty... | trusted_official_docs | CPython Docs | above. Similarly, :class:`~collections.abc.Mapping` only accepts two type arguments: the first indicates the type of the keys, and the second indicates the type of the values.
Unlike most other Python containers, however, it is common in idiomatic Python
code for tuples to have elements which are not all of the same ty... | above. Similarly, :class:`~collections.abc.Mapping` only accepts two type arguments: the first indicates the type of the keys, and the second indicates the type of the values.
Unlike most other Python containers, however, it is common in idiomatic Python
code for tuples to have elements which are not all of the same ty... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
038b90f2-1f82-4525-8e83-2898201298a8 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,817 | supabase-export-v2 | b34ef76c516141db | z = print_capitalized(45) # error: int is not a subtype of str
The upper bound of a type variable can be a concrete type, abstract type
(ABC or Protocol), or even a union of types:: | trusted_official_docs | CPython Docs | z = print_capitalized(45) # error: int is not a subtype of str
The upper bound of a type variable can be a concrete type, abstract type
(ABC or Protocol), or even a union of types:: | z = print_capitalized(45) # error: int is not a subtype of str
The upper bound of a type variable can be a concrete type, abstract type
(ABC or Protocol), or even a union of types:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
03ae6b12-69f0-49cb-a1e9-3aa9ce4cc147 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,886 | supabase-export-v2 | da9dbe1d5d8fa82a | def call_soon[*Ts]( callback: Callable[[*Ts], None], *args: *Ts ) -> None: ... callback(*args)
In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``,
which would specify that *all* arguments are ``int`` - ``*args: *Ts``
enables reference to the types of the *individual* arguments in ``*args``. He... | trusted_official_docs | CPython Docs | def call_soon[*Ts]( callback: Callable[[*Ts], None], *args: *Ts ) -> None: ... callback(*args)
In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``,
which would specify that *all* arguments are ``int`` - ``*args: *Ts``
enables reference to the types of the *individual* arguments in ``*args``. He... | def call_soon[*Ts]( callback: Callable[[*Ts], None], *args: *Ts ) -> None: ... callback(*args)
In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``,
which would specify that *all* arguments are ``int`` - ``*args: *Ts``
enables reference to the types of the *individual* arguments in ``*args``. He... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
041b49b4-914d-4830-a062-85f4ffc76f56 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,410 | supabase-export-v2 | d0210938d5ca9f32 | ``Text`` is provided to supply a forward compatible path for Python 2 code: in Python 2, ``Text`` is an alias for ``unicode``.
Use ``Text`` to indicate that a value must contain a unicode string in
a manner that is compatible with both Python 2 and Python 3:: | trusted_official_docs | CPython Docs | ``Text`` is provided to supply a forward compatible path for Python 2 code: in Python 2, ``Text`` is an alias for ``unicode``.
Use ``Text`` to indicate that a value must contain a unicode string in
a manner that is compatible with both Python 2 and Python 3:: | ``Text`` is provided to supply a forward compatible path for Python 2 code: in Python 2, ``Text`` is an alias for ``unicode``.
Use ``Text`` to indicate that a value must contain a unicode string in
a manner that is compatible with both Python 2 and Python 3:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0471ba51-891b-43d0-9ef2-36ff0f0a4c5a | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,579 | supabase-export-v2 | 37f1a893cab8cd00 | incorrect return annotation here, # as the object returned is always an instance of Eggs, # even in subclasses def returns_eggs(self) -> "Eggs": return Eggs()
See :pep:`673` for more details. | trusted_official_docs | CPython Docs | incorrect return annotation here, # as the object returned is always an instance of Eggs, # even in subclasses def returns_eggs(self) -> "Eggs": return Eggs()
See :pep:`673` for more details. | incorrect return annotation here, # as the object returned is always an instance of Eggs, # even in subclasses def returns_eggs(self) -> "Eggs": return Eggs()
See :pep:`673` for more details. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
069f02ca-08e6-486f-9484-e69c34aead83 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,331 | supabase-export-v2 | 3ec5c8508231ceab | # 'output' is of type 'int', not 'UserId' output = UserId(23413) + UserId(54341)
Note that these checks are enforced only by the static type checker. At runtime,
the statement ``Derived = NewType('Derived', Base)`` will make ``Derived`` a
callable that immediately returns whatever parameter you pass it. That means
the ... | trusted_official_docs | CPython Docs | # 'output' is of type 'int', not 'UserId' output = UserId(23413) + UserId(54341)
Note that these checks are enforced only by the static type checker. At runtime,
the statement ``Derived = NewType('Derived', Base)`` will make ``Derived`` a
callable that immediately returns whatever parameter you pass it. That means
the ... | # 'output' is of type 'int', not 'UserId' output = UserId(23413) + UserId(54341)
Note that these checks are enforced only by the static type checker. At runtime,
the statement ``Derived = NewType('Derived', Base)`` will make ``Derived`` a
callable that immediately returns whatever parameter you pass it. That means
the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
06a6a856-4b85-4656-893a-b0c40f3b5b93 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,867 | supabase-export-v2 | 8659fd826607945f | in contrast, allows parameterization with an *arbitrary* number of types by acting like an *arbitrary* number of type variables wrapped in a tuple. For example::
# T is bound to int, Ts is bound to ()
# Return value is (1,), which has type tuple[int]
move_first_element_to_last(tup=(1,)) | trusted_official_docs | CPython Docs | in contrast, allows parameterization with an *arbitrary* number of types by acting like an *arbitrary* number of type variables wrapped in a tuple. For example::
# T is bound to int, Ts is bound to ()
# Return value is (1,), which has type tuple[int]
move_first_element_to_last(tup=(1,)) | in contrast, allows parameterization with an *arbitrary* number of types by acting like an *arbitrary* number of type variables wrapped in a tuple. For example::
# T is bound to int, Ts is bound to ()
# Return value is (1,), which has type tuple[int]
move_first_element_to_last(tup=(1,)) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07717d9b-f6c6-40b8-ac81-35cbcbe42ebb | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,627 | supabase-export-v2 | b2f9b4e136bd0a62 | from collections.abc import Callable from threading import Lock from typing import Concatenate
# Use this lock to ensure that only one thread is executing a function
# at any time. my_lock = Lock() | trusted_official_docs | CPython Docs | from collections.abc import Callable from threading import Lock from typing import Concatenate
# Use this lock to ensure that only one thread is executing a function
# at any time. my_lock = Lock() | from collections.abc import Callable from threading import Lock from typing import Concatenate
# Use this lock to ensure that only one thread is executing a function
# at any time. my_lock = Lock() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09f6c2cb-02d6-423e-83b1-ba3eb70a6b68 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,290 | supabase-export-v2 | 26b97ec96958616d | Calling :func:`get_type_hints` on an instance is not supported. To retrieve annotations for an instance, call :func:`get_type_hints` on the instance's class instead (for example, ``get_type_hints(type(obj))``).
.. versionchanged:: 3.9
Added ``include_extras`` parameter as part of :pep:`593`. See the documentation on :... | trusted_official_docs | CPython Docs | Calling :func:`get_type_hints` on an instance is not supported. To retrieve annotations for an instance, call :func:`get_type_hints` on the instance's class instead (for example, ``get_type_hints(type(obj))``).
.. versionchanged:: 3.9
Added ``include_extras`` parameter as part of :pep:`593`. See the documentation on :... | Calling :func:`get_type_hints` on an instance is not supported. To retrieve annotations for an instance, call :func:`get_type_hints` on the instance's class instead (for example, ``get_type_hints(type(obj))``).
.. versionchanged:: 3.9
Added ``include_extras`` parameter as part of :pep:`593`. See the documentation on :... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a39e61b-dc2f-4fef-adb0-c2554b74f269 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,839 | supabase-export-v2 | bd7a979f16193f1c | .. method:: evaluate_bound
An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` attribute. When called directly, this method supports only the :attr:`~annotationlib.Format.VALUE`
format, which is equivalent to accessing the :attr:`~TypeVar.__bound__` attribute directly,
but the method object c... | trusted_official_docs | CPython Docs | .. method:: evaluate_bound
An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` attribute. When called directly, this method supports only the :attr:`~annotationlib.Format.VALUE`
format, which is equivalent to accessing the :attr:`~TypeVar.__bound__` attribute directly,
but the method object c... | .. method:: evaluate_bound
An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` attribute. When called directly, this method supports only the :attr:`~annotationlib.Format.VALUE`
format, which is equivalent to accessing the :attr:`~TypeVar.__bound__` attribute directly,
but the method object c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a8d3542-62ef-4aab-9e50-c16b41b480da | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,887 | supabase-export-v2 | a035cd14fd8b7bee | in ``*args``. Here, this allows us to ensure the types of the ``*args`` passed to ``call_soon`` match the types of the (positional) arguments of ``callback``.
See :pep:`646` for more details on type variable tuples. | trusted_official_docs | CPython Docs | in ``*args``. Here, this allows us to ensure the types of the ``*args`` passed to ``call_soon`` match the types of the (positional) arguments of ``callback``.
See :pep:`646` for more details on type variable tuples. | in ``*args``. Here, this allows us to ensure the types of the ``*args`` passed to ``call_soon`` match the types of the (positional) arguments of ``callback``.
See :pep:`646` for more details on type variable tuples. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0af34ccf-2da4-4838-b956-c69c2fa27e4d | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,407 | supabase-export-v2 | b0e7946e03276c50 | with ``type[C]`` (or deprecated :class:`typing.Type[C] <Type>`) may accept values that are classes themselves -- specifically, it will accept the *class object* of ``C``. For example::
a = 3 # Has type ``int``
b = int # Has type ``type[int]``
c = type(a) # Also has type ``type[int]`` | trusted_official_docs | CPython Docs | with ``type[C]`` (or deprecated :class:`typing.Type[C] <Type>`) may accept values that are classes themselves -- specifically, it will accept the *class object* of ``C``. For example::
a = 3 # Has type ``int``
b = int # Has type ``type[int]``
c = type(a) # Also has type ``type[int]`` | with ``type[C]`` (or deprecated :class:`typing.Type[C] <Type>`) may accept values that are classes themselves -- specifically, it will accept the *class object* of ``C``. For example::
a = 3 # Has type ``int``
b = int # Has type ``type[int]``
c = type(a) # Also has type ``type[int]`` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bc5e7e3-720d-4aeb-a7a5-dd7808e86934 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,371 | supabase-export-v2 | 64147820a083cf39 | or removes arguments from other callables, the :data:`Concatenate` operator may be used. They take the form ``Callable[ParamSpecVariable, ReturnType]`` and ``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], ReturnType]`` respectively.
.. versionchanged:: 3.10
``Callable`` now supports :class:`ParamSpe... | trusted_official_docs | CPython Docs | or removes arguments from other callables, the :data:`Concatenate` operator may be used. They take the form ``Callable[ParamSpecVariable, ReturnType]`` and ``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], ReturnType]`` respectively.
.. versionchanged:: 3.10
``Callable`` now supports :class:`ParamSpe... | or removes arguments from other callables, the :data:`Concatenate` operator may be used. They take the form ``Callable[ParamSpecVariable, ReturnType]`` and ``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], ReturnType]`` respectively.
.. versionchanged:: 3.10
``Callable`` now supports :class:`ParamSpe... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bf29e90-e57e-49a6-9b42-332932987287 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,488 | supabase-export-v2 | 2fea66425e5914e4 | class Z(Generic[P]): ...
Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a
generic with only one parameter specification variable will accept
parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also
``X[Type1, Type2, ...]`` for aesthetic reasons. Internally, the latter is converted
to... | trusted_official_docs | CPython Docs | class Z(Generic[P]): ...
Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a
generic with only one parameter specification variable will accept
parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also
``X[Type1, Type2, ...]`` for aesthetic reasons. Internally, the latter is converted
to... | class Z(Generic[P]): ...
Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a
generic with only one parameter specification variable will accept
parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also
``X[Type1, Type2, ...]`` for aesthetic reasons. Internally, the latter is converted
to... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f0799d0-ed95-4f43-818c-a3e2a322b0c6 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,515 | supabase-export-v2 | 12991c42b9c494d7 | to support them, which is unpythonic and unlike what one would normally do in idiomatic dynamically typed Python code. For example, this conforms to :pep:`484`::
from collections.abc import Sized, Iterable, Iterator | trusted_official_docs | CPython Docs | to support them, which is unpythonic and unlike what one would normally do in idiomatic dynamically typed Python code. For example, this conforms to :pep:`484`::
from collections.abc import Sized, Iterable, Iterator | to support them, which is unpythonic and unlike what one would normally do in idiomatic dynamically typed Python code. For example, this conforms to :pep:`484`::
from collections.abc import Sized, Iterable, Iterator | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f2b5e91-da57-4114-a24e-63228b9c5447 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,500 | supabase-export-v2 | cd13802801dc1b1c | def foo(item: Any) -> int: # Passes type checking; 'item' could be any type, # and that type might have a 'bar' method item.bar() ...
Notice that no type checking is performed when assigning a value of type
:data:`Any` to a more precise type. For example, the static type checker did
not report an error when assigning `... | trusted_official_docs | CPython Docs | def foo(item: Any) -> int: # Passes type checking; 'item' could be any type, # and that type might have a 'bar' method item.bar() ...
Notice that no type checking is performed when assigning a value of type
:data:`Any` to a more precise type. For example, the static type checker did
not report an error when assigning `... | def foo(item: Any) -> int: # Passes type checking; 'item' could be any type, # and that type might have a 'bar' method item.bar() ...
Notice that no type checking is performed when assigning a value of type
:data:`Any` to a more precise type. For example, the static type checker did
not report an error when assigning `... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f87490f-d6b3-4d03-b80d-d4d1d74f9ba9 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,403 | supabase-export-v2 | 5fd6405824b4484a | # ``y`` can only ever be assigned to an empty tuple y: tuple[()] = ()
z: tuple = ("foo", "bar")
# These reassignments are OK: plain ``tuple`` is equivalent to ``tuple[Any, ...]``
z = (1, 2, 3)
z = () | trusted_official_docs | CPython Docs | # ``y`` can only ever be assigned to an empty tuple y: tuple[()] = ()
z: tuple = ("foo", "bar")
# These reassignments are OK: plain ``tuple`` is equivalent to ``tuple[Any, ...]``
z = (1, 2, 3)
z = () | # ``y`` can only ever be assigned to an empty tuple y: tuple[()] = ()
z: tuple = ("foo", "bar")
# These reassignments are OK: plain ``tuple`` is equivalent to ``tuple[Any, ...]``
z = (1, 2, 3)
z = () | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fafd17c-ea5a-401e-83a4-e4b48e9bdecc | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,575 | supabase-export-v2 | 01df3796d162aea7 | ``Foo.return_self`` was annotated as returning ``"Foo"``, then the type checker would infer the object returned from ``SubclassOfFoo.return_self`` as being of type ``Foo`` rather than ``SubclassOfFoo``.
Other common use cases include: | trusted_official_docs | CPython Docs | ``Foo.return_self`` was annotated as returning ``"Foo"``, then the type checker would infer the object returned from ``SubclassOfFoo.return_self`` as being of type ``Foo`` rather than ``SubclassOfFoo``.
Other common use cases include: | ``Foo.return_self`` was annotated as returning ``"Foo"``, then the type checker would infer the object returned from ``SubclassOfFoo.return_self`` as being of type ``Foo`` rather than ``SubclassOfFoo``.
Other common use cases include: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1202677e-9273-422f-b11d-8f755ee9d876 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,592 | supabase-export-v2 | b973a5e1047bbef2 | .. versionadded:: 3.10
.. deprecated:: 3.12
:data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement,
which creates instances of :class:`TypeAliasType`
and which natively supports forward references. Note that while :data:`TypeAlias` and :class:`TypeAliasType` serve
similar purposes and have simila... | trusted_official_docs | CPython Docs | .. versionadded:: 3.10
.. deprecated:: 3.12
:data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement,
which creates instances of :class:`TypeAliasType`
and which natively supports forward references. Note that while :data:`TypeAlias` and :class:`TypeAliasType` serve
similar purposes and have simila... | .. versionadded:: 3.10
.. deprecated:: 3.12
:data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement,
which creates instances of :class:`TypeAliasType`
and which natively supports forward references. Note that while :data:`TypeAlias` and :class:`TypeAliasType` serve
similar purposes and have simila... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
122ae40d-0cf1-4f97-bb2b-ef232cae7931 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,060 | supabase-export-v2 | 638212008535dac8 | .. note::
:func:`!runtime_checkable` will check only the presence of the required
methods or attributes, not their type signatures or types. For example, :class:`ssl.SSLObject`
is a class, therefore it passes an :func:`issubclass`
check against :ref:`Callable <annotating-callables>`. However, the
``ssl.SSLObject.__... | trusted_official_docs | CPython Docs | .. note::
:func:`!runtime_checkable` will check only the presence of the required
methods or attributes, not their type signatures or types. For example, :class:`ssl.SSLObject`
is a class, therefore it passes an :func:`issubclass`
check against :ref:`Callable <annotating-callables>`. However, the
``ssl.SSLObject.__... | .. note::
:func:`!runtime_checkable` will check only the presence of the required
methods or attributes, not their type signatures or types. For example, :class:`ssl.SSLObject`
is a class, therefore it passes an :func:`issubclass`
check against :ref:`Callable <annotating-callables>`. However, the
``ssl.SSLObject.__... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
126d9a0e-5718-48ec-a0c2-df4b40e13c60 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,329 | supabase-export-v2 | ea9b54fd6ebcfb74 | :class:`annotationlib.ForwardRef`. Several undocumented behaviors of this class have been changed; for example, after a ``ForwardRef`` has been evaluated, the evaluated value is no longer cached.
.. function:: evaluate_forward_ref(forward_ref, *, owner=None, globals=None, locals=None, type_params=None, format=annotatio... | trusted_official_docs | CPython Docs | :class:`annotationlib.ForwardRef`. Several undocumented behaviors of this class have been changed; for example, after a ``ForwardRef`` has been evaluated, the evaluated value is no longer cached.
.. function:: evaluate_forward_ref(forward_ref, *, owner=None, globals=None, locals=None, type_params=None, format=annotatio... | :class:`annotationlib.ForwardRef`. Several undocumented behaviors of this class have been changed; for example, after a ``ForwardRef`` has been evaluated, the evaluated value is no longer cached.
.. function:: evaluate_forward_ref(forward_ref, *, owner=None, globals=None, locals=None, type_params=None, format=annotatio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1279c665-24dd-4094-9613-18040e0728c0 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,165 | supabase-export-v2 | e4cecb861deeb604 | Ask a static type checker to confirm that *val* has an inferred type of *typ*.
At runtime this does nothing: it returns the first argument unchanged with no
checks or side effects, no matter the actual type of the argument. | trusted_official_docs | CPython Docs | Ask a static type checker to confirm that *val* has an inferred type of *typ*.
At runtime this does nothing: it returns the first argument unchanged with no
checks or side effects, no matter the actual type of the argument. | Ask a static type checker to confirm that *val* has an inferred type of *typ*.
At runtime this does nothing: it returns the first argument unchanged with no
checks or side effects, no matter the actual type of the argument. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15644bfc-4ed4-4e28-bd06-3ac383b6ad9a | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,018 | supabase-export-v2 | b6bc11f8b15df749 | .. versionchanged:: 3.9 ``NamedTuple`` is now a function rather than a class. It can still be used as a class base, as described above.
.. versionchanged:: 3.11
Added support for generic namedtuples. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.9 ``NamedTuple`` is now a function rather than a class. It can still be used as a class base, as described above.
.. versionchanged:: 3.11
Added support for generic namedtuples. | .. versionchanged:: 3.9 ``NamedTuple`` is now a function rather than a class. It can still be used as a class base, as described above.
.. versionchanged:: 3.11
Added support for generic namedtuples. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15e6cce5-9112-44b8-9071-6c12cae386dd | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,162 | supabase-export-v2 | c8a118be61e70464 | Cast a value to a type.
This returns the value unchanged. To the type checker this
signals that the return value has the designated type, but at
runtime we intentionally don't check anything (we want this
to be as fast as possible). | trusted_official_docs | CPython Docs | Cast a value to a type.
This returns the value unchanged. To the type checker this
signals that the return value has the designated type, but at
runtime we intentionally don't check anything (we want this
to be as fast as possible). | Cast a value to a type.
This returns the value unchanged. To the type checker this
signals that the return value has the designated type, but at
runtime we intentionally don't check anything (we want this
to be as fast as possible). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16205757-5cfd-466a-ab7f-39f7f04bb022 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,066 | supabase-export-v2 | 6e8b2af3a9065590 | still work, but will have no impact on :func:`isinstance` checks comparing objects to the protocol. See :ref:`What's new in Python 3.12 <whatsnew-typing-py312>` for more details.
.. deprecated-removed:: 3.15 3.20
It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
protocol classes that were n... | trusted_official_docs | CPython Docs | still work, but will have no impact on :func:`isinstance` checks comparing objects to the protocol. See :ref:`What's new in Python 3.12 <whatsnew-typing-py312>` for more details.
.. deprecated-removed:: 3.15 3.20
It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
protocol classes that were n... | still work, but will have no impact on :func:`isinstance` checks comparing objects to the protocol. See :ref:`What's new in Python 3.12 <whatsnew-typing-py312>` for more details.
.. deprecated-removed:: 3.15 3.20
It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
protocol classes that were n... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16a9c988-5a13-4f41-b46b-d43be82b9132 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,876 | supabase-export-v2 | c729eb5ab533b5ba | class Array[*Shape]: def __getitem__(self, key: tuple[*Shape]) -> float: ... def __abs__(self) -> "Array[*Shape]": ... def get_shape(self) -> tuple[*Shape]: ...
Type variable tuples can be happily combined with normal type variables: | trusted_official_docs | CPython Docs | class Array[*Shape]: def __getitem__(self, key: tuple[*Shape]) -> float: ... def __abs__(self) -> "Array[*Shape]": ... def get_shape(self) -> tuple[*Shape]: ...
Type variable tuples can be happily combined with normal type variables: | class Array[*Shape]: def __getitem__(self, key: tuple[*Shape]) -> float: ... def __abs__(self) -> "Array[*Shape]": ... def get_shape(self) -> tuple[*Shape]: ...
Type variable tuples can be happily combined with normal type variables: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1842461b-ef0b-4009-9a92-7cac33c398ae | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,411 | supabase-export-v2 | eddc238f1041919a | def make_new_user(user_class: type[User]) -> User: # ... return user_class()
make_new_user(User) # OK
make_new_user(ProUser) # Also OK: ``type[ProUser]`` is a subtype of ``type[User]``
make_new_user(TeamUser) # Still fine
make_new_user(User()) # Error: expected ``type[User]`` but got ``User``
make_new_user(int) # E... | trusted_official_docs | CPython Docs | def make_new_user(user_class: type[User]) -> User: # ... return user_class()
make_new_user(User) # OK
make_new_user(ProUser) # Also OK: ``type[ProUser]`` is a subtype of ``type[User]``
make_new_user(TeamUser) # Still fine
make_new_user(User()) # Error: expected ``type[User]`` but got ``User``
make_new_user(int) # E... | def make_new_user(user_class: type[User]) -> User: # ... return user_class()
make_new_user(User) # OK
make_new_user(ProUser) # Also OK: ``type[ProUser]`` is a subtype of ``type[User]``
make_new_user(TeamUser) # Still fine
make_new_user(User()) # Error: expected ``type[User]`` but got ``User``
make_new_user(int) # E... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18e3bf8e-473f-4823-9293-e06347503623 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,252 | supabase-export-v2 | ab5aae1c37c0e7c7 | Decorator to indicate that a method in a subclass is intended to override a method or attribute in a superclass.
Type checkers should emit an error if a method decorated with ``@override``
does not, in fact, override anything. This helps prevent bugs that may occur when a base class is changed without
an equivalent c... | trusted_official_docs | CPython Docs | Decorator to indicate that a method in a subclass is intended to override a method or attribute in a superclass.
Type checkers should emit an error if a method decorated with ``@override``
does not, in fact, override anything. This helps prevent bugs that may occur when a base class is changed without
an equivalent c... | Decorator to indicate that a method in a subclass is intended to override a method or attribute in a superclass.
Type checkers should emit an error if a method decorated with ``@override``
does not, in fact, override anything. This helps prevent bugs that may occur when a base class is changed without
an equivalent c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1903491f-26e5-4469-94fd-fe96cd760d59 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,511 | supabase-export-v2 | f921b24cc4a268a6 | # Passes type checking, since Any is compatible with all types hash_b(42) hash_b("foo")
Use :class:`object` to indicate that a value could be any type in a typesafe
manner. Use :data:`Any` to indicate that a value is dynamically typed. | trusted_official_docs | CPython Docs | # Passes type checking, since Any is compatible with all types hash_b(42) hash_b("foo")
Use :class:`object` to indicate that a value could be any type in a typesafe
manner. Use :data:`Any` to indicate that a value is dynamically typed. | # Passes type checking, since Any is compatible with all types hash_b(42) hash_b("foo")
Use :class:`object` to indicate that a value could be any type in a typesafe
manner. Use :data:`Any` to indicate that a value is dynamically typed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19b19919-feac-43e8-a010-aef8a0121613 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,444 | supabase-export-v2 | 6a72d6a93d690e97 | implicitly inherit from :class:`Generic`. For compatibility with Python 3.11 and lower, it is also possible to inherit explicitly from :class:`Generic` to indicate a generic class::
from typing import TypeVar, Generic | trusted_official_docs | CPython Docs | implicitly inherit from :class:`Generic`. For compatibility with Python 3.11 and lower, it is also possible to inherit explicitly from :class:`Generic` to indicate a generic class::
from typing import TypeVar, Generic | implicitly inherit from :class:`Generic`. For compatibility with Python 3.11 and lower, it is also possible to inherit explicitly from :class:`Generic` to indicate a generic class::
from typing import TypeVar, Generic | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1af63df7-f879-44d2-b2bb-8beb652fa821 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,794 | supabase-export-v2 | 66388f87c96516bb | For backwards compatibility, generic classes can also be declared by explicitly inheriting from ``Generic``. In this case, the type parameters must be declared separately::
KT = TypeVar('KT')
VT = TypeVar('VT') | trusted_official_docs | CPython Docs | For backwards compatibility, generic classes can also be declared by explicitly inheriting from ``Generic``. In this case, the type parameters must be declared separately::
KT = TypeVar('KT')
VT = TypeVar('VT') | For backwards compatibility, generic classes can also be declared by explicitly inheriting from ``Generic``. In this case, the type parameters must be declared separately::
KT = TypeVar('KT')
VT = TypeVar('VT') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b07f430-9b1d-49a6-bbad-56862193028d | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,543 | supabase-export-v2 | eadccac4b420451b | Deprecated in favor of the new :ref:`type parameter syntax <type-params>`. Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :pep:`695` for more details.
In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and
deprecation warnings will be emitted at runtime when it is accessed ... | trusted_official_docs | CPython Docs | Deprecated in favor of the new :ref:`type parameter syntax <type-params>`. Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :pep:`695` for more details.
In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and
deprecation warnings will be emitted at runtime when it is accessed ... | Deprecated in favor of the new :ref:`type parameter syntax <type-params>`. Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :pep:`695` for more details.
In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and
deprecation warnings will be emitted at runtime when it is accessed ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1bfb9820-9f7b-4778-a0df-fff155c7e8e2 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,291 | supabase-export-v2 | c5e0d080e70a5577 | .. versionchanged:: 3.9 Added ``include_extras`` parameter as part of :pep:`593`. See the documentation on :data:`Annotated` for more information.
.. versionchanged:: 3.11
Previously, ``Optional[t]`` was added for function and method annotations
if a default value equal to ``None`` was set. Now the annotation is retu... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.9 Added ``include_extras`` parameter as part of :pep:`593`. See the documentation on :data:`Annotated` for more information.
.. versionchanged:: 3.11
Previously, ``Optional[t]`` was added for function and method annotations
if a default value equal to ``None`` was set. Now the annotation is retu... | .. versionchanged:: 3.9 Added ``include_extras`` parameter as part of :pep:`593`. See the documentation on :data:`Annotated` for more information.
.. versionchanged:: 3.11
Previously, ``Optional[t]`` was added for function and method annotations
if a default value equal to ``None`` was set. Now the annotation is retu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1cd0dc12-0479-4b5e-a4cc-7b1c9a05299c | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,421 | supabase-export-v2 | a440305451193e54 | Deprecated alias to :class:`collections.abc.ByteString`.
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
implements the :ref:`buffer protocol <bufferobjects>` at runtime. For use in
type annotations, either use :class:`~collections.abc.Buffer` or a union
that explicitly specifies the types your co... | trusted_official_docs | CPython Docs | Deprecated alias to :class:`collections.abc.ByteString`.
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
implements the :ref:`buffer protocol <bufferobjects>` at runtime. For use in
type annotations, either use :class:`~collections.abc.Buffer` or a union
that explicitly specifies the types your co... | Deprecated alias to :class:`collections.abc.ByteString`.
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
implements the :ref:`buffer protocol <bufferobjects>` at runtime. For use in
type annotations, either use :class:`~collections.abc.Buffer` or a union
that explicitly specifies the types your co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1cd21088-fc4b-4a79-9699-3acc3eaad435 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,512 | supabase-export-v2 | 117a47051b12d218 | Use :class:`object` to indicate that a value could be any type in a typesafe manner. Use :data:`Any` to indicate that a value is dynamically typed.
Nominal vs structural subtyping
=============================== | trusted_official_docs | CPython Docs | Use :class:`object` to indicate that a value could be any type in a typesafe manner. Use :data:`Any` to indicate that a value is dynamically typed.
Nominal vs structural subtyping
=============================== | Use :class:`object` to indicate that a value could be any type in a typesafe manner. Use :data:`Any` to indicate that a value is dynamically typed.
Nominal vs structural subtyping
=============================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1dd34190-ddcc-4763-aa63-1ba4b2112aaa | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,293 | supabase-export-v2 | 8f9a8211ab21d8e2 | .. versionchanged:: 3.14 Added the ``format`` parameter. See the documentation on :func:`annotationlib.get_annotations` for more information.
.. versionchanged:: 3.14
Calling :func:`get_type_hints` on instances is no longer supported. Some instances were accepted in earlier versions as an undocumented
implementation ... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.14 Added the ``format`` parameter. See the documentation on :func:`annotationlib.get_annotations` for more information.
.. versionchanged:: 3.14
Calling :func:`get_type_hints` on instances is no longer supported. Some instances were accepted in earlier versions as an undocumented
implementation ... | .. versionchanged:: 3.14 Added the ``format`` parameter. See the documentation on :func:`annotationlib.get_annotations` for more information.
.. versionchanged:: 3.14
Calling :func:`get_type_hints` on instances is no longer supported. Some instances were accepted in earlier versions as an undocumented
implementation ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e0e1cf7-b78b-4250-952d-7b4d306ce300 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,156 | supabase-export-v2 | f766ab02e2b72674 | The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler alternative for argument types, when only the ``read()`` or ``write()`` methods are accessed, respectively::
def read_and_write(reader: Reader[str], writer: Writer[bytes]):
data = reader.read()
writer.write(data.encode()) | trusted_official_docs | CPython Docs | The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler alternative for argument types, when only the ``read()`` or ``write()`` methods are accessed, respectively::
def read_and_write(reader: Reader[str], writer: Writer[bytes]):
data = reader.read()
writer.write(data.encode()) | The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler alternative for argument types, when only the ``read()`` or ``write()`` methods are accessed, respectively::
def read_and_write(reader: Reader[str], writer: Writer[bytes]):
data = reader.read()
writer.write(data.encode()) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e638013-52b6-4038-a203-0786a4a33d2b | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,205 | supabase-export-v2 | 084d28ee299bd55e | by type checkers similarly to classes created with :deco:`dataclasses.dataclass`. For example, type checkers will assume these classes have ``__init__`` methods that accept ``id`` and ``name``.
The decorated class, metaclass, or function may accept the following bool
arguments which type checkers will assume have the ... | trusted_official_docs | CPython Docs | by type checkers similarly to classes created with :deco:`dataclasses.dataclass`. For example, type checkers will assume these classes have ``__init__`` methods that accept ``id`` and ``name``.
The decorated class, metaclass, or function may accept the following bool
arguments which type checkers will assume have the ... | by type checkers similarly to classes created with :deco:`dataclasses.dataclass`. For example, type checkers will assume these classes have ``__init__`` methods that accept ``id`` and ``name``.
The decorated class, metaclass, or function may accept the following bool
arguments which type checkers will assume have the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e89911c-a4b8-4ca2-b4af-3f725d67bcca | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,287 | supabase-export-v2 | d62275bba65bcdc4 | .. note::
If :attr:`Format.VALUE <annotationlib.Format.VALUE>` is used and any
forward references in the annotations of *obj* are not resolvable, a
:exc:`NameError` exception is raised. For example, this can happen
with names imported under :data:`if TYPE_CHECKING <TYPE_CHECKING>`. More generally, any kind of except... | trusted_official_docs | CPython Docs | .. note::
If :attr:`Format.VALUE <annotationlib.Format.VALUE>` is used and any
forward references in the annotations of *obj* are not resolvable, a
:exc:`NameError` exception is raised. For example, this can happen
with names imported under :data:`if TYPE_CHECKING <TYPE_CHECKING>`. More generally, any kind of except... | .. note::
If :attr:`Format.VALUE <annotationlib.Format.VALUE>` is used and any
forward references in the annotations of *obj* are not resolvable, a
:exc:`NameError` exception is raised. For example, this can happen
with names imported under :data:`if TYPE_CHECKING <TYPE_CHECKING>`. More generally, any kind of except... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e966657-9bf5-4db2-9d4a-6f6177255cd9 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,925 | supabase-export-v2 | e430e05aa06ddf96 | Without ``ParamSpec``, the simplest way to annotate this previously was to use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However this causes two problems:
1. The type checker can't type check the ``inner`` function because
``*args`` and ``**kwargs`` have to be typed :data:`Any`. 2. :func:`~cast` may ... | trusted_official_docs | CPython Docs | Without ``ParamSpec``, the simplest way to annotate this previously was to use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However this causes two problems:
1. The type checker can't type check the ``inner`` function because
``*args`` and ``**kwargs`` have to be typed :data:`Any`. 2. :func:`~cast` may ... | Without ``ParamSpec``, the simplest way to annotate this previously was to use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However this causes two problems:
1. The type checker can't type check the ``inner`` function because
``*args`` and ``**kwargs`` have to be typed :data:`Any`. 2. :func:`~cast` may ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1ee5e3f1-0a7d-499c-8047-f6cbc4e93c1f | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,311 | supabase-export-v2 | b816bc8468484d67 | def scale(scalar: float, vector: Vector) -> Vector: return [scalar * num for num in vector]
# passes type checking; a list of floats qualifies as a Vector. new_vector = scale(2.0, [1.0, -4.2, 5.4]) | trusted_official_docs | CPython Docs | def scale(scalar: float, vector: Vector) -> Vector: return [scalar * num for num in vector]
# passes type checking; a list of floats qualifies as a Vector. new_vector = scale(2.0, [1.0, -4.2, 5.4]) | def scale(scalar: float, vector: Vector) -> Vector: return [scalar * num for num in vector]
# passes type checking; a list of floats qualifies as a Vector. new_vector = scale(2.0, [1.0, -4.2, 5.4]) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1f18b976-48de-4092-8bd4-463f011f3603 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,450 | supabase-export-v2 | b8775189684b7bdc | def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None: for var in vars: var.set(0)
A generic type can have any number of type variables. All varieties of
:class:`TypeVar` are permissible as parameters for a generic type:: | trusted_official_docs | CPython Docs | def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None: for var in vars: var.set(0)
A generic type can have any number of type variables. All varieties of
:class:`TypeVar` are permissible as parameters for a generic type:: | def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None: for var in vars: var.set(0)
A generic type can have any number of type variables. All varieties of
:class:`TypeVar` are permissible as parameters for a generic type:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1f3c78b5-6756-4b5e-8f14-b8ef604975cb | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 31,056 | supabase-export-v2 | f6b8945ee5580805 | of protocols is not inherited. A subclass of a runtime-checkable protocol is only runtime-checkable if it is explicitly marked as such, regardless of class hierarchy::
@runtime_checkable
class Iterable(Protocol):
def __iter__(self): ... | trusted_official_docs | CPython Docs | of protocols is not inherited. A subclass of a runtime-checkable protocol is only runtime-checkable if it is explicitly marked as such, regardless of class hierarchy::
@runtime_checkable
class Iterable(Protocol):
def __iter__(self): ... | of protocols is not inherited. A subclass of a runtime-checkable protocol is only runtime-checkable if it is explicitly marked as such, regardless of class hierarchy::
@runtime_checkable
class Iterable(Protocol):
def __iter__(self): ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1fd33bce-8943-495a-81e2-5875ba78150b | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,702 | supabase-export-v2 | 9f03bd78aee70e0c | assert a1 != a2 # Order matters
It is up to the tool consuming the annotations to decide whether the
client is allowed to add multiple metadata elements to one annotation and how to
merge those annotations. | trusted_official_docs | CPython Docs | assert a1 != a2 # Order matters
It is up to the tool consuming the annotations to decide whether the
client is allowed to add multiple metadata elements to one annotation and how to
merge those annotations. | assert a1 != a2 # Order matters
It is up to the tool consuming the annotations to decide whether the
client is allowed to add multiple metadata elements to one annotation and how to
merge those annotations. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2021d4f5-42fb-4916-b176-631aa57d2ec2 | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,520 | supabase-export-v2 | e58d5ab236d00746 | class Bucket: # Note: no base classes ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ...
def collect(items: Iterable[int]) -> int: ... result = collect(Bucket()) # Passes type check | trusted_official_docs | CPython Docs | class Bucket: # Note: no base classes ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ...
def collect(items: Iterable[int]) -> int: ... result = collect(Bucket()) # Passes type check | class Bucket: # Note: no base classes ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ...
def collect(items: Iterable[int]) -> int: ... result = collect(Bucket()) # Passes type check | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2073cddd-7da7-47b7-aad3-ed35784e502e | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,793 | supabase-export-v2 | fcd154a7cec7684b | Here the brackets after the function name indicate a :ref:`generic function <generic-functions>`.
For backwards compatibility, generic classes can also be
declared by explicitly inheriting from
``Generic``. In this case, the type parameters must be declared
separately:: | trusted_official_docs | CPython Docs | Here the brackets after the function name indicate a :ref:`generic function <generic-functions>`.
For backwards compatibility, generic classes can also be
declared by explicitly inheriting from
``Generic``. In this case, the type parameters must be declared
separately:: | Here the brackets after the function name indicate a :ref:`generic function <generic-functions>`.
For backwards compatibility, generic classes can also be
declared by explicitly inheriting from
``Generic``. In this case, the type parameters must be declared
separately:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2113b336-73d0-4528-be5b-0bf579b44dee | CPython Docs | file://datasets/cpython/Doc/library/typing.rst | unknown | 761dcd07-e75b-4e99-a2c4-881ccac2b544 | 30,869 | supabase-export-v2 | 7b81f6f1663ffd60 | # T is bound to int, Ts is bound to (str,) # Return value is ('spam', 1), which has type tuple[str, int] move_first_element_to_last(tup=(1, 'spam'))
# T is bound to int, Ts is bound to (str, float)
# Return value is ('spam', 3.0, 1), which has type tuple[str, float, int]
move_first_element_to_last(tup=(1, 'spam', 3.0... | trusted_official_docs | CPython Docs | # T is bound to int, Ts is bound to (str,) # Return value is ('spam', 1), which has type tuple[str, int] move_first_element_to_last(tup=(1, 'spam'))
# T is bound to int, Ts is bound to (str, float)
# Return value is ('spam', 3.0, 1), which has type tuple[str, float, int]
move_first_element_to_last(tup=(1, 'spam', 3.0... | # T is bound to int, Ts is bound to (str,) # Return value is ('spam', 1), which has type tuple[str, int] move_first_element_to_last(tup=(1, 'spam'))
# T is bound to int, Ts is bound to (str, float)
# Return value is ('spam', 3.0, 1), which has type tuple[str, float, int]
move_first_element_to_last(tup=(1, 'spam', 3.0... | 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.