id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
176,047
from __future__ import unicode_literals import codecs from email import message_from_file import json import logging import re from . import DistlibException, __version__ from .compat import StringIO, string_types, text_type from .markers import interpret from .util import extract_by_key, get_extras from .version impor...
null
176,048
from __future__ import unicode_literals import codecs from email import message_from_file import json import logging import re from . import DistlibException, __version__ from .compat import StringIO, string_types, text_type from .markers import interpret from .util import extract_by_key, get_extras from .version impor...
Detect the best version depending on the fields used.
176,049
from __future__ import unicode_literals import codecs from email import message_from_file import json import logging import re from . import DistlibException, __version__ from .compat import StringIO, string_types, text_type from .markers import interpret from .util import extract_by_key, get_extras from .version impor...
Return the distribution name with version. If for_filename is true, return a filename-escaped form.
176,050
from datetime import datetime as _DateTime import sys import struct from .exceptions import BufferFull, OutOfData, ExtraData, FormatError, StackError from .ext import ExtType, Timestamp def dict_iteritems(d): return d.iteritems()
null
176,051
from datetime import datetime as _DateTime import sys import struct from .exceptions import BufferFull, OutOfData, ExtraData, FormatError, StackError from .ext import ExtType, Timestamp def dict_iteritems(d): return d.items()
null
176,052
from datetime import datetime as _DateTime import sys import struct from .exceptions import BufferFull, OutOfData, ExtraData, FormatError, StackError from .ext import ExtType, Timestamp def _check_type_strict(obj, t, type=type, tuple=tuple): if type(t) is tuple: return type(obj) in t else: retu...
null
176,053
from datetime import datetime as _DateTime import sys import struct from .exceptions import BufferFull, OutOfData, ExtraData, FormatError, StackError from .ext import ExtType, Timestamp def _get_data_from_buffer(obj): view = memoryview(obj) if view.itemsize != 1: raise ValueError("cannot unpack from mu...
null
176,054
from datetime import datetime as _DateTime import sys import struct if sys.version_info < (3, 5): # Ugly hack... RecursionError = RuntimeError def _is_recursionerror(e): return ( len(e.args) == 1 and isinstance(e.args[0], str) and e.args[0].startswith("maximum rec...
Unpack an object from `packed`. Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``ValueError`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. Other exceptions can be raised during unpacking. See :class:`Unp...
176,055
from datetime import datetime as _DateTime import sys import struct from .exceptions import BufferFull, OutOfData, ExtraData, FormatError, StackError from .ext import ExtType, Timestamp The provided code snippet includes necessary dependencies for implementing the `_unpack_from` function. Write a Python function `def ...
Explicit type cast for legacy struct.unpack_from
176,059
from __future__ import absolute_import, division, unicode_literals from types import ModuleType from pip._vendor.six import text_type, PY3 class ModuleType: __doc__: Optional[str] __file__: Optional[str] __name__: str __package__: Optional[str] __path__: Optional[Iterable[str]] __dict__: Dict[s...
null
176,060
from __future__ import absolute_import, division, unicode_literals from types import ModuleType from pip._vendor.six import text_type, PY3 def memoize(func): cache = {} def wrapped(*args, **kwargs): key = (tuple(args), tuple(kwargs.items())) if key not in cache: cache[key] = func(*...
null
176,061
from __future__ import absolute_import, division, unicode_literals from collections import OrderedDict import re from pip._vendor.six import string_types from . import base from .._utils import moduleFactoryFactory tag_regexp = re.compile("{([^}]*)}(.*)") class OrderedDict(dict): def __init__(self, data=None, **kw...
null
176,062
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from collections import OrderedDict from lxml import etree from ..treebuilders.etree import tag_regexp from . import base from .. import _ihatexml def ensure_str(s): if s is None: return None elif i...
null
176,065
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from pip._vendor.six.moves import http_client, urllib import codecs import re from io import BytesIO, StringIO from pip._vendor import webencodings from .constants import EOF, spaceCharacters, asciiLetters, asciiUpp...
null
176,066
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from pip._vendor.six.moves import http_client, urllib import codecs import re from io import BytesIO, StringIO from pip._vendor import webencodings from .constants import EOF, spaceCharacters, asciiLetters, asciiUpp...
Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.
176,068
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type import re from copy import copy from . import base from .. import _ihatexml from .. import constants from ..constants import namespaces from .._utils import moduleFactoryFactory tag_regexp = re.compile("{([^}]*)}(.*...
null
176,069
from __future__ import absolute_import, division, unicode_literals import warnings import re import sys from . import base from ..constants import DataLossWarning from .. import constants from . import etree as etree_builders from .. import _ihatexml import lxml.etree as etree from pip._vendor.six import PY3, binary_ty...
null
176,070
from __future__ import absolute_import, division, unicode_literals import warnings import re import sys from . import base from ..constants import DataLossWarning from .. import constants from . import etree as etree_builders from .. import _ihatexml import lxml.etree as etree from pip._vendor.six import PY3, binary_ty...
Serialize an element and its child nodes to a string
176,071
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import with_metaclass, viewkeys import types from . import _inputstream from . import _tokenizer from . import treebuilders from .treebuilders.base import Marker from . import _utils from .constants import ( spaceCharacters, asc...
Parse an HTML fragment as a string or file-like object into a tree :arg doc: the fragment to parse as a string or file-like object :arg container: the container context to parse the fragment in :arg treebuilder: the treebuilder to use when parsing :arg namespaceHTMLElements: whether or not to namespace HTML elements :r...
176,072
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import with_metaclass, viewkeys import types from . import _inputstream from . import _tokenizer from . import treebuilders from .treebuilders.base import Marker from . import _utils from .constants import ( spaceCharacters, asc...
null
176,073
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import with_metaclass, viewkeys import types from . import _inputstream from . import _tokenizer from . import treebuilders from .treebuilders.base import Marker from . import _utils from .constants import ( spaceCharacters, asc...
null
176,074
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type import re from codecs import register_error, xmlcharrefreplace_errors from .constants import voidElements, booleanAttributes, spaceCharacters from .constants import rcdataElements, entities, xmlEntities from . impor...
null
176,075
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type import re from codecs import register_error, xmlcharrefreplace_errors from .constants import voidElements, booleanAttributes, spaceCharacters from .constants import rcdataElements, entities, xmlEntities from . impor...
Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the :py:class:`html5lib.serializer.HTMLSerializer` that gets created :returns: the tree serialized a...
176,078
import os import errno import sys from pip._vendor import six makedirs = _makedirs_31 if needs_makedirs else os.makedirs import os from os import utime try: from os import mkdir, rename, unlink WRITE_SUPPORT = True except ImportError: # no write support, probably under GAE WRITE_SUPPORT = False fr...
null
176,079
from __future__ import absolute_import import binascii import codecs import os from io import BytesIO from .packages import six from .packages.six import b from .fields import RequestField The provided code snippet includes necessary dependencies for implementing the `iter_fields` function. Write a Python function `de...
.. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples and dicts.
176,080
from __future__ import absolute_import import binascii import codecs import os from io import BytesIO from .packages import six from .packages.six import b from .fields import RequestField writer = codecs.lookup("utf-8")[3] def choose_boundary(): """ Our embarrassingly-simple replacement for mimetools.choose_bo...
Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary will be generated using :func:`urllib3.filepost.choose_boundary`.
176,081
import base64 import ctypes import itertools import re import os import ssl import tempfile from .bindings import Security, CoreFoundation, CFConst CoreFoundation = CDLL(core_foundation_path, use_errno=True) The provided code snippet includes necessary dependencies for implementing the `_cf_dictionary_from_tuples` fu...
Given a list of Python tuples, create an associated CFDictionary.
176,082
import base64 import ctypes import itertools import re import os import ssl import tempfile from .bindings import Security, CoreFoundation, CFConst _PEM_CERTS_RE = re.compile( b"-----BEGIN CERTIFICATE-----\n(.*?)\n-----END CERTIFICATE-----", re.DOTALL ) def _cf_data_from_bytes(bytestring): """ Given a bytes...
Given a bundle of certs in PEM format, turns them into a CFArray of certs that can be used to validate a cert chain.
176,083
import base64 import ctypes import itertools import re import os import ssl import tempfile from .bindings import Security, CoreFoundation, CFConst def _assert_no_error(error, exception_class=None): """ Checks the return code and throws an exception if there is an error to report """ if error == 0: ...
This function creates a temporary Mac keychain that we can use to work with credentials. This keychain uses a one-time password and a temporary file to store the data. We expect to have one keychain per socket. The returned SecKeychainRef must be freed by the caller, including calling SecKeychainDelete. Returns a tuple...
176,084
import base64 import ctypes import itertools import re import os import ssl import tempfile from .bindings import Security, CoreFoundation, CFConst def _assert_no_error(error, exception_class=None): """ Checks the return code and throws an exception if there is an error to report """ if error == 0: ...
Load certificates and maybe keys from a number of files. Has the end goal of returning a CFArray containing one SecIdentityRef, and then zero or more SecCertificateRef objects, suitable for use as a client certificate trust chain.
176,085
from __future__ import absolute_import import contextlib import ctypes import errno import os.path import shutil import socket import ssl import threading import weakref from .. import util from ._securetransport.bindings import Security, SecurityConst, CoreFoundation from ._securetransport.low_level import ( _asse...
Undo monkey-patching by :func:`inject_into_urllib3`.
176,086
from __future__ import absolute_import import contextlib import ctypes import errno import os.path import shutil import socket import ssl import threading import weakref from .. import util from ._securetransport.bindings import Security, SecurityConst, CoreFoundation from ._securetransport.low_level import ( _asse...
SecureTransport read callback. This is called by ST to request that data be returned from the socket.
176,087
from __future__ import absolute_import import contextlib import ctypes import errno import os.path import shutil import socket import ssl import threading import weakref from .. import util from ._securetransport.bindings import Security, SecurityConst, CoreFoundation from ._securetransport.low_level import ( _asse...
SecureTransport write callback. This is called by ST to request that data actually be sent on the network.
176,088
from __future__ import absolute_import import contextlib import ctypes import errno import os.path import shutil import socket import ssl import threading import weakref from .. import util from ._securetransport.bindings import Security, SecurityConst, CoreFoundation from ._securetransport.low_level import ( _asse...
null
176,089
from __future__ import absolute_import import contextlib import ctypes import errno import os.path import shutil import socket import ssl import threading import weakref from .. import util from ._securetransport.bindings import Security, SecurityConst, CoreFoundation from ._securetransport.low_level import ( _asse...
null
176,091
from __future__ import absolute_import import OpenSSL.SSL from cryptography import x509 from cryptography.hazmat.backends.openssl import backend as openssl_backend from cryptography.hazmat.backends.openssl.x509 import _Certificate from socket import timeout, error as SocketError from io import BytesIO import logging im...
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
176,092
from __future__ import absolute_import import OpenSSL.SSL from cryptography import x509 from cryptography.hazmat.backends.openssl import backend as openssl_backend from cryptography.hazmat.backends.openssl.x509 import _Certificate from socket import timeout, error as SocketError from io import BytesIO import logging im...
Undo monkey-patching by :func:`inject_into_urllib3`.
176,093
from __future__ import absolute_import import OpenSSL.SSL from cryptography import x509 from cryptography.hazmat.backends.openssl import backend as openssl_backend from cryptography.hazmat.backends.openssl.x509 import _Certificate try: from cryptography.x509 import UnsupportedExtension except ImportError: # Uns...
Given an PyOpenSSL certificate, provides all the subject alternative names.
176,094
from __future__ import absolute_import import OpenSSL.SSL from cryptography import x509 from cryptography.hazmat.backends.openssl import backend as openssl_backend from cryptography.hazmat.backends.openssl.x509 import _Certificate from socket import timeout, error as SocketError from io import BytesIO import logging im...
null
176,095
from __future__ import absolute_import import OpenSSL.SSL from cryptography import x509 from cryptography.hazmat.backends.openssl import backend as openssl_backend from cryptography.hazmat.backends.openssl.x509 import _Certificate from socket import timeout, error as SocketError from io import BytesIO import logging im...
null
176,096
from __future__ import absolute_import import errno import logging import sys import warnings from socket import error as SocketError, timeout as SocketTimeout import socket from .exceptions import ( ClosedPoolError, ProtocolError, EmptyPoolError, HeaderParsingError, HostChangedError, LocationVa...
Given a url, return an :class:`.ConnectionPool` instance of its host. This is a shortcut for not having to parse out the scheme, host, and port of the url before creating an :class:`.ConnectionPool` instance. :param url: Absolute URL string that must include the scheme. Port is optional. :param \\**kw: Passes additiona...
176,097
from __future__ import absolute_import import errno import logging import sys import warnings from socket import error as SocketError, timeout as SocketTimeout import socket from .exceptions import ( ClosedPoolError, ProtocolError, EmptyPoolError, HeaderParsingError, HostChangedError, LocationVa...
Normalize hosts for comparisons and use with sockets.
176,099
from __future__ import absolute_import import email.utils import mimetypes import re from .packages import six The provided code snippet includes necessary dependencies for implementing the `format_header_param_rfc2231` function. Write a Python function `def format_header_param_rfc2231(name, value)` to solve the follo...
Helper function to format and quote a single header parameter using the strategy defined in RFC 2231. Particularly useful for header parameters which might contain non-ASCII values, like file names. This follows RFC 2388 Section 4.4. :param name: The name of the parameter, a string expected to be ASCII only. :param val...
176,100
from __future__ import absolute_import import email.utils import mimetypes import re from .packages import six _HTML5_REPLACEMENTS = { u"\u0022": u"%22", # Replace "\" with "\\". u"\u005C": u"\u005C\u005C", u"\u005C": u"\u005C\u005C", } _HTML5_REPLACEMENTS.update( { six.unichr(cc): u"%{:02X}...
Helper function to format and quote a single header parameter using the HTML5 strategy. Particularly useful for header parameters which might contain non-ASCII values, like file names. This follows the `HTML5 Working Draft Section 4.10.22.7`_ and matches the behavior of curl and modern browsers. .. _HTML5 Working Draft...
176,101
from __future__ import absolute_import from contextlib import contextmanager import zlib import io import logging from socket import timeout as SocketTimeout from socket import error as SocketError try: import brotli except ImportError: brotli = None from ._collections import HTTPHeaderDict from .exceptions imp...
null
176,102
from __future__ import absolute_import import collections import functools import logging import warnings from ._collections import RecentlyUsedContainer from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool from .connectionpool import port_by_scheme from .exceptions import ( LocationValueError, M...
Create a pool key out of a request context dictionary. According to RFC 3986, both the scheme and host are case-insensitive. Therefore, this function normalizes both before constructing the pool key for an HTTPS request. If you wish to change this behaviour, provide alternate callables to ``key_fn_by_scheme``. :param k...
176,103
from __future__ import absolute_import import collections import functools import logging import warnings from ._collections import RecentlyUsedContainer from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool from .connectionpool import port_by_scheme from .exceptions import ( LocationValueError, M...
null
176,133
from __future__ import absolute_import import functools import itertools import operator import sys import types The provided code snippet includes necessary dependencies for implementing the `with_metaclass` function. Write a Python function `def with_metaclass(meta, *bases)` to solve the following problem: Create a ...
Create a base class with a metaclass.
176,137
from __future__ import absolute_import import re import datetime import logging import os import socket from socket import error as SocketError, timeout as SocketTimeout import warnings from .packages import six from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection from .packages.six.moves.http_...
null
176,140
from __future__ import absolute_import from ..packages.six.moves import http_client as httplib from ..exceptions import HeaderParsingError The provided code snippet includes necessary dependencies for implementing the `is_fp_closed` function. Write a Python function `def is_fp_closed(obj)` to solve the following probl...
Checks whether a given file-like object is closed. :param obj: The file-like object to check.
176,141
from __future__ import absolute_import from ..packages.six.moves import http_client as httplib from ..exceptions import HeaderParsingError class HeaderParsingError(HTTPError): "Raised by assert_header_parsing, but we convert it to a log.warning statement." def __init__(self, defects, unparsed_data): m...
Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers. Only works on Python 3. :param headers: Headers to verify. :type headers: `httplib.HTTPMessage`. :raises urllib3.exceptions.HeaderParsingError: If parsing errors are found.
176,142
from __future__ import absolute_import from ..packages.six.moves import http_client as httplib from ..exceptions import HeaderParsingError The provided code snippet includes necessary dependencies for implementing the `is_response_to_head` function. Write a Python function `def is_response_to_head(response)` to solve ...
Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine. :param conn: :type conn: :class:`httplib.HTTPResponse`
176,143
from __future__ import absolute_import from base64 import b64encode from ..packages.six import b, integer_types from ..exceptions import UnrewindableBodyError ACCEPT_ENCODING = "gzip,deflate" def b64encode(s: _encodable, altchars: Optional[bytes] = ...) -> bytes: ... The provided code snippet includes necessary depen...
Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: Can be a boolean, list, or string. ``True`` translates to 'gzip,deflate'. List will get joined by comma. String will be used as provided. :param user_agent: String representing the use...
176,144
from __future__ import absolute_import from base64 import b64encode from ..packages.six import b, integer_types from ..exceptions import UnrewindableBodyError _FAILEDTELL = object() def rewind_body(body, body_pos): """ Attempt to rewind body to a certain position. Primarily used for request redirects and re...
If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use.
176,145
import errno from functools import partial import select import sys def wait_for_socket(*args, **kwargs): # We delay choosing which implementation to use until the first time we're # called. We could do it at import time, but then we might make the wrong # decision if someone goes wild with monkeypatching s...
Waits for writing to be available on a given socket. Returns True if the socket is readable, or False if the timeout expired.
176,146
from __future__ import absolute_import import errno import warnings import hmac import sys from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from .url import IPV4_RE, BRACELESS_IPV6_ADDRZ_RE from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning from ..packages import ...
Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise.
176,147
from __future__ import absolute_import import errno import warnings import hmac import sys from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from .url import IPV4_RE, BRACELESS_IPV6_ADDRZ_RE from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning from ..packages import ...
Checks if given fingerprint matches the supplied certificate. :param cert: Certificate as bytes object. :param fingerprint: Fingerprint as string of hexdigits, can be interspersed by colons.
176,148
from __future__ import absolute_import import errno import warnings import hmac import sys from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from .url import IPV4_RE, BRACELESS_IPV6_ADDRZ_RE from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning from ..packages import ...
Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:`ssl.CERT_REQUIRED`. If given a string it is assumed to be the name of the constant in the :mod:`ssl` module or its abbreviation. (So you can specify `REQUIRED` instead of `CERT_REQ...
176,149
from __future__ import absolute_import import errno import warnings import hmac import sys from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from .url import IPV4_RE, BRACELESS_IPV6_ADDRZ_RE from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning from ..packages import ...
like resolve_cert_reqs
176,150
from __future__ import absolute_import import errno import warnings import hmac import sys from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from .url import IPV4_RE, BRACELESS_IPV6_ADDRZ_RE from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning from ..packages import ...
All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:`ssl.wrap_socket`. :param server_hostname: When SNI is supported, the expected hostname of the certificate :param ssl_context: A pre-made :class:`SSLContext` object. If none is provided, one will be ...
176,151
from __future__ import absolute_import import socket from .wait import NoWayToWaitForSocketError, wait_for_read from ..contrib import _appengine_environ class NoWayToWaitForSocketError(Exception): pass def wait_for_read(sock, timeout=None): """ Waits for reading to be available on a given socket...
Returns True if the connection is dropped and should be closed. :param conn: :class:`httplib.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycling transparently for us.
176,152
from __future__ import absolute_import import socket from .wait import NoWayToWaitForSocketError, wait_for_read from ..contrib import _appengine_environ def _set_socket_options(sock, options): if options is None: return for opt in options: sock.setsockopt(*opt) def allowed_gai_family(): """T...
Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default time...
176,153
from __future__ import absolute_import import socket from .wait import NoWayToWaitForSocketError, wait_for_read from ..contrib import _appengine_environ The provided code snippet includes necessary dependencies for implementing the `_has_ipv6` function. Write a Python function `def _has_ipv6(host)` to solve the follow...
Returns True if the system can bind an IPv6 address.
176,154
import os try: from importlib.resources import path as get_path, read_text _CACERT_CTX = None _CACERT_PATH = None except ImportError: # This fallback will work for Python versions prior to 3.7 that lack the # importlib.resources module but relies on the existing `where` function # so won't addre...
null
176,155
import argparse import logging import os from os.path import isfile, join as pjoin from pip._vendor.toml import TomlDecodeError, load as toml_load import shutil from subprocess import CalledProcessError import sys import tarfile from tempfile import mkdtemp import zipfile from .colorlog import enable_colourful_output f...
null
176,156
import argparse import logging import os from os.path import isfile, join as pjoin from pip._vendor.toml import TomlDecodeError, load as toml_load import shutil from subprocess import CalledProcessError import sys import tarfile from tempfile import mkdtemp import zipfile from .colorlog import enable_colourful_output f...
null
176,157
import threading from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call, check_output, STDOUT import sys from tempfile import mkdtemp from . import compat def _in_proc_script_path(): return resources.path(__package__, ...
null
176,158
import threading from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call, check_output, STDOUT import sys from tempfile import mkdtemp from . import compat def _in_proc_script_path(): yield pjoin(dirname(abspath(__file_...
null
176,159
import threading from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call, check_output, STDOUT import sys from tempfile import mkdtemp from . import compat def check_call( args: _CMD, bufsize: int = ..., executable:...
The default method of calling the wrapper subprocess.
176,160
import threading from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call, check_output, STDOUT import sys from tempfile import mkdtemp from . import compat The provided code snippet includes necessary dependencies for implement...
Normalise and check a backend path. Ensure that the requested backend path is specified as a relative path, and resolves to a location under the given source tree. Return an absolute version of the requested path.
176,161
import logging import sys try: import curses except ImportError: curses = None def _stderr_supports_color(): color = False if curses and hasattr(sys.stderr, 'isatty') and sys.stderr.isatty(): try: curses.setupterm() if curses.tigetnum("colors") > 0: color...
null
176,162
import logging import sys class LogFormatter(logging.Formatter): """Log formatter with colour support """ DEFAULT_COLORS = { logging.INFO: 2, # Green logging.WARNING: 3, # Yellow logging.ERROR: 1, # Red logging.CRITICAL: 1, } def __init__(self, color=True, datefmt=...
null
176,163
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def write_json(obj, path, **kwargs): with open(path, 'w', encoding='utf-8') as f: json.dump(obj, f, **kwargs)
null
176,164
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def read_json(path): with open(path, 'r', encoding='utf-8') as f: return json.load(f)
null
176,165
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def write_json(obj, path, **kwargs): with open(path, 'wb') as f: json.dump(obj, f, encoding='utf-8', **kwargs)
null
176,166
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def read_json(path): with open(path, 'rb') as f: return json.load(f)
null
176,167
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def _build_backend(): """Find and load the build backend""" # Add in-tree backend directories to the front of sys.path. backend...
Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined.
176,168
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback class HookMissing(Exception): """Raised if a hook is missing and we are not executing the fallback""" def _build_backend(): """Find...
Invoke optional prepare_metadata_for_build_wheel Implements a fallback by building a wheel if the hook isn't defined, unless _allow_fallback is False in which case HookMissing is raised.
176,169
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def _build_backend(): """Find and load the build backend""" # Add in-tree backend directories to the front of sys.path. backend...
Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined.
176,170
from glob import glob from importlib import import_module import json import os import os.path from os.path import join as pjoin import re import shutil import sys import traceback def _build_backend(): """Find and load the build backend""" # Add in-tree backend directories to the front of sys.path. backend...
Invoke the mandatory build_sdist hook.
176,171
import json import sys def write_json(obj, path, **kwargs): with open(path, 'w', encoding='utf-8') as f: json.dump(obj, f, **kwargs)
null
176,172
import json import sys def read_json(path): with open(path, 'r', encoding='utf-8') as f: return json.load(f)
null
176,173
import json import sys def write_json(obj, path, **kwargs): with open(path, 'wb') as f: json.dump(obj, f, encoding='utf-8', **kwargs)
null
176,174
import json import sys def read_json(path): with open(path, 'rb') as f: return json.load(f)
null
176,175
import argparse import logging import os import shutil import functools from .envbuild import BuildEnvironment from .wrappers import Pep517HookCaller, quiet_subprocess_runner from .dirtools import tempdir, mkdir_p, dir_to_zipfile from .build import validate_system, load_system, compat_system def build(source_dir='.', d...
Given a source directory (root) of a package, return an importlib.metadata.Distribution object with metadata build from that package.
176,176
import sys import os def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Wind...
r"""Return full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls ...
176,177
import sys import os def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Wind...
r"""Return full path to the user-specific state dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls b...
176,178
import sys import os def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Wind...
r"""Return full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls bac...
176,183
import json def assert_lower(string): assert string == string.lower() return string def urlopen(url: str, data=..., proxies: Mapping[str, str] = ..., context=...) -> IO[Any]: ... def generate(url): parts = ['''\ """ webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. ...
null
176,184
from __future__ import absolute_import, division, print_function import collections import itertools import re from ._structures import Infinity, NegativeInfinity from ._typing import TYPE_CHECKING def _parse_version_parts(s): # type: (str) -> Iterator[str] for part in _legacy_version_component_re.split(s): ...
null
176,185
from __future__ import absolute_import, division, print_function import collections import itertools import re from ._structures import Infinity, NegativeInfinity from ._typing import TYPE_CHECKING def _parse_letter_version( letter, # type: str number, # type: Union[str, bytes, SupportsInt] ): # type: (....
null
176,186
from __future__ import absolute_import, division, print_function import collections import itertools import re from ._structures import Infinity, NegativeInfinity from ._typing import TYPE_CHECKING _local_version_separators = re.compile(r"[\._-]") The provided code snippet includes necessary dependencies for implement...
Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
176,187
from __future__ import absolute_import, division, print_function import collections import itertools import re from ._structures import Infinity, NegativeInfinity from ._typing import TYPE_CHECKING Infinity = InfinityType() NegativeInfinity = NegativeInfinityType() def _cmpkey( epoch, # type: int release...
null
176,188
from __future__ import absolute_import, division, print_function import re from ._typing import TYPE_CHECKING, cast from .version import InvalidVersion, Version class InvalidVersion(ValueError): """ An invalid version was found, users should refer to PEP 440. """ class Version(_BaseVersion):...
This is very similar to Version.__str__, but has one subtle difference with the way it handles the release segment.
176,189
from __future__ import absolute_import import distutils.util import logging import os import platform import re import struct import sys import sysconfig import warnings from ._typing import TYPE_CHECKING, cast class Tag(object): """ A representation of the tag triple for a wheel. Instances are considered i...
Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances. Returning a set is required due to the possibility that the tag is a compressed tag set.
176,190
from __future__ import absolute_import import distutils.util import logging import os import platform import re import struct import sys import sysconfig import warnings from ._typing import TYPE_CHECKING, cast def _warn_keyword_parameter(func_name, kwargs): # type: (str, Dict[str, bool]) -> bool """ Backwa...
Returns the sequence of tag triples for the running interpreter. The order of the sequence corresponds to priority order for the interpreter, from most to least important.
176,191
from __future__ import absolute_import, division, print_function import operator import os import platform import sys from pip._vendor.pyparsing import ParseException, ParseResults, stringStart, stringEnd from pip._vendor.pyparsing import ZeroOrMore, Group, Forward, QuotedString from pip._vendor.pyparsing import Litera...
null
176,192
from __future__ import absolute_import, division, print_function import operator import os import platform import sys from pip._vendor.pyparsing import ParseException, ParseResults, stringStart, stringEnd from pip._vendor.pyparsing import ZeroOrMore, Group, Forward, QuotedString from pip._vendor.pyparsing import Litera...
null
176,193
from __future__ import absolute_import, division, print_function import operator import os import platform import sys from pip._vendor.pyparsing import ParseException, ParseResults, stringStart, stringEnd from pip._vendor.pyparsing import ZeroOrMore, Group, Forward, QuotedString from pip._vendor.pyparsing import Litera...
null
176,194
from __future__ import absolute_import, division, print_function import operator import os import platform import sys from pip._vendor.pyparsing import ParseException, ParseResults, stringStart, stringEnd from pip._vendor.pyparsing import ZeroOrMore, Group, Forward, QuotedString from pip._vendor.pyparsing import Litera...
null