id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
172,367
import copyreg import io import functools import types import sys import os from multiprocessing import util from pickle import loads, HIGHEST_PROTOCOL def _rebuild_partial(func, args, keywords): return functools.partial(func, *args, **keywords) def _reduce_partial(p): return _rebuild_partial, (p.func, p.args,...
null
172,368
import copyreg import io import functools import types import sys import os from multiprocessing import util from pickle import loads, HIGHEST_PROTOCOL _dispatch_table = {} def register(type_, reduce_function): _dispatch_table[type_] = reduce_function register(type(_C().f), _reduce_method) register(type(_C.h), _red...
null
172,369
import copyreg import io import functools import types import sys import os from multiprocessing import util from pickle import loads, HIGHEST_PROTOCOL _loky_pickler_name = None def get_loky_pickler_name(): global _loky_pickler_name return _loky_pickler_name
null
172,370
import copyreg import io import functools import types import sys import os from multiprocessing import util from pickle import loads, HIGHEST_PROTOCOL _LokyPickler = None def get_loky_pickler(): global _LokyPickler return _LokyPickler
null
172,371
import copyreg import io import functools import types import sys import os from multiprocessing import util from pickle import loads, HIGHEST_PROTOCOL _LokyPickler = None def dump(obj, file, reducers=None, protocol=None): '''Replacement for pickle.dump() using _LokyPickler.''' global _LokyPickler _LokyPick...
null
172,372
import warnings def _make_viztracer_initializer_and_initargs(): try: import viztracer tracer = viztracer.get_tracer() if tracer is not None and getattr(tracer, 'enable', False): # Profiler is active: introspect its configuration to # initialize the workers with the sa...
null
172,373
from __future__ import with_statement import os import time import pathlib import pydoc import re import functools import traceback import warnings import inspect import weakref from tokenize import open as open_py_source from . import hashing from .func_inspect import get_func_code, get_func_name, filter_args from .fu...
Extract the first line information from the function code text if available.
172,374
from __future__ import with_statement import os import time import pathlib import pydoc import re import functools import traceback import warnings import inspect import weakref from tokenize import open as open_py_source from . import hashing from .func_inspect import get_func_code, get_func_name, filter_args from .fu...
Extend available store backends. The Memory, MemorizeResult and MemorizeFunc objects are designed to be agnostic to the type of store used behind. By default, the local file system is used but this function gives the possibility to extend joblib's memory pattern with other types of storage such as cloud storage (S3, GC...
172,375
from __future__ import with_statement import os import time import pathlib import pydoc import re import functools import traceback import warnings import inspect import weakref from tokenize import open as open_py_source from . import hashing from .func_inspect import get_func_code, get_func_name, filter_args from .fu...
Return the correct store object for the given location.
172,376
from __future__ import with_statement import os import time import pathlib import pydoc import re import functools import traceback import warnings import inspect import weakref from tokenize import open as open_py_source from . import hashing from .func_inspect import get_func_code, get_func_name, filter_args from .fu...
Build a roughly unique identifier for the cached function.
172,377
from __future__ import with_statement import os import time import pathlib import pydoc import re import functools import traceback import warnings import inspect import weakref from tokenize import open as open_py_source from . import hashing from .func_inspect import get_func_code, get_func_name, filter_args from .fu...
Helper function to format the message when loading the results.
172,378
from __future__ import print_function, division, absolute_import import asyncio import concurrent.futures import contextlib import time from uuid import uuid4 import weakref from .parallel import AutoBatchingMixin, ParallelBackendBase, BatchedCalls from .parallel import parallel_backend def is_weakrefable(obj): tr...
null
172,379
from __future__ import print_function, division, absolute_import import asyncio import concurrent.futures import contextlib import time from uuid import uuid4 import weakref from .parallel import AutoBatchingMixin, ParallelBackendBase, BatchedCalls from .parallel import parallel_backend def _funcname(x): try: ...
Summarize of list of (func, args, kwargs) function calls
172,380
from __future__ import print_function, division, absolute_import import asyncio import concurrent.futures import contextlib import time from uuid import uuid4 import weakref from .parallel import AutoBatchingMixin, ParallelBackendBase, BatchedCalls from .parallel import parallel_backend def _joblib_probe_task(): #...
null
172,381
from __future__ import print_function import time import sys import os import shutil import logging import pprint from .disk import mkdirp def _squeeze_time(t): def short_format_time(t): t = _squeeze_time(t) if t > 60: return "%4.1fmin" % (t / 60.) else: return " %5.1fs" % (t)
null
172,382
def _mk_exception(exception, name=None): if issubclass(exception, JoblibException): # No need to wrap recursively JoblibException return exception, exception.__name__ # Create an exception inheriting from both JoblibException # and that exception if name is None: name = exception...
null
172,383
import copy import math import operator import typing as t from contextvars import ContextVar from functools import partial from functools import update_wrapper from operator import attrgetter from .wsgi import ClosingIterator if t.TYPE_CHECKING: from _typeshed.wsgi import StartResponse from _typeshed.wsgi impo...
Release the data for the current context in a :class:`Local` or :class:`LocalStack` without using a :class:`LocalManager`. This should not be needed for modern use cases, and may be removed in the future. .. versionadded:: 0.6.1
172,384
import copy import math import operator import typing as t from contextvars import ContextVar from functools import partial from functools import update_wrapper from operator import attrgetter from .wsgi import ClosingIterator if t.TYPE_CHECKING: from _typeshed.wsgi import StartResponse from _typeshed.wsgi impo...
Swap the argument order to turn an l-op into an r-op.
172,385
import copy import math import operator import typing as t from contextvars import ContextVar from functools import partial from functools import update_wrapper from operator import attrgetter from .wsgi import ClosingIterator T = t.TypeVar("T") def _identity(o: T) -> T: return o
null
172,386
import typing as t from functools import update_wrapper from io import BytesIO from itertools import chain from typing import Union from . import exceptions from .datastructures import FileStorage from .datastructures import Headers from .datastructures import MultiDict from .http import parse_options_header from .sans...
null
172,387
import typing as t from functools import update_wrapper from io import BytesIO from itertools import chain from typing import Union from . import exceptions from .datastructures import FileStorage from .datastructures import Headers from .datastructures import MultiDict from .http import parse_options_header from .sans...
null
172,388
import typing as t from functools import update_wrapper from io import BytesIO from itertools import chain from typing import Union from . import exceptions from .datastructures import FileStorage from .datastructures import Headers from .datastructures import MultiDict from .http import parse_options_header from .sans...
Parse the form data in the environ and return it as tuple in the form ``(stream, form, files)``. You should only call this method if the transport method is `POST`, `PUT`, or `PATCH`. If the mimetype of the data transmitted is `multipart/form-data` the files multidict will be filled with `FileStorage` objects. If the m...
172,389
import typing as t from functools import update_wrapper from io import BytesIO from itertools import chain from typing import Union from . import exceptions from .datastructures import FileStorage from .datastructures import Headers from .datastructures import MultiDict from .http import parse_options_header from .sans...
Helper decorator for methods that exhausts the stream on return.
172,390
import typing as t from functools import update_wrapper from io import BytesIO from itertools import chain from typing import Union from . import exceptions from .datastructures import FileStorage from .datastructures import Headers from .datastructures import MultiDict from .http import parse_options_header from .sans...
Removes line ending characters and returns a tuple (`stripped_line`, `is_terminated`).
172,391
import io import mimetypes import os import pkgutil import re import sys import typing as t import unicodedata from datetime import datetime from time import time from zlib import adler32 from markupsafe import escape from ._internal import _DictAccessorProperty from ._internal import _missing from ._internal import _T...
Returns the full content type string with charset for a mimetype. If the mimetype represents text, the charset parameter will be appended, otherwise the mimetype is returned unchanged. :param mimetype: The mimetype to be used as content type. :param charset: The charset to be appended for text mimetypes. :return: The c...
172,392
import io import mimetypes import os import pkgutil import re import sys import typing as t import unicodedata from datetime import datetime from time import time from zlib import adler32 from markupsafe import escape from ._internal import _DictAccessorProperty from ._internal import _missing from ._internal import _T...
r"""Pass it a filename and it will return a secure version of it. This filename can then safely be stored on a regular file system and passed to :func:`os.path.join`. The filename returned is an ASCII only string for maximum portability. On windows systems the function also makes sure that the file is not named after o...
172,393
import io import mimetypes import os import pkgutil import re import sys import typing as t import unicodedata from datetime import datetime from time import time from zlib import adler32 from markupsafe import escape from ._internal import _DictAccessorProperty from ._internal import _missing from ._internal import _T...
Redirect to the current URL with a slash appended. If the current URL is ``/user/42``, the redirect URL will be ``42/``. When joined to the current URL during response processing or by the browser, this will produce ``/user/42/``. The behavior is undefined if the path ends with a slash already. If called unconditionall...
172,394
import io import mimetypes import os import pkgutil import re import sys import typing as t import unicodedata from datetime import datetime from time import time from zlib import adler32 from markupsafe import escape from ._internal import _DictAccessorProperty from ._internal import _missing from ._internal import _T...
Send a file from within a directory using :func:`send_file`. This is a secure way to serve files from a folder, such as static files or uploads. Uses :func:`~werkzeug.security.safe_join` to ensure the path coming from the client is not maliciously crafted to point outside the specified directory. If the final path does...
172,395
import io import mimetypes import os import pkgutil import re import sys import typing as t import unicodedata from datetime import datetime from time import time from zlib import adler32 from markupsafe import escape from ._internal import _DictAccessorProperty from ._internal import _missing from ._internal import _T...
Finds all the modules below a package. This can be useful to automatically import all views / controllers so that their metaclasses / function decorators have a chance to register themselves on the application. Packages are not returned unless `include_packages` is `True`. This can also recursively list modules but in ...
172,396
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str def url_unquote( s: t.Union[str, bytes], charset: str = "utf-8", err...
null
172,397
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str if t.TYPE_CHECKING: from . import datastructures as ds _always_safe = frozen...
Precompile the translation table for a URL encoding function. Unlike :func:`url_quote`, the generated function only takes the string to quote. :param charset: The charset to encode the result with. :param errors: How to handle encoding errors. :param safe: An optional sequence of safe characters to never encode. :param...
172,398
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str def url_parse( url: str, scheme: t.Optional[str] = None, allow_fragments: bo...
r"""Sometimes you get an URL by a user that just isn't a real URL because it contains unsafe characters like ' ' and so on. This function can fix some of the problems in a similar way browsers handle data entered by the user: >>> url_fix('http://de.wikipedia.org/wiki/Elf (Begriffskl\xe4rung)') 'http://de.wikipedia.org/...
172,399
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str if t.TYPE_CHECKING: from . import datastructures as ds _fast_url_quote = _ma...
Used in :func:`uri_to_iri` after unquoting to re-quote any invalid bytes.
172,400
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str if t.TYPE_CHECKING: from . import datastructures as ds def _url_decode_impl(...
Parse a query string and return it as a :class:`MultiDict`. :param s: The query string to parse. :param charset: Decode bytes to string with this charset. If not given, bytes are returned as-is. :param include_empty: Include keys with empty values in the dict. :param errors: Error handling behavior when decoding bytes....
172,401
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str if t.TYPE_CHECKING: from . import datastructures as ds def _url_decode_impl(...
Works like :func:`url_decode` but decodes a stream. The behavior of stream and limit follows functions like :func:`~werkzeug.wsgi.make_line_iter`. The generator of pairs is directly fed to the `cls` so you can consume the data while it's parsed. :param stream: a stream with the encoded querystring :param charset: the c...
172,402
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str if t.TYPE_CHECKING: from . import datastructures as ds def _url_encode_impl(...
URL encode a dict/`MultiDict`. If a value is `None` it will not appear in the result string. Per default only values are encoded into the target charset strings. :param obj: the object to encode into a query string. :param charset: the charset of the query string. :param sort: set to `True` if you want parameters to be...
172,403
import codecs import os import re import typing as t from ._internal import _check_str_tuple from ._internal import _decode_idna from ._internal import _encode_idna from ._internal import _make_encode_wrapper from ._internal import _to_str if t.TYPE_CHECKING: from . import datastructures as ds def _url_encode_impl(...
Like :meth:`url_encode` but writes the results to a stream object. If the stream is `None` a generator over all encoded pairs is returned. :param obj: the object to encode into a query string. :param stream: a stream to write the encoded object into or `None` if an iterator over the encoded pairs should be returned. In...
172,404
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
null
172,405
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing class UpdateDictMixi...
null
172,406
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
null
172,407
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
null
172,408
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing _mime_split_re = re....
null
172,409
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing _locale_delim_re = r...
Process a language tag for matching.
172,410
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
Return a new property object for a cache header. Useful if you want to add support for a cache extension in a subclass. .. versionchanged:: 2.0 Renamed from ``cache_property``.
172,411
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
Return a new property object for a content security policy header. Useful if you want to add support for a csp extension in a subclass.
172,412
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
null
172,413
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
A static helper function for Authentication subclasses to add extra authentication system properties onto a class:: class FooAuthenticate(WWWAuthenticate): special_realm = auth_property('special_realm') For more information have a look at the sourcecode to see how the regular properties (:attr:`realm` etc.) are impleme...
172,414
import base64 import codecs import mimetypes import os import re from collections.abc import Collection from collections.abc import MutableSet from copy import deepcopy from io import BytesIO from itertools import repeat from os import fspath from . import exceptions from ._internal import _missing from . import http ...
null
172,415
import json import typing import typing as t import warnings from http import HTTPStatus from .._internal import _to_bytes from ..datastructures import Headers from ..http import remove_entity_headers from ..sansio.response import Response as _SansIOResponse from ..urls import iri_to_uri from ..urls import url_join fro...
Helper for the response objects to check if the iterable returned to the WSGI server is not a string.
172,416
import json import typing import typing as t import warnings from http import HTTPStatus from .._internal import _to_bytes from ..datastructures import Headers from ..http import remove_entity_headers from ..sansio.response import Response as _SansIOResponse from ..urls import iri_to_uri from ..urls import url_join fro...
null
172,417
import json import typing import typing as t import warnings from http import HTTPStatus from .._internal import _to_bytes from ..datastructures import Headers from ..http import remove_entity_headers from ..sansio.response import Response as _SansIOResponse from ..urls import iri_to_uri from ..urls import url_join fro...
null
172,418
import errno import io import os import socket import socketserver import sys import typing as t from datetime import datetime as dt from datetime import timedelta from datetime import timezone from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from ._internal import _log from ._internal ...
Creates an SSL key for development. This should be used instead of the ``'adhoc'`` key which generates a new cert on each server start. It accepts a path for where it should store the key and cert and either a host or CN. If a host is given it will use the CN ``*.host/CN=host``. For more information see :func:`run_simp...
172,419
import errno import io import os import socket import socketserver import sys import typing as t from datetime import datetime as dt from datetime import timedelta from datetime import timezone from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from ._internal import _log from ._internal ...
Generates an adhoc SSL context for the development server.
172,420
import errno import io import os import socket import socketserver import sys import typing as t from datetime import datetime as dt from datetime import timedelta from datetime import timezone from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from ._internal import _log from ._internal ...
Checks if the given error (or the current one) is an SSL error.
172,421
import errno import io import os import socket import socketserver import sys import typing as t from datetime import datetime as dt from datetime import timedelta from datetime import timezone from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from ._internal import _log from ._internal ...
Return ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on the host and port.
172,422
import errno import io import os import socket import socketserver import sys import typing as t from datetime import datetime as dt from datetime import timedelta from datetime import timezone from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from ._internal import _log from ._internal ...
Return a fully qualified socket address that can be passed to :func:`socket.bind`.
172,423
import errno import io import os import socket import socketserver import sys import typing as t from datetime import datetime as dt from datetime import timedelta from datetime import timezone from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from ._internal import _log from ._internal ...
Get the IP address of an external interface. Used when binding to 0.0.0.0 or ::1 to show a more useful URL. :meta private:
172,424
import typing as t from datetime import datetime from markupsafe import escape from markupsafe import Markup from ._internal import _get_environ class HTTPException(Exception): """The base class for all HTTP exceptions. This exception can be called as a WSGI application to render a default error page or you can...
null
172,425
import typing as t from datetime import datetime from markupsafe import escape from markupsafe import Markup from ._internal import _get_environ if t.TYPE_CHECKING: import typing_extensions as te from _typeshed.wsgi import StartResponse from _typeshed.wsgi import WSGIEnvironment from .datastructures imp...
Raises an :py:exc:`HTTPException` for the given status code or WSGI application. If a status code is given, it will be looked up in the list of exceptions and will raise that exception. If passed a WSGI application, it will wrap it in a proxy WSGI exception and raise that:: abort(404) # 404 Not Found abort(Response('He...
172,426
import ast import re import typing as t from dataclasses import dataclass from string import Template from types import CodeType from .._internal import _to_bytes from ..urls import url_encode from ..urls import url_quote from .converters import ValidationError The provided code snippet includes necessary dependencies...
Find the *target* in *value* after *pos*. Returns the *value* length if *target* isn't found.
172,427
import ast import re import typing as t from dataclasses import dataclass from string import Template from types import CodeType from .._internal import _to_bytes from ..urls import url_encode from ..urls import url_quote from .converters import ValidationError if t.TYPE_CHECKING: from .converters import BaseConver...
null
172,428
import ast import re import typing as t from dataclasses import dataclass from string import Template from types import CodeType from .._internal import _to_bytes from ..urls import url_encode from ..urls import url_quote from .converters import ValidationError The provided code snippet includes necessary dependencies...
ast parse and prefix names with `.` to avoid collision with user vars
172,429
import hashlib import hmac import os import posixpath import secrets import typing as t def gen_salt(length: int) -> str: """Generate a random string of SALT_CHARS with specified ``length``.""" if length <= 0: raise ValueError("Salt length must be positive") return "".join(secrets.choice(SALT_CHARS)...
Hash a password with the given method and salt with a string of the given length. The format of the string returned includes the method that was used so that :func:`check_password_hash` can check the hash. The format for the hashed string looks like this:: method$salt$hash This method can **not** generate unsalted pass...
172,430
import hashlib import hmac import os import posixpath import secrets import typing as t def _hash_internal(method: str, salt: str, password: str) -> t.Tuple[str, str]: """Internal password hash helper. Supports plaintext without salt, unsalted and salted passwords. In case salted passwords are used hmac i...
Check a password against a given salted and hashed password value. In order to support unsalted legacy passwords this method supports plain text passwords, md5 and sha1 hashes (both salted and unsalted). Returns `True` if the password matched, `False` otherwise. :param pwhash: a hashed string like returned by :func:`ge...
172,431
import typing as t from datetime import datetime from datetime import timedelta from datetime import timezone from http import HTTPStatus from .._internal import _to_str from ..datastructures import Headers from ..datastructures import HeaderSet from ..http import dump_cookie from ..http import HTTP_STATUS_CODES from ....
null
172,432
import re import typing as t from datetime import datetime from .._internal import _cookie_parse_impl from .._internal import _dt_as_utc from .._internal import _to_str from ..http import generate_etag from ..http import parse_date from ..http import parse_etags from ..http import parse_if_range_header from ..http impo...
Convenience method for conditional requests. :param http_range: Range HTTP header :param http_if_range: If-Range HTTP header :param http_if_modified_since: If-Modified-Since HTTP header :param http_if_none_match: If-None-Match HTTP header :param http_if_match: If-Match HTTP header :param etag: the etag for the response...
172,433
import re import typing as t from datetime import datetime from .._internal import _cookie_parse_impl from .._internal import _dt_as_utc from .._internal import _to_str from ..http import generate_etag from ..http import parse_date from ..http import parse_etags from ..http import parse_if_range_header from ..http impo...
Parse a cookie from a string. The same key can be provided multiple times, the values are stored in-order. The default :class:`MultiDict` will have the first value first, and all values can be retrieved with :meth:`MultiDict.getlist`. :param cookie: The cookie header as a string. :param charset: The charset for the coo...
172,445
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Dump a Content Security Policy header. These are structured into policies such as "default-src 'self'; script-src 'self'". .. versionadded:: 1.0.0 Support for Content Security Policy headers was added.
172,446
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parse a ``Content-Type``-like header into a tuple with the value and any options: >>> parse_options_header('text/html; charset=utf8') ('text/html', {'charset': 'utf8'}) This should is not for ``Cache-Control``-like headers, which use a different format. For those, use :func:`parse_dict_header`. :param value: The header...
172,447
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
null
172,448
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
null
172,449
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parses an HTTP Accept-* header. This does not implement a complete valid algorithm but one that supports at least value and quality extraction. Returns a new :class:`Accept` object (basically a list of ``(value, quality)`` tuples sorted by the quality with some additional accessor methods). The second parameter can be ...
172,450
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
null
172,451
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
null
172,452
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parse a cache control header. The RFC differs between response and request cache control, this method does not. It's your responsibility to not use the wrong control statements. .. versionadded:: 0.5 The `cls` was added. If not specified an immutable :class:`~werkzeug.datastructures.RequestCacheControl` is returned. :p...
172,453
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
null
172,454
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
null
172,455
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parse a Content Security Policy header. .. versionadded:: 1.0.0 Support for Content Security Policy headers was added. :param value: a csp header to be parsed. :param on_update: an optional callable that is called every time a value on the object is changed. :param cls: the class for the returned object. By default :cl...
172,456
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parse an HTTP basic/digest authorization header transmitted by the web browser. The return value is either `None` if the header was invalid or not given, otherwise an :class:`~werkzeug.datastructures.Authorization` object. :param value: the authorization header to parse. :return: a :class:`~werkzeug.datastructures.Auth...
172,457
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parse an HTTP WWW-Authenticate header into a :class:`~werkzeug.datastructures.WWWAuthenticate` object. :param value: a WWW-Authenticate header to parse. :param on_update: an optional callable that is called every time a value on the :class:`~werkzeug.datastructures.WWWAuthenticate` object is changed. :return: a :class:...
172,458
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parses a range header into a :class:`~werkzeug.datastructures.Range` object. If the header is missing or malformed `None` is returned. `ranges` is a list of ``(start, stop)`` tuples where the ranges are non-inclusive. .. versionadded:: 0.7
172,459
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parses a range header into a :class:`~werkzeug.datastructures.ContentRange` object or `None` if parsing is not possible. .. versionadded:: 0.7 :param value: a content range header to be parsed. :param on_update: an optional callable that is called every time a value on the :class:`~werkzeug.datastructures.ContentRange`...
172,460
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Quote an etag. :param etag: the etag to quote. :param weak: set to `True` to tag it "weak".
172,461
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parses a base-10 integer count of seconds into a timedelta. If parsing fails, the return value is `None`. :param value: a string consisting of an integer represented in base-10 :return: a :class:`datetime.timedelta` object or `None`.
172,462
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Formats the duration as a base-10 integer. :param age: should be an integer number of seconds, a :class:`datetime.timedelta` object, or, if the age is unknown, `None` (default).
172,463
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Convenience method for conditional requests. :param environ: the WSGI environment of the request to be checked. :param etag: the etag for the response for comparison. :param data: or alternatively the data of the response to automatically generate an etag using :func:`generate_etag`. :param last_modified: an optional d...
172,464
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Remove all entity headers from a list or :class:`Headers` object. This operation works in-place. `Expires` and `Content-Location` headers are by default not removed. The reason for this is :rfc:`2616` section 10.3.5 which specifies some entity headers that should be sent. .. versionchanged:: 0.5 added `allowed` paramet...
172,465
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Remove all HTTP/1.1 "Hop-by-Hop" headers from a list or :class:`Headers` object. This operation works in-place. .. versionadded:: 0.5 :param headers: a list or :class:`Headers` object.
172,466
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Parse a cookie from a string or WSGI environ. The same key can be provided multiple times, the values are stored in-order. The default :class:`MultiDict` will have the first value first, and all values can be retrieved with :meth:`MultiDict.getlist`. :param header: The cookie header as a string, or a WSGI environ dict ...
172,467
import base64 import email.utils import re import typing import typing as t import warnings from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from datetime import timezone from enum import Enum from hashlib import sha1 from time import mktime from time impo...
Create a Set-Cookie header without the ``Set-Cookie`` prefix. The return value is usually restricted to ascii as the vast majority of values are properly escaped, but that is no guarantee. It's tunneled through latin1 as required by :pep:`3333`. The return value is not ASCII safe if the key contains unicode characters....
172,468
import logging import operator import re import string import sys import typing import typing as t from datetime import date from datetime import datetime from datetime import timezone from itertools import chain from weakref import WeakKeyDictionary def _wsgi_encoding_dance( s: str, charset: str = "utf-8", errors...
null
172,469
import logging import operator import re import string import sys import typing import typing as t from datetime import date from datetime import datetime from datetime import timezone from itertools import chain from weakref import WeakKeyDictionary if t.TYPE_CHECKING: from _typeshed.wsgi import StartResponse ...
null
172,470
import logging import operator import re import string import sys import typing import typing as t from datetime import date from datetime import datetime from datetime import timezone from itertools import chain from weakref import WeakKeyDictionary if t.TYPE_CHECKING: from _typeshed.wsgi import StartResponse ...
null
172,471
import logging import operator import re import string import sys import typing import typing as t from datetime import date from datetime import datetime from datetime import timezone from itertools import chain from weakref import WeakKeyDictionary if t.TYPE_CHECKING: from _typeshed.wsgi import StartResponse ...
Like the name says. But who knows how it works?
172,472
import fnmatch import os import subprocess import sys import threading import time import typing as t from itertools import chain from pathlib import PurePath from ._internal import _log _stat_ignore_scan = tuple(prefix) _ignore_common_dirs = { "__pycache__", ".git", ".hg", ".tox", ".nox", ".pyt...
Find paths for the stat reloader to watch. Returns imported module files, Python files under non-system paths. Extra files and Python files under extra directories can also be scanned. System paths have to be excluded for efficiency. Non-system paths, such as a project root or ``sys.path.insert``, should be the paths o...
172,473
import fnmatch import os import subprocess import sys import threading import time import typing as t from itertools import chain from pathlib import PurePath from ._internal import _log def _iter_module_paths() -> t.Iterator[str]: """Find the filesystem paths associated with imported modules.""" # List is in c...
Find paths for the stat reloader to watch. Looks at the same sources as the stat reloader, but watches everything under directories instead of individual files.
172,474
import fnmatch import os import subprocess import sys import threading import time import typing as t from itertools import chain from pathlib import PurePath from ._internal import _log The provided code snippet includes necessary dependencies for implementing the `_get_args_for_reloading` function. Write a Python fu...
Determine how the script was executed, and return the args needed to execute it again in a new process.
172,475
import io import re import typing as t import warnings from functools import partial from functools import update_wrapper from itertools import chain from ._internal import _make_encode_wrapper from ._internal import _to_bytes from ._internal import _to_str from .sansio import utils as _sansio_utils from .sansio.utils ...
Marks a function as responder. Decorate a function with it and it will automatically call the return value as WSGI application. Example:: @responder def application(environ, start_response): return Response('Hello World!')
172,476
import io import re import typing as t import warnings from functools import partial from functools import update_wrapper from itertools import chain from ._internal import _make_encode_wrapper from ._internal import _to_bytes from ._internal import _to_str from .sansio import utils as _sansio_utils from .sansio.utils ...
Returns the input stream from the WSGI environment and wraps it in the most sensible way possible. The stream returned is not the raw WSGI stream in most cases but one that is safe to read from without taking into account the content length. If content length is not set, the stream will be empty for safety reasons. If ...
172,477
import io import re import typing as t import warnings from functools import partial from functools import update_wrapper from itertools import chain from ._internal import _make_encode_wrapper from ._internal import _to_bytes from ._internal import _to_str from .sansio import utils as _sansio_utils from .sansio.utils ...
Returns the ``QUERY_STRING`` from the WSGI environment. This also takes care of the WSGI decoding dance. The string returned will be restricted to ASCII characters. :param environ: WSGI environment to get the query string from. .. deprecated:: 2.2 Will be removed in Werkzeug 2.3. .. versionadded:: 0.9