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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8697237b-6ee5-46ef-b8a9-32da31ea88d1 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,966 | supabase-export-v2 | 01a73f4f3e1b928d | Union >>> @fun.register ... def _(arg: Union[list, set], verbose=False): ... if verbose: ... print("Enumerate this:") ... for i, elem in enumerate(arg): ... print(i, elem) ...
For code which doesn't use type annotations, the appropriate type
argument can be passed explicitly to the decorator itself:: | trusted_official_docs | CPython Docs | Union >>> @fun.register ... def _(arg: Union[list, set], verbose=False): ... if verbose: ... print("Enumerate this:") ... for i, elem in enumerate(arg): ... print(i, elem) ...
For code which doesn't use type annotations, the appropriate type
argument can be passed explicitly to the decorator itself:: | Union >>> @fun.register ... def _(arg: Union[list, set], verbose=False): ... if verbose: ... print("Enumerate this:") ... for i, elem in enumerate(arg): ... print(i, elem) ...
For code which doesn't use type annotations, the appropriate type
argument can be passed explicitly to the decorator itself:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
87e67a50-0788-4e2e-9f4b-e43b66f9990e | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,940 | supabase-export-v2 | e15c609700e5b5b8 | dear') 'Hello, world!' >>> remove_dear = partial(remove, _, ' dear') >>> remove_dear(message) 'Hello, world!' >>> remove_first_dear = partial(remove_dear, _, 1) >>> remove_first_dear(message) 'Hello, dear world!'
:data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword argument. | trusted_official_docs | CPython Docs | dear') 'Hello, world!' >>> remove_dear = partial(remove, _, ' dear') >>> remove_dear(message) 'Hello, world!' >>> remove_first_dear = partial(remove_dear, _, 1) >>> remove_first_dear(message) 'Hello, dear world!'
:data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword argument. | dear') 'Hello, world!' >>> remove_dear = partial(remove, _, ' dear') >>> remove_dear(message) 'Hello, world!' >>> remove_first_dear = partial(remove_dear, _, 1) >>> remove_first_dear(message) 'Hello, dear world!'
:data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword argument. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a5160d3-8485-45ff-8e02-8a1312789038 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,895 | supabase-export-v2 | 08d37db485d2cf88 | The decorator also provides a :func:`!cache_clear` function for clearing or invalidating the cache.
The original underlying function is accessible through the
:attr:`__wrapped__` attribute. This is useful for introspection, for
bypassing the cache, or for rewrapping the function with a different cache. | trusted_official_docs | CPython Docs | The decorator also provides a :func:`!cache_clear` function for clearing or invalidating the cache.
The original underlying function is accessible through the
:attr:`__wrapped__` attribute. This is useful for introspection, for
bypassing the cache, or for rewrapping the function with a different cache. | The decorator also provides a :func:`!cache_clear` function for clearing or invalidating the cache.
The original underlying function is accessible through the
:attr:`__wrapped__` attribute. This is useful for introspection, for
bypassing the cache, or for rewrapping the function with a different cache. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a789ce5-a675-4558-8b63-1fbcffea27be | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,905 | supabase-export-v2 | 43d5e59dfdf1ac64 | Example of efficiently computing `Fibonacci numbers <https://en.wikipedia.org/wiki/Fibonacci_number>`_ using a cache to implement a `dynamic programming <https://en.wikipedia.org/wiki/Dynamic_programming>`_ technique::
@lru_cache(maxsize=None)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2) | trusted_official_docs | CPython Docs | Example of efficiently computing `Fibonacci numbers <https://en.wikipedia.org/wiki/Fibonacci_number>`_ using a cache to implement a `dynamic programming <https://en.wikipedia.org/wiki/Dynamic_programming>`_ technique::
@lru_cache(maxsize=None)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2) | Example of efficiently computing `Fibonacci numbers <https://en.wikipedia.org/wiki/Fibonacci_number>`_ using a cache to implement a `dynamic programming <https://en.wikipedia.org/wiki/Dynamic_programming>`_ technique::
@lru_cache(maxsize=None)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d7d1998-c470-4c69-8d3f-1fe692240844 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,932 | supabase-export-v2 | 4899150a5f8b0bfa | >>> basetwo = partial(int, base=2) >>> basetwo.__doc__ = 'Convert base 2 string to an int.' >>> basetwo('10010') 18
If :data:`Placeholder` sentinels are present in *args*, they will be filled first
when :func:`!partial` is called. This makes it possible to pre-fill any positional
argument with a call to :func:`!parti... | trusted_official_docs | CPython Docs | >>> basetwo = partial(int, base=2) >>> basetwo.__doc__ = 'Convert base 2 string to an int.' >>> basetwo('10010') 18
If :data:`Placeholder` sentinels are present in *args*, they will be filled first
when :func:`!partial` is called. This makes it possible to pre-fill any positional
argument with a call to :func:`!parti... | >>> basetwo = partial(int, base=2) >>> basetwo.__doc__ = 'Convert base 2 string to an int.' >>> basetwo('10010') 18
If :data:`Placeholder` sentinels are present in *args*, they will be filled first
when :func:`!partial` is called. This makes it possible to pre-fill any positional
argument with a call to :func:`!parti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8da4236f-7cd9-45c0-803a-697db9e24703 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,978 | supabase-export-v2 | cb7c93642b82d20d | numbers, eh? 42 >>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True) Enumerate this: 0 spam 1 spam 2 eggs 3 spam >>> fun(None) Nothing. >>> fun(1.23) 0.615
Where there is no registered implementation for a specific type, its
method resolution order is used to find a more generic implementation. The original functio... | trusted_official_docs | CPython Docs | numbers, eh? 42 >>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True) Enumerate this: 0 spam 1 spam 2 eggs 3 spam >>> fun(None) Nothing. >>> fun(1.23) 0.615
Where there is no registered implementation for a specific type, its
method resolution order is used to find a more generic implementation. The original functio... | numbers, eh? 42 >>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True) Enumerate this: 0 spam 1 spam 2 eggs 3 spam >>> fun(None) Nothing. >>> fun(1.23) 0.615
Where there is no registered implementation for a specific type, its
method resolution order is used to find a more generic implementation. The original functio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8eb3f731-545b-453c-aaff-7a8b90535317 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,011 | supabase-export-v2 | a5cb58884dcf3aa9 | a convenience function for invoking :func:`update_wrapper` as a function decorator when defining a wrapper function. It is equivalent to ``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For example::
>>> from functools import wraps
>>> def my_decorator(f):
... @wraps(f)
... def wrapp... | trusted_official_docs | CPython Docs | a convenience function for invoking :func:`update_wrapper` as a function decorator when defining a wrapper function. It is equivalent to ``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For example::
>>> from functools import wraps
>>> def my_decorator(f):
... @wraps(f)
... def wrapp... | a convenience function for invoking :func:`update_wrapper` as a function decorator when defining a wrapper function. It is equivalent to ``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For example::
>>> from functools import wraps
>>> def my_decorator(f):
... @wraps(f)
... def wrapp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
94236ef0-bad9-4f55-abac-454734003875 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,964 | supabase-export-v2 | e999f3c0f1fd3219 | ... print(arg) ... >>> @fun.register ... def _(arg: list, verbose=False): ... if verbose: ... print("Enumerate this:") ... for i, elem in enumerate(arg): ... print(i, elem)
:class:`typing.Union` can also be used:: | trusted_official_docs | CPython Docs | ... print(arg) ... >>> @fun.register ... def _(arg: list, verbose=False): ... if verbose: ... print("Enumerate this:") ... for i, elem in enumerate(arg): ... print(i, elem)
:class:`typing.Union` can also be used:: | ... print(arg) ... >>> @fun.register ... def _(arg: list, verbose=False): ... if verbose: ... print("Enumerate this:") ... for i, elem in enumerate(arg): ... print(i, elem)
:class:`typing.Union` can also be used:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9501c6f2-cf8a-4156-bbf3-efdd9a6e89dd | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,943 | supabase-export-v2 | 68517432e83ecada | .. class:: partialmethod(func, /, *args, **keywords)
Return a new :class:`partialmethod` descriptor which behaves
like :class:`partial` except that it is designed to be used as a method
definition rather than being directly callable. | trusted_official_docs | CPython Docs | .. class:: partialmethod(func, /, *args, **keywords)
Return a new :class:`partialmethod` descriptor which behaves
like :class:`partial` except that it is designed to be used as a method
definition rather than being directly callable. | .. class:: partialmethod(func, /, *args, **keywords)
Return a new :class:`partialmethod` descriptor which behaves
like :class:`partial` except that it is designed to be used as a method
definition rather than being directly callable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
97f40eca-cbb5-47e7-af47-e76b6661067d | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,022 | supabase-export-v2 | 5d306ba5dc2d9345 | The keyword arguments that will be supplied when the :class:`partial` object is called.
:class:`partial` objects are like :ref:`function objects <user-defined-funcs>` in that they are
callable, weak referenceable, and can have attributes. There are some important
differences. For instance, the :attr:`~definition.__name... | trusted_official_docs | CPython Docs | The keyword arguments that will be supplied when the :class:`partial` object is called.
:class:`partial` objects are like :ref:`function objects <user-defined-funcs>` in that they are
callable, weak referenceable, and can have attributes. There are some important
differences. For instance, the :attr:`~definition.__name... | The keyword arguments that will be supplied when the :class:`partial` object is called.
:class:`partial` objects are like :ref:`function objects <user-defined-funcs>` in that they are
callable, weak referenceable, and can have attributes. There are some important
differences. For instance, the :attr:`~definition.__name... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
99b8c1c0-ee11-4392-9424-33bfd65cc374 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,012 | supabase-export-v2 | 9b12c4e121c56603 | @my_decorator ... def example(): ... """Docstring""" ... print('Called example function') ... >>> example() Calling decorated function Called example function >>> example.__name__ 'example' >>> example.__doc__ 'Docstring'
Without the use of this decorator factory, the name of the example function
would have been ``'wr... | trusted_official_docs | CPython Docs | @my_decorator ... def example(): ... """Docstring""" ... print('Called example function') ... >>> example() Calling decorated function Called example function >>> example.__name__ 'example' >>> example.__doc__ 'Docstring'
Without the use of this decorator factory, the name of the example function
would have been ``'wr... | @my_decorator ... def example(): ... """Docstring""" ... print('Called example function') ... >>> example() Calling decorated function Called example function >>> example.__name__ 'example' >>> example.__doc__ 'Docstring'
Without the use of this decorator factory, the name of the example function
would have been ``'wr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
99d83c1a-4c63-4005-bb7e-2458aad3199b | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,963 | supabase-export-v2 | b13ced56472c6c3c | generic function, which can be used as a decorator. For functions annotated with types, the decorator will infer the type of the first argument automatically::
>>> @fun.register
... def _(arg: int, verbose=False):
... if verbose:
... print("Strength in numbers, eh?", end=" ")
... print(arg)
... >>> @fun.register
... | trusted_official_docs | CPython Docs | generic function, which can be used as a decorator. For functions annotated with types, the decorator will infer the type of the first argument automatically::
>>> @fun.register
... def _(arg: int, verbose=False):
... if verbose:
... print("Strength in numbers, eh?", end=" ")
... print(arg)
... >>> @fun.register
... | generic function, which can be used as a decorator. For functions annotated with types, the decorator will infer the type of the first argument automatically::
>>> @fun.register
... def _(arg: int, verbose=False):
... if verbose:
... print("Strength in numbers, eh?", end=" ")
... print(arg)
... >>> @fun.register
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0a9d676-e379-435b-8fda-97cd0609d70b | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,977 | supabase-export-v2 | 6faa143169f6f63f | When called, the generic function dispatches on the type of the first argument::
>>> fun("Hello, world.")
Hello, world. >>> fun("test.", verbose=True)
Let me just say, test. >>> fun(42, verbose=True)
Strength in numbers, eh? 42
>>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)
Enumerate this:
0 spam
1 spam... | trusted_official_docs | CPython Docs | When called, the generic function dispatches on the type of the first argument::
>>> fun("Hello, world.")
Hello, world. >>> fun("test.", verbose=True)
Let me just say, test. >>> fun(42, verbose=True)
Strength in numbers, eh? 42
>>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)
Enumerate this:
0 spam
1 spam... | When called, the generic function dispatches on the type of the first argument::
>>> fun("Hello, world.")
Hello, world. >>> fun("test.", verbose=True)
Let me just say, test. >>> fun(42, verbose=True)
Strength in numbers, eh? 42
>>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)
Enumerate this:
0 spam
1 spam... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a2730eee-3ee6-4f5c-a267-ad0f4b602e85 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,980 | supabase-export-v2 | 3f5d32779253cd76 | If an implementation is registered to an :term:`abstract base class`, virtual subclasses of the base class will be dispatched to that implementation::
>>> from collections.abc import Mapping
>>> @fun.register
... def _(arg: Mapping, verbose=False):
... if verbose:
... print("Keys & Values")
... for key, value in a... | trusted_official_docs | CPython Docs | If an implementation is registered to an :term:`abstract base class`, virtual subclasses of the base class will be dispatched to that implementation::
>>> from collections.abc import Mapping
>>> @fun.register
... def _(arg: Mapping, verbose=False):
... if verbose:
... print("Keys & Values")
... for key, value in a... | If an implementation is registered to an :term:`abstract base class`, virtual subclasses of the base class will be dispatched to that implementation::
>>> from collections.abc import Mapping
>>> @fun.register
... def _(arg: Mapping, verbose=False):
... if verbose:
... print("Keys & Values")
... for key, value in a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6d8848f-3242-42bd-b7ca-829b6a408f8e | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,995 | supabase-export-v2 | 6ae4d2eb6172ae69 | be the *outer most* decorator. Here is the ``Negator`` class with the ``neg`` methods bound to the class, rather than an instance of the class::
class Negator:
@singledispatchmethod
@classmethod
def neg(cls, arg):
raise NotImplementedError("Cannot negate a") | trusted_official_docs | CPython Docs | be the *outer most* decorator. Here is the ``Negator`` class with the ``neg`` methods bound to the class, rather than an instance of the class::
class Negator:
@singledispatchmethod
@classmethod
def neg(cls, arg):
raise NotImplementedError("Cannot negate a") | be the *outer most* decorator. Here is the ``Negator`` class with the ``neg`` methods bound to the class, rather than an instance of the class::
class Negator:
@singledispatchmethod
@classmethod
def neg(cls, arg):
raise NotImplementedError("Cannot negate a") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa28d4d5-2865-4a05-9d2a-6bf6fe3cff48 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,969 | supabase-export-v2 | 6fa3e94315dc2091 | items of the collection (e.g., ``list[int]``), the dispatch type should be passed explicitly to the decorator itself with the typehint going into the function definition::
>>> @fun.register(list)
... def _(arg: list[int], verbose=False):
... if verbose:
... print("Enumerate this:")
... for i, elem in enumerate(arg)... | trusted_official_docs | CPython Docs | items of the collection (e.g., ``list[int]``), the dispatch type should be passed explicitly to the decorator itself with the typehint going into the function definition::
>>> @fun.register(list)
... def _(arg: list[int], verbose=False):
... if verbose:
... print("Enumerate this:")
... for i, elem in enumerate(arg)... | items of the collection (e.g., ``list[int]``), the dispatch type should be passed explicitly to the decorator itself with the typehint going into the function definition::
>>> @fun.register(list)
... def _(arg: list[int], verbose=False):
... if verbose:
... print("Enumerate this:")
... for i, elem in enumerate(arg)... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b0c64f95-66cb-4425-bf05-de298f31384e | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,897 | supabase-export-v2 | 4fe97acdecf82e72 | The cache keeps references to the arguments and return values until they age out of the cache or until the cache is cleared.
If a method is cached, the ``self`` instance argument is included in the
cache. See :ref:`faq-cache-method-calls` | trusted_official_docs | CPython Docs | The cache keeps references to the arguments and return values until they age out of the cache or until the cache is cleared.
If a method is cached, the ``self`` instance argument is included in the
cache. See :ref:`faq-cache-method-calls` | The cache keeps references to the arguments and return values until they age out of the cache or until the cache is cleared.
If a method is cached, the ``self`` instance argument is included in the
cache. See :ref:`faq-cache-method-calls` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b22d9a09-28e7-439f-a072-023d99a3c6c8 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,865 | supabase-export-v2 | 184be9ea44f3e063 | to the attribute with the same name. Subsequent attribute reads and writes take precedence over the *cached_property* method and it works like a normal attribute.
The cached value can be cleared by deleting the attribute. This
allows the *cached_property* method to run again. | trusted_official_docs | CPython Docs | to the attribute with the same name. Subsequent attribute reads and writes take precedence over the *cached_property* method and it works like a normal attribute.
The cached value can be cleared by deleting the attribute. This
allows the *cached_property* method to run again. | to the attribute with the same name. Subsequent attribute reads and writes take precedence over the *cached_property* method and it works like a normal attribute.
The cached value can be cleared by deleting the attribute. This
allows the *cached_property* method to run again. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b45533ef-5606-40a0-b270-6aa2dc25d09f | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,874 | supabase-export-v2 | ee94956ce50cddc1 | :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition tool for programs being converted from Python 2 which supported the use of comparison functions.
A comparison function is any callable that accepts two arguments, compares them,
and returns a negative number for less-t... | trusted_official_docs | CPython Docs | :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition tool for programs being converted from Python 2 which supported the use of comparison functions.
A comparison function is any callable that accepts two arguments, compares them,
and returns a negative number for less-t... | :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition tool for programs being converted from Python 2 which supported the use of comparison functions.
A comparison function is any callable that accepts two arguments, compares them,
and returns a negative number for less-t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b58da4b6-49f9-4402-800e-2e520b98ef54 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,955 | supabase-export-v2 | 0295a176a4c10e41 | initial=initial_missing): it = iter(iterable) if initial is initial_missing: value = next(it) else: value = initial for element in it: value = function(value, element) return value
See :func:`itertools.accumulate` for an iterator that yields all intermediate
values. | trusted_official_docs | CPython Docs | initial=initial_missing): it = iter(iterable) if initial is initial_missing: value = next(it) else: value = initial for element in it: value = function(value, element) return value
See :func:`itertools.accumulate` for an iterator that yields all intermediate
values. | initial=initial_missing): it = iter(iterable) if initial is initial_missing: value = next(it) else: value = initial for element in it: value = function(value, element) return value
See :func:`itertools.accumulate` for an iterator that yields all intermediate
values. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bf4d4dd1-96c1-49b5-bf18-383e6ecb11c3 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,868 | supabase-export-v2 | d4d901ae4cb0ffdf | Note, this decorator interferes with the operation of :pep:`412` key-sharing dictionaries. This means that instance dictionaries can take more space than usual.
Also, this decorator requires that the ``__dict__`` attribute on each instance
be a mutable mapping. This means it will not work with some types, such as
met... | trusted_official_docs | CPython Docs | Note, this decorator interferes with the operation of :pep:`412` key-sharing dictionaries. This means that instance dictionaries can take more space than usual.
Also, this decorator requires that the ``__dict__`` attribute on each instance
be a mutable mapping. This means it will not work with some types, such as
met... | Note, this decorator interferes with the operation of :pep:`412` key-sharing dictionaries. This means that instance dictionaries can take more space than usual.
Also, this decorator requires that the ``__dict__`` attribute on each instance
be a mutable mapping. This means it will not work with some types, such as
met... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bfa67109-af42-43c4-9e65-67ca680e83af | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,967 | supabase-export-v2 | 9e8b18744ef09909 | For code which doesn't use type annotations, the appropriate type argument can be passed explicitly to the decorator itself::
>>> @fun.register(complex)
... def _(arg, verbose=False):
... if verbose:
... print("Better than complicated.", end=" ")
... print(arg.real, arg.imag)
... | trusted_official_docs | CPython Docs | For code which doesn't use type annotations, the appropriate type argument can be passed explicitly to the decorator itself::
>>> @fun.register(complex)
... def _(arg, verbose=False):
... if verbose:
... print("Better than complicated.", end=" ")
... print(arg.real, arg.imag)
... | For code which doesn't use type annotations, the appropriate type argument can be passed explicitly to the decorator itself::
>>> @fun.register(complex)
... def _(arg, verbose=False):
... if verbose:
... print("Better than complicated.", end=" ")
... print(arg.real, arg.imag)
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bfbb0d34-f1be-43e0-aea1-7e307914bab0 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,972 | supabase-export-v2 | 9f9a645512590604 | be dispatched the same as ``["foo", "bar", "baz"]``. The annotation provided in this example is for static type checkers only and has no runtime impact.
To enable registering :term:`lambdas<lambda>` and pre-existing functions,
the :func:`~singledispatch.register` attribute can also be used in a functional form:: | trusted_official_docs | CPython Docs | be dispatched the same as ``["foo", "bar", "baz"]``. The annotation provided in this example is for static type checkers only and has no runtime impact.
To enable registering :term:`lambdas<lambda>` and pre-existing functions,
the :func:`~singledispatch.register` attribute can also be used in a functional form:: | be dispatched the same as ``["foo", "bar", "baz"]``. The annotation provided in this example is for static type checkers only and has no runtime impact.
To enable registering :term:`lambdas<lambda>` and pre-existing functions,
the :func:`~singledispatch.register` attribute can also be used in a functional form:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c38b9dee-806f-4112-a0ba-0afe660a7c9f | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,920 | supabase-export-v2 | f95903b22acde6d7 | .. note::
This decorator makes no attempt to override methods that have been
declared in the class *or its superclasses*. Meaning that if a
superclass defines a comparison operator, *total_ordering* will not
implement it again, even if the original method is abstract. | trusted_official_docs | CPython Docs | .. note::
This decorator makes no attempt to override methods that have been
declared in the class *or its superclasses*. Meaning that if a
superclass defines a comparison operator, *total_ordering* will not
implement it again, even if the original method is abstract. | .. note::
This decorator makes no attempt to override methods that have been
declared in the class *or its superclasses*. Meaning that if a
superclass defines a comparison operator, *total_ordering* will not
implement it again, even if the original method is abstract. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c56b4899-6ad3-4e29-9449-96fb1074a869 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,962 | supabase-export-v2 | b0930924e89f57c7 | .. method:: singledispatch.register() :no-typesetting:
To add overloaded implementations to the function, use the :func:`!register`
attribute of the generic function, which can be used as a decorator. For
functions annotated with types, the decorator will infer the type of the
first argument automatically:: | trusted_official_docs | CPython Docs | .. method:: singledispatch.register() :no-typesetting:
To add overloaded implementations to the function, use the :func:`!register`
attribute of the generic function, which can be used as a decorator. For
functions annotated with types, the decorator will infer the type of the
first argument automatically:: | .. method:: singledispatch.register() :no-typesetting:
To add overloaded implementations to the function, use the :func:`!register`
attribute of the generic function, which can be used as a decorator. For
functions annotated with types, the decorator will infer the type of the
first argument automatically:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c64bb9cb-e6e3-4b52-ac67-eb04eda3ee71 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,936 | supabase-export-v2 | e65d991547472409 | >>> say_to_world = partial(print, Placeholder, Placeholder, "world!") >>> say_to_world('Hello', 'dear') Hello dear world!
Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because
only one positional argument is provided, but there are two placeholders
that must be filled in. | trusted_official_docs | CPython Docs | >>> say_to_world = partial(print, Placeholder, Placeholder, "world!") >>> say_to_world('Hello', 'dear') Hello dear world!
Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because
only one positional argument is provided, but there are two placeholders
that must be filled in. | >>> say_to_world = partial(print, Placeholder, Placeholder, "world!") >>> say_to_world('Hello', 'dear') Hello dear world!
Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because
only one positional argument is provided, but there are two placeholders
that must be filled in. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c68320b1-3305-4822-8d92-05627e337f37 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,901 | supabase-export-v2 | bdbaebb183d11389 | Example of an LRU cache for static web content::
@lru_cache(maxsize=32)
def get_pep(num):
'Retrieve text of a Python Enhancement Proposal'
resource = f'https://peps.python.org/pep-{num:04d}'
try:
with urllib.request.urlopen(resource) as s:
return s.read()
except urllib.error.HTTPError:
return 'Not Found' | trusted_official_docs | CPython Docs | Example of an LRU cache for static web content::
@lru_cache(maxsize=32)
def get_pep(num):
'Retrieve text of a Python Enhancement Proposal'
resource = f'https://peps.python.org/pep-{num:04d}'
try:
with urllib.request.urlopen(resource) as s:
return s.read()
except urllib.error.HTTPError:
return 'Not Found' | Example of an LRU cache for static web content::
@lru_cache(maxsize=32)
def get_pep(num):
'Retrieve text of a Python Enhancement Proposal'
resource = f'https://peps.python.org/pep-{num:04d}'
try:
with urllib.request.urlopen(resource) as s:
return s.read()
except urllib.error.HTTPError:
return 'Not Found' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c912b21f-5c38-458b-8328-e44273c64cd0 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,880 | supabase-export-v2 | d147a07dda0f1766 | .. decorator:: lru_cache(user_function) lru_cache(maxsize=128, typed=False)
Decorator to wrap a function with a memoizing callable that saves up to the
*maxsize* most recent calls. It can save time when an expensive or I/O bound
function is periodically called with the same arguments. | trusted_official_docs | CPython Docs | .. decorator:: lru_cache(user_function) lru_cache(maxsize=128, typed=False)
Decorator to wrap a function with a memoizing callable that saves up to the
*maxsize* most recent calls. It can save time when an expensive or I/O bound
function is periodically called with the same arguments. | .. decorator:: lru_cache(user_function) lru_cache(maxsize=128, typed=False)
Decorator to wrap a function with a memoizing callable that saves up to the
*maxsize* most recent calls. It can save time when an expensive or I/O bound
function is periodically called with the same arguments. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d0a75ef6-1ddd-43c7-9af3-6c2c24224e4c | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,006 | supabase-export-v2 | f3e1e3e67aaaa957 | not attempt to set them on the wrapper function). :exc:`AttributeError` is still raised if the wrapper function itself is missing any attributes named in *updated*.
.. versionchanged:: 3.2
The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default... | trusted_official_docs | CPython Docs | not attempt to set them on the wrapper function). :exc:`AttributeError` is still raised if the wrapper function itself is missing any attributes named in *updated*.
.. versionchanged:: 3.2
The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default... | not attempt to set them on the wrapper function). :exc:`AttributeError` is still raised if the wrapper function itself is missing any attributes named in *updated*.
.. versionchanged:: 3.2
The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d17fede0-94dc-4eb4-84b8-b49a3c265453 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,939 | supabase-export-v2 | e212865e64882550 | .. doctest::
>>> from functools import partial, Placeholder as _
>>> remove = partial(str.replace, _, _, '')
>>> message = 'Hello, dear dear world!'
>>> remove(message, ' dear')
'Hello, world!'
>>> remove_dear = partial(remove, _, ' dear')
>>> remove_dear(message)
'Hello, world!'
>>> remove_first_dear = partial... | trusted_official_docs | CPython Docs | .. doctest::
>>> from functools import partial, Placeholder as _
>>> remove = partial(str.replace, _, _, '')
>>> message = 'Hello, dear dear world!'
>>> remove(message, ' dear')
'Hello, world!'
>>> remove_dear = partial(remove, _, ' dear')
>>> remove_dear(message)
'Hello, world!'
>>> remove_first_dear = partial... | .. doctest::
>>> from functools import partial, Placeholder as _
>>> remove = partial(str.replace, _, _, '')
>>> message = 'Hello, dear dear world!'
>>> remove(message, ' dear')
'Hello, world!'
>>> remove_dear = partial(remove, _, ' dear')
>>> remove_dear(message)
'Hello, world!'
>>> remove_first_dear = partial... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d31c4e5d-3e20-4490-a663-a1804abea183 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,913 | supabase-export-v2 | abd39cf6348c5316 | .. decorator:: total_ordering
Given a class defining one or more rich comparison ordering methods, this
class decorator supplies the rest. This simplifies the effort involved
in specifying all of the possible rich comparison operations: | trusted_official_docs | CPython Docs | .. decorator:: total_ordering
Given a class defining one or more rich comparison ordering methods, this
class decorator supplies the rest. This simplifies the effort involved
in specifying all of the possible rich comparison operations: | .. decorator:: total_ordering
Given a class defining one or more rich comparison ordering methods, this
class decorator supplies the rest. This simplifies the effort involved
in specifying all of the possible rich comparison operations: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3435518-a0b2-4e7e-b2df-bbcf2b4685c7 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,003 | supabase-export-v2 | 5b064fb8dab1eba1 | the wrapper function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function.__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's :attr:`~function._... | trusted_official_docs | CPython Docs | the wrapper function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function.__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's :attr:`~function._... | the wrapper function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function.__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's :attr:`~function._... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d6c311f1-e6ed-4994-b94f-b7e2afff0b2e | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,884 | supabase-export-v2 | 6061d891e12e7747 | Since a dictionary is used to cache results, the positional and keyword arguments to the function must be :term:`hashable`.
Distinct argument patterns may be considered to be distinct calls with
separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)``
differ in their keyword argument order and may hav... | trusted_official_docs | CPython Docs | Since a dictionary is used to cache results, the positional and keyword arguments to the function must be :term:`hashable`.
Distinct argument patterns may be considered to be distinct calls with
separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)``
differ in their keyword argument order and may hav... | Since a dictionary is used to cache results, the positional and keyword arguments to the function must be :term:`hashable`.
Distinct argument patterns may be considered to be distinct calls with
separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)``
differ in their keyword argument order and may hav... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d6e6aecc-2298-495e-b832-fa13c1ef24d2 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,944 | supabase-export-v2 | 95b3a39cadea313e | a new :class:`partialmethod` descriptor which behaves like :class:`partial` except that it is designed to be used as a method definition rather than being directly callable.
*func* must be a :term:`descriptor` or a callable (objects which are both,
like normal functions, are handled as descriptors). | trusted_official_docs | CPython Docs | a new :class:`partialmethod` descriptor which behaves like :class:`partial` except that it is designed to be used as a method definition rather than being directly callable.
*func* must be a :term:`descriptor` or a callable (objects which are both,
like normal functions, are handled as descriptors). | a new :class:`partialmethod` descriptor which behaves like :class:`partial` except that it is designed to be used as a method definition rather than being directly callable.
*func* must be a :term:`descriptor` or a callable (objects which are both,
like normal functions, are handled as descriptors). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d8447a14-6191-40c3-8e5d-73256bd0a4f8 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,869 | supabase-export-v2 | dfa117aee15cdcce | namespace), and those that specify ``__slots__`` without including ``__dict__`` as one of the defined slots (as such classes don't provide a ``__dict__`` attribute at all).
If a mutable mapping is not available or if space-efficient key sharing is
desired, an effect similar to :func:`cached_property` can also be achie... | trusted_official_docs | CPython Docs | namespace), and those that specify ``__slots__`` without including ``__dict__`` as one of the defined slots (as such classes don't provide a ``__dict__`` attribute at all).
If a mutable mapping is not available or if space-efficient key sharing is
desired, an effect similar to :func:`cached_property` can also be achie... | namespace), and those that specify ``__slots__`` without including ``__dict__`` as one of the defined slots (as such classes don't provide a ``__dict__`` attribute at all).
If a mutable mapping is not available or if space-efficient key sharing is
desired, an effect similar to :func:`cached_property` can also be achie... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d983558f-5523-4510-8a74-9901ddd82f40 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,850 | supabase-export-v2 | 94408c99a0920c53 | Simple lightweight unbounded function cache. Sometimes called `"memoize" <https://en.wikipedia.org/wiki/Memoization>`_.
Returns the same as ``lru_cache(maxsize=None)``, creating a thin
wrapper around a dictionary lookup for the function arguments. Because it
never needs to evict old values, this is smaller and faster... | trusted_official_docs | CPython Docs | Simple lightweight unbounded function cache. Sometimes called `"memoize" <https://en.wikipedia.org/wiki/Memoization>`_.
Returns the same as ``lru_cache(maxsize=None)``, creating a thin
wrapper around a dictionary lookup for the function arguments. Because it
never needs to evict old values, this is smaller and faster... | Simple lightweight unbounded function cache. Sometimes called `"memoize" <https://en.wikipedia.org/wiki/Memoization>`_.
Returns the same as ``lru_cache(maxsize=None)``, creating a thin
wrapper around a dictionary lookup for the function arguments. Because it
never needs to evict old values, this is smaller and faster... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d9e0058f-3acf-4ee1-b956-1e9a9b913e61 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,883 | supabase-export-v2 | 7f1056e69af9e937 | the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached.
Since a dictionary is used to cache results, the positional and keyword
arguments to the function must be :term:`hashable`. | trusted_official_docs | CPython Docs | the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached.
Since a dictionary is used to cache results, the positional and keyword
arguments to the function must be :term:`hashable`. | the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached.
Since a dictionary is used to cache results, the positional and keyword
arguments to the function must be :term:`hashable`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dcdd4847-1cba-46ba-85dc-7c49bb28c4b4 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,991 | supabase-export-v2 | cb9ec04c947c259d | with the ``@singledispatchmethod`` decorator. When defining a method using ``@singledispatchmethod``, note that the dispatch happens on the type of the first non-*self* or non-*cls* argument::
class Negator:
@singledispatchmethod
def neg(self, arg):
raise NotImplementedError("Cannot negate a") | trusted_official_docs | CPython Docs | with the ``@singledispatchmethod`` decorator. When defining a method using ``@singledispatchmethod``, note that the dispatch happens on the type of the first non-*self* or non-*cls* argument::
class Negator:
@singledispatchmethod
def neg(self, arg):
raise NotImplementedError("Cannot negate a") | with the ``@singledispatchmethod`` decorator. When defining a method using ``@singledispatchmethod``, note that the dispatch happens on the type of the first non-*self* or non-*cls* argument::
class Negator:
@singledispatchmethod
def neg(self, arg):
raise NotImplementedError("Cannot negate a") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
de442d89-46d4-477a-b20b-27478724c1ad | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,990 | supabase-export-v2 | a76daf8019cb19f2 | Transform a method into a :term:`single-dispatch <single dispatch>` :term:`generic function`.
To define a generic method, decorate it with the ``@singledispatchmethod``
decorator. When defining a method using ``@singledispatchmethod``, note
that the dispatch happens on the type of the first non-*self* or non-*cls*
a... | trusted_official_docs | CPython Docs | Transform a method into a :term:`single-dispatch <single dispatch>` :term:`generic function`.
To define a generic method, decorate it with the ``@singledispatchmethod``
decorator. When defining a method using ``@singledispatchmethod``, note
that the dispatch happens on the type of the first non-*self* or non-*cls*
a... | Transform a method into a :term:`single-dispatch <single dispatch>` :term:`generic function`.
To define a generic method, decorate it with the ``@singledispatchmethod``
decorator. When defining a method using ``@singledispatchmethod``, note
that the dispatch happens on the type of the first non-*self* or non-*cls*
a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df679b67-3515-46fe-a98a-e813f8d9b396 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,853 | supabase-export-v2 | aa8c80934d172660 | @cache def factorial(n): return n * factorial(n-1) if n else 1
>>> factorial(10) # no previously cached result, makes 11 recursive calls
3628800
>>> factorial(5) # no new calls, just returns the cached result
120
>>> factorial(12) # two new recursive calls, factorial(10) is cached
479001600 | trusted_official_docs | CPython Docs | @cache def factorial(n): return n * factorial(n-1) if n else 1
>>> factorial(10) # no previously cached result, makes 11 recursive calls
3628800
>>> factorial(5) # no new calls, just returns the cached result
120
>>> factorial(12) # two new recursive calls, factorial(10) is cached
479001600 | @cache def factorial(n): return n * factorial(n-1) if n else 1
>>> factorial(10) # no previously cached result, makes 11 recursive calls
3628800
>>> factorial(5) # no new calls, just returns the cached result
120
>>> factorial(12) # two new recursive calls, factorial(10) is cached
479001600 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e0938ceb-4bc5-48cc-9fcd-2a8b4da4c0e2 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,856 | supabase-export-v2 | 410bba6b8f1f088d | the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached.
Call-once behavior is not guaranteed because locks are not held during the
function call. Potentially another call with the same arguments could
occur while the first call... | trusted_official_docs | CPython Docs | the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached.
Call-once behavior is not guaranteed because locks are not held during the
function call. Potentially another call with the same arguments could
occur while the first call... | the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached.
Call-once behavior is not guaranteed because locks are not held during the
function call. Potentially another call with the same arguments could
occur while the first call... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e096263d-1f56-46af-87af-309aa7dd5e3e | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,937 | supabase-export-v2 | cae7870db9bd45e6 | Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only one positional argument is provided, but there are two placeholders that must be filled in.
If :func:`!partial` is applied to an existing :func:`!partial` object,
:data:`!Placeholder` sentinels of the input object are filled in with
new positio... | trusted_official_docs | CPython Docs | Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only one positional argument is provided, but there are two placeholders that must be filled in.
If :func:`!partial` is applied to an existing :func:`!partial` object,
:data:`!Placeholder` sentinels of the input object are filled in with
new positio... | Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only one positional argument is provided, but there are two placeholders that must be filled in.
If :func:`!partial` is applied to an existing :func:`!partial` object,
:data:`!Placeholder` sentinels of the input object are filled in with
new positio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eac1cfdb-0016-4a76-8db8-367e641fd258 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,946 | supabase-export-v2 | 45bd681619e1d3b3 | :func:`staticmethod`, :func:`~abc.abstractmethod` or another instance of :class:`partialmethod`), calls to ``__get__`` are delegated to the underlying descriptor, and an appropriate :ref:`partial object<partial-objects>` returned as the result.
When *func* is a non-descriptor callable, an appropriate bound method is
c... | trusted_official_docs | CPython Docs | :func:`staticmethod`, :func:`~abc.abstractmethod` or another instance of :class:`partialmethod`), calls to ``__get__`` are delegated to the underlying descriptor, and an appropriate :ref:`partial object<partial-objects>` returned as the result.
When *func* is a non-descriptor callable, an appropriate bound method is
c... | :func:`staticmethod`, :func:`~abc.abstractmethod` or another instance of :class:`partialmethod`), calls to ``__get__`` are delegated to the underlying descriptor, and an appropriate :ref:`partial object<partial-objects>` returned as the result.
When *func* is a non-descriptor callable, an appropriate bound method is
c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eacf795b-9426-4507-972f-db497fb67167 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,007 | supabase-export-v2 | f4edb964ac8d69ab | .. versionchanged:: 3.2 The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default. Missing attributes no longer trigger an :exc:`AttributeError`.
.. versionchanged:: 3.4
The ``__wrapped__`` attribute now always refers to the wrapped
function, ev... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.2 The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default. Missing attributes no longer trigger an :exc:`AttributeError`.
.. versionchanged:: 3.4
The ``__wrapped__`` attribute now always refers to the wrapped
function, ev... | .. versionchanged:: 3.2 The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default. Missing attributes no longer trigger an :exc:`AttributeError`.
.. versionchanged:: 3.4
The ``__wrapped__`` attribute now always refers to the wrapped
function, ev... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb3d3bbb-048d-4476-8482-1118e984a368 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,945 | supabase-export-v2 | 421c287b147424f7 | *func* must be a :term:`descriptor` or a callable (objects which are both, like normal functions, are handled as descriptors).
When *func* is a descriptor (such as a normal Python function,
:func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or
another instance of :class:`partialmethod`), calls to ... | trusted_official_docs | CPython Docs | *func* must be a :term:`descriptor` or a callable (objects which are both, like normal functions, are handled as descriptors).
When *func* is a descriptor (such as a normal Python function,
:func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or
another instance of :class:`partialmethod`), calls to ... | *func* must be a :term:`descriptor` or a callable (objects which are both, like normal functions, are handled as descriptors).
When *func* is a descriptor (such as a normal Python function,
:func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or
another instance of :class:`partialmethod`), calls to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ecd27740-53fc-4cc2-a49f-b06246c6b4e2 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,004 | supabase-export-v2 | c3fe3cc5870e29a0 | (e.g. bypassing a caching decorator such as :func:`lru_cache`), this function automatically adds a ``__wrapped__`` attribute to the wrapper that refers to the function being wrapped.
The main intended use for this function is in :term:`decorator` functions which
wrap the decorated function and return the wrapper. If t... | trusted_official_docs | CPython Docs | (e.g. bypassing a caching decorator such as :func:`lru_cache`), this function automatically adds a ``__wrapped__`` attribute to the wrapper that refers to the function being wrapped.
The main intended use for this function is in :term:`decorator` functions which
wrap the decorated function and return the wrapper. If t... | (e.g. bypassing a caching decorator such as :func:`lru_cache`), this function automatically adds a ``__wrapped__`` attribute to the wrapper that refers to the function being wrapped.
The main intended use for this function is in :term:`decorator` functions which
wrap the decorated function and return the wrapper. If t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ed5d867e-704c-429b-8d34-9d31d9bd7c1f | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,010 | supabase-export-v2 | 7b2597091ba0e362 | .. decorator:: wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
This is a convenience function for invoking :func:`update_wrapper` as a
function decorator when defining a wrapper function. It is equivalent to
``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For ex... | trusted_official_docs | CPython Docs | .. decorator:: wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
This is a convenience function for invoking :func:`update_wrapper` as a
function decorator when defining a wrapper function. It is equivalent to
``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For ex... | .. decorator:: wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
This is a convenience function for invoking :func:`update_wrapper` as a
function decorator when defining a wrapper function. It is equivalent to
``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For ex... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1bfe836-9640-47bb-94f3-e8504988590d | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,864 | supabase-export-v2 | 6aeb7ae9832d4672 | mechanics of :func:`cached_property` are somewhat different from :func:`property`. A regular property blocks attribute writes unless a setter is defined. In contrast, a *cached_property* allows writes.
The *cached_property* decorator only runs on lookups and only when an
attribute of the same name doesn't exist. When ... | trusted_official_docs | CPython Docs | mechanics of :func:`cached_property` are somewhat different from :func:`property`. A regular property blocks attribute writes unless a setter is defined. In contrast, a *cached_property* allows writes.
The *cached_property* decorator only runs on lookups and only when an
attribute of the same name doesn't exist. When ... | mechanics of :func:`cached_property` are somewhat different from :func:`property`. A regular property blocks attribute writes unless a setter is defined. In contrast, a *cached_property* allows writes.
The *cached_property* decorator only runs on lookups and only when an
attribute of the same name doesn't exist. When ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6909d60-da8f-471a-8235-855ac2fc55f6 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,974 | supabase-export-v2 | 7cde781c66e80a95 | >>> def nothing(arg, verbose=False): ... print("Nothing.") ... >>> fun.register(type(None), nothing)
The :func:`~singledispatch.register` attribute returns the undecorated function. This
enables decorator stacking, :mod:`pickling<pickle>`, and the creation
of unit tests for each variant independently:: | trusted_official_docs | CPython Docs | >>> def nothing(arg, verbose=False): ... print("Nothing.") ... >>> fun.register(type(None), nothing)
The :func:`~singledispatch.register` attribute returns the undecorated function. This
enables decorator stacking, :mod:`pickling<pickle>`, and the creation
of unit tests for each variant independently:: | >>> def nothing(arg, verbose=False): ... print("Nothing.") ... >>> fun.register(type(None), nothing)
The :func:`~singledispatch.register` attribute returns the undecorated function. This
enables decorator stacking, :mod:`pickling<pickle>`, and the creation
of unit tests for each variant independently:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8c68732-a369-48c1-b143-de6b5125a576 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,008 | supabase-export-v2 | e72347a39c9a273c | .. versionchanged:: 3.4 The ``__wrapped__`` attribute now always refers to the wrapped function, even if that function defined a ``__wrapped__`` attribute. (see :issue:`17482`)
.. versionchanged:: 3.12
The :attr:`~function.__type_params__` attribute is now copied by default. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.4 The ``__wrapped__`` attribute now always refers to the wrapped function, even if that function defined a ``__wrapped__`` attribute. (see :issue:`17482`)
.. versionchanged:: 3.12
The :attr:`~function.__type_params__` attribute is now copied by default. | .. versionchanged:: 3.4 The ``__wrapped__`` attribute now always refers to the wrapped function, even if that function defined a ``__wrapped__`` attribute. (see :issue:`17482`)
.. versionchanged:: 3.12
The :attr:`~function.__type_params__` attribute is now copied by default. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea614978-1e73-45bf-ab17-694ebd1b66ce | CPython Docs | file://datasets/cpython/Doc/library/cmdline.rst | unknown | da0a76d5-9789-4776-ade0-3ed3e36e658b | 14,025 | supabase-export-v2 | 164014eff8d7df7a | The following modules have a command-line interface.
* :ref:`ast <ast-cli>`
* :ref:`asyncio <asyncio-cli>`
* :mod:`base64`
* :ref:`calendar <calendar-cli>`
* :mod:`code`
* :ref:`compileall <compileall-cli>`
* ``cProfile``: see :ref:`profiling.tracing <profiling-tracing-cli>`
* :ref:`dis <dis-cli>`
* :ref:`doctest <doct... | trusted_official_docs | CPython Docs | The following modules have a command-line interface.
* :ref:`ast <ast-cli>`
* :ref:`asyncio <asyncio-cli>`
* :mod:`base64`
* :ref:`calendar <calendar-cli>`
* :mod:`code`
* :ref:`compileall <compileall-cli>`
* ``cProfile``: see :ref:`profiling.tracing <profiling-tracing-cli>`
* :ref:`dis <dis-cli>`
* :ref:`doctest <doct... | The following modules have a command-line interface.
* :ref:`ast <ast-cli>`
* :ref:`asyncio <asyncio-cli>`
* :mod:`base64`
* :ref:`calendar <calendar-cli>`
* :mod:`code`
* :ref:`compileall <compileall-cli>`
* ``cProfile``: see :ref:`profiling.tracing <profiling-tracing-cli>`
* :ref:`dis <dis-cli>`
* :ref:`doctest <doct... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eeceb69e-4482-4eb1-b37c-aa8d30b7f115 | CPython Docs | file://datasets/cpython/Doc/library/cmdline.rst | unknown | da0a76d5-9789-4776-ade0-3ed3e36e658b | 14,026 | supabase-export-v2 | 0e50952cc0195ad6 | :ref:`tokenize <tokenize-cli>` * :ref:`trace <trace-cli>` * :mod:`turtledemo` * :ref:`unittest <unittest-command-line-interface>` * :ref:`uuid <uuid-cli>` * :ref:`venv <venv-cli>` * :ref:`webbrowser <webbrowser-cli>` * :ref:`zipapp <zipapp-command-line-interface>` * :ref:`zipfile <zipfile-commandline>`
See also the :re... | trusted_official_docs | CPython Docs | :ref:`tokenize <tokenize-cli>` * :ref:`trace <trace-cli>` * :mod:`turtledemo` * :ref:`unittest <unittest-command-line-interface>` * :ref:`uuid <uuid-cli>` * :ref:`venv <venv-cli>` * :ref:`webbrowser <webbrowser-cli>` * :ref:`zipapp <zipapp-command-line-interface>` * :ref:`zipfile <zipfile-commandline>`
See also the :re... | :ref:`tokenize <tokenize-cli>` * :ref:`trace <trace-cli>` * :mod:`turtledemo` * :ref:`unittest <unittest-command-line-interface>` * :ref:`uuid <uuid-cli>` * :ref:`venv <venv-cli>` * :ref:`webbrowser <webbrowser-cli>` * :ref:`zipapp <zipapp-command-line-interface>` * :ref:`zipfile <zipfile-commandline>`
See also the :re... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
152fe7dd-3185-48b9-8419-a8f15385bb39 | CPython Docs | file://datasets/cpython/Doc/library/urllib.error.rst | unknown | 628f84e4-3267-4e14-980b-cd84ec158df8 | 14,051 | supabase-export-v2 | f06ba166a3f1c238 | .. exception:: ContentTooShortError(msg, content)
This exception is raised when the :func:`~urllib.request.urlretrieve`
function detects that
the amount of the downloaded data is less than the expected amount (given by
the *Content-Length* header). | trusted_official_docs | CPython Docs | .. exception:: ContentTooShortError(msg, content)
This exception is raised when the :func:`~urllib.request.urlretrieve`
function detects that
the amount of the downloaded data is less than the expected amount (given by
the *Content-Length* header). | .. exception:: ContentTooShortError(msg, content)
This exception is raised when the :func:`~urllib.request.urlretrieve`
function detects that
the amount of the downloaded data is less than the expected amount (given by
the *Content-Length* header). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18411797-aac1-4511-a8e4-a1f614eeec56 | CPython Docs | file://datasets/cpython/Doc/library/urllib.error.rst | unknown | 628f84e4-3267-4e14-980b-cd84ec158df8 | 14,037 | supabase-export-v2 | cee068f43c76efa5 | The reason for this error. It can be a message string or another exception instance.
.. versionchanged:: 3.3
:exc:`URLError` used to be a subtype of :exc:`IOError`, which is now an
alias of :exc:`OSError`. | trusted_official_docs | CPython Docs | The reason for this error. It can be a message string or another exception instance.
.. versionchanged:: 3.3
:exc:`URLError` used to be a subtype of :exc:`IOError`, which is now an
alias of :exc:`OSError`. | The reason for this error. It can be a message string or another exception instance.
.. versionchanged:: 3.3
:exc:`URLError` used to be a subtype of :exc:`IOError`, which is now an
alias of :exc:`OSError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5258f633-7e13-4d58-9029-b6c207561b43 | CPython Docs | file://datasets/cpython/Doc/library/urllib.error.rst | unknown | 628f84e4-3267-4e14-980b-cd84ec158df8 | 14,039 | supabase-export-v2 | 041274575a1ed060 | .. exception:: HTTPError(url, code, msg, hdrs, fp)
Though being an exception (a subclass of :exc:`URLError`), an
:exc:`HTTPError` can also function as a non-exceptional file-like return
value (the same thing that :func:`~urllib.request.urlopen` returns). This
is useful when handling exotic HTTP errors, such as reque... | trusted_official_docs | CPython Docs | .. exception:: HTTPError(url, code, msg, hdrs, fp)
Though being an exception (a subclass of :exc:`URLError`), an
:exc:`HTTPError` can also function as a non-exceptional file-like return
value (the same thing that :func:`~urllib.request.urlopen` returns). This
is useful when handling exotic HTTP errors, such as reque... | .. exception:: HTTPError(url, code, msg, hdrs, fp)
Though being an exception (a subclass of :exc:`URLError`), an
:exc:`HTTPError` can also function as a non-exceptional file-like return
value (the same thing that :func:`~urllib.request.urlopen` returns). This
is useful when handling exotic HTTP errors, such as reque... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3739ec7a-3cef-485a-a842-9c677862e131 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,095 | supabase-export-v2 | 2f3c7fed4a2f3b82 | *upgrade* indicates whether or not to upgrade an existing installation of an earlier version of ``pip`` to the available version.
*user* indicates whether to use the user scheme rather than installing
globally. | trusted_official_docs | CPython Docs | *upgrade* indicates whether or not to upgrade an existing installation of an earlier version of ``pip`` to the available version.
*user* indicates whether to use the user scheme rather than installing
globally. | *upgrade* indicates whether or not to upgrade an existing installation of an earlier version of ``pip`` to the available version.
*user* indicates whether to use the user scheme rather than installing
globally. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
44c680a0-a20c-454b-a3c0-87eebf555386 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,086 | supabase-export-v2 | 5c42f32b2f2d3cba | If a "default pip" installation is requested, the ``pip`` script will be installed in addition to the two regular scripts.
Providing both of the script selection options will trigger an exception. | trusted_official_docs | CPython Docs | If a "default pip" installation is requested, the ``pip`` script will be installed in addition to the two regular scripts.
Providing both of the script selection options will trigger an exception. | If a "default pip" installation is requested, the ``pip`` script will be installed in addition to the two regular scripts.
Providing both of the script selection options will trigger an exception. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46dfc03f-1490-4bf4-a099-71f164652204 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,078 | supabase-export-v2 | 5a2cf39a3a44e5fb | .. option:: --root <dir>
Installs ``pip`` relative to the given root directory rather than the root
of the currently active virtual environment (if any) or the default root
for the current Python installation. | trusted_official_docs | CPython Docs | .. option:: --root <dir>
Installs ``pip`` relative to the given root directory rather than the root
of the currently active virtual environment (if any) or the default root
for the current Python installation. | .. option:: --root <dir>
Installs ``pip`` relative to the given root directory rather than the root
of the currently active virtual environment (if any) or the default root
for the current Python installation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c3040e7-87de-4c9a-b18b-a503e11b9948 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,081 | supabase-export-v2 | 9aba3cfa546d7d7b | ``pip`` into the user site packages directory rather than globally for the current Python installation (this option is not permitted inside an active virtual environment).
By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where
X.Y stands for the version of Python used to invoke ``ensurepip``). The
scr... | trusted_official_docs | CPython Docs | ``pip`` into the user site packages directory rather than globally for the current Python installation (this option is not permitted inside an active virtual environment).
By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where
X.Y stands for the version of Python used to invoke ``ensurepip``). The
scr... | ``pip`` into the user site packages directory rather than globally for the current Python installation (this option is not permitted inside an active virtual environment).
By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where
X.Y stands for the version of Python used to invoke ``ensurepip``). The
scr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5974b84d-ae7a-4905-ab47-7598904c7d91 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,105 | supabase-export-v2 | 5b0268b98860b400 | .. note::
The bootstrapping process may install additional modules required by
``pip``, but other software should not assume those dependencies will
always be present by default (as the dependencies may be removed in a
future version of ``pip``). | trusted_official_docs | CPython Docs | .. note::
The bootstrapping process may install additional modules required by
``pip``, but other software should not assume those dependencies will
always be present by default (as the dependencies may be removed in a
future version of ``pip``). | .. note::
The bootstrapping process may install additional modules required by
``pip``, but other software should not assume those dependencies will
always be present by default (as the dependencies may be removed in a
future version of ``pip``). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
598c73a4-a4db-4894-be6a-651614b9dacf | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,076 | supabase-export-v2 | 8d2a7b9fc3d17723 | python -m ensurepip --upgrade
By default, ``pip`` is installed into the current virtual environment
(if one is active) or into the system site packages (if there is no
active virtual environment). The installation location can be controlled
through two additional command line options: | trusted_official_docs | CPython Docs | python -m ensurepip --upgrade
By default, ``pip`` is installed into the current virtual environment
(if one is active) or into the system site packages (if there is no
active virtual environment). The installation location can be controlled
through two additional command line options: | python -m ensurepip --upgrade
By default, ``pip`` is installed into the current virtual environment
(if one is active) or into the system site packages (if there is no
active virtual environment). The installation location can be controlled
through two additional command line options: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c6841a4-2498-4032-86d8-fba32ae5e7c4 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,060 | supabase-export-v2 | acfb3dcd94ff2f6d | independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter.
In most cases, end users of Python shouldn't need to invoke this module
directly (as ``pip`` should be bootstrapped by default), but it may be
ne... | trusted_official_docs | CPython Docs | independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter.
In most cases, end users of Python shouldn't need to invoke this module
directly (as ``pip`` should be bootstrapped by default), but it may be
ne... | independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter.
In most cases, end users of Python shouldn't need to invoke this module
directly (as ``pip`` should be bootstrapped by default), but it may be
ne... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7520757e-2e2d-4451-b1cf-210493b74534 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,094 | supabase-export-v2 | 4d08ec77ac390068 | *root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location for the current environment.
*upgrade* indicates whether or not to upgrade an existing installation
of an earlier version of ``pip`` to the available version. | trusted_official_docs | CPython Docs | *root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location for the current environment.
*upgrade* indicates whether or not to upgrade an existing installation
of an earlier version of ``pip`` to the available version. | *root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location for the current environment.
*upgrade* indicates whether or not to upgrade an existing installation
of an earlier version of ``pip`` to the available version. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a75d602-5299-4bcf-a0e2-ca8cfccdaa9c | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,074 | supabase-export-v2 | 9a10facff91b8fab | python -m ensurepip
This invocation will install ``pip`` if it is not already installed,
but otherwise does nothing. To ensure the installed version of ``pip``
is at least as recent as the one available in ``ensurepip``, pass the
``--upgrade`` option:: | trusted_official_docs | CPython Docs | python -m ensurepip
This invocation will install ``pip`` if it is not already installed,
but otherwise does nothing. To ensure the installed version of ``pip``
is at least as recent as the one available in ``ensurepip``, pass the
``--upgrade`` option:: | python -m ensurepip
This invocation will install ``pip`` if it is not already installed,
but otherwise does nothing. To ensure the installed version of ``pip``
is at least as recent as the one available in ``ensurepip``, pass the
``--upgrade`` option:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cd32b394-f128-4afa-b3fd-afb502c02a4e | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,059 | supabase-export-v2 | 07270ae8c4317237 | --------------
The :mod:`!ensurepip` package provides support for bootstrapping the ``pip``
installer into an existing Python installation or virtual environment. This
bootstrapping approach reflects the fact that ``pip`` is an independent
project with its own release cycle, and the latest available stable version
is b... | trusted_official_docs | CPython Docs | --------------
The :mod:`!ensurepip` package provides support for bootstrapping the ``pip``
installer into an existing Python installation or virtual environment. This
bootstrapping approach reflects the fact that ``pip`` is an independent
project with its own release cycle, and the latest available stable version
is b... | --------------
The :mod:`!ensurepip` package provides support for bootstrapping the ``pip``
installer into an existing Python installation or virtual environment. This
bootstrapping approach reflects the fact that ``pip`` is an independent
project with its own release cycle, and the latest available stable version
is b... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2925212-9fa4-4f13-8da6-40c53e6d59bd | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,093 | supabase-export-v2 | f51f30a216fc6ce9 | Bootstraps ``pip`` into the current or designated environment.
*root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location
for the current environment. | trusted_official_docs | CPython Docs | Bootstraps ``pip`` into the current or designated environment.
*root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location
for the current environment. | Bootstraps ``pip`` into the current or designated environment.
*root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location
for the current environment. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fca4e359-b555-4876-b669-3908c49b0535 | CPython Docs | file://datasets/cpython/Doc/library/ensurepip.rst | unknown | c7cfb173-fd5a-4d1a-875b-6654c93b8f27 | 14,096 | supabase-export-v2 | 0b0915b964b8b217 | *user* indicates whether to use the user scheme rather than installing globally.
By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where
X.Y stands for the current version of Python). | trusted_official_docs | CPython Docs | *user* indicates whether to use the user scheme rather than installing globally.
By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where
X.Y stands for the current version of Python). | *user* indicates whether to use the user scheme rather than installing globally.
By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where
X.Y stands for the current version of Python). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
14f883b2-75e5-4a53-84f9-67663ae21574 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,172 | supabase-export-v2 | fe1f4449a41263ab | to the specified *domain* and URL *path* are removed. If given three arguments, then the cookie with the specified *domain*, *path* and *name* is removed.
Raises :exc:`KeyError` if no matching cookie exists. | trusted_official_docs | CPython Docs | to the specified *domain* and URL *path* are removed. If given three arguments, then the cookie with the specified *domain*, *path* and *name* is removed.
Raises :exc:`KeyError` if no matching cookie exists. | to the specified *domain* and URL *path* are removed. If given three arguments, then the cookie with the specified *domain*, *path* and *name* is removed.
Raises :exc:`KeyError` if no matching cookie exists. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
173c9e7c-6eae-40af-ba9e-c795097adcc0 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,134 | supabase-export-v2 | d341a9c7452ab742 | .. class:: Cookie()
This class represents Netscape, :rfc:`2109` and :rfc:`2965` cookies. It is not
expected that users of :mod:`!http.cookiejar` construct their own :class:`Cookie`
instances. Instead, if necessary, call :meth:`make_cookies` on a
:class:`CookieJar` instance. | trusted_official_docs | CPython Docs | .. class:: Cookie()
This class represents Netscape, :rfc:`2109` and :rfc:`2965` cookies. It is not
expected that users of :mod:`!http.cookiejar` construct their own :class:`Cookie`
instances. Instead, if necessary, call :meth:`make_cookies` on a
:class:`CookieJar` instance. | .. class:: Cookie()
This class represents Netscape, :rfc:`2109` and :rfc:`2965` cookies. It is not
expected that users of :mod:`!http.cookiejar` construct their own :class:`Cookie`
instances. Instead, if necessary, call :meth:`make_cookies` on a
:class:`CookieJar` instance. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1bb043e2-cc48-40b0-aa87-4612dc0ba120 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,291 | supabase-export-v2 | 0d64f26766dfc37b | Cookie Objects --------------
:class:`Cookie` instances have Python attributes roughly corresponding to the
standard cookie-attributes specified in the various cookie standards. The
correspondence is not one-to-one, because there are complicated rules for
assigning default values, because the ``max-age`` and ``expires`... | trusted_official_docs | CPython Docs | Cookie Objects --------------
:class:`Cookie` instances have Python attributes roughly corresponding to the
standard cookie-attributes specified in the various cookie standards. The
correspondence is not one-to-one, because there are complicated rules for
assigning default values, because the ``max-age`` and ``expires`... | Cookie Objects --------------
:class:`Cookie` instances have Python attributes roughly corresponding to the
standard cookie-attributes specified in the various cookie standards. The
correspondence is not one-to-one, because there are complicated rules for
assigning default values, because the ``max-age`` and ``expires`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
226e9ed3-eb28-4981-87e8-c31cc8f7b775 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,292 | supabase-export-v2 | 120914a3cc388017 | the ``max-age`` and ``expires`` cookie-attributes contain equivalent information, and because :rfc:`2109` cookies may be 'downgraded' by :mod:`!http.cookiejar` from version 1 to version 0 (Netscape) cookies.
Assignment to these attributes should not be necessary other than in rare
circumstances in a :class:`CookiePolic... | trusted_official_docs | CPython Docs | the ``max-age`` and ``expires`` cookie-attributes contain equivalent information, and because :rfc:`2109` cookies may be 'downgraded' by :mod:`!http.cookiejar` from version 1 to version 0 (Netscape) cookies.
Assignment to these attributes should not be necessary other than in rare
circumstances in a :class:`CookiePolic... | the ``max-age`` and ``expires`` cookie-attributes contain equivalent information, and because :rfc:`2109` cookies may be 'downgraded' by :mod:`!http.cookiejar` from version 1 to version 0 (Netscape) cookies.
Assignment to these attributes should not be necessary other than in rare
circumstances in a :class:`CookiePolic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
278e48d0-c6ce-4f37-842d-8836b6536bbb | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,260 | supabase-export-v2 | 49b891fe5ab08d9a | Return ``True`` if *domain* is not on the allowlist for setting or receiving cookies.
:class:`DefaultCookiePolicy` instances have the following attributes, which are
all initialised from the constructor arguments of the same name, and which may
all be assigned to. | trusted_official_docs | CPython Docs | Return ``True`` if *domain* is not on the allowlist for setting or receiving cookies.
:class:`DefaultCookiePolicy` instances have the following attributes, which are
all initialised from the constructor arguments of the same name, and which may
all be assigned to. | Return ``True`` if *domain* is not on the allowlist for setting or receiving cookies.
:class:`DefaultCookiePolicy` instances have the following attributes, which are
all initialised from the constructor arguments of the same name, and which may
all be assigned to. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2925b322-ddbb-41d8-87f0-667fa364abdf | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,262 | supabase-export-v2 | f2411bc7b8d019a4 | .. attribute:: DefaultCookiePolicy.rfc2109_as_netscape
If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` cookies
(ie. cookies received in a :mailheader:`Set-Cookie` header with a version
cookie-attribute of 1) to Netscape cookies by setting the version attribute of
the :class:`Cookie` insta... | trusted_official_docs | CPython Docs | .. attribute:: DefaultCookiePolicy.rfc2109_as_netscape
If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` cookies
(ie. cookies received in a :mailheader:`Set-Cookie` header with a version
cookie-attribute of 1) to Netscape cookies by setting the version attribute of
the :class:`Cookie` insta... | .. attribute:: DefaultCookiePolicy.rfc2109_as_netscape
If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` cookies
(ie. cookies received in a :mailheader:`Set-Cookie` header with a version
cookie-attribute of 1) to Netscape cookies by setting the version attribute of
the :class:`Cookie` insta... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34975630-751e-4446-9b2c-0e2bda330574 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,176 | supabase-export-v2 | eef73b799d33c829 | no ``max-age`` or ``expires`` cookie-attribute, or an explicit ``discard`` cookie-attribute). For interactive browsers, the end of a session usually corresponds to closing the browser window.
Note that the :meth:`save` method won't save session cookies anyway, unless you
ask otherwise by passing a true *ignore_discard... | trusted_official_docs | CPython Docs | no ``max-age`` or ``expires`` cookie-attribute, or an explicit ``discard`` cookie-attribute). For interactive browsers, the end of a session usually corresponds to closing the browser window.
Note that the :meth:`save` method won't save session cookies anyway, unless you
ask otherwise by passing a true *ignore_discard... | no ``max-age`` or ``expires`` cookie-attribute, or an explicit ``discard`` cookie-attribute). For interactive browsers, the end of a session usually corresponds to closing the browser window.
Note that the :meth:`save` method won't save session cookies anyway, unless you
ask otherwise by passing a true *ignore_discard... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d9923ce-6519-4963-ade8-e64f53c3fb55 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,243 | supabase-export-v2 | f974a0e35f70444d | way to provide your own policy is to override this class and call its methods in your overridden implementations before adding your own additional checks::
import http.cookiejar
class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy):
def set_ok(self, cookie, request):
if not http.cookiejar.DefaultCookiePolicy.set_... | trusted_official_docs | CPython Docs | way to provide your own policy is to override this class and call its methods in your overridden implementations before adding your own additional checks::
import http.cookiejar
class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy):
def set_ok(self, cookie, request):
if not http.cookiejar.DefaultCookiePolicy.set_... | way to provide your own policy is to override this class and call its methods in your overridden implementations before adding your own additional checks::
import http.cookiejar
class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy):
def set_ok(self, cookie, request):
if not http.cookiejar.DefaultCookiePolicy.set_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3dc31122-017e-479f-b142-a18d28396b6f | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,192 | supabase-export-v2 | 7bea66a7669be1f2 | Clear all cookies and reload cookies from a saved file.
:meth:`revert` can raise the same exceptions as :meth:`load`. If there is a
failure, the object's state will not be altered. | trusted_official_docs | CPython Docs | Clear all cookies and reload cookies from a saved file.
:meth:`revert` can raise the same exceptions as :meth:`load`. If there is a
failure, the object's state will not be altered. | Clear all cookies and reload cookies from a saved file.
:meth:`revert` can raise the same exceptions as :meth:`load`. If there is a
failure, the object's state will not be altered. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
413db68d-cb93-436e-87b5-969ac21dd53b | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,278 | supabase-export-v2 | 38b039c06420704b | Don't allow setting cookies whose path doesn't path-match request URI.
:attr:`~DefaultCookiePolicy.strict_ns_domain` is a collection of flags. Its value is constructed by
or-ing together (for example, ``DomainStrictNoDots|DomainStrictNonDomain`` means
both flags are set). | trusted_official_docs | CPython Docs | Don't allow setting cookies whose path doesn't path-match request URI.
:attr:`~DefaultCookiePolicy.strict_ns_domain` is a collection of flags. Its value is constructed by
or-ing together (for example, ``DomainStrictNoDots|DomainStrictNonDomain`` means
both flags are set). | Don't allow setting cookies whose path doesn't path-match request URI.
:attr:`~DefaultCookiePolicy.strict_ns_domain` is a collection of flags. Its value is constructed by
or-ing together (for example, ``DomainStrictNoDots|DomainStrictNonDomain`` means
both flags are set). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
472b6816-db7b-45d9-ae79-ec8a15ae8f78 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,130 | supabase-export-v2 | 8e84d4208b80ddc5 | This class is responsible for deciding whether each cookie should be accepted from / returned to the server.
.. class:: DefaultCookiePolicy( blocked_domains=None, allowed_domains=None, netscape=True, rfc2965=False, rfc2109_as_netscape=None, hide_cookie2=False, strict_domain=False, strict_rfc2965_unverifiable=True, stri... | trusted_official_docs | CPython Docs | This class is responsible for deciding whether each cookie should be accepted from / returned to the server.
.. class:: DefaultCookiePolicy( blocked_domains=None, allowed_domains=None, netscape=True, rfc2965=False, rfc2109_as_netscape=None, hide_cookie2=False, strict_domain=False, strict_rfc2965_unverifiable=True, stri... | This class is responsible for deciding whether each cookie should be accepted from / returned to the server.
.. class:: DefaultCookiePolicy( blocked_domains=None, allowed_domains=None, netscape=True, rfc2965=False, rfc2109_as_netscape=None, hide_cookie2=False, strict_domain=False, strict_rfc2965_unverifiable=True, stri... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4814b0fb-97b9-4c5c-8cf6-a05bdae5516f | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,223 | supabase-export-v2 | 4c28374189d0a274 | Return ``False`` if cookies should not be returned, given cookie domain.
This method is an optimization. It removes the need for checking every cookie
with a particular domain (which might involve reading many files). Returning
true from :meth:`domain_return_ok` and :meth:`path_return_ok` leaves all the
work to :met... | trusted_official_docs | CPython Docs | Return ``False`` if cookies should not be returned, given cookie domain.
This method is an optimization. It removes the need for checking every cookie
with a particular domain (which might involve reading many files). Returning
true from :meth:`domain_return_ok` and :meth:`path_return_ok` leaves all the
work to :met... | Return ``False`` if cookies should not be returned, given cookie domain.
This method is an optimization. It removes the need for checking every cookie
with a particular domain (which might involve reading many files). Returning
true from :meth:`domain_return_ok` and :meth:`path_return_ok` leaves all the
work to :met... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4f567e89-e8fd-4ff0-bc1f-66d0e5a0e411 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,316 | supabase-export-v2 | 95b5d3ba373e22cc | .. attribute:: Cookie.rfc2109
``True`` if this cookie was received as an :rfc:`2109` cookie (ie. the cookie
arrived in a :mailheader:`Set-Cookie` header, and the value of the Version
cookie-attribute in that header was 1). This attribute is provided because
:mod:`!http.cookiejar` may 'downgrade' RFC 2109 cookies to ... | trusted_official_docs | CPython Docs | .. attribute:: Cookie.rfc2109
``True`` if this cookie was received as an :rfc:`2109` cookie (ie. the cookie
arrived in a :mailheader:`Set-Cookie` header, and the value of the Version
cookie-attribute in that header was 1). This attribute is provided because
:mod:`!http.cookiejar` may 'downgrade' RFC 2109 cookies to ... | .. attribute:: Cookie.rfc2109
``True`` if this cookie was received as an :rfc:`2109` cookie (ie. the cookie
arrived in a :mailheader:`Set-Cookie` header, and the value of the Version
cookie-attribute in that header was 1). This attribute is provided because
:mod:`!http.cookiejar` may 'downgrade' RFC 2109 cookies to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5045870d-0845-4fe6-a536-2e6f683fc55d | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,155 | supabase-export-v2 | 90124d974e26182c | Extract cookies from HTTP *response* and store them in the :class:`CookieJar`, where allowed by policy.
The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and
:mailheader:`Set-Cookie2` headers in the *response* argument, and store cookies
as appropriate (subject to the :meth:`CookiePolicy.set_ok`... | trusted_official_docs | CPython Docs | Extract cookies from HTTP *response* and store them in the :class:`CookieJar`, where allowed by policy.
The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and
:mailheader:`Set-Cookie2` headers in the *response* argument, and store cookies
as appropriate (subject to the :meth:`CookiePolicy.set_ok`... | Extract cookies from HTTP *response* and store them in the :class:`CookieJar`, where allowed by policy.
The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and
:mailheader:`Set-Cookie2` headers in the *response* argument, and store cookies
as appropriate (subject to the :meth:`CookiePolicy.set_ok`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
540c8393-9a29-4c4a-94ce-3cd3158ea325 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,132 | supabase-export-v2 | e66d051e4cb54d14 | added to. By default *https* and *wss* (secure websocket) are considered secure protocols. For all other arguments, see the documentation for :class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects.
:class:`DefaultCookiePolicy` implements the standard accept / reject rules for
Netscape and :rfc:`2965` cookies. ... | trusted_official_docs | CPython Docs | added to. By default *https* and *wss* (secure websocket) are considered secure protocols. For all other arguments, see the documentation for :class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects.
:class:`DefaultCookiePolicy` implements the standard accept / reject rules for
Netscape and :rfc:`2965` cookies. ... | added to. By default *https* and *wss* (secure websocket) are considered secure protocols. For all other arguments, see the documentation for :class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects.
:class:`DefaultCookiePolicy` implements the standard accept / reject rules for
Netscape and :rfc:`2965` cookies. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55d4a7ec-7526-4a67-83d4-7d73beb445e1 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,332 | supabase-export-v2 | 86d41f20ec8ed693 | .. method:: Cookie.is_expired(now=None)
``True`` if cookie has passed the time at which the server requested it should
expire. If *now* is given (in seconds since the epoch), return whether the
cookie has expired at the specified time. | trusted_official_docs | CPython Docs | .. method:: Cookie.is_expired(now=None)
``True`` if cookie has passed the time at which the server requested it should
expire. If *now* is given (in seconds since the epoch), return whether the
cookie has expired at the specified time. | .. method:: Cookie.is_expired(now=None)
``True`` if cookie has passed the time at which the server requested it should
expire. If *now* is given (in seconds since the epoch), return whether the
cookie has expired at the specified time. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
62389501-6cfd-4a98-99db-66679dbc1e02 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,244 | supabase-export-v2 | d69b0cf2028d5b27 | import http.cookiejar class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy): def set_ok(self, cookie, request): if not http.cookiejar.DefaultCookiePolicy.set_ok(self, cookie, request): return False if i_dont_want_to_store_this_cookie(cookie): return False return True
In addition to the features required to implement... | trusted_official_docs | CPython Docs | import http.cookiejar class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy): def set_ok(self, cookie, request): if not http.cookiejar.DefaultCookiePolicy.set_ok(self, cookie, request): return False if i_dont_want_to_store_this_cookie(cookie): return False return True
In addition to the features required to implement... | import http.cookiejar class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy): def set_ok(self, cookie, request): if not http.cookiejar.DefaultCookiePolicy.set_ok(self, cookie, request): return False if i_dont_want_to_store_this_cookie(cookie): return False return True
In addition to the features required to implement... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6742e371-efc9-4565-88fa-47456b07cf4d | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,149 | supabase-export-v2 | 4843e0df4ec5f167 | Add correct :mailheader:`Cookie` header to *request*.
If policy allows (ie. the :attr:`rfc2965` and :attr:`hide_cookie2` attributes of
the :class:`CookieJar`'s :class:`CookiePolicy` instance are true and false
respectively), the :mailheader:`Cookie2` header is also added when appropriate. | trusted_official_docs | CPython Docs | Add correct :mailheader:`Cookie` header to *request*.
If policy allows (ie. the :attr:`rfc2965` and :attr:`hide_cookie2` attributes of
the :class:`CookieJar`'s :class:`CookiePolicy` instance are true and false
respectively), the :mailheader:`Cookie2` header is also added when appropriate. | Add correct :mailheader:`Cookie` header to *request*.
If policy allows (ie. the :attr:`rfc2965` and :attr:`hide_cookie2` attributes of
the :class:`CookieJar`'s :class:`CookiePolicy` instance are true and false
respectively), the :mailheader:`Cookie2` header is also added when appropriate. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
69b72b26-4a7a-4d4c-ad20-ffd35443165f | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,110 | supabase-export-v2 | 462c1bf5b0891ef4 | --------------
The :mod:`!http.cookiejar` module defines classes for automatic handling of HTTP
cookies. It is useful for accessing websites that require small pieces of data
-- :dfn:`cookies` -- to be set on the client machine by an HTTP response from a
web server, and then returned to the server in later HTTP request... | trusted_official_docs | CPython Docs | --------------
The :mod:`!http.cookiejar` module defines classes for automatic handling of HTTP
cookies. It is useful for accessing websites that require small pieces of data
-- :dfn:`cookies` -- to be set on the client machine by an HTTP response from a
web server, and then returned to the server in later HTTP request... | --------------
The :mod:`!http.cookiejar` module defines classes for automatic handling of HTTP
cookies. It is useful for accessing websites that require small pieces of data
-- :dfn:`cookies` -- to be set on the client machine by an HTTP response from a
web server, and then returned to the server in later HTTP request... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a0d5675-5508-4117-b74c-4510c17016b1 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,122 | supabase-export-v2 | 15595500c061db56 | in HTTP responses. :class:`CookieJar` instances automatically expire contained cookies when necessary. Subclasses are also responsible for storing and retrieving cookies from a file or database.
.. class:: FileCookieJar(filename=None, delayload=None, policy=None) | trusted_official_docs | CPython Docs | in HTTP responses. :class:`CookieJar` instances automatically expire contained cookies when necessary. Subclasses are also responsible for storing and retrieving cookies from a file or database.
.. class:: FileCookieJar(filename=None, delayload=None, policy=None) | in HTTP responses. :class:`CookieJar` instances automatically expire contained cookies when necessary. Subclasses are also responsible for storing and retrieving cookies from a file or database.
.. class:: FileCookieJar(filename=None, delayload=None, policy=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6cd1284e-30aa-4345-8d4e-9b457f25a379 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,139 | supabase-export-v2 | e98401e3d6724386 | protocol, the 'Netscape cookie protocol' implemented by all the major browsers (and :mod:`!http.cookiejar`) only bears a passing resemblance to the one sketched out in ``cookie_spec.html``.
:rfc:`2109` - HTTP State Management Mechanism
Obsoleted by :rfc:`2965`. Uses :mailheader:`Set-Cookie` with version=1. | trusted_official_docs | CPython Docs | protocol, the 'Netscape cookie protocol' implemented by all the major browsers (and :mod:`!http.cookiejar`) only bears a passing resemblance to the one sketched out in ``cookie_spec.html``.
:rfc:`2109` - HTTP State Management Mechanism
Obsoleted by :rfc:`2965`. Uses :mailheader:`Set-Cookie` with version=1. | protocol, the 'Netscape cookie protocol' implemented by all the major browsers (and :mod:`!http.cookiejar`) only bears a passing resemblance to the one sketched out in ``cookie_spec.html``.
:rfc:`2109` - HTTP State Management Mechanism
Obsoleted by :rfc:`2965`. Uses :mailheader:`Set-Cookie` with version=1. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6e8d20e5-60f0-4237-ad85-60a748b901a5 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,225 | supabase-export-v2 | 5a602a960f71b445 | If :meth:`path_return_ok` returns true, :meth:`return_ok` is called with the :class:`Cookie` object itself for a full check. Otherwise, :meth:`return_ok` is never called for that cookie path.
Note that :meth:`domain_return_ok` is called for every *cookie* domain, not just
for the *request* domain. For example, the fun... | trusted_official_docs | CPython Docs | If :meth:`path_return_ok` returns true, :meth:`return_ok` is called with the :class:`Cookie` object itself for a full check. Otherwise, :meth:`return_ok` is never called for that cookie path.
Note that :meth:`domain_return_ok` is called for every *cookie* domain, not just
for the *request* domain. For example, the fun... | If :meth:`path_return_ok` returns true, :meth:`return_ok` is called with the :class:`Cookie` object itself for a full check. Otherwise, :meth:`return_ok` is never called for that cookie path.
Note that :meth:`domain_return_ok` is called for every *cookie* domain, not just
for the *request* domain. For example, the fun... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
729717be-db6b-48c0-9d82-9087d87c4b6b | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,206 | supabase-export-v2 | 2c304035d35ccd84 | .. warning::
Back up your cookies before saving if you have cookies whose loss / corruption
would be inconvenient (there are some subtleties which may lead to slight
changes in the file over a load / save round-trip). | trusted_official_docs | CPython Docs | .. warning::
Back up your cookies before saving if you have cookies whose loss / corruption
would be inconvenient (there are some subtleties which may lead to slight
changes in the file over a load / save round-trip). | .. warning::
Back up your cookies before saving if you have cookies whose loss / corruption
would be inconvenient (there are some subtleties which may lead to slight
changes in the file over a load / save round-trip). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
735821b1-7826-42ad-9959-0d6e2677f126 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,124 | supabase-export-v2 | 422a71186992f419 | *policy* is an object implementing the :class:`CookiePolicy` interface. For the other arguments, see the documentation for the corresponding attributes.
A :class:`CookieJar` which can load cookies from, and perhaps save cookies to, a
file on disk. Cookies are **NOT** loaded from the named file until either the
:meth:... | trusted_official_docs | CPython Docs | *policy* is an object implementing the :class:`CookiePolicy` interface. For the other arguments, see the documentation for the corresponding attributes.
A :class:`CookieJar` which can load cookies from, and perhaps save cookies to, a
file on disk. Cookies are **NOT** loaded from the named file until either the
:meth:... | *policy* is an object implementing the :class:`CookiePolicy` interface. For the other arguments, see the documentation for the corresponding attributes.
A :class:`CookieJar` which can load cookies from, and perhaps save cookies to, a
file on disk. Cookies are **NOT** loaded from the named file until either the
:meth:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
784a9003-926d-4c75-ae21-63f5875e0e69 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,156 | supabase-export-v2 | 76a7cd62e3dbc8ab | The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and :mailheader:`Set-Cookie2` headers in the *response* argument, and store cookies as appropriate (subject to the :meth:`CookiePolicy.set_ok` method's approval).
The *response* object (usually the result of a call to
:meth:`urllib.request.urlopen... | trusted_official_docs | CPython Docs | The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and :mailheader:`Set-Cookie2` headers in the *response* argument, and store cookies as appropriate (subject to the :meth:`CookiePolicy.set_ok` method's approval).
The *response* object (usually the result of a call to
:meth:`urllib.request.urlopen... | The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and :mailheader:`Set-Cookie2` headers in the *response* argument, and store cookies as appropriate (subject to the :meth:`CookiePolicy.set_ok` method's approval).
The *response* object (usually the result of a call to
:meth:`urllib.request.urlopen... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
786edc6e-b140-49b4-a7c8-e620fba0d8ab | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,114 | supabase-export-v2 | 2bcc6213857c7d13 | ``domain`` and ``expires``) are conventionally referred to as :dfn:`attributes`. To distinguish them from Python attributes, the documentation for this module uses the term :dfn:`cookie-attribute` instead.
The module defines the following exception: | trusted_official_docs | CPython Docs | ``domain`` and ``expires``) are conventionally referred to as :dfn:`attributes`. To distinguish them from Python attributes, the documentation for this module uses the term :dfn:`cookie-attribute` instead.
The module defines the following exception: | ``domain`` and ``expires``) are conventionally referred to as :dfn:`attributes`. To distinguish them from Python attributes, the documentation for this module uses the term :dfn:`cookie-attribute` instead.
The module defines the following exception: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
78d7b6da-6d1e-4ad2-a710-1a914ff83307 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,197 | supabase-export-v2 | e8bd78106c363c64 | .. attribute:: FileCookieJar.delayload
If true, load cookies lazily from disk. This attribute should not be assigned
to. This is only a hint, since this only affects performance, not behaviour
(unless the cookies on disk are changing). A :class:`CookieJar` object may
ignore it. None of the :class:`FileCookieJar` cla... | trusted_official_docs | CPython Docs | .. attribute:: FileCookieJar.delayload
If true, load cookies lazily from disk. This attribute should not be assigned
to. This is only a hint, since this only affects performance, not behaviour
(unless the cookies on disk are changing). A :class:`CookieJar` object may
ignore it. None of the :class:`FileCookieJar` cla... | .. attribute:: FileCookieJar.delayload
If true, load cookies lazily from disk. This attribute should not be assigned
to. This is only a hint, since this only affects performance, not behaviour
(unless the cookies on disk are changing). A :class:`CookieJar` object may
ignore it. None of the :class:`FileCookieJar` cla... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c1d24aa-f480-4bba-b4dc-6b23b971b478 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,337 | supabase-export-v2 | 38c6a65980bb4551 | This example illustrates how to open a URL using your Netscape, Mozilla, or Lynx cookies (assumes Unix/Netscape convention for location of the cookies file)::
import os, http.cookiejar, urllib.request
cj = http.cookiejar.MozillaCookieJar()
cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
op... | trusted_official_docs | CPython Docs | This example illustrates how to open a URL using your Netscape, Mozilla, or Lynx cookies (assumes Unix/Netscape convention for location of the cookies file)::
import os, http.cookiejar, urllib.request
cj = http.cookiejar.MozillaCookieJar()
cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
op... | This example illustrates how to open a URL using your Netscape, Mozilla, or Lynx cookies (assumes Unix/Netscape convention for location of the cookies file)::
import os, http.cookiejar, urllib.request
cj = http.cookiejar.MozillaCookieJar()
cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
op... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7cb6c3a1-9341-4590-bb71-8e2a9dc7acf8 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,111 | supabase-export-v2 | a15abb569fcd3c71 | to be set on the client machine by an HTTP response from a web server, and then returned to the server in later HTTP requests.
Both the regular Netscape cookie protocol and the protocol defined by
:rfc:`2965` are handled. RFC 2965 handling is switched off by default. :rfc:`2109` cookies are parsed as Netscape cookies a... | trusted_official_docs | CPython Docs | to be set on the client machine by an HTTP response from a web server, and then returned to the server in later HTTP requests.
Both the regular Netscape cookie protocol and the protocol defined by
:rfc:`2965` are handled. RFC 2965 handling is switched off by default. :rfc:`2109` cookies are parsed as Netscape cookies a... | to be set on the client machine by an HTTP response from a web server, and then returned to the server in later HTTP requests.
Both the regular Netscape cookie protocol and the protocol defined by
:rfc:`2965` are handled. RFC 2965 handling is switched off by default. :rfc:`2109` cookies are parsed as Netscape cookies a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7db15b18-745e-4853-a105-8b60c7c26e54 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,247 | supabase-export-v2 | fdb681da8969f959 | not). IP addresses are an exception, and must match exactly. For example, if blocked_domains contains ``"192.168.1.2"`` and ``".168.1.2"``, 192.168.1.2 is blocked, but 193.168.1.2 is not.
:class:`DefaultCookiePolicy` implements the following additional methods: | trusted_official_docs | CPython Docs | not). IP addresses are an exception, and must match exactly. For example, if blocked_domains contains ``"192.168.1.2"`` and ``".168.1.2"``, 192.168.1.2 is blocked, but 193.168.1.2 is not.
:class:`DefaultCookiePolicy` implements the following additional methods: | not). IP addresses are an exception, and must match exactly. For example, if blocked_domains contains ``"192.168.1.2"`` and ``".168.1.2"``, 192.168.1.2 is blocked, but 193.168.1.2 is not.
:class:`DefaultCookiePolicy` implements the following additional methods: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85a2771a-1d1d-4002-8015-af85762bda2d | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,268 | supabase-export-v2 | d597b78bcdbd1d10 | .. attribute:: DefaultCookiePolicy.strict_rfc2965_unverifiable
Follow :rfc:`2965` rules on unverifiable transactions (usually, an unverifiable
transaction is one resulting from a redirect or a request for an image hosted on
another site). If this is false, cookies are *never* blocked on the basis of
verifiability | trusted_official_docs | CPython Docs | .. attribute:: DefaultCookiePolicy.strict_rfc2965_unverifiable
Follow :rfc:`2965` rules on unverifiable transactions (usually, an unverifiable
transaction is one resulting from a redirect or a request for an image hosted on
another site). If this is false, cookies are *never* blocked on the basis of
verifiability | .. attribute:: DefaultCookiePolicy.strict_rfc2965_unverifiable
Follow :rfc:`2965` rules on unverifiable transactions (usually, an unverifiable
transaction is one resulting from a redirect or a request for an image hosted on
another site). If this is false, cookies are *never* blocked on the basis of
verifiability | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85a5cd7f-e98a-4e82-a04a-7362f48d4bbd | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,245 | supabase-export-v2 | 98a25dcd2152aa5c | strictness switches that allow you to tighten up the rather loose Netscape protocol rules a little bit (at the cost of blocking some benign cookies).
A domain blocklist and allowlist is provided (both off by default). Only domains
not in the blocklist and present in the allowlist (if the allowlist is active)
participat... | trusted_official_docs | CPython Docs | strictness switches that allow you to tighten up the rather loose Netscape protocol rules a little bit (at the cost of blocking some benign cookies).
A domain blocklist and allowlist is provided (both off by default). Only domains
not in the blocklist and present in the allowlist (if the allowlist is active)
participat... | strictness switches that allow you to tighten up the rather loose Netscape protocol rules a little bit (at the cost of blocking some benign cookies).
A domain blocklist and allowlist is provided (both off by default). Only domains
not in the blocklist and present in the allowlist (if the allowlist is active)
participat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
891624b4-06d9-4e87-ad78-6c525af62c91 | CPython Docs | file://datasets/cpython/Doc/library/http.cookiejar.rst | unknown | fa37f1c3-70b4-457e-829d-0ad0a30352cf | 14,181 | supabase-export-v2 | 88d501c6b9bc2474 | This base class raises :exc:`NotImplementedError`. Subclasses may leave this method unimplemented.
*filename* is the name of file in which to save cookies. If *filename* is not
specified, :attr:`self.filename` is used (whose default is the value passed to
the constructor, if any); if :attr:`self.filename` is :const:`... | trusted_official_docs | CPython Docs | This base class raises :exc:`NotImplementedError`. Subclasses may leave this method unimplemented.
*filename* is the name of file in which to save cookies. If *filename* is not
specified, :attr:`self.filename` is used (whose default is the value passed to
the constructor, if any); if :attr:`self.filename` is :const:`... | This base class raises :exc:`NotImplementedError`. Subclasses may leave this method unimplemented.
*filename* is the name of file in which to save cookies. If *filename* is not
specified, :attr:`self.filename` is used (whose default is the value passed to
the constructor, if any); if :attr:`self.filename` is :const:`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.