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
6ab74e7b-07f1-4704-9f01-78862d46bf4c
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,422
supabase-export-v2
88adffad692380dc
def process_file(file_or_path): if isinstance(file_or_path, str): # If string, open file cm = open(file_or_path) else: # Caller is responsible for closing file cm = nullcontext(file_or_path) with cm as file: # Perform processing on the file
trusted_official_docs
CPython Docs
def process_file(file_or_path): if isinstance(file_or_path, str): # If string, open file cm = open(file_or_path) else: # Caller is responsible for closing file cm = nullcontext(file_or_path) with cm as file: # Perform processing on the file
def process_file(file_or_path): if isinstance(file_or_path, str): # If string, open file cm = open(file_or_path) else: # Caller is responsible for closing file cm = nullcontext(file_or_path) with cm as file: # Perform processing on the file
python, official-docs, cpython, P0
Local_Trusted_Corpus
6b9a68b8-4d2f-414b-a49b-9030dca87bff
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,504
supabase-export-v2
7ca7858c31146dbe
explicitly or implicitly at the end of a :keyword:`with` statement). Note that callbacks are *not* invoked implicitly when the context stack instance is garbage collected. This stack model is used so that context managers that acquire their resources in their ``__init__`` method (such as file objects) can be handled ...
trusted_official_docs
CPython Docs
explicitly or implicitly at the end of a :keyword:`with` statement). Note that callbacks are *not* invoked implicitly when the context stack instance is garbage collected. This stack model is used so that context managers that acquire their resources in their ``__init__`` method (such as file objects) can be handled ...
explicitly or implicitly at the end of a :keyword:`with` statement). Note that callbacks are *not* invoked implicitly when the context stack instance is garbage collected. This stack model is used so that context managers that acquire their resources in their ``__init__`` method (such as file objects) can be handled ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6be2b892-ec0b-4f74-949f-418ec8c6d27c
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,499
supabase-export-v2
1da4a29642daea5e
.. class:: ExitStack() A context manager that is designed to make it easy to programmatically combine other context managers and cleanup functions, especially those that are optional or otherwise driven by input data.
trusted_official_docs
CPython Docs
.. class:: ExitStack() A context manager that is designed to make it easy to programmatically combine other context managers and cleanup functions, especially those that are optional or otherwise driven by input data.
.. class:: ExitStack() A context manager that is designed to make it easy to programmatically combine other context managers and cleanup functions, especially those that are optional or otherwise driven by input data.
python, official-docs, cpython, P0
Local_Trusted_Corpus
6e820d3b-870c-43a8-beb9-4ebe6df01cf6
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,374
supabase-export-v2
45958f10e5f05112
a resource needs to be managed that isn't a context manager in its own right, and doesn't implement a ``close()`` method for use with ``contextlib.closing``. An abstract example would be the following to ensure correct resource management::
trusted_official_docs
CPython Docs
a resource needs to be managed that isn't a context manager in its own right, and doesn't implement a ``close()`` method for use with ``contextlib.closing``. An abstract example would be the following to ensure correct resource management::
a resource needs to be managed that isn't a context manager in its own right, and doesn't implement a ``close()`` method for use with ``contextlib.closing``. An abstract example would be the following to ensure correct resource management::
python, official-docs, cpython, P0
Local_Trusted_Corpus
6eaa7626-2772-4669-9ae0-3cc54426b9f7
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,616
supabase-export-v2
849170a5cab3c492
:class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` instead). Another example of a reusable, but not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leavin...
trusted_official_docs
CPython Docs
:class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` instead). Another example of a reusable, but not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leavin...
:class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` instead). Another example of a reusable, but not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leavin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
71d6e746-b318-4175-b921-be7f01ffff18
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,406
supabase-export-v2
fd8308e1ad33dae4
.. note:: Most types managing resources support the :term:`context manager` protocol, which closes *thing* on leaving the :keyword:`with` statement. As such, :func:`!closing` is most useful for third party types that don't support context managers. This example is purely for illustration purposes, as :func:`~urllib....
trusted_official_docs
CPython Docs
.. note:: Most types managing resources support the :term:`context manager` protocol, which closes *thing* on leaving the :keyword:`with` statement. As such, :func:`!closing` is most useful for third party types that don't support context managers. This example is purely for illustration purposes, as :func:`~urllib....
.. note:: Most types managing resources support the :term:`context manager` protocol, which closes *thing* on leaving the :keyword:`with` statement. As such, :func:`!closing` is most useful for third party types that don't support context managers. This example is purely for illustration purposes, as :func:`~urllib....
python, official-docs, cpython, P0
Local_Trusted_Corpus
72985129-612a-468e-a28d-481106cb3bbc
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,595
supabase-export-v2
5f590d53ea38772c
@track_entry_and_exit('widget loader') def activity(): print('Some time consuming activity goes here') load_widget() Note that there is one additional limitation when using context managers as function decorators: there's no way to access the return value of :meth:`~object.__enter__`. If that value is needed, then it i...
trusted_official_docs
CPython Docs
@track_entry_and_exit('widget loader') def activity(): print('Some time consuming activity goes here') load_widget() Note that there is one additional limitation when using context managers as function decorators: there's no way to access the return value of :meth:`~object.__enter__`. If that value is needed, then it i...
@track_entry_and_exit('widget loader') def activity(): print('Some time consuming activity goes here') load_widget() Note that there is one additional limitation when using context managers as function decorators: there's no way to access the return value of :meth:`~object.__enter__`. If that value is needed, then it i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
72c9a9b6-311d-4339-b825-9c25fd925ac8
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,495
supabase-export-v2
f44c6f6e4ff04146
>>> @mycontext() ... async def function(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing >>> async def function(): ... async with mycontext(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing
trusted_official_docs
CPython Docs
>>> @mycontext() ... async def function(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing >>> async def function(): ... async with mycontext(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing
>>> @mycontext() ... async def function(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing >>> async def function(): ... async with mycontext(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing
python, official-docs, cpython, P0
Local_Trusted_Corpus
72f08f5e-5bc1-41d4-bc49-bf847eee9147
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,425
supabase-export-v2
f5edabfe019d8a32
session: # If no http session, create it with aiohttp cm = aiohttp.ClientSession() else: # Caller is responsible for closing the session cm = nullcontext(session) async with cm as session: # Send http requests with session
trusted_official_docs
CPython Docs
session: # If no http session, create it with aiohttp cm = aiohttp.ClientSession() else: # Caller is responsible for closing the session cm = nullcontext(session) async with cm as session: # Send http requests with session
session: # If no http session, create it with aiohttp cm = aiohttp.ClientSession() else: # Caller is responsible for closing the session cm = nullcontext(session) async with cm as session: # Send http requests with session
python, official-docs, cpython, P0
Local_Trusted_Corpus
748a0fc7-e9f8-4ef1-897d-689f3cb18f75
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,438
supabase-export-v2
77839c0c3dc93b4a
This context manager is :ref:`reentrant <reentrant-cms>`. If the code within the :keyword:`!with` block raises a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any exceptions of the group which are not suppressed are re-raised in a new group which is created using the original group's :...
trusted_official_docs
CPython Docs
This context manager is :ref:`reentrant <reentrant-cms>`. If the code within the :keyword:`!with` block raises a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any exceptions of the group which are not suppressed are re-raised in a new group which is created using the original group's :...
This context manager is :ref:`reentrant <reentrant-cms>`. If the code within the :keyword:`!with` block raises a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any exceptions of the group which are not suppressed are re-raised in a new group which is created using the original group's :...
python, official-docs, cpython, P0
Local_Trusted_Corpus
77f01c46-22d7-4ff3-9b09-ea8c7c00b1c6
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,564
supabase-export-v2
e7b728623f0c0acf
validation check passed and didn't raise an exception # Accordingly, we want to keep the resource, and pass it # back to our caller stack.pop_all() def __enter__(self): resource = self.acquire_resource() with self._cleanup_on_error(): if not self.check_resource_ok(resource): msg = "Failed validation for {!r}" rais...
trusted_official_docs
CPython Docs
validation check passed and didn't raise an exception # Accordingly, we want to keep the resource, and pass it # back to our caller stack.pop_all() def __enter__(self): resource = self.acquire_resource() with self._cleanup_on_error(): if not self.check_resource_ok(resource): msg = "Failed validation for {!r}" rais...
validation check passed and didn't raise an exception # Accordingly, we want to keep the resource, and pass it # back to our caller stack.pop_all() def __enter__(self): resource = self.acquire_resource() with self._cleanup_on_error(): if not self.check_resource_ok(resource): msg = "Failed validation for {!r}" rais...
python, official-docs, cpython, P0
Local_Trusted_Corpus
789f4d83-7262-43bd-a8f0-bffb40203a1d
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,511
supabase-export-v2
e60bb484b6362abc
These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement. .. versionchanged:: 3.11 Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a context manager.
trusted_official_docs
CPython Docs
These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement. .. versionchanged:: 3.11 Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a context manager.
These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement. .. versionchanged:: 3.11 Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a context manager.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7904b3c3-7950-4121-a490-ba797c668967
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,380
supabase-export-v2
9f077c47e066debd
:term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any. At the point where the generator yields, the block nested in the :keyword:`with` statement is executed. The generator is then resumed ...
trusted_official_docs
CPython Docs
:term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any. At the point where the generator yields, the block nested in the :keyword:`with` statement is executed. The generator is then resumed ...
:term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any. At the point where the generator yields, the block nested in the :keyword:`with` statement is executed. The generator is then resumed ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7a68fb54-d056-4c41-9d74-fbfcbbd499ff
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,429
supabase-export-v2
0bc38575f7083b07
.. function:: suppress(*exceptions) Return a context manager that suppresses any of the specified exceptions if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement.
trusted_official_docs
CPython Docs
.. function:: suppress(*exceptions) Return a context manager that suppresses any of the specified exceptions if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement.
.. function:: suppress(*exceptions) Return a context manager that suppresses any of the specified exceptions if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement.
python, official-docs, cpython, P0
Local_Trusted_Corpus
7daec371-c436-4432-9787-f2d5eefca6a0
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,369
supabase-export-v2
d47eec4aa5ba384c
.. class:: AbstractAsyncContextManager An :term:`abstract base class` for classes that implement :meth:`~object.__aenter__` and :meth:`~object.__aexit__`. A default implementation for :meth:`~object.__aenter__` is provided which returns ``self`` while :meth:`~object.__aexit__` is an abstract method which by default ...
trusted_official_docs
CPython Docs
.. class:: AbstractAsyncContextManager An :term:`abstract base class` for classes that implement :meth:`~object.__aenter__` and :meth:`~object.__aexit__`. A default implementation for :meth:`~object.__aenter__` is provided which returns ``self`` while :meth:`~object.__aexit__` is an abstract method which by default ...
.. class:: AbstractAsyncContextManager An :term:`abstract base class` for classes that implement :meth:`~object.__aenter__` and :meth:`~object.__aexit__`. A default implementation for :meth:`~object.__aenter__` is provided which returns ``self`` while :meth:`~object.__aexit__` is an abstract method which by default ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7e059dd3-05ca-4607-aa2a-a151f6fe4ecc
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,418
supabase-export-v2
fe7c7f10479ab987
.. function:: nullcontext(enter_result=None) Return a context manager that returns *enter_result* from :meth:`~object.__enter__`, but otherwise does nothing. It is intended to be used as a stand-in for an optional context manager, for example::
trusted_official_docs
CPython Docs
.. function:: nullcontext(enter_result=None) Return a context manager that returns *enter_result* from :meth:`~object.__enter__`, but otherwise does nothing. It is intended to be used as a stand-in for an optional context manager, for example::
.. function:: nullcontext(enter_result=None) Return a context manager that returns *enter_result* from :meth:`~object.__enter__`, but otherwise does nothing. It is intended to be used as a stand-in for an optional context manager, for example::
python, official-docs, cpython, P0
Local_Trusted_Corpus
8798db1b-2638-4d6e-9018-99a9a55d81da
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,568
supabase-export-v2
5ac44af47e798268
clause should be executed. In its simplest form (that can't already be handled just by using an ``except`` clause instead), it looks something like this:: cleanup_needed = True try: result = perform_operation() if result: cleanup_needed = False finally: if cleanup_needed: cleanup_resources()
trusted_official_docs
CPython Docs
clause should be executed. In its simplest form (that can't already be handled just by using an ``except`` clause instead), it looks something like this:: cleanup_needed = True try: result = perform_operation() if result: cleanup_needed = False finally: if cleanup_needed: cleanup_resources()
clause should be executed. In its simplest form (that can't already be handled just by using an ``except`` clause instead), it looks something like this:: cleanup_needed = True try: result = perform_operation() if result: cleanup_needed = False finally: if cleanup_needed: cleanup_resources()
python, official-docs, cpython, P0
Local_Trusted_Corpus
8aeeb17f-1045-4cd9-8195-b67f9c366e16
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,396
supabase-export-v2
918e2a8983de32e9
the otherwise "one-shot" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators. .. versionchanged:: 3.10 Async context managers created with :func:`asynccontextmanager` can be used as decorators.
trusted_official_docs
CPython Docs
the otherwise "one-shot" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators. .. versionchanged:: 3.10 Async context managers created with :func:`asynccontextmanager` can be used as decorators.
the otherwise "one-shot" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators. .. versionchanged:: 3.10 Async context managers created with :func:`asynccontextmanager` can be used as decorators.
python, official-docs, cpython, P0
Local_Trusted_Corpus
902f88bf-3c02-4bd4-9bf4-bab9ba954e7d
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,617
supabase-export-v2
3f8224c5e4010a87
not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leaving any with statement, regardless of where those callbacks were added:: >>> from contextlib import ExitStack >>> stack = ExitStack() >>> with stack: ... stack.callback(print, "Callback: from first conte...
trusted_official_docs
CPython Docs
not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leaving any with statement, regardless of where those callbacks were added:: >>> from contextlib import ExitStack >>> stack = ExitStack() >>> with stack: ... stack.callback(print, "Callback: from first conte...
not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leaving any with statement, regardless of where those callbacks were added:: >>> from contextlib import ExitStack >>> stack = ExitStack() >>> with stack: ... stack.callback(print, "Callback: from first conte...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9165ba3a-9537-4c27-a6d8-f5c8ec4ae746
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,551
supabase-export-v2
0f3be2d748f6c960
managers needed being driven by user input (such as opening a user specified collection of files), or from some of the context managers being optional:: with ExitStack() as stack: for resource in resources: stack.enter_context(resource) if need_special_resource(): special = acquire_special_resource() stack.callbac...
trusted_official_docs
CPython Docs
managers needed being driven by user input (such as opening a user specified collection of files), or from some of the context managers being optional:: with ExitStack() as stack: for resource in resources: stack.enter_context(resource) if need_special_resource(): special = acquire_special_resource() stack.callbac...
managers needed being driven by user input (such as opening a user specified collection of files), or from some of the context managers being optional:: with ExitStack() as stack: for resource in resources: stack.enter_context(resource) if need_special_resource(): special = acquire_special_resource() stack.callbac...
python, official-docs, cpython, P0
Local_Trusted_Corpus
94c40d9b-5129-417a-81ee-842dc0a09a72
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,552
supabase-export-v2
1612feeae2b2ec93
with ExitStack() as stack: for resource in resources: stack.enter_context(resource) if need_special_resource(): special = acquire_special_resource() stack.callback(release_special_resource, special) # Perform operations that use the acquired resources As shown, :class:`ExitStack` also makes it quite easy to use :keywor...
trusted_official_docs
CPython Docs
with ExitStack() as stack: for resource in resources: stack.enter_context(resource) if need_special_resource(): special = acquire_special_resource() stack.callback(release_special_resource, special) # Perform operations that use the acquired resources As shown, :class:`ExitStack` also makes it quite easy to use :keywor...
with ExitStack() as stack: for resource in resources: stack.enter_context(resource) if need_special_resource(): special = acquire_special_resource() stack.callback(release_special_resource, special) # Perform operations that use the acquired resources As shown, :class:`ExitStack` also makes it quite easy to use :keywor...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9500991e-8abf-42d2-a26c-ef1622abc9c9
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,506
supabase-export-v2
aa9c8e381cdd195f
to exception handling - if an inner callback suppresses or replaces an exception, then outer callbacks will be passed arguments based on that updated state. This is a relatively low level API that takes care of the details of correctly unwinding the stack of exit callbacks. It provides a suitable foundation for highe...
trusted_official_docs
CPython Docs
to exception handling - if an inner callback suppresses or replaces an exception, then outer callbacks will be passed arguments based on that updated state. This is a relatively low level API that takes care of the details of correctly unwinding the stack of exit callbacks. It provides a suitable foundation for highe...
to exception handling - if an inner callback suppresses or replaces an exception, then outer callbacks will be passed arguments based on that updated state. This is a relatively low level API that takes care of the details of correctly unwinding the stack of exit callbacks. It provides a suitable foundation for highe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9c79986c-05b5-4388-9761-3a87c06b2dd5
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,378
supabase-export-v2
a0962dd86ee762c9
The function can then be used like this:: >>> with managed_resource(timeout=3600) as resource: ... # Resource is released at the end of this block, ... # even if code in the block raises an exception
trusted_official_docs
CPython Docs
The function can then be used like this:: >>> with managed_resource(timeout=3600) as resource: ... # Resource is released at the end of this block, ... # even if code in the block raises an exception
The function can then be used like this:: >>> with managed_resource(timeout=3600) as resource: ... # Resource is released at the end of this block, ... # even if code in the block raises an exception
python, official-docs, cpython, P0
Local_Trusted_Corpus
9dcdca87-de51-40b6-b83d-47fefdfeeed9
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,471
supabase-export-v2
7c5e209e2dd7c9d8
>>> @mycontext() ... def function(): ... print('The bit in the middle') ... >>> function() Starting The bit in the middle Finishing >>> with mycontext(): ... print('The bit in the middle') ... Starting The bit in the middle Finishing
trusted_official_docs
CPython Docs
>>> @mycontext() ... def function(): ... print('The bit in the middle') ... >>> function() Starting The bit in the middle Finishing >>> with mycontext(): ... print('The bit in the middle') ... Starting The bit in the middle Finishing
>>> @mycontext() ... def function(): ... print('The bit in the middle') ... >>> function() Starting The bit in the middle Finishing >>> with mycontext(): ... print('The bit in the middle') ... Starting The bit in the middle Finishing
python, official-docs, cpython, P0
Local_Trusted_Corpus
a226ae4b-6caf-43ab-b3e0-f79a578097b4
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,481
supabase-export-v2
196e2db9162754a2
def __exit__(self, *exc): return False .. note:: As the decorated function must be able to be called multiple times, the underlying context manager must support use in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the fu...
trusted_official_docs
CPython Docs
def __exit__(self, *exc): return False .. note:: As the decorated function must be able to be called multiple times, the underlying context manager must support use in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the fu...
def __exit__(self, *exc): return False .. note:: As the decorated function must be able to be called multiple times, the underlying context manager must support use in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the fu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a3620ffd-3104-4509-ac9d-4e32ca0c25ea
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,583
supabase-export-v2
68d29858be9c00c8
decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables. Using a context manager as a function decorator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
trusted_official_docs
CPython Docs
decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables. Using a context manager as a function decorator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables. Using a context manager as a function decorator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python, official-docs, cpython, P0
Local_Trusted_Corpus
a6ff5d85-5f6c-4a63-ab95-5d6613e78054
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,501
supabase-export-v2
52397c4a755de8c8
For example, a set of files may easily be handled in a single with statement as follows:: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the lis...
trusted_official_docs
CPython Docs
For example, a set of files may easily be handled in a single with statement as follows:: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the lis...
For example, a set of files may easily be handled in a single with statement as follows:: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the lis...
python, official-docs, cpython, P0
Local_Trusted_Corpus
adf8710f-3402-4778-aa8d-aa1844349cd7
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,445
supabase-export-v2
cbd2ea18b01ee31e
output to an :class:`io.StringIO` object. The replacement stream is returned from the :meth:`~object.__enter__` method and so is available as the target of the :keyword:`with` statement:: with redirect_stdout(io.StringIO()) as f: help(pow) s = f.getvalue()
trusted_official_docs
CPython Docs
output to an :class:`io.StringIO` object. The replacement stream is returned from the :meth:`~object.__enter__` method and so is available as the target of the :keyword:`with` statement:: with redirect_stdout(io.StringIO()) as f: help(pow) s = f.getvalue()
output to an :class:`io.StringIO` object. The replacement stream is returned from the :meth:`~object.__enter__` method and so is available as the target of the :keyword:`with` statement:: with redirect_stdout(io.StringIO()) as f: help(pow) s = f.getvalue()
python, official-docs, cpython, P0
Local_Trusted_Corpus
ae41120a-c23e-4102-92af-cda3a2f8f711
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,395
supabase-export-v2
3cb9017c00c2551c
@timeit() async def main(): # ... async code ... When used as a decorator, a new generator instance is implicitly created on each function call. This allows the otherwise "one-shot" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in o...
trusted_official_docs
CPython Docs
@timeit() async def main(): # ... async code ... When used as a decorator, a new generator instance is implicitly created on each function call. This allows the otherwise "one-shot" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in o...
@timeit() async def main(): # ... async code ... When used as a decorator, a new generator instance is implicitly created on each function call. This allows the otherwise "one-shot" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b23b1761-89e9-4c55-b070-db96711efcc4
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,450
supabase-export-v2
652d9c45f3ce3b08
with redirect_stdout(sys.stderr): help(pow) Note that the global side effect on :data:`sys.stdout` means that this context manager is not suitable for use in library code and most threaded applications. It also has no effect on the output of subprocesses. However, it is still a useful approach for many utility script...
trusted_official_docs
CPython Docs
with redirect_stdout(sys.stderr): help(pow) Note that the global side effect on :data:`sys.stdout` means that this context manager is not suitable for use in library code and most threaded applications. It also has no effect on the output of subprocesses. However, it is still a useful approach for many utility script...
with redirect_stdout(sys.stderr): help(pow) Note that the global side effect on :data:`sys.stdout` means that this context manager is not suitable for use in library code and most threaded applications. It also has no effect on the output of subprocesses. However, it is still a useful approach for many utility script...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b2f96c5d-5514-4fc5-8742-b2113921571b
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,555
supabase-export-v2
cb99d315d5a0146a
or the context manager's :meth:`~object.__exit__` method. By using :class:`ExitStack` the steps in the context management protocol can be separated slightly in order to allow this:: stack = ExitStack() try: x = stack.enter_context(cm) except Exception: # handle __enter__ exception else: with stack: # Handle norm...
trusted_official_docs
CPython Docs
or the context manager's :meth:`~object.__exit__` method. By using :class:`ExitStack` the steps in the context management protocol can be separated slightly in order to allow this:: stack = ExitStack() try: x = stack.enter_context(cm) except Exception: # handle __enter__ exception else: with stack: # Handle norm...
or the context manager's :meth:`~object.__exit__` method. By using :class:`ExitStack` the steps in the context management protocol can be separated slightly in order to allow this:: stack = ExitStack() try: x = stack.enter_context(cm) except Exception: # handle __enter__ exception else: with stack: # Handle norm...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b315575f-dcda-4ba7-b659-88333de60830
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,372
supabase-export-v2
d601f0274b0ec973
.. decorator:: contextmanager This function is a :term:`decorator` that can be used to define a factory function for :keyword:`with` statement context managers, without needing to create a class or separate :meth:`~object.__enter__` and :meth:`~object.__exit__` methods.
trusted_official_docs
CPython Docs
.. decorator:: contextmanager This function is a :term:`decorator` that can be used to define a factory function for :keyword:`with` statement context managers, without needing to create a class or separate :meth:`~object.__enter__` and :meth:`~object.__exit__` methods.
.. decorator:: contextmanager This function is a :term:`decorator` that can be used to define a factory function for :keyword:`with` statement context managers, without needing to create a class or separate :meth:`~object.__enter__` and :meth:`~object.__exit__` methods.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b43cdac0-38de-4a99-8eaf-9aff00c6f28f
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,404
supabase-export-v2
df3e29fb90a14b99
with closing(urlopen('https://www.python.org')) as page: for line in page: print(line) without needing to explicitly close ``page``. Even if an error occurs, ``page.close()`` will be called when the :keyword:`with` block is exited.
trusted_official_docs
CPython Docs
with closing(urlopen('https://www.python.org')) as page: for line in page: print(line) without needing to explicitly close ``page``. Even if an error occurs, ``page.close()`` will be called when the :keyword:`with` block is exited.
with closing(urlopen('https://www.python.org')) as page: for line in page: print(line) without needing to explicitly close ``page``. Even if an error occurs, ``page.close()`` will be called when the :keyword:`with` block is exited.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b6335892-e6a1-4e2f-a09a-5f68c2e8f7bf
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,579
supabase-export-v2
ba9d3f3c657907be
with Callback(cleanup_resources) as cb: result = perform_operation() if result: cb.cancel() If the resource cleanup isn't already neatly bundled into a standalone function, then it is still possible to use the decorator form of :meth:`ExitStack.callback` to declare the resource cleanup in advance::
trusted_official_docs
CPython Docs
with Callback(cleanup_resources) as cb: result = perform_operation() if result: cb.cancel() If the resource cleanup isn't already neatly bundled into a standalone function, then it is still possible to use the decorator form of :meth:`ExitStack.callback` to declare the resource cleanup in advance::
with Callback(cleanup_resources) as cb: result = perform_operation() if result: cb.cancel() If the resource cleanup isn't already neatly bundled into a standalone function, then it is still possible to use the decorator form of :meth:`ExitStack.callback` to declare the resource cleanup in advance::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b71f68e0-eb66-4e42-8aa0-6553d94e58cf
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,382
supabase-export-v2
d8f8a08f680ef020
the otherwise "one-shot" context managers created by :func:`contextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators). .. versionchanged:: 3.2 Use of :class:`ContextDecorator`.
trusted_official_docs
CPython Docs
the otherwise "one-shot" context managers created by :func:`contextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators). .. versionchanged:: 3.2 Use of :class:`ContextDecorator`.
the otherwise "one-shot" context managers created by :func:`contextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators). .. versionchanged:: 3.2 Use of :class:`ContextDecorator`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
bbd5873b-b0f6-48ad-a399-d2c5b3c38a98
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,600
supabase-export-v2
2d64c80252571d78
Single use, reusable and reentrant context managers --------------------------------------------------- Most context managers are written in a way that means they can only be used effectively in a :keyword:`with` statement once. These single use context managers must be created afresh each time they're used - attemptin...
trusted_official_docs
CPython Docs
Single use, reusable and reentrant context managers --------------------------------------------------- Most context managers are written in a way that means they can only be used effectively in a :keyword:`with` statement once. These single use context managers must be created afresh each time they're used - attemptin...
Single use, reusable and reentrant context managers --------------------------------------------------- Most context managers are written in a way that means they can only be used effectively in a :keyword:`with` statement once. These single use context managers must be created afresh each time they're used - attemptin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c0961fa2-3bfa-4883-a42b-7ae0efa078ff
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,510
supabase-export-v2
fc3bac69b8cfcef3
new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method. These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement.
trusted_official_docs
CPython Docs
new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method. These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement.
new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method. These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c2c68ff5-b695-445e-a26d-09ffdfa14a34
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,527
supabase-export-v2
cf2c88e4a056aa71
For example, a group of files can be opened as an "all or nothing" operation as follows:: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # Hold onto the close method, but don't call it yet. close_files = stack.pop_all().close # If opening any file fails, all previously o...
trusted_official_docs
CPython Docs
For example, a group of files can be opened as an "all or nothing" operation as follows:: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # Hold onto the close method, but don't call it yet. close_files = stack.pop_all().close # If opening any file fails, all previously o...
For example, a group of files can be opened as an "all or nothing" operation as follows:: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # Hold onto the close method, but don't call it yet. close_files = stack.pop_all().close # If opening any file fails, all previously o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5c45883-4978-4664-919e-b6631fd0e3b5
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,609
supabase-export-v2
6a8fb47ba1deb8aa
:class:`threading.RLock` is an example of a reentrant context manager, as are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a very simple example of reentrant use:: >>> from contextlib import redirect_stdout >>> from io import StringIO >>> stream = StringIO() >>> write_to_stream = redirect_std...
trusted_official_docs
CPython Docs
:class:`threading.RLock` is an example of a reentrant context manager, as are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a very simple example of reentrant use:: >>> from contextlib import redirect_stdout >>> from io import StringIO >>> stream = StringIO() >>> write_to_stream = redirect_std...
:class:`threading.RLock` is an example of a reentrant context manager, as are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a very simple example of reentrant use:: >>> from contextlib import redirect_stdout >>> from io import StringIO >>> stream = StringIO() >>> write_to_stream = redirect_std...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c9613221-c5e1-4d64-a39e-ac15a8cb2b34
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,522
supabase-export-v2
20b0d882c32ef735
Accepts an arbitrary callback function and arguments and adds it to the callback stack. Unlike the other methods, callbacks added this way cannot suppress exceptions (as they are never passed the exception details).
trusted_official_docs
CPython Docs
Accepts an arbitrary callback function and arguments and adds it to the callback stack. Unlike the other methods, callbacks added this way cannot suppress exceptions (as they are never passed the exception details).
Accepts an arbitrary callback function and arguments and adds it to the callback stack. Unlike the other methods, callbacks added this way cannot suppress exceptions (as they are never passed the exception details).
python, official-docs, cpython, P0
Local_Trusted_Corpus
cafdf9e7-f2d8-422b-90b8-50b3681d9b73
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,476
supabase-export-v2
41688c5ec783cf37
@cm() def f(): # Do stuff It makes it clear that the ``cm`` applies to the whole function, rather than just a piece of it (and saving an indentation level is nice, too).
trusted_official_docs
CPython Docs
@cm() def f(): # Do stuff It makes it clear that the ``cm`` applies to the whole function, rather than just a piece of it (and saving an indentation level is nice, too).
@cm() def f(): # Do stuff It makes it clear that the ``cm`` applies to the whole function, rather than just a piece of it (and saving an indentation level is nice, too).
python, official-docs, cpython, P0
Local_Trusted_Corpus
cbb74af7-1aae-42ef-9d90-3dcd6604e692
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,556
supabase-export-v2
18e9d5d9a6f23965
stack = ExitStack() try: x = stack.enter_context(cm) except Exception: # handle __enter__ exception else: with stack: # Handle normal case Actually needing to do this is likely to indicate that the underlying API should be providing a direct resource management interface for use with :keyword:`try`/:keyword:`except`/:k...
trusted_official_docs
CPython Docs
stack = ExitStack() try: x = stack.enter_context(cm) except Exception: # handle __enter__ exception else: with stack: # Handle normal case Actually needing to do this is likely to indicate that the underlying API should be providing a direct resource management interface for use with :keyword:`try`/:keyword:`except`/:k...
stack = ExitStack() try: x = stack.enter_context(cm) except Exception: # handle __enter__ exception else: with stack: # Handle normal case Actually needing to do this is likely to indicate that the underlying API should be providing a direct resource management interface for use with :keyword:`try`/:keyword:`except`/:k...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cfb18c81-f0cc-4ea2-bbb8-76b86a2b864d
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,502
supabase-export-v2
64d92769411738cd
automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception The :meth:`~object.__enter__` method returns the :class:`ExitStack` instance, and performs no additional operations.
trusted_official_docs
CPython Docs
automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception The :meth:`~object.__enter__` method returns the :class:`ExitStack` instance, and performs no additional operations.
automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception The :meth:`~object.__enter__` method returns the :class:`ExitStack` instance, and performs no additional operations.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2072e41-d1db-4bd9-ad4f-63476489af96
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,472
supabase-export-v2
d49ba2764926a8f1
>>> with mycontext(): ... print('The bit in the middle') ... Starting The bit in the middle Finishing This change is just syntactic sugar for any construct of the following form::
trusted_official_docs
CPython Docs
>>> with mycontext(): ... print('The bit in the middle') ... Starting The bit in the middle Finishing This change is just syntactic sugar for any construct of the following form::
>>> with mycontext(): ... print('The bit in the middle') ... Starting The bit in the middle Finishing This change is just syntactic sugar for any construct of the following form::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2f82b7f-c0b1-4648-9111-ea91814e2de3
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,550
supabase-export-v2
ef51bd73b66380fa
Supporting a variable number of context managers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The primary use case for :class:`ExitStack` is the one given in the class documentation: supporting a variable number of context managers and other cleanup operations in a single :keyword:`with` statement. The variability ...
trusted_official_docs
CPython Docs
Supporting a variable number of context managers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The primary use case for :class:`ExitStack` is the one given in the class documentation: supporting a variable number of context managers and other cleanup operations in a single :keyword:`with` statement. The variability ...
Supporting a variable number of context managers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The primary use case for :class:`ExitStack` is the one given in the class documentation: supporting a variable number of context managers and other cleanup operations in a single :keyword:`with` statement. The variability ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d3a3e6b8-3b09-456d-8272-706f1642e920
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,585
supabase-export-v2
c6d29637f3970540
:class:`ContextDecorator` makes it possible to use a context manager in both an ordinary ``with`` statement and also as a function decorator. For example, it is sometimes useful to wrap functions or groups of statements with a logger that can track the time of entry and time of exit. Rather than writing both a function...
trusted_official_docs
CPython Docs
:class:`ContextDecorator` makes it possible to use a context manager in both an ordinary ``with`` statement and also as a function decorator. For example, it is sometimes useful to wrap functions or groups of statements with a logger that can track the time of entry and time of exit. Rather than writing both a function...
:class:`ContextDecorator` makes it possible to use a context manager in both an ordinary ``with`` statement and also as a function decorator. For example, it is sometimes useful to wrap functions or groups of statements with a logger that can track the time of entry and time of exit. Rather than writing both a function...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8aea557-1f55-4c9d-a0cf-5ebbacd3d2f7
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,482
supabase-export-v2
f9da854cb4d7562b
in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the function should be used. When the decorated callable is a generator function, coroutine function, or asynchronous generator function, the returned wrapper is of the same ...
trusted_official_docs
CPython Docs
in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the function should be used. When the decorated callable is a generator function, coroutine function, or asynchronous generator function, the returned wrapper is of the same ...
in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the function should be used. When the decorated callable is a generator function, coroutine function, or asynchronous generator function, the returned wrapper is of the same ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8b158a8-c095-4a20-81ae-f086e6c921a6
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,553
supabase-export-v2
ff8f2a6b3bee7a08
As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` statements to manage arbitrary resources that don't natively support the context management protocol. Catching exceptions from ``__enter__`` methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
trusted_official_docs
CPython Docs
As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` statements to manage arbitrary resources that don't natively support the context management protocol. Catching exceptions from ``__enter__`` methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` statements to manage arbitrary resources that don't natively support the context management protocol. Catching exceptions from ``__enter__`` methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8fe899b-0d99-4686-b761-cb6a7534a351
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,515
supabase-export-v2
d50086150b97aba9
Adds a context manager's :meth:`~object.__exit__` method to the callback stack. As ``__enter__`` is *not* invoked, this method can be used to cover part of an :meth:`~object.__enter__` implementation with a context manager's own :meth:`~object.__exit__` method.
trusted_official_docs
CPython Docs
Adds a context manager's :meth:`~object.__exit__` method to the callback stack. As ``__enter__`` is *not* invoked, this method can be used to cover part of an :meth:`~object.__enter__` implementation with a context manager's own :meth:`~object.__exit__` method.
Adds a context manager's :meth:`~object.__exit__` method to the callback stack. As ``__enter__`` is *not* invoked, this method can be used to cover part of an :meth:`~object.__enter__` implementation with a context manager's own :meth:`~object.__exit__` method.
python, official-docs, cpython, P0
Local_Trusted_Corpus
db8a6475-26b6-4140-ac7a-c65e6eb09ab9
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,570
supabase-export-v2
b841f5aff9f090e2
cause problems for development and review, because the setup code and the cleanup code can end up being separated by arbitrarily long sections of code. :class:`ExitStack` makes it possible to instead register a callback for execution at the end of a ``with`` statement, and then later decide to skip executing that callb...
trusted_official_docs
CPython Docs
cause problems for development and review, because the setup code and the cleanup code can end up being separated by arbitrarily long sections of code. :class:`ExitStack` makes it possible to instead register a callback for execution at the end of a ``with`` statement, and then later decide to skip executing that callb...
cause problems for development and review, because the setup code and the cleanup code can end up being separated by arbitrarily long sections of code. :class:`ExitStack` makes it possible to instead register a callback for execution at the end of a ``with`` statement, and then later decide to skip executing that callb...
python, official-docs, cpython, P0
Local_Trusted_Corpus
df844d31-77b9-41ea-b94c-3070a060708e
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,529
supabase-export-v2
60b8e296faeb072b
.. method:: close() Immediately unwinds the callback stack, invoking callbacks in the reverse order of registration. For any context managers and exit callbacks registered, the arguments passed in will indicate that no exception occurred.
trusted_official_docs
CPython Docs
.. method:: close() Immediately unwinds the callback stack, invoking callbacks in the reverse order of registration. For any context managers and exit callbacks registered, the arguments passed in will indicate that no exception occurred.
.. method:: close() Immediately unwinds the callback stack, invoking callbacks in the reverse order of registration. For any context managers and exit callbacks registered, the arguments passed in will indicate that no exception occurred.
python, official-docs, cpython, P0
Local_Trusted_Corpus
dfec0927-f13e-408e-9d13-0ca2779b5dab
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,615
supabase-export-v2
1c25ada410b98a7d
multiple times, but will fail (or otherwise not work correctly) if the specific context manager instance has already been used in a containing with statement. :class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` in...
trusted_official_docs
CPython Docs
multiple times, but will fail (or otherwise not work correctly) if the specific context manager instance has already been used in a containing with statement. :class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` in...
multiple times, but will fail (or otherwise not work correctly) if the specific context manager instance has already been used in a containing with statement. :class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` in...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e00c73e6-a861-4704-94e2-38ac5255a2b2
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,509
supabase-export-v2
a8ae783c14e68eab
.. method:: enter_context(cm) Enters a new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method.
trusted_official_docs
CPython Docs
.. method:: enter_context(cm) Enters a new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method.
.. method:: enter_context(cm) Enters a new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e0ef9c71-7b62-49e4-8c8f-8aa36af68409
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,457
supabase-export-v2
75783b35d0fc480e
.. function:: chdir(path) Non parallel-safe context manager to change the current working directory. As this changes a global state, the working directory, it is not suitable for use in most threaded or async contexts. It is also not suitable for most non-linear code execution, like generators, where the program exec...
trusted_official_docs
CPython Docs
.. function:: chdir(path) Non parallel-safe context manager to change the current working directory. As this changes a global state, the working directory, it is not suitable for use in most threaded or async contexts. It is also not suitable for most non-linear code execution, like generators, where the program exec...
.. function:: chdir(path) Non parallel-safe context manager to change the current working directory. As this changes a global state, the working directory, it is not suitable for use in most threaded or async contexts. It is also not suitable for most non-linear code execution, like generators, where the program exec...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e533ca1e-080a-46ce-bc29-54b01c82710e
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,430
supabase-export-v2
ce2f31c2db307550
if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement. As with any other mechanism that completely suppresses exceptions, this context manager should be used only to cover very specific errors where silently co...
trusted_official_docs
CPython Docs
if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement. As with any other mechanism that completely suppresses exceptions, this context manager should be used only to cover very specific errors where silently co...
if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement. As with any other mechanism that completely suppresses exceptions, this context manager should be used only to cover very specific errors where silently co...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e7f8eddb-4930-4e62-84a1-79cc19cf481e
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,379
supabase-export-v2
9a2ab371d1cc1bd3
managed_resource(timeout=3600) as resource: ... # Resource is released at the end of this block, ... # even if code in the block raises an exception The function being decorated must return a :term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the ...
trusted_official_docs
CPython Docs
managed_resource(timeout=3600) as resource: ... # Resource is released at the end of this block, ... # even if code in the block raises an exception The function being decorated must return a :term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the ...
managed_resource(timeout=3600) as resource: ... # Resource is released at the end of this block, ... # even if code in the block raises an exception The function being decorated must return a :term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e93747fa-a5cc-4018-b055-a67a613cabf4
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,582
supabase-export-v2
d21f7cb46f8ac83f
with ExitStack() as stack: @stack.callback def cleanup_resources(): ... result = perform_operation() if result: stack.pop_all() Due to the way the decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables.
trusted_official_docs
CPython Docs
with ExitStack() as stack: @stack.callback def cleanup_resources(): ... result = perform_operation() if result: stack.pop_all() Due to the way the decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables.
with ExitStack() as stack: @stack.callback def cleanup_resources(): ... result = perform_operation() if result: stack.pop_all() Due to the way the decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ed9f74cf-d613-4650-afac-989cbd758739
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,554
supabase-export-v2
0993d7f6a28bd6f5
Catching exceptions from ``__enter__`` methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is occasionally desirable to catch exceptions from an :meth:`~object.__enter__` method implementation, *without* inadvertently catching exceptions from the :keyword:`with` statement body or the context manager's :meth:`~obj...
trusted_official_docs
CPython Docs
Catching exceptions from ``__enter__`` methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is occasionally desirable to catch exceptions from an :meth:`~object.__enter__` method implementation, *without* inadvertently catching exceptions from the :keyword:`with` statement body or the context manager's :meth:`~obj...
Catching exceptions from ``__enter__`` methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is occasionally desirable to catch exceptions from an :meth:`~object.__enter__` method implementation, *without* inadvertently catching exceptions from the :keyword:`with` statement body or the context manager's :meth:`~obj...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef96c411-d6a7-4cc6-93ac-13911a92505a
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,458
supabase-export-v2
3f3548cb76dd4608
code execution, like generators, where the program execution is temporarily relinquished -- unless explicitly desired, you should not yield when this context manager is active. This is a simple wrapper around :func:`~os.chdir`, it changes the current working directory upon entering and restores the old one on exit.
trusted_official_docs
CPython Docs
code execution, like generators, where the program execution is temporarily relinquished -- unless explicitly desired, you should not yield when this context manager is active. This is a simple wrapper around :func:`~os.chdir`, it changes the current working directory upon entering and restores the old one on exit.
code execution, like generators, where the program execution is temporarily relinquished -- unless explicitly desired, you should not yield when this context manager is active. This is a simple wrapper around :func:`~os.chdir`, it changes the current working directory upon entering and restores the old one on exit.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f0d73c3a-99c3-4ea6-8798-5b9f41343fba
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,526
supabase-export-v2
cf70db47b624611d
operation - instead, they will now be invoked when the new stack is closed (either explicitly or implicitly at the end of a :keyword:`with` statement). For example, a group of files can be opened as an "all or nothing" operation as follows::
trusted_official_docs
CPython Docs
operation - instead, they will now be invoked when the new stack is closed (either explicitly or implicitly at the end of a :keyword:`with` statement). For example, a group of files can be opened as an "all or nothing" operation as follows::
operation - instead, they will now be invoked when the new stack is closed (either explicitly or implicitly at the end of a :keyword:`with` statement). For example, a group of files can be opened as an "all or nothing" operation as follows::
python, official-docs, cpython, P0
Local_Trusted_Corpus
f4526ff3-80ea-4c61-98b0-84983955c52f
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,557
supabase-export-v2
8c858a1ab8092c00
the only resource management API provided, then :class:`ExitStack` can make it easier to handle various situations that can't be handled directly in a :keyword:`with` statement. Cleaning up in an ``__enter__`` implementation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
trusted_official_docs
CPython Docs
the only resource management API provided, then :class:`ExitStack` can make it easier to handle various situations that can't be handled directly in a :keyword:`with` statement. Cleaning up in an ``__enter__`` implementation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
the only resource management API provided, then :class:`ExitStack` can make it easier to handle various situations that can't be handled directly in a :keyword:`with` statement. Cleaning up in an ``__enter__`` implementation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python, official-docs, cpython, P0
Local_Trusted_Corpus
f7f1fd8c-048c-4ec8-8bb3-c0f20acb74a6
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,494
supabase-export-v2
28c101500b2f3632
The class can then be used like this:: >>> @mycontext() ... async def function(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing
trusted_official_docs
CPython Docs
The class can then be used like this:: >>> @mycontext() ... async def function(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing
The class can then be used like this:: >>> @mycontext() ... async def function(): ... print('The bit in the middle') ... >>> run(function()) Starting The bit in the middle Finishing
python, official-docs, cpython, P0
Local_Trusted_Corpus
f8a66bd3-3c12-476e-bd59-f2d366633154
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,601
supabase-export-v2
ba468b89299eca02
must be created afresh each time they're used - attempting to use them a second time will trigger an exception or otherwise not work correctly. This common limitation means that it is generally advisable to create context managers directly in the header of the :keyword:`with` statement where they are used (as shown in ...
trusted_official_docs
CPython Docs
must be created afresh each time they're used - attempting to use them a second time will trigger an exception or otherwise not work correctly. This common limitation means that it is generally advisable to create context managers directly in the header of the :keyword:`with` statement where they are used (as shown in ...
must be created afresh each time they're used - attempting to use them a second time will trigger an exception or otherwise not work correctly. This common limitation means that it is generally advisable to create context managers directly in the header of the :keyword:`with` statement where they are used (as shown in ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f95842d2-e8fa-45bc-a04e-e9aef3e1091e
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,464
supabase-export-v2
f4221893506b8bee
Context managers inheriting from ``ContextDecorator`` have to implement :meth:`~object.__enter__` and :meth:`~object.__exit__` as normal. ``__exit__`` retains its optional exception handling even when used as a decorator. ``ContextDecorator`` is used by :func:`contextmanager`, so you get this functionality automatical...
trusted_official_docs
CPython Docs
Context managers inheriting from ``ContextDecorator`` have to implement :meth:`~object.__enter__` and :meth:`~object.__exit__` as normal. ``__exit__`` retains its optional exception handling even when used as a decorator. ``ContextDecorator`` is used by :func:`contextmanager`, so you get this functionality automatical...
Context managers inheriting from ``ContextDecorator`` have to implement :meth:`~object.__enter__` and :meth:`~object.__exit__` as normal. ``__exit__`` retains its optional exception handling even when used as a decorator. ``ContextDecorator`` is used by :func:`contextmanager`, so you get this functionality automatical...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f9983476-b1ad-48f9-8fee-39e8f811d82a
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,381
supabase-export-v2
4a35216491121bf2
manager will indicate to the :keyword:`!with` statement that the exception has been handled, and execution will resume with the statement immediately following the :keyword:`!with` statement. :func:`contextmanager` uses :class:`ContextDecorator` so the context managers it creates can be used as decorators as well as i...
trusted_official_docs
CPython Docs
manager will indicate to the :keyword:`!with` statement that the exception has been handled, and execution will resume with the statement immediately following the :keyword:`!with` statement. :func:`contextmanager` uses :class:`ContextDecorator` so the context managers it creates can be used as decorators as well as i...
manager will indicate to the :keyword:`!with` statement that the exception has been handled, and execution will resume with the statement immediately following the :keyword:`!with` statement. :func:`contextmanager` uses :class:`ContextDecorator` so the context managers it creates can be used as decorators as well as i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fbe81612-c23d-46d0-9b99-b05c31f6b90c
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,610
supabase-export-v2
e6c068020f6ec633
stdout") This is written directly to stdout >>> print(stream.getvalue()) This is written to the stream rather than stdout This is also written to the stream Real world examples of reentrancy are more likely to involve multiple functions calling each other and hence be far more complicated than this example.
trusted_official_docs
CPython Docs
stdout") This is written directly to stdout >>> print(stream.getvalue()) This is written to the stream rather than stdout This is also written to the stream Real world examples of reentrancy are more likely to involve multiple functions calling each other and hence be far more complicated than this example.
stdout") This is written directly to stdout >>> print(stream.getvalue()) This is written to the stream rather than stdout This is also written to the stream Real world examples of reentrancy are more likely to involve multiple functions calling each other and hence be far more complicated than this example.
python, official-docs, cpython, P0
Local_Trusted_Corpus
fed296fc-f49c-47d4-b7e0-031a11b5f3b5
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,517
supabase-export-v2
0f5f7d2cf9b02440
this method assumes it is a callback with the same signature as a context manager's :meth:`~object.__exit__` method and adds it directly to the callback stack. By returning true values, these callbacks can suppress exceptions the same way context manager :meth:`~object.__exit__` methods can.
trusted_official_docs
CPython Docs
this method assumes it is a callback with the same signature as a context manager's :meth:`~object.__exit__` method and adds it directly to the callback stack. By returning true values, these callbacks can suppress exceptions the same way context manager :meth:`~object.__exit__` methods can.
this method assumes it is a callback with the same signature as a context manager's :meth:`~object.__exit__` method and adds it directly to the callback stack. By returning true values, these callbacks can suppress exceptions the same way context manager :meth:`~object.__exit__` methods can.
python, official-docs, cpython, P0
Local_Trusted_Corpus
feeb856a-413c-4f38-ac3e-655af3d9b701
CPython Docs
file://datasets/cpython/Doc/library/contextlib.rst
unknown
ffd60464-ed92-4f77-8236-03860b1deb46
28,567
supabase-export-v2
8b9352b24b4b3bc2
Replacing any use of ``try-finally`` and flag variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A pattern you will sometimes see is a ``try-finally`` statement with a flag variable to indicate whether or not the body of the ``finally`` clause should be executed. In its simplest form (that can't already ...
trusted_official_docs
CPython Docs
Replacing any use of ``try-finally`` and flag variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A pattern you will sometimes see is a ``try-finally`` statement with a flag variable to indicate whether or not the body of the ``finally`` clause should be executed. In its simplest form (that can't already ...
Replacing any use of ``try-finally`` and flag variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A pattern you will sometimes see is a ``try-finally`` statement with a flag variable to indicate whether or not the body of the ``finally`` clause should be executed. In its simplest form (that can't already ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e10bdc5f-cab0-4ea4-80dd-56cb31632024
CPython Docs
file://datasets/cpython/Doc/library/chunk.rst
unknown
14c3028e-b90d-40b0-a82c-5bb4e3b5d79c
28,625
supabase-export-v2
6b94fe6eae0c9fdd
part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. The last version of Python that provided the :mod:`!chunk` module was `Python 3.12 <https://docs.python.org/3.12/library/chunk.html>`_.
trusted_official_docs
CPython Docs
part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. The last version of Python that provided the :mod:`!chunk` module was `Python 3.12 <https://docs.python.org/3.12/library/chunk.html>`_.
part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. The last version of Python that provided the :mod:`!chunk` module was `Python 3.12 <https://docs.python.org/3.12/library/chunk.html>`_.
python, official-docs, cpython, P0
Local_Trusted_Corpus
08ce7b56-b072-439f-9afe-12fef8a092b8
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,642
supabase-export-v2
b76503adb0afb60e
Encapsulation of the information needed by the :class:`XMLReader` to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity.
trusted_official_docs
CPython Docs
Encapsulation of the information needed by the :class:`XMLReader` to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity.
Encapsulation of the information needed by the :class:`XMLReader` to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity.
python, official-docs, cpython, P0
Local_Trusted_Corpus
16378975-35ec-492f-8b61-446beb60cb75
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,721
supabase-export-v2
09af50d6a7f8832a
Set the byte stream (a :term:`binary file`) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.
trusted_official_docs
CPython Docs
Set the byte stream (a :term:`binary file`) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.
Set the byte stream (a :term:`binary file`) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1a91d76d-9cb1-4783-ac22-02b2c13a1cd9
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,682
supabase-export-v2
acbd5679b849b4af
.. method:: XMLReader.setProperty(propertyname, value) Set the *propertyname* to *value*. If the property is not recognized, :exc:`SAXNotRecognizedException` is raised. If the property or its setting is not supported by the parser, *SAXNotSupportedException* is raised.
trusted_official_docs
CPython Docs
.. method:: XMLReader.setProperty(propertyname, value) Set the *propertyname* to *value*. If the property is not recognized, :exc:`SAXNotRecognizedException` is raised. If the property or its setting is not supported by the parser, *SAXNotSupportedException* is raised.
.. method:: XMLReader.setProperty(propertyname, value) Set the *propertyname* to *value*. If the property is not recognized, :exc:`SAXNotRecognizedException` is raised. If the property or its setting is not supported by the parser, *SAXNotSupportedException* is raised.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1e551591-e073-4e9d-a9e7-ee7f283f4784
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,654
supabase-export-v2
65855f2d0d411a8c
:term:`path-like <path-like object>` object, or an :class:`InputSource` object. When :meth:`parse` returns, the input is completely processed, and the parser object can be discarded or reset. .. versionchanged:: 3.5 Added support of character streams.
trusted_official_docs
CPython Docs
:term:`path-like <path-like object>` object, or an :class:`InputSource` object. When :meth:`parse` returns, the input is completely processed, and the parser object can be discarded or reset. .. versionchanged:: 3.5 Added support of character streams.
:term:`path-like <path-like object>` object, or an :class:`InputSource` object. When :meth:`parse` returns, the input is completely processed, and the parser object can be discarded or reset. .. versionchanged:: 3.5 Added support of character streams.
python, official-docs, cpython, P0
Local_Trusted_Corpus
28639622-e893-4366-9095-06c992821a4e
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,689
supabase-export-v2
57841520a90cfc36
.. method:: IncrementalParser.close() Assume the end of the document. That will check well-formedness conditions that can be checked only at the end, invoke handlers, and may clean up resources allocated during parsing.
trusted_official_docs
CPython Docs
.. method:: IncrementalParser.close() Assume the end of the document. That will check well-formedness conditions that can be checked only at the end, invoke handlers, and may clean up resources allocated during parsing.
.. method:: IncrementalParser.close() Assume the end of the document. That will check well-formedness conditions that can be checked only at the end, invoke handlers, and may clean up resources allocated during parsing.
python, official-docs, cpython, P0
Local_Trusted_Corpus
54a65d04-94a1-457a-8936-a4d1099d737c
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,637
supabase-export-v2
f6f157d20081e8b7
Note that these methods must *not* be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver write...
trusted_official_docs
CPython Docs
Note that these methods must *not* be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver write...
Note that these methods must *not* be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver write...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5f70cea3-e088-4d51-b34d-8de116fe74dc
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,639
supabase-export-v2
cf5bdb69a814ba01
.. class:: Locator() Interface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable. If information is not available, methods may return ``None``.
trusted_official_docs
CPython Docs
.. class:: Locator() Interface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable. If information is not available, methods may return ``None``.
.. class:: Locator() Interface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable. If information is not available, methods may return ``None``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
816efd75-380e-463e-bf4a-d3fa4974da3e
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,716
supabase-export-v2
1860ea7d6c8092cc
The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the :class:`InputSource` is ignored if the :class:`InputSource` also contains a character stream.
trusted_official_docs
CPython Docs
The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the :class:`InputSource` is ignored if the :class:`InputSource` also contains a character stream.
The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the :class:`InputSource` is ignored if the :class:`InputSource` also contains a character stream.
python, official-docs, cpython, P0
Local_Trusted_Corpus
84f81979-9a58-48ba-8de6-7feff2fe29ad
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,630
supabase-export-v2
0a655b8b4f89f6fc
-------------- SAX parsers implement the :class:`XMLReader` interface. They are implemented in a Python module, which must provide a function :func:`create_parser`. This function is invoked by :func:`xml.sax.make_parser` with no arguments to create a new parser object.
trusted_official_docs
CPython Docs
-------------- SAX parsers implement the :class:`XMLReader` interface. They are implemented in a Python module, which must provide a function :func:`create_parser`. This function is invoked by :func:`xml.sax.make_parser` with no arguments to create a new parser object.
-------------- SAX parsers implement the :class:`XMLReader` interface. They are implemented in a Python module, which must provide a function :func:`create_parser`. This function is invoked by :func:`xml.sax.make_parser` with no arguments to create a new parser object.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9a491eff-54b8-4c9e-826f-c8a8a57bb30e
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,643
supabase-export-v2
51921b7084847ae8
This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the :meth:`XMLReader.parse` method and for returning from EntityResolver.res...
trusted_official_docs
CPython Docs
This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the :meth:`XMLReader.parse` method and for returning from EntityResolver.res...
This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the :meth:`XMLReader.parse` method and for returning from EntityResolver.res...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9a541069-24a9-471c-89cb-ddcf245d6db4
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,648
supabase-export-v2
2e83911eb8cc550b
.. class:: AttributesNSImpl(attrs, qnames) Namespace-aware variant of :class:`AttributesImpl`, which will be passed to :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but understands attribute names as two-tuples of *namespaceURI* and *localname*. In addition, it provides a number of methods expe...
trusted_official_docs
CPython Docs
.. class:: AttributesNSImpl(attrs, qnames) Namespace-aware variant of :class:`AttributesImpl`, which will be passed to :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but understands attribute names as two-tuples of *namespaceURI* and *localname*. In addition, it provides a number of methods expe...
.. class:: AttributesNSImpl(attrs, qnames) Namespace-aware variant of :class:`AttributesImpl`, which will be passed to :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but understands attribute names as two-tuples of *namespaceURI* and *localname*. In addition, it provides a number of methods expe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9c129ace-5735-4008-b21b-a5a23cac1078
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,746
supabase-export-v2
f1c6f193fd465cff
This interface is a subtype of the :class:`Attributes` interface (see section :ref:`attributes-objects`). All methods supported by that interface are also available on :class:`AttributesNS` objects. The following methods are also available:
trusted_official_docs
CPython Docs
This interface is a subtype of the :class:`Attributes` interface (see section :ref:`attributes-objects`). All methods supported by that interface are also available on :class:`AttributesNS` objects. The following methods are also available:
This interface is a subtype of the :class:`Attributes` interface (see section :ref:`attributes-objects`). All methods supported by that interface are also available on :class:`AttributesNS` objects. The following methods are also available:
python, official-docs, cpython, P0
Local_Trusted_Corpus
9f6c4711-8a23-48c9-a6fe-f6ef15d53e30
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,653
supabase-export-v2
8bf1b25e6eb16668
.. method:: XMLReader.parse(source) Process an input source, producing SAX events. The *source* object can be a system identifier (a string identifying the input source -- typically a file name or a URL), a :class:`pathlib.Path` or :term:`path-like <path-like object>` object, or an :class:`InputSource` object. When ...
trusted_official_docs
CPython Docs
.. method:: XMLReader.parse(source) Process an input source, producing SAX events. The *source* object can be a system identifier (a string identifying the input source -- typically a file name or a URL), a :class:`pathlib.Path` or :term:`path-like <path-like object>` object, or an :class:`InputSource` object. When ...
.. method:: XMLReader.parse(source) Process an input source, producing SAX events. The *source* object can be a system identifier (a string identifying the input source -- typically a file name or a URL), a :class:`pathlib.Path` or :term:`path-like <path-like object>` object, or an :class:`InputSource` object. When ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9f83ae3-05a3-4e5d-a5e1-e024bc357455
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,691
supabase-export-v2
ebecfdaf9f00aecc
.. method:: IncrementalParser.reset() This method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.
trusted_official_docs
CPython Docs
.. method:: IncrementalParser.reset() This method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.
.. method:: IncrementalParser.reset() This method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.
python, official-docs, cpython, P0
Local_Trusted_Corpus
aa366f81-8190-403b-b657-05a20135f665
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,722
supabase-export-v2
ac4ec07d6037be0f
ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.
trusted_official_docs
CPython Docs
ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.
ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ade87983-60a4-4fd5-bbcb-0be3a2696b79
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,678
supabase-export-v2
4fc28fbbcebe72af
.. method:: XMLReader.setFeature(featurename, value) Set the *featurename* to *value*. If the feature is not recognized, :exc:`SAXNotRecognizedException` is raised. If the feature or its setting is not supported by the parser, *SAXNotSupportedException* is raised.
trusted_official_docs
CPython Docs
.. method:: XMLReader.setFeature(featurename, value) Set the *featurename* to *value*. If the feature is not recognized, :exc:`SAXNotRecognizedException` is raised. If the feature or its setting is not supported by the parser, *SAXNotSupportedException* is raised.
.. method:: XMLReader.setFeature(featurename, value) Set the *featurename* to *value*. If the feature is not recognized, :exc:`SAXNotRecognizedException` is raised. If the feature or its setting is not supported by the parser, *SAXNotSupportedException* is raised.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b45b7cab-640f-4520-b6f6-97b441d2f866
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,644
supabase-export-v2
ff8095e22a7957c6
Applications will create objects of this class for use in the :meth:`XMLReader.parse` method and for returning from EntityResolver.resolveEntity. An :class:`InputSource` belongs to the application, the :class:`XMLReader` is not allowed to modify :class:`InputSource` objects passed to it from the application, although...
trusted_official_docs
CPython Docs
Applications will create objects of this class for use in the :meth:`XMLReader.parse` method and for returning from EntityResolver.resolveEntity. An :class:`InputSource` belongs to the application, the :class:`XMLReader` is not allowed to modify :class:`InputSource` objects passed to it from the application, although...
Applications will create objects of this class for use in the :meth:`XMLReader.parse` method and for returning from EntityResolver.resolveEntity. An :class:`InputSource` belongs to the application, the :class:`XMLReader` is not allowed to modify :class:`InputSource` objects passed to it from the application, although...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b491f086-c981-4739-a980-2cf66c9a8430
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,635
supabase-export-v2
81bc4fdefa97c164
still :meth:`parse` won't return until the entire document is processed. So these interfaces should be used if the blocking behaviour of :meth:`parse` is not desirable. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to c...
trusted_official_docs
CPython Docs
still :meth:`parse` won't return until the entire document is processed. So these interfaces should be used if the blocking behaviour of :meth:`parse` is not desirable. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to c...
still :meth:`parse` won't return until the entire document is processed. So these interfaces should be used if the blocking behaviour of :meth:`parse` is not desirable. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bae050a2-f440-4e19-bf4c-e400d744618c
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,636
supabase-export-v2
a006984314c28b51
to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must *not* be called during parsing, that is, after parse has been called and before it returns.
trusted_official_docs
CPython Docs
to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must *not* be called during parsing, that is, after parse has been called and before it returns.
to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must *not* be called during parsing, that is, after parse has been called and before it returns.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c43f5f13-900f-4a68-882b-d063b41bc070
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,646
supabase-export-v2
3d05d5c6da229678
.. class:: AttributesImpl(attrs) This is an implementation of the :class:`Attributes` interface (see section :ref:`attributes-objects`). This is a dictionary-like object which represents the element attributes in a :meth:`startElement` call. In addition to the most useful dictionary operations, it supports a number ...
trusted_official_docs
CPython Docs
.. class:: AttributesImpl(attrs) This is an implementation of the :class:`Attributes` interface (see section :ref:`attributes-objects`). This is a dictionary-like object which represents the element attributes in a :meth:`startElement` call. In addition to the most useful dictionary operations, it supports a number ...
.. class:: AttributesImpl(attrs) This is an implementation of the :class:`Attributes` interface (see section :ref:`attributes-objects`). This is a dictionary-like object which represents the element attributes in a :meth:`startElement` call. In addition to the most useful dictionary operations, it supports a number ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d61876f2-e0f1-4d19-b641-3762177a39ac
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,728
supabase-export-v2
9ba941baf0ffe508
Set the character stream (a :term:`text file`) for this input source. If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.
trusted_official_docs
CPython Docs
Set the character stream (a :term:`text file`) for this input source. If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.
Set the character stream (a :term:`text file`) for this input source. If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e5aa05cb-1b95-42a2-9a76-642f3806e672
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,733
supabase-export-v2
3c76100b921a520f
The :class:`Attributes` Interface --------------------------------- :class:`Attributes` objects implement a portion of the :term:`mapping protocol <mapping>`, including the methods :meth:`~collections.abc.Mapping.copy`, :meth:`~collections.abc.Mapping.get`, :meth:`~object.__contains__`, :meth:`~collections.abc.Mapping....
trusted_official_docs
CPython Docs
The :class:`Attributes` Interface --------------------------------- :class:`Attributes` objects implement a portion of the :term:`mapping protocol <mapping>`, including the methods :meth:`~collections.abc.Mapping.copy`, :meth:`~collections.abc.Mapping.get`, :meth:`~object.__contains__`, :meth:`~collections.abc.Mapping....
The :class:`Attributes` Interface --------------------------------- :class:`Attributes` objects implement a portion of the :term:`mapping protocol <mapping>`, including the methods :meth:`~collections.abc.Mapping.copy`, :meth:`~collections.abc.Mapping.get`, :meth:`~object.__contains__`, :meth:`~collections.abc.Mapping....
python, official-docs, cpython, P0
Local_Trusted_Corpus
ed6366d9-67f0-450b-aa1e-aaaf12b50da6
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,667
supabase-export-v2
6dd17f649e822847
.. method:: XMLReader.setEntityResolver(handler) Set the current :class:`~xml.sax.handler.EntityResolver`. If no :class:`~xml.sax.handler.EntityResolver` is set, attempts to resolve an external entity will result in opening the system identifier for the entity, and fail if it is not available.
trusted_official_docs
CPython Docs
.. method:: XMLReader.setEntityResolver(handler) Set the current :class:`~xml.sax.handler.EntityResolver`. If no :class:`~xml.sax.handler.EntityResolver` is set, attempts to resolve an external entity will result in opening the system identifier for the entity, and fail if it is not available.
.. method:: XMLReader.setEntityResolver(handler) Set the current :class:`~xml.sax.handler.EntityResolver`. If no :class:`~xml.sax.handler.EntityResolver` is set, attempts to resolve an external entity will result in opening the system identifier for the entity, and fail if it is not available.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f4f20cfa-099c-4471-b4e8-de8b1f8914d5
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,634
supabase-export-v2
b1673e24846c12b7
.. class:: IncrementalParser() In some cases, it is desirable not to parse an input source at once, but to feed chunks of the document as they get available. Note that the reader will normally not read the entire file, but read it in chunks as well; still :meth:`parse` won't return until the entire document is proce...
trusted_official_docs
CPython Docs
.. class:: IncrementalParser() In some cases, it is desirable not to parse an input source at once, but to feed chunks of the document as they get available. Note that the reader will normally not read the entire file, but read it in chunks as well; still :meth:`parse` won't return until the entire document is proce...
.. class:: IncrementalParser() In some cases, it is desirable not to parse an input source at once, but to feed chunks of the document as they get available. Note that the reader will normally not read the entire file, but read it in chunks as well; still :meth:`parse` won't return until the entire document is proce...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f8592416-aee0-4176-a5f6-8d0bcfc612cc
CPython Docs
file://datasets/cpython/Doc/library/xml.sax.reader.rst
unknown
005e751b-697c-40de-b2d3-3d1d57e812ad
28,674
supabase-export-v2
7ba206736776e065
Allow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.
trusted_official_docs
CPython Docs
Allow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.
Allow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.
python, official-docs, cpython, P0
Local_Trusted_Corpus
00e6acc9-9d21-4ca6-9a5d-2d7e03137c66
CPython Docs
file://datasets/cpython/Doc/library/rlcompleter.rst
unknown
accbfbd9-c5d0-4139-99b9-c6ffb653e5ef
28,763
supabase-export-v2
c2ce02c3d71f9ecf
>>> import rlcompleter >>> import readline >>> readline.parse_and_bind("tab: complete") >>> readline. <TAB PRESSED> readline.__doc__ readline.get_line_buffer( readline.read_init_file( readline.__file__ readline.insert_text( readline.set_completer( readline.__name__ readline.parse_and_bind( >>> readline. The :mod:`!rlco...
trusted_official_docs
CPython Docs
>>> import rlcompleter >>> import readline >>> readline.parse_and_bind("tab: complete") >>> readline. <TAB PRESSED> readline.__doc__ readline.get_line_buffer( readline.read_init_file( readline.__file__ readline.insert_text( readline.set_completer( readline.__name__ readline.parse_and_bind( >>> readline. The :mod:`!rlco...
>>> import rlcompleter >>> import readline >>> readline.parse_and_bind("tab: complete") >>> readline. <TAB PRESSED> readline.__doc__ readline.get_line_buffer( readline.read_init_file( readline.__file__ readline.insert_text( readline.set_completer( readline.__name__ readline.parse_and_bind( >>> readline. The :mod:`!rlco...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1d9f372a-52ff-47d1-ae62-607135b029a2
CPython Docs
file://datasets/cpython/Doc/library/rlcompleter.rst
unknown
accbfbd9-c5d0-4139-99b9-c6ffb653e5ef
28,769
supabase-export-v2
de747dc95f903d3a
Return the next possible completion for *text*. When called by the :mod:`readline` module, this method is called successively with ``state == 0, 1, 2, ...`` until the method returns ``None``.
trusted_official_docs
CPython Docs
Return the next possible completion for *text*. When called by the :mod:`readline` module, this method is called successively with ``state == 0, 1, 2, ...`` until the method returns ``None``.
Return the next possible completion for *text*. When called by the :mod:`readline` module, this method is called successively with ``state == 0, 1, 2, ...`` until the method returns ``None``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
4aeaa0c0-7053-4495-83cb-47edd93e24e0
CPython Docs
file://datasets/cpython/Doc/library/rlcompleter.rst
unknown
accbfbd9-c5d0-4139-99b9-c6ffb653e5ef
28,760
supabase-export-v2
f0357a05f5ad3cb3
The :mod:`!rlcompleter` module defines a completion function suitable to be passed to :func:`~readline.set_completer` in the :mod:`readline` module. When this module is imported on a Unix platform with the :mod:`readline` module available, an instance of the :class:`Completer` class is automatically created and its :me...
trusted_official_docs
CPython Docs
The :mod:`!rlcompleter` module defines a completion function suitable to be passed to :func:`~readline.set_completer` in the :mod:`readline` module. When this module is imported on a Unix platform with the :mod:`readline` module available, an instance of the :class:`Completer` class is automatically created and its :me...
The :mod:`!rlcompleter` module defines a completion function suitable to be passed to :func:`~readline.set_completer` in the :mod:`readline` module. When this module is imported on a Unix platform with the :mod:`readline` module available, an instance of the :class:`Completer` class is automatically created and its :me...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8ff3efbe-c636-4997-bf33-18019b2ba2e2
CPython Docs
file://datasets/cpython/Doc/library/rlcompleter.rst
unknown
accbfbd9-c5d0-4139-99b9-c6ffb653e5ef
28,764
supabase-export-v2
cd50532cde7489d5
designed for use with Python's :ref:`interactive mode <tut-interactive>`. Unless Python is run with the :option:`-S` option, the module is automatically imported and configured (see :ref:`rlcompleter-config`). On platforms without :mod:`readline`, the :class:`Completer` class defined by this module can still be used fo...
trusted_official_docs
CPython Docs
designed for use with Python's :ref:`interactive mode <tut-interactive>`. Unless Python is run with the :option:`-S` option, the module is automatically imported and configured (see :ref:`rlcompleter-config`). On platforms without :mod:`readline`, the :class:`Completer` class defined by this module can still be used fo...
designed for use with Python's :ref:`interactive mode <tut-interactive>`. Unless Python is run with the :option:`-S` option, the module is automatically imported and configured (see :ref:`rlcompleter-config`). On platforms without :mod:`readline`, the :class:`Completer` class defined by this module can still be used fo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b36940a4-9d0b-4da4-8b25-bf12ce3ca52e
CPython Docs
file://datasets/cpython/Doc/library/rlcompleter.rst
unknown
accbfbd9-c5d0-4139-99b9-c6ffb653e5ef
28,771
supabase-export-v2
1179985cb63ba632
that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and keywords (as defined by the :mod:`keyword` module). If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but i...
trusted_official_docs
CPython Docs
that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and keywords (as defined by the :mod:`keyword` module). If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but i...
that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and keywords (as defined by the :mod:`keyword` module). If called for a dotted name, it will try to evaluate anything without obvious side-effects (functions will not be evaluated, but i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dd5911ba-1cc9-439f-9ba2-d623274dc6e6
CPython Docs
file://datasets/cpython/Doc/library/rlcompleter.rst
unknown
accbfbd9-c5d0-4139-99b9-c6ffb653e5ef
28,770
supabase-export-v2
8ba32747f12380e4
When called by the :mod:`readline` module, this method is called successively with ``state == 0, 1, 2, ...`` until the method returns ``None``. If called for *text* that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and keywords (as def...
trusted_official_docs
CPython Docs
When called by the :mod:`readline` module, this method is called successively with ``state == 0, 1, 2, ...`` until the method returns ``None``. If called for *text* that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and keywords (as def...
When called by the :mod:`readline` module, this method is called successively with ``state == 0, 1, 2, ...`` until the method returns ``None``. If called for *text* that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and keywords (as def...
python, official-docs, cpython, P0
Local_Trusted_Corpus