repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
pypa/pipenv
pipenv/patched/notpip/_vendor/webencodings/__init__.py
iter_encode
def iter_encode(input, encoding=UTF8, errors='strict'): """ “Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupEr...
python
def iter_encode(input, encoding=UTF8, errors='strict'): """ “Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupEr...
[ "def", "iter_encode", "(", "input", ",", "encoding", "=", "UTF8", ",", "errors", "=", "'strict'", ")", ":", "# Fail early if `encoding` is an invalid label.", "encode", "=", "IncrementalEncoder", "(", "encoding", ",", "errors", ")", ".", "encode", "return", "_iter...
“Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An iterable of byt...
[ "“Pull”", "-", "based", "encoder", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/webencodings/__init__.py#L246-L259
train
pypa/pipenv
pipenv/patched/notpip/_vendor/webencodings/__init__.py
IncrementalDecoder.decode
def decode(self, input, final=False): """Decode one chunk of the input. :param input: A byte string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: An Unicode string. """ decoder = ...
python
def decode(self, input, final=False): """Decode one chunk of the input. :param input: A byte string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: An Unicode string. """ decoder = ...
[ "def", "decode", "(", "self", ",", "input", ",", "final", "=", "False", ")", ":", "decoder", "=", "self", ".", "_decoder", "if", "decoder", "is", "not", "None", ":", "return", "decoder", "(", "input", ",", "final", ")", "input", "=", "self", ".", "...
Decode one chunk of the input. :param input: A byte string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: An Unicode string.
[ "Decode", "one", "chunk", "of", "the", "input", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/webencodings/__init__.py#L295-L320
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_cf_dictionary_from_tuples
def _cf_dictionary_from_tuples(tuples): """ Given a list of Python tuples, create an associated CFDictionary. """ dictionary_size = len(tuples) # We need to get the dictionary keys and values out in the same order. keys = (t[0] for t in tuples) values = (t[1] for t in tuples) cf_keys = ...
python
def _cf_dictionary_from_tuples(tuples): """ Given a list of Python tuples, create an associated CFDictionary. """ dictionary_size = len(tuples) # We need to get the dictionary keys and values out in the same order. keys = (t[0] for t in tuples) values = (t[1] for t in tuples) cf_keys = ...
[ "def", "_cf_dictionary_from_tuples", "(", "tuples", ")", ":", "dictionary_size", "=", "len", "(", "tuples", ")", "# We need to get the dictionary keys and values out in the same order.", "keys", "=", "(", "t", "[", "0", "]", "for", "t", "in", "tuples", ")", "values"...
Given a list of Python tuples, create an associated CFDictionary.
[ "Given", "a", "list", "of", "Python", "tuples", "create", "an", "associated", "CFDictionary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L37-L56
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_cf_string_to_unicode
def _cf_string_to_unicode(value): """ Creates a Unicode string from a CFString object. Used entirely for error reporting. Yes, it annoys me quite a lot that this function is this complex. """ value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p)) string = CoreFoundation.CFSt...
python
def _cf_string_to_unicode(value): """ Creates a Unicode string from a CFString object. Used entirely for error reporting. Yes, it annoys me quite a lot that this function is this complex. """ value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p)) string = CoreFoundation.CFSt...
[ "def", "_cf_string_to_unicode", "(", "value", ")", ":", "value_as_void_p", "=", "ctypes", ".", "cast", "(", "value", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_void_p", ")", ")", "string", "=", "CoreFoundation", ".", "CFStringGetCStringPtr", "(", ...
Creates a Unicode string from a CFString object. Used entirely for error reporting. Yes, it annoys me quite a lot that this function is this complex.
[ "Creates", "a", "Unicode", "string", "from", "a", "CFString", "object", ".", "Used", "entirely", "for", "error", "reporting", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L59-L85
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_assert_no_error
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: return cf_error_string = Security.SecCopyErrorMessageString(error, None) output = _cf_string_to_unicode(cf_error_string) CoreFo...
python
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: return cf_error_string = Security.SecCopyErrorMessageString(error, None) output = _cf_string_to_unicode(cf_error_string) CoreFo...
[ "def", "_assert_no_error", "(", "error", ",", "exception_class", "=", "None", ")", ":", "if", "error", "==", "0", ":", "return", "cf_error_string", "=", "Security", ".", "SecCopyErrorMessageString", "(", "error", ",", "None", ")", "output", "=", "_cf_string_to...
Checks the return code and throws an exception if there is an error to report
[ "Checks", "the", "return", "code", "and", "throws", "an", "exception", "if", "there", "is", "an", "error", "to", "report" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L88-L106
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_cert_array_from_pem
def _cert_array_from_pem(pem_bundle): """ Given a bundle of certs in PEM format, turns them into a CFArray of certs that can be used to validate a cert chain. """ # Normalize the PEM bundle's line endings. pem_bundle = pem_bundle.replace(b"\r\n", b"\n") der_certs = [ base64.b64decod...
python
def _cert_array_from_pem(pem_bundle): """ Given a bundle of certs in PEM format, turns them into a CFArray of certs that can be used to validate a cert chain. """ # Normalize the PEM bundle's line endings. pem_bundle = pem_bundle.replace(b"\r\n", b"\n") der_certs = [ base64.b64decod...
[ "def", "_cert_array_from_pem", "(", "pem_bundle", ")", ":", "# Normalize the PEM bundle's line endings.", "pem_bundle", "=", "pem_bundle", ".", "replace", "(", "b\"\\r\\n\"", ",", "b\"\\n\"", ")", "der_certs", "=", "[", "base64", ".", "b64decode", "(", "match", ".",...
Given a bundle of certs in PEM format, turns them into a CFArray of certs that can be used to validate a cert chain.
[ "Given", "a", "bundle", "of", "certs", "in", "PEM", "format", "turns", "them", "into", "a", "CFArray", "of", "certs", "that", "can", "be", "used", "to", "validate", "a", "cert", "chain", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L109-L152
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_temporary_keychain
def _temporary_keychain(): """ 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, i...
python
def _temporary_keychain(): """ 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, i...
[ "def", "_temporary_keychain", "(", ")", ":", "# Unfortunately, SecKeychainCreate requires a path to a keychain. This", "# means we cannot use mkstemp to use a generic temporary file. Instead,", "# we're going to create a temporary directory and a filename to use there.", "# This filename will be 8 r...
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....
[ "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"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L171-L208
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_load_items_from_file
def _load_items_from_file(keychain, path): """ Given a single file, loads all the trust objects from it into arrays and the keychain. Returns a tuple of lists: the first list is a list of identities, the second a list of certs. """ certificates = [] identities = [] result_array = Non...
python
def _load_items_from_file(keychain, path): """ Given a single file, loads all the trust objects from it into arrays and the keychain. Returns a tuple of lists: the first list is a list of identities, the second a list of certs. """ certificates = [] identities = [] result_array = Non...
[ "def", "_load_items_from_file", "(", "keychain", ",", "path", ")", ":", "certificates", "=", "[", "]", "identities", "=", "[", "]", "result_array", "=", "None", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "raw_filedata", "=", "f", "....
Given a single file, loads all the trust objects from it into arrays and the keychain. Returns a tuple of lists: the first list is a list of identities, the second a list of certs.
[ "Given", "a", "single", "file", "loads", "all", "the", "trust", "objects", "from", "it", "into", "arrays", "and", "the", "keychain", ".", "Returns", "a", "tuple", "of", "lists", ":", "the", "first", "list", "is", "a", "list", "of", "identities", "the", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L211-L267
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/_securetransport/low_level.py
_load_client_cert_chain
def _load_client_cert_chain(keychain, *paths): """ 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. """ # Ok, ...
python
def _load_client_cert_chain(keychain, *paths): """ 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. """ # Ok, ...
[ "def", "_load_client_cert_chain", "(", "keychain", ",", "*", "paths", ")", ":", "# Ok, the strategy.", "#", "# This relies on knowing that macOS will not give you a SecIdentityRef", "# unless you have imported a key into a keychain. This is a somewhat", "# artificial limitation of macOS (f...
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.
[ "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...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/_securetransport/low_level.py#L270-L346
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse.get_redirect_location
def get_redirect_location(self): """ Should we redirect and where to? :returns: Truthy redirect location string if we got a redirect status code and valid location. ``None`` if redirect status and no location. ``False`` if not a redirect status code. """ ...
python
def get_redirect_location(self): """ Should we redirect and where to? :returns: Truthy redirect location string if we got a redirect status code and valid location. ``None`` if redirect status and no location. ``False`` if not a redirect status code. """ ...
[ "def", "get_redirect_location", "(", "self", ")", ":", "if", "self", ".", "status", "in", "self", ".", "REDIRECT_STATUSES", ":", "return", "self", ".", "headers", ".", "get", "(", "'location'", ")", "return", "False" ]
Should we redirect and where to? :returns: Truthy redirect location string if we got a redirect status code and valid location. ``None`` if redirect status and no location. ``False`` if not a redirect status code.
[ "Should", "we", "redirect", "and", "where", "to?" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L211-L222
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse._init_length
def _init_length(self, request_method): """ Set initial length value for Response content if available. """ length = self.headers.get('content-length') if length is not None: if self.chunked: # This Response will fail with an IncompleteRead if it can'...
python
def _init_length(self, request_method): """ Set initial length value for Response content if available. """ length = self.headers.get('content-length') if length is not None: if self.chunked: # This Response will fail with an IncompleteRead if it can'...
[ "def", "_init_length", "(", "self", ",", "request_method", ")", ":", "length", "=", "self", ".", "headers", ".", "get", "(", "'content-length'", ")", "if", "length", "is", "not", "None", ":", "if", "self", ".", "chunked", ":", "# This Response will fail with...
Set initial length value for Response content if available.
[ "Set", "initial", "length", "value", "for", "Response", "content", "if", "available", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L255-L301
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse._init_decoder
def _init_decoder(self): """ Set-up the _decoder attribute if necessary. """ # Note: content-encoding value should be case-insensitive, per RFC 7230 # Section 3.2 content_encoding = self.headers.get('content-encoding', '').lower() if self._decoder is None: ...
python
def _init_decoder(self): """ Set-up the _decoder attribute if necessary. """ # Note: content-encoding value should be case-insensitive, per RFC 7230 # Section 3.2 content_encoding = self.headers.get('content-encoding', '').lower() if self._decoder is None: ...
[ "def", "_init_decoder", "(", "self", ")", ":", "# Note: content-encoding value should be case-insensitive, per RFC 7230", "# Section 3.2", "content_encoding", "=", "self", ".", "headers", ".", "get", "(", "'content-encoding'", ",", "''", ")", ".", "lower", "(", ")", "...
Set-up the _decoder attribute if necessary.
[ "Set", "-", "up", "the", "_decoder", "attribute", "if", "necessary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L303-L316
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse._flush_decoder
def _flush_decoder(self): """ Flushes the decoder. Should only be called if the decoder is actually being used. """ if self._decoder: buf = self._decoder.decompress(b'') return buf + self._decoder.flush() return b''
python
def _flush_decoder(self): """ Flushes the decoder. Should only be called if the decoder is actually being used. """ if self._decoder: buf = self._decoder.decompress(b'') return buf + self._decoder.flush() return b''
[ "def", "_flush_decoder", "(", "self", ")", ":", "if", "self", ".", "_decoder", ":", "buf", "=", "self", ".", "_decoder", ".", "decompress", "(", "b''", ")", "return", "buf", "+", "self", ".", "_decoder", ".", "flush", "(", ")", "return", "b''" ]
Flushes the decoder. Should only be called if the decoder is actually being used.
[ "Flushes", "the", "decoder", ".", "Should", "only", "be", "called", "if", "the", "decoder", "is", "actually", "being", "used", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L336-L345
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse._error_catcher
def _error_catcher(self): """ Catch low-level python exceptions, instead re-raising urllib3 variants, so that low-level exceptions are not leaked in the high-level api. On exit, release the connection back to the pool. """ clean_exit = False try: ...
python
def _error_catcher(self): """ Catch low-level python exceptions, instead re-raising urllib3 variants, so that low-level exceptions are not leaked in the high-level api. On exit, release the connection back to the pool. """ clean_exit = False try: ...
[ "def", "_error_catcher", "(", "self", ")", ":", "clean_exit", "=", "False", "try", ":", "try", ":", "yield", "except", "SocketTimeout", ":", "# FIXME: Ideally we'd like to include the url in the ReadTimeoutError but", "# there is yet no clean way to get at it from this context.",...
Catch low-level python exceptions, instead re-raising urllib3 variants, so that low-level exceptions are not leaked in the high-level api. On exit, release the connection back to the pool.
[ "Catch", "low", "-", "level", "python", "exceptions", "instead", "re", "-", "raising", "urllib3", "variants", "so", "that", "low", "-", "level", "exceptions", "are", "not", "leaked", "in", "the", "high", "-", "level", "api", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L348-L402
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse.read
def read(self, amt=None, decode_content=None, cache_content=False): """ Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``. :param amt: How much of the content to read. If specified, caching is skipped ...
python
def read(self, amt=None, decode_content=None, cache_content=False): """ Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``. :param amt: How much of the content to read. If specified, caching is skipped ...
[ "def", "read", "(", "self", ",", "amt", "=", "None", ",", "decode_content", "=", "None", ",", "cache_content", "=", "False", ")", ":", "self", ".", "_init_decoder", "(", ")", "if", "decode_content", "is", "None", ":", "decode_content", "=", "self", ".", ...
Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to cache partial content as the full ...
[ "Similar", "to", ":", "meth", ":", "httplib", ".", "HTTPResponse", ".", "read", "but", "with", "two", "additional", "parameters", ":", "decode_content", "and", "cache_content", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L404-L471
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse.from_httplib
def from_httplib(ResponseCls, r, **response_kw): """ Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``. ...
python
def from_httplib(ResponseCls, r, **response_kw): """ Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``. ...
[ "def", "from_httplib", "(", "ResponseCls", ",", "r", ",", "*", "*", "response_kw", ")", ":", "headers", "=", "r", ".", "msg", "if", "not", "isinstance", "(", "headers", ",", "HTTPHeaderDict", ")", ":", "if", "PY3", ":", "# Python 3", "headers", "=", "H...
Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``.
[ "Given", "an", ":", "class", ":", "httplib", ".", "HTTPResponse", "instance", "r", "return", "a", "corresponding", ":", "class", ":", "urllib3", ".", "response", ".", "HTTPResponse", "object", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L500-L526
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse.read_chunked
def read_chunked(self, amt=None, decode_content=None): """ Similar to :meth:`HTTPResponse.read`, but with an additional parameter: ``decode_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to c...
python
def read_chunked(self, amt=None, decode_content=None): """ Similar to :meth:`HTTPResponse.read`, but with an additional parameter: ``decode_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to c...
[ "def", "read_chunked", "(", "self", ",", "amt", "=", "None", ",", "decode_content", "=", "None", ")", ":", "self", ".", "_init_decoder", "(", ")", "# FIXME: Rewrite this method and make it a class with a better structured logic.", "if", "not", "self", ".", "chunked", ...
Similar to :meth:`HTTPResponse.read`, but with an additional parameter: ``decode_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to cache partial content as the full response. :param deco...
[ "Similar", "to", ":", "meth", ":", "HTTPResponse", ".", "read", "but", "with", "an", "additional", "parameter", ":", "decode_content", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L629-L694
train
pypa/pipenv
pipenv/vendor/urllib3/response.py
HTTPResponse.geturl
def geturl(self): """ Returns the URL that was the source of this response. If the request that generated this response redirected, this method will return the final redirect location. """ if self.retries is not None and len(self.retries.history): return self....
python
def geturl(self): """ Returns the URL that was the source of this response. If the request that generated this response redirected, this method will return the final redirect location. """ if self.retries is not None and len(self.retries.history): return self....
[ "def", "geturl", "(", "self", ")", ":", "if", "self", ".", "retries", "is", "not", "None", "and", "len", "(", "self", ".", "retries", ".", "history", ")", ":", "return", "self", ".", "retries", ".", "history", "[", "-", "1", "]", ".", "redirect_loc...
Returns the URL that was the source of this response. If the request that generated this response redirected, this method will return the final redirect location.
[ "Returns", "the", "URL", "that", "was", "the", "source", "of", "this", "response", ".", "If", "the", "request", "that", "generated", "this", "response", "redirected", "this", "method", "will", "return", "the", "final", "redirect", "location", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/response.py#L696-L705
train
pypa/pipenv
pipenv/vendor/vistir/spin.py
VistirSpinner.ok
def ok(self, text=u"OK", err=False): """Set Ok (success) finalizer to a spinner.""" # Do not display spin text for ok state self._text = None _text = to_text(text) if text else u"OK" err = err or not self.write_to_stdout self._freeze(_text, err=err)
python
def ok(self, text=u"OK", err=False): """Set Ok (success) finalizer to a spinner.""" # Do not display spin text for ok state self._text = None _text = to_text(text) if text else u"OK" err = err or not self.write_to_stdout self._freeze(_text, err=err)
[ "def", "ok", "(", "self", ",", "text", "=", "u\"OK\"", ",", "err", "=", "False", ")", ":", "# Do not display spin text for ok state", "self", ".", "_text", "=", "None", "_text", "=", "to_text", "(", "text", ")", "if", "text", "else", "u\"OK\"", "err", "=...
Set Ok (success) finalizer to a spinner.
[ "Set", "Ok", "(", "success", ")", "finalizer", "to", "a", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/spin.py#L227-L234
train
pypa/pipenv
pipenv/vendor/vistir/spin.py
VistirSpinner.fail
def fail(self, text=u"FAIL", err=False): """Set fail finalizer to a spinner.""" # Do not display spin text for fail state self._text = None _text = text if text else u"FAIL" err = err or not self.write_to_stdout self._freeze(_text, err=err)
python
def fail(self, text=u"FAIL", err=False): """Set fail finalizer to a spinner.""" # Do not display spin text for fail state self._text = None _text = text if text else u"FAIL" err = err or not self.write_to_stdout self._freeze(_text, err=err)
[ "def", "fail", "(", "self", ",", "text", "=", "u\"FAIL\"", ",", "err", "=", "False", ")", ":", "# Do not display spin text for fail state", "self", ".", "_text", "=", "None", "_text", "=", "text", "if", "text", "else", "u\"FAIL\"", "err", "=", "err", "or",...
Set fail finalizer to a spinner.
[ "Set", "fail", "finalizer", "to", "a", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/spin.py#L236-L243
train
pypa/pipenv
pipenv/vendor/vistir/spin.py
VistirSpinner.write_err
def write_err(self, text): """Write error text in the terminal without breaking the spinner.""" stderr = self.stderr if self.stderr.closed: stderr = sys.stderr stderr.write(decode_output(u"\r", target_stream=stderr)) stderr.write(decode_output(CLEAR_LINE, target_strea...
python
def write_err(self, text): """Write error text in the terminal without breaking the spinner.""" stderr = self.stderr if self.stderr.closed: stderr = sys.stderr stderr.write(decode_output(u"\r", target_stream=stderr)) stderr.write(decode_output(CLEAR_LINE, target_strea...
[ "def", "write_err", "(", "self", ",", "text", ")", ":", "stderr", "=", "self", ".", "stderr", "if", "self", ".", "stderr", ".", "closed", ":", "stderr", "=", "sys", ".", "stderr", "stderr", ".", "write", "(", "decode_output", "(", "u\"\\r\"", ",", "t...
Write error text in the terminal without breaking the spinner.
[ "Write", "error", "text", "in", "the", "terminal", "without", "breaking", "the", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/spin.py#L270-L281
train
pypa/pipenv
pipenv/vendor/vistir/spin.py
VistirSpinner._freeze
def _freeze(self, final_text, err=False): """Stop spinner, compose last frame and 'freeze' it.""" if not final_text: final_text = "" target = self.stderr if err else self.stdout if target.closed: target = sys.stderr if err else sys.stdout text = to_text(fi...
python
def _freeze(self, final_text, err=False): """Stop spinner, compose last frame and 'freeze' it.""" if not final_text: final_text = "" target = self.stderr if err else self.stdout if target.closed: target = sys.stderr if err else sys.stdout text = to_text(fi...
[ "def", "_freeze", "(", "self", ",", "final_text", ",", "err", "=", "False", ")", ":", "if", "not", "final_text", ":", "final_text", "=", "\"\"", "target", "=", "self", ".", "stderr", "if", "err", "else", "self", ".", "stdout", "if", "target", ".", "c...
Stop spinner, compose last frame and 'freeze' it.
[ "Stop", "spinner", "compose", "last", "frame", "and", "freeze", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/spin.py#L318-L332
train
pypa/pipenv
pipenv/vendor/jinja2/lexer.py
describe_token_expr
def describe_token_expr(expr): """Like `describe_token` but for token expressions.""" if ':' in expr: type, value = expr.split(':', 1) if type == 'name': return value else: type = expr return _describe_token_type(type)
python
def describe_token_expr(expr): """Like `describe_token` but for token expressions.""" if ':' in expr: type, value = expr.split(':', 1) if type == 'name': return value else: type = expr return _describe_token_type(type)
[ "def", "describe_token_expr", "(", "expr", ")", ":", "if", "':'", "in", "expr", ":", "type", ",", "value", "=", "expr", ".", "split", "(", "':'", ",", "1", ")", "if", "type", "==", "'name'", ":", "return", "value", "else", ":", "type", "=", "expr",...
Like `describe_token` but for token expressions.
[ "Like", "describe_token", "but", "for", "token", "expressions", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/lexer.py#L178-L186
train
pypa/pipenv
pipenv/vendor/jinja2/lexer.py
get_lexer
def get_lexer(environment): """Return a lexer which is probably cached.""" key = (environment.block_start_string, environment.block_end_string, environment.variable_start_string, environment.variable_end_string, environment.comment_start_string, environment...
python
def get_lexer(environment): """Return a lexer which is probably cached.""" key = (environment.block_start_string, environment.block_end_string, environment.variable_start_string, environment.variable_end_string, environment.comment_start_string, environment...
[ "def", "get_lexer", "(", "environment", ")", ":", "key", "=", "(", "environment", ".", "block_start_string", ",", "environment", ".", "block_end_string", ",", "environment", ".", "variable_start_string", ",", "environment", ".", "variable_end_string", ",", "environm...
Return a lexer which is probably cached.
[ "Return", "a", "lexer", "which", "is", "probably", "cached", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/lexer.py#L391-L409
train
pypa/pipenv
pipenv/vendor/jinja2/lexer.py
Lexer.tokenize
def tokenize(self, source, name=None, filename=None, state=None): """Calls tokeniter + tokenize and wraps it in a token stream. """ stream = self.tokeniter(source, name, filename, state) return TokenStream(self.wrap(stream, name, filename), name, filename)
python
def tokenize(self, source, name=None, filename=None, state=None): """Calls tokeniter + tokenize and wraps it in a token stream. """ stream = self.tokeniter(source, name, filename, state) return TokenStream(self.wrap(stream, name, filename), name, filename)
[ "def", "tokenize", "(", "self", ",", "source", ",", "name", "=", "None", ",", "filename", "=", "None", ",", "state", "=", "None", ")", ":", "stream", "=", "self", ".", "tokeniter", "(", "source", ",", "name", ",", "filename", ",", "state", ")", "re...
Calls tokeniter + tokenize and wraps it in a token stream.
[ "Calls", "tokeniter", "+", "tokenize", "and", "wraps", "it", "in", "a", "token", "stream", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/lexer.py#L552-L556
train
pypa/pipenv
pipenv/vendor/jinja2/lexer.py
Lexer.wrap
def wrap(self, stream, name=None, filename=None): """This is called with the stream as returned by `tokenize` and wraps every token in a :class:`Token` and converts the value. """ for lineno, token, value in stream: if token in ignored_tokens: continue ...
python
def wrap(self, stream, name=None, filename=None): """This is called with the stream as returned by `tokenize` and wraps every token in a :class:`Token` and converts the value. """ for lineno, token, value in stream: if token in ignored_tokens: continue ...
[ "def", "wrap", "(", "self", ",", "stream", ",", "name", "=", "None", ",", "filename", "=", "None", ")", ":", "for", "lineno", ",", "token", ",", "value", "in", "stream", ":", "if", "token", "in", "ignored_tokens", ":", "continue", "elif", "token", "=...
This is called with the stream as returned by `tokenize` and wraps every token in a :class:`Token` and converts the value.
[ "This", "is", "called", "with", "the", "stream", "as", "returned", "by", "tokenize", "and", "wraps", "every", "token", "in", "a", ":", "class", ":", "Token", "and", "converts", "the", "value", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/lexer.py#L558-L597
train
pypa/pipenv
pipenv/patched/notpip/_internal/pyproject.py
load_pyproject_toml
def load_pyproject_toml( use_pep517, # type: Optional[bool] pyproject_toml, # type: str setup_py, # type: str req_name # type: str ): # type: (...) -> Optional[Tuple[List[str], str, List[str]]] """Load the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP ...
python
def load_pyproject_toml( use_pep517, # type: Optional[bool] pyproject_toml, # type: str setup_py, # type: str req_name # type: str ): # type: (...) -> Optional[Tuple[List[str], str, List[str]]] """Load the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP ...
[ "def", "load_pyproject_toml", "(", "use_pep517", ",", "# type: Optional[bool]", "pyproject_toml", ",", "# type: str", "setup_py", ",", "# type: str", "req_name", "# type: str", ")", ":", "# type: (...) -> Optional[Tuple[List[str], str, List[str]]]", "has_pyproject", "=", "os", ...
Load the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing? None means the user hasn't explicitly specified. pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file r...
[ "Load", "the", "pyproject", ".", "toml", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pyproject.py#L35-L171
train
pypa/pipenv
pipenv/pyenv.py
Runner.iter_installable_versions
def iter_installable_versions(self): """Iterate through CPython versions available for Pipenv to install. """ for name in self._pyenv('install', '--list').out.splitlines(): try: version = Version.parse(name.strip()) except ValueError: conti...
python
def iter_installable_versions(self): """Iterate through CPython versions available for Pipenv to install. """ for name in self._pyenv('install', '--list').out.splitlines(): try: version = Version.parse(name.strip()) except ValueError: conti...
[ "def", "iter_installable_versions", "(", "self", ")", ":", "for", "name", "in", "self", ".", "_pyenv", "(", "'install'", ",", "'--list'", ")", ".", "out", ".", "splitlines", "(", ")", ":", "try", ":", "version", "=", "Version", ".", "parse", "(", "name...
Iterate through CPython versions available for Pipenv to install.
[ "Iterate", "through", "CPython", "versions", "available", "for", "Pipenv", "to", "install", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/pyenv.py#L75-L83
train
pypa/pipenv
pipenv/pyenv.py
Runner.find_version_to_install
def find_version_to_install(self, name): """Find a version in pyenv from the version supplied. A ValueError is raised if a matching version cannot be found. """ version = Version.parse(name) if version.patch is not None: return name try: best_matc...
python
def find_version_to_install(self, name): """Find a version in pyenv from the version supplied. A ValueError is raised if a matching version cannot be found. """ version = Version.parse(name) if version.patch is not None: return name try: best_matc...
[ "def", "find_version_to_install", "(", "self", ",", "name", ")", ":", "version", "=", "Version", ".", "parse", "(", "name", ")", "if", "version", ".", "patch", "is", "not", "None", ":", "return", "name", "try", ":", "best_match", "=", "max", "(", "(", ...
Find a version in pyenv from the version supplied. A ValueError is raised if a matching version cannot be found.
[ "Find", "a", "version", "in", "pyenv", "from", "the", "version", "supplied", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/pyenv.py#L85-L103
train
pypa/pipenv
pipenv/pyenv.py
Runner.install
def install(self, version): """Install the given version with pyenv. The version must be a ``Version`` instance representing a version found in pyenv. A ValueError is raised if the given version does not have a match in pyenv. A PyenvError is raised if the pyenv command fails. ...
python
def install(self, version): """Install the given version with pyenv. The version must be a ``Version`` instance representing a version found in pyenv. A ValueError is raised if the given version does not have a match in pyenv. A PyenvError is raised if the pyenv command fails. ...
[ "def", "install", "(", "self", ",", "version", ")", ":", "c", "=", "self", ".", "_pyenv", "(", "'install'", ",", "'-s'", ",", "str", "(", "version", ")", ",", "timeout", "=", "PIPENV_INSTALL_TIMEOUT", ",", ")", "return", "c" ]
Install the given version with pyenv. The version must be a ``Version`` instance representing a version found in pyenv. A ValueError is raised if the given version does not have a match in pyenv. A PyenvError is raised if the pyenv command fails.
[ "Install", "the", "given", "version", "with", "pyenv", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/pyenv.py#L105-L118
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/constructors.py
parse_editable
def parse_editable(editable_req): # type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]] """Parses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirecto...
python
def parse_editable(editable_req): # type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]] """Parses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirecto...
[ "def", "parse_editable", "(", "editable_req", ")", ":", "# type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]", "url", "=", "editable_req", "# If a file path is specified with extras, strip off the extras.", "url_no_extras", ",", "extras", "=", "_strip_extras", "(", "url"...
Parses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir .[some_extra]
[ "Parses", "an", "editable", "requirement", "into", ":", "-", "a", "requirement", "name", "-", "an", "URL", "-", "extras", "-", "editable", "options", "Accepted", "requirements", ":", "svn", "+", "http", ":", "//", "blahblah" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/constructors.py#L62-L133
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/constructors.py
deduce_helpful_msg
def deduce_helpful_msg(req): # type: (str) -> str """Returns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path """ msg = "" if os.path.exists(req): msg = " It does exist." # Try to parse and check if it is a requir...
python
def deduce_helpful_msg(req): # type: (str) -> str """Returns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path """ msg = "" if os.path.exists(req): msg = " It does exist." # Try to parse and check if it is a requir...
[ "def", "deduce_helpful_msg", "(", "req", ")", ":", "# type: (str) -> str", "msg", "=", "\"\"", "if", "os", ".", "path", ".", "exists", "(", "req", ")", ":", "msg", "=", "\" It does exist.\"", "# Try to parse and check if it is a requirements file.", "try", ":", "w...
Returns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path
[ "Returns", "helpful", "msg", "in", "case", "requirements", "file", "does", "not", "exist", "or", "cannot", "be", "parsed", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/constructors.py#L136-L161
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/constructors.py
install_req_from_line
def install_req_from_line( name, # type: str comes_from=None, # type: Optional[Union[str, InstallRequirement]] use_pep517=None, # type: Optional[bool] isolated=False, # type: bool options=None, # type: Optional[Dict[str, Any]] wheel_cache=None, # type: Optional[WheelCache] constraint=F...
python
def install_req_from_line( name, # type: str comes_from=None, # type: Optional[Union[str, InstallRequirement]] use_pep517=None, # type: Optional[bool] isolated=False, # type: bool options=None, # type: Optional[Dict[str, Any]] wheel_cache=None, # type: Optional[WheelCache] constraint=F...
[ "def", "install_req_from_line", "(", "name", ",", "# type: str", "comes_from", "=", "None", ",", "# type: Optional[Union[str, InstallRequirement]]", "use_pep517", "=", "None", ",", "# type: Optional[bool]", "isolated", "=", "False", ",", "# type: bool", "options", "=", ...
Creates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL.
[ "Creates", "an", "InstallRequirement", "from", "a", "name", "which", "might", "be", "a", "requirement", "directory", "containing", "setup", ".", "py", "filename", "or", "URL", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/constructors.py#L203-L308
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/caches/file_cache.py
url_to_file_path
def url_to_file_path(url, filecache): """Return the file cache path based on the URL. This does not ensure the file exists! """ key = CacheController.cache_url(url) return filecache._fn(key)
python
def url_to_file_path(url, filecache): """Return the file cache path based on the URL. This does not ensure the file exists! """ key = CacheController.cache_url(url) return filecache._fn(key)
[ "def", "url_to_file_path", "(", "url", ",", "filecache", ")", ":", "key", "=", "CacheController", ".", "cache_url", "(", "url", ")", "return", "filecache", ".", "_fn", "(", "key", ")" ]
Return the file cache path based on the URL. This does not ensure the file exists!
[ "Return", "the", "file", "cache", "path", "based", "on", "the", "URL", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/caches/file_cache.py#L140-L146
train
pypa/pipenv
pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py
write_pid_to_pidfile
def write_pid_to_pidfile(pidfile_path): """ Write the PID in the named PID file. Get the numeric process ID (“PID”) of the current process and write it to the named file as a line of text. """ open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY) open_mode = 0o644 pidfile_fd = os...
python
def write_pid_to_pidfile(pidfile_path): """ Write the PID in the named PID file. Get the numeric process ID (“PID”) of the current process and write it to the named file as a line of text. """ open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY) open_mode = 0o644 pidfile_fd = os...
[ "def", "write_pid_to_pidfile", "(", "pidfile_path", ")", ":", "open_flags", "=", "(", "os", ".", "O_CREAT", "|", "os", ".", "O_EXCL", "|", "os", ".", "O_WRONLY", ")", "open_mode", "=", "0o644", "pidfile_fd", "=", "os", ".", "open", "(", "pidfile_path", "...
Write the PID in the named PID file. Get the numeric process ID (“PID”) of the current process and write it to the named file as a line of text.
[ "Write", "the", "PID", "in", "the", "named", "PID", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py#L152-L173
train
pypa/pipenv
pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py
remove_existing_pidfile
def remove_existing_pidfile(pidfile_path): """ Remove the named PID file if it exists. Removing a PID file that doesn't already exist puts us in the desired state, so we ignore the condition if the file does not exist. """ try: os.remove(pidfile_path) except OSError...
python
def remove_existing_pidfile(pidfile_path): """ Remove the named PID file if it exists. Removing a PID file that doesn't already exist puts us in the desired state, so we ignore the condition if the file does not exist. """ try: os.remove(pidfile_path) except OSError...
[ "def", "remove_existing_pidfile", "(", "pidfile_path", ")", ":", "try", ":", "os", ".", "remove", "(", "pidfile_path", ")", "except", "OSError", "as", "exc", ":", "if", "exc", ".", "errno", "==", "errno", ".", "ENOENT", ":", "pass", "else", ":", "raise" ...
Remove the named PID file if it exists. Removing a PID file that doesn't already exist puts us in the desired state, so we ignore the condition if the file does not exist.
[ "Remove", "the", "named", "PID", "file", "if", "it", "exists", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py#L176-L190
train
pypa/pipenv
pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py
PIDLockFile.release
def release(self): """ Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock. """ if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) if not self.i_am_loc...
python
def release(self): """ Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock. """ if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) if not self.i_am_loc...
[ "def", "release", "(", "self", ")", ":", "if", "not", "self", ".", "is_locked", "(", ")", ":", "raise", "NotLocked", "(", "\"%s is not locked\"", "%", "self", ".", "path", ")", "if", "not", "self", ".", "i_am_locking", "(", ")", ":", "raise", "NotMyLoc...
Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock.
[ "Release", "the", "lock", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py#L95-L106
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/bazaar.py
Bazaar.export
def export(self, location): """ Export the Bazaar repository at the url to the destination location """ # Remove the location to make sure Bazaar can export it correctly if os.path.exists(location): rmtree(location) with TempDirectory(kind="export") as temp_d...
python
def export(self, location): """ Export the Bazaar repository at the url to the destination location """ # Remove the location to make sure Bazaar can export it correctly if os.path.exists(location): rmtree(location) with TempDirectory(kind="export") as temp_d...
[ "def", "export", "(", "self", ",", "location", ")", ":", "# Remove the location to make sure Bazaar can export it correctly", "if", "os", ".", "path", ".", "exists", "(", "location", ")", ":", "rmtree", "(", "location", ")", "with", "TempDirectory", "(", "kind", ...
Export the Bazaar repository at the url to the destination location
[ "Export", "the", "Bazaar", "repository", "at", "the", "url", "to", "the", "destination", "location" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/bazaar.py#L37-L51
train
pypa/pipenv
pipenv/patched/notpip/_internal/commands/show.py
search_packages_info
def search_packages_info(query): """ Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. """ installed = {} for p in pkg_re...
python
def search_packages_info(query): """ Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. """ installed = {} for p in pkg_re...
[ "def", "search_packages_info", "(", "query", ")", ":", "installed", "=", "{", "}", "for", "p", "in", "pkg_resources", ".", "working_set", ":", "installed", "[", "canonicalize_name", "(", "p", ".", "project_name", ")", "]", "=", "p", "query_names", "=", "["...
Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory.
[ "Gather", "details", "from", "installed", "distributions", ".", "Print", "distribution", "name", "version", "location", "and", "installed", "files", ".", "Installed", "files", "requires", "a", "pip", "generated", "installed", "-", "files", ".", "txt", "in", "the...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/show.py#L52-L122
train
pypa/pipenv
pipenv/patched/notpip/_internal/commands/show.py
print_results
def print_results(distributions, list_files=False, verbose=False): """ Print the informations from installed distributions found. """ results_printed = False for i, dist in enumerate(distributions): results_printed = True if i > 0: logger.info("---") name = dist....
python
def print_results(distributions, list_files=False, verbose=False): """ Print the informations from installed distributions found. """ results_printed = False for i, dist in enumerate(distributions): results_printed = True if i > 0: logger.info("---") name = dist....
[ "def", "print_results", "(", "distributions", ",", "list_files", "=", "False", ",", "verbose", "=", "False", ")", ":", "results_printed", "=", "False", "for", "i", ",", "dist", "in", "enumerate", "(", "distributions", ")", ":", "results_printed", "=", "True"...
Print the informations from installed distributions found.
[ "Print", "the", "informations", "from", "installed", "distributions", "found", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/show.py#L125-L168
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.fail
def fail(self, msg, lineno=None, exc=TemplateSyntaxError): """Convenience method that raises `exc` with the message, passed line number or last line number as well as the current name and filename. """ if lineno is None: lineno = self.stream.current.lineno rai...
python
def fail(self, msg, lineno=None, exc=TemplateSyntaxError): """Convenience method that raises `exc` with the message, passed line number or last line number as well as the current name and filename. """ if lineno is None: lineno = self.stream.current.lineno rai...
[ "def", "fail", "(", "self", ",", "msg", ",", "lineno", "=", "None", ",", "exc", "=", "TemplateSyntaxError", ")", ":", "if", "lineno", "is", "None", ":", "lineno", "=", "self", ".", "stream", ".", "current", ".", "lineno", "raise", "exc", "(", "msg", ...
Convenience method that raises `exc` with the message, passed line number or last line number as well as the current name and filename.
[ "Convenience", "method", "that", "raises", "exc", "with", "the", "message", "passed", "line", "number", "or", "last", "line", "number", "as", "well", "as", "the", "current", "name", "and", "filename", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L52-L59
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.fail_unknown_tag
def fail_unknown_tag(self, name, lineno=None): """Called if the parser encounters an unknown tag. Tries to fail with a human readable error message that could help to identify the problem. """ return self._fail_ut_eof(name, self._end_token_stack, lineno)
python
def fail_unknown_tag(self, name, lineno=None): """Called if the parser encounters an unknown tag. Tries to fail with a human readable error message that could help to identify the problem. """ return self._fail_ut_eof(name, self._end_token_stack, lineno)
[ "def", "fail_unknown_tag", "(", "self", ",", "name", ",", "lineno", "=", "None", ")", ":", "return", "self", ".", "_fail_ut_eof", "(", "name", ",", "self", ".", "_end_token_stack", ",", "lineno", ")" ]
Called if the parser encounters an unknown tag. Tries to fail with a human readable error message that could help to identify the problem.
[ "Called", "if", "the", "parser", "encounters", "an", "unknown", "tag", ".", "Tries", "to", "fail", "with", "a", "human", "readable", "error", "message", "that", "could", "help", "to", "identify", "the", "problem", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L92-L97
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.fail_eof
def fail_eof(self, end_tokens=None, lineno=None): """Like fail_unknown_tag but for end of template situations.""" stack = list(self._end_token_stack) if end_tokens is not None: stack.append(end_tokens) return self._fail_ut_eof(None, stack, lineno)
python
def fail_eof(self, end_tokens=None, lineno=None): """Like fail_unknown_tag but for end of template situations.""" stack = list(self._end_token_stack) if end_tokens is not None: stack.append(end_tokens) return self._fail_ut_eof(None, stack, lineno)
[ "def", "fail_eof", "(", "self", ",", "end_tokens", "=", "None", ",", "lineno", "=", "None", ")", ":", "stack", "=", "list", "(", "self", ".", "_end_token_stack", ")", "if", "end_tokens", "is", "not", "None", ":", "stack", ".", "append", "(", "end_token...
Like fail_unknown_tag but for end of template situations.
[ "Like", "fail_unknown_tag", "but", "for", "end", "of", "template", "situations", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L99-L104
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.is_tuple_end
def is_tuple_end(self, extra_end_rules=None): """Are we at the end of a tuple?""" if self.stream.current.type in ('variable_end', 'block_end', 'rparen'): return True elif extra_end_rules is not None: return self.stream.current.test_any(extra_end_rules) return Fals...
python
def is_tuple_end(self, extra_end_rules=None): """Are we at the end of a tuple?""" if self.stream.current.type in ('variable_end', 'block_end', 'rparen'): return True elif extra_end_rules is not None: return self.stream.current.test_any(extra_end_rules) return Fals...
[ "def", "is_tuple_end", "(", "self", ",", "extra_end_rules", "=", "None", ")", ":", "if", "self", ".", "stream", ".", "current", ".", "type", "in", "(", "'variable_end'", ",", "'block_end'", ",", "'rparen'", ")", ":", "return", "True", "elif", "extra_end_ru...
Are we at the end of a tuple?
[ "Are", "we", "at", "the", "end", "of", "a", "tuple?" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L106-L112
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.free_identifier
def free_identifier(self, lineno=None): """Return a new free identifier as :class:`~jinja2.nodes.InternalName`.""" self._last_identifier += 1 rv = object.__new__(nodes.InternalName) nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno) return rv
python
def free_identifier(self, lineno=None): """Return a new free identifier as :class:`~jinja2.nodes.InternalName`.""" self._last_identifier += 1 rv = object.__new__(nodes.InternalName) nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno) return rv
[ "def", "free_identifier", "(", "self", ",", "lineno", "=", "None", ")", ":", "self", ".", "_last_identifier", "+=", "1", "rv", "=", "object", ".", "__new__", "(", "nodes", ".", "InternalName", ")", "nodes", ".", "Node", ".", "__init__", "(", "rv", ",",...
Return a new free identifier as :class:`~jinja2.nodes.InternalName`.
[ "Return", "a", "new", "free", "identifier", "as", ":", "class", ":", "~jinja2", ".", "nodes", ".", "InternalName", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L114-L119
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse_statement
def parse_statement(self): """Parse a single statement.""" token = self.stream.current if token.type != 'name': self.fail('tag name expected', token.lineno) self._tag_stack.append(token.value) pop_tag = True try: if token.value in _statement_keywor...
python
def parse_statement(self): """Parse a single statement.""" token = self.stream.current if token.type != 'name': self.fail('tag name expected', token.lineno) self._tag_stack.append(token.value) pop_tag = True try: if token.value in _statement_keywor...
[ "def", "parse_statement", "(", "self", ")", ":", "token", "=", "self", ".", "stream", ".", "current", "if", "token", ".", "type", "!=", "'name'", ":", "self", ".", "fail", "(", "'tag name expected'", ",", "token", ".", "lineno", ")", "self", ".", "_tag...
Parse a single statement.
[ "Parse", "a", "single", "statement", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L121-L147
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse_statements
def parse_statements(self, end_tokens, drop_needle=False): """Parse multiple statements into a list until one of the end tokens is reached. This is used to parse the body of statements as it also parses template data if appropriate. The parser checks first if the current token is a col...
python
def parse_statements(self, end_tokens, drop_needle=False): """Parse multiple statements into a list until one of the end tokens is reached. This is used to parse the body of statements as it also parses template data if appropriate. The parser checks first if the current token is a col...
[ "def", "parse_statements", "(", "self", ",", "end_tokens", ",", "drop_needle", "=", "False", ")", ":", "# the first token may be a colon for python compatibility", "self", ".", "stream", ".", "skip_if", "(", "'colon'", ")", "# in the future it would be possible to add whole...
Parse multiple statements into a list until one of the end tokens is reached. This is used to parse the body of statements as it also parses template data if appropriate. The parser checks first if the current token is a colon and skips it if there is one. Then it checks for the block...
[ "Parse", "multiple", "statements", "into", "a", "list", "until", "one", "of", "the", "end", "tokens", "is", "reached", ".", "This", "is", "used", "to", "parse", "the", "body", "of", "statements", "as", "it", "also", "parses", "template", "data", "if", "a...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L149-L174
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse_set
def parse_set(self): """Parse an assign statement.""" lineno = next(self.stream).lineno target = self.parse_assign_target(with_namespace=True) if self.stream.skip_if('assign'): expr = self.parse_tuple() return nodes.Assign(target, expr, lineno=lineno) filt...
python
def parse_set(self): """Parse an assign statement.""" lineno = next(self.stream).lineno target = self.parse_assign_target(with_namespace=True) if self.stream.skip_if('assign'): expr = self.parse_tuple() return nodes.Assign(target, expr, lineno=lineno) filt...
[ "def", "parse_set", "(", "self", ")", ":", "lineno", "=", "next", "(", "self", ".", "stream", ")", ".", "lineno", "target", "=", "self", ".", "parse_assign_target", "(", "with_namespace", "=", "True", ")", "if", "self", ".", "stream", ".", "skip_if", "...
Parse an assign statement.
[ "Parse", "an", "assign", "statement", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L176-L186
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse_for
def parse_for(self): """Parse a for loop.""" lineno = self.stream.expect('name:for').lineno target = self.parse_assign_target(extra_end_rules=('name:in',)) self.stream.expect('name:in') iter = self.parse_tuple(with_condexpr=False, extra_end_rules=(...
python
def parse_for(self): """Parse a for loop.""" lineno = self.stream.expect('name:for').lineno target = self.parse_assign_target(extra_end_rules=('name:in',)) self.stream.expect('name:in') iter = self.parse_tuple(with_condexpr=False, extra_end_rules=(...
[ "def", "parse_for", "(", "self", ")", ":", "lineno", "=", "self", ".", "stream", ".", "expect", "(", "'name:for'", ")", ".", "lineno", "target", "=", "self", ".", "parse_assign_target", "(", "extra_end_rules", "=", "(", "'name:in'", ",", ")", ")", "self"...
Parse a for loop.
[ "Parse", "a", "for", "loop", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L188-L205
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse_if
def parse_if(self): """Parse an if construct.""" node = result = nodes.If(lineno=self.stream.expect('name:if').lineno) while 1: node.test = self.parse_tuple(with_condexpr=False) node.body = self.parse_statements(('name:elif', 'name:else', ...
python
def parse_if(self): """Parse an if construct.""" node = result = nodes.If(lineno=self.stream.expect('name:if').lineno) while 1: node.test = self.parse_tuple(with_condexpr=False) node.body = self.parse_statements(('name:elif', 'name:else', ...
[ "def", "parse_if", "(", "self", ")", ":", "node", "=", "result", "=", "nodes", ".", "If", "(", "lineno", "=", "self", ".", "stream", ".", "expect", "(", "'name:if'", ")", ".", "lineno", ")", "while", "1", ":", "node", ".", "test", "=", "self", "....
Parse an if construct.
[ "Parse", "an", "if", "construct", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L207-L225
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse_assign_target
def parse_assign_target(self, with_tuple=True, name_only=False, extra_end_rules=None, with_namespace=False): """Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tup...
python
def parse_assign_target(self, with_tuple=True, name_only=False, extra_end_rules=None, with_namespace=False): """Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tup...
[ "def", "parse_assign_target", "(", "self", ",", "with_tuple", "=", "True", ",", "name_only", "=", "False", ",", "extra_end_rules", "=", "None", ",", "with_namespace", "=", "False", ")", ":", "if", "with_namespace", "and", "self", ".", "stream", ".", "look", ...
Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that can be disable however by setting `with_tuple` to `False`. If only assignments to names are wanted `name_only`...
[ "Parse", "an", "assignment", "target", ".", "As", "Jinja2", "allows", "assignments", "to", "tuples", "this", "function", "can", "parse", "all", "allowed", "assignment", "targets", ".", "Per", "default", "assignments", "to", "tuples", "are", "parsed", "that", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L396-L424
train
pypa/pipenv
pipenv/vendor/jinja2/parser.py
Parser.parse
def parse(self): """Parse the whole template into a `Template` node.""" result = nodes.Template(self.subparse(), lineno=1) result.set_environment(self.environment) return result
python
def parse(self): """Parse the whole template into a `Template` node.""" result = nodes.Template(self.subparse(), lineno=1) result.set_environment(self.environment) return result
[ "def", "parse", "(", "self", ")", ":", "result", "=", "nodes", ".", "Template", "(", "self", ".", "subparse", "(", ")", ",", "lineno", "=", "1", ")", "result", ".", "set_environment", "(", "self", ".", "environment", ")", "return", "result" ]
Parse the whole template into a `Template` node.
[ "Parse", "the", "whole", "template", "into", "a", "Template", "node", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L899-L903
train
pypa/pipenv
pipenv/vendor/pexpect/exceptions.py
ExceptionPexpect.get_trace
def get_trace(self): '''This returns an abbreviated stack trace with lines that only concern the caller. In other words, the stack trace inside the Pexpect module is not included. ''' tblist = traceback.extract_tb(sys.exc_info()[2]) tblist = [item for item in tblist if ('pexpect...
python
def get_trace(self): '''This returns an abbreviated stack trace with lines that only concern the caller. In other words, the stack trace inside the Pexpect module is not included. ''' tblist = traceback.extract_tb(sys.exc_info()[2]) tblist = [item for item in tblist if ('pexpect...
[ "def", "get_trace", "(", "self", ")", ":", "tblist", "=", "traceback", ".", "extract_tb", "(", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ")", "tblist", "=", "[", "item", "for", "item", "in", "tblist", "if", "(", "'pexpect/__init__'", "not", "i...
This returns an abbreviated stack trace with lines that only concern the caller. In other words, the stack trace inside the Pexpect module is not included.
[ "This", "returns", "an", "abbreviated", "stack", "trace", "with", "lines", "that", "only", "concern", "the", "caller", ".", "In", "other", "words", "the", "stack", "trace", "inside", "the", "Pexpect", "module", "is", "not", "included", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/exceptions.py#L17-L26
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/controller.py
parse_uri
def parse_uri(uri): """Parses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) """ groups = URI.match(uri).groups() return (groups[1], groups[3], groups[4], groups[6], groups[8])
python
def parse_uri(uri): """Parses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) """ groups = URI.match(uri).groups() return (groups[1], groups[3], groups[4], groups[6], groups[8])
[ "def", "parse_uri", "(", "uri", ")", ":", "groups", "=", "URI", ".", "match", "(", "uri", ")", ".", "groups", "(", ")", "return", "(", "groups", "[", "1", "]", ",", "groups", "[", "3", "]", ",", "groups", "[", "4", "]", ",", "groups", "[", "6...
Parses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri)
[ "Parses", "a", "URI", "using", "the", "regex", "given", "in", "Appendix", "B", "of", "RFC", "3986", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L21-L27
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/controller.py
CacheController._urlnorm
def _urlnorm(cls, uri): """Normalize the URL to create a safe key for the cache""" (scheme, authority, path, query, fragment) = parse_uri(uri) if not scheme or not authority: raise Exception("Only absolute URIs are allowed. uri = %s" % uri) scheme = scheme.lower() au...
python
def _urlnorm(cls, uri): """Normalize the URL to create a safe key for the cache""" (scheme, authority, path, query, fragment) = parse_uri(uri) if not scheme or not authority: raise Exception("Only absolute URIs are allowed. uri = %s" % uri) scheme = scheme.lower() au...
[ "def", "_urlnorm", "(", "cls", ",", "uri", ")", ":", "(", "scheme", ",", "authority", ",", "path", ",", "query", ",", "fragment", ")", "=", "parse_uri", "(", "uri", ")", "if", "not", "scheme", "or", "not", "authority", ":", "raise", "Exception", "(",...
Normalize the URL to create a safe key for the cache
[ "Normalize", "the", "URL", "to", "create", "a", "safe", "key", "for", "the", "cache" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L43-L60
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/controller.py
CacheController.cached_request
def cached_request(self, request): """ Return a cached response if it exists in the cache, otherwise return False. """ cache_url = self.cache_url(request.url) logger.debug('Looking up "%s" in the cache', cache_url) cc = self.parse_cache_control(request.headers) ...
python
def cached_request(self, request): """ Return a cached response if it exists in the cache, otherwise return False. """ cache_url = self.cache_url(request.url) logger.debug('Looking up "%s" in the cache', cache_url) cc = self.parse_cache_control(request.headers) ...
[ "def", "cached_request", "(", "self", ",", "request", ")", ":", "cache_url", "=", "self", ".", "cache_url", "(", "request", ".", "url", ")", "logger", ".", "debug", "(", "'Looking up \"%s\" in the cache'", ",", "cache_url", ")", "cc", "=", "self", ".", "pa...
Return a cached response if it exists in the cache, otherwise return False.
[ "Return", "a", "cached", "response", "if", "it", "exists", "in", "the", "cache", "otherwise", "return", "False", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L120-L229
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/controller.py
CacheController.cache_response
def cache_response(self, request, response, body=None, status_codes=None): """ Algorithm for caching requests. This assumes a requests Response object. """ # From httplib2: Don't cache 206's since we aren't going to # handle byte range requests cac...
python
def cache_response(self, request, response, body=None, status_codes=None): """ Algorithm for caching requests. This assumes a requests Response object. """ # From httplib2: Don't cache 206's since we aren't going to # handle byte range requests cac...
[ "def", "cache_response", "(", "self", ",", "request", ",", "response", ",", "body", "=", "None", ",", "status_codes", "=", "None", ")", ":", "# From httplib2: Don't cache 206's since we aren't going to", "# handle byte range requests", "cacheable_status_codes",...
Algorithm for caching requests. This assumes a requests Response object.
[ "Algorithm", "for", "caching", "requests", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L247-L327
train
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/controller.py
CacheController.update_cached_response
def update_cached_response(self, request, response): """On a 304 we will get a new set of headers that we want to update our cached value with, assuming we have one. This should only ever be called when we've sent an ETag and gotten a 304 as the response. """ cache_url =...
python
def update_cached_response(self, request, response): """On a 304 we will get a new set of headers that we want to update our cached value with, assuming we have one. This should only ever be called when we've sent an ETag and gotten a 304 as the response. """ cache_url =...
[ "def", "update_cached_response", "(", "self", ",", "request", ",", "response", ")", ":", "cache_url", "=", "self", ".", "cache_url", "(", "request", ".", "url", ")", "cached_response", "=", "self", ".", "serializer", ".", "loads", "(", "request", ",", "sel...
On a 304 we will get a new set of headers that we want to update our cached value with, assuming we have one. This should only ever be called when we've sent an ETag and gotten a 304 as the response.
[ "On", "a", "304", "we", "will", "get", "a", "new", "set", "of", "headers", "that", "we", "want", "to", "update", "our", "cached", "value", "with", "assuming", "we", "have", "one", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L329-L367
train
pypa/pipenv
pipenv/vendor/pexpect/fdpexpect.py
fdspawn.close
def close (self): """Close the file descriptor. Calling this method a second time does nothing, but if the file descriptor was closed elsewhere, :class:`OSError` will be raised. """ if self.child_fd == -1: return self.flush() os.close(self.child_fd) ...
python
def close (self): """Close the file descriptor. Calling this method a second time does nothing, but if the file descriptor was closed elsewhere, :class:`OSError` will be raised. """ if self.child_fd == -1: return self.flush() os.close(self.child_fd) ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "child_fd", "==", "-", "1", ":", "return", "self", ".", "flush", "(", ")", "os", ".", "close", "(", "self", ".", "child_fd", ")", "self", ".", "child_fd", "=", "-", "1", "self", ".", "cl...
Close the file descriptor. Calling this method a second time does nothing, but if the file descriptor was closed elsewhere, :class:`OSError` will be raised.
[ "Close", "the", "file", "descriptor", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L63-L75
train
pypa/pipenv
pipenv/vendor/pexpect/fdpexpect.py
fdspawn.isalive
def isalive (self): '''This checks if the file descriptor is still valid. If :func:`os.fstat` does not raise an exception then we assume it is alive. ''' if self.child_fd == -1: return False try: os.fstat(self.child_fd) return True except: ...
python
def isalive (self): '''This checks if the file descriptor is still valid. If :func:`os.fstat` does not raise an exception then we assume it is alive. ''' if self.child_fd == -1: return False try: os.fstat(self.child_fd) return True except: ...
[ "def", "isalive", "(", "self", ")", ":", "if", "self", ".", "child_fd", "==", "-", "1", ":", "return", "False", "try", ":", "os", ".", "fstat", "(", "self", ".", "child_fd", ")", "return", "True", "except", ":", "return", "False" ]
This checks if the file descriptor is still valid. If :func:`os.fstat` does not raise an exception then we assume it is alive.
[ "This", "checks", "if", "the", "file", "descriptor", "is", "still", "valid", ".", "If", ":", "func", ":", "os", ".", "fstat", "does", "not", "raise", "an", "exception", "then", "we", "assume", "it", "is", "alive", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L77-L87
train
pypa/pipenv
pipenv/vendor/pexpect/fdpexpect.py
fdspawn.read_nonblocking
def read_nonblocking(self, size=1, timeout=-1): """ Read from the file descriptor and return the result as a string. The read_nonblocking method of :class:`SpawnBase` assumes that a call to os.read will not block (timeout parameter is ignored). This is not the case for POSIX fil...
python
def read_nonblocking(self, size=1, timeout=-1): """ Read from the file descriptor and return the result as a string. The read_nonblocking method of :class:`SpawnBase` assumes that a call to os.read will not block (timeout parameter is ignored). This is not the case for POSIX fil...
[ "def", "read_nonblocking", "(", "self", ",", "size", "=", "1", ",", "timeout", "=", "-", "1", ")", ":", "if", "os", ".", "name", "==", "'posix'", ":", "if", "timeout", "==", "-", "1", ":", "timeout", "=", "self", ".", "timeout", "rlist", "=", "["...
Read from the file descriptor and return the result as a string. The read_nonblocking method of :class:`SpawnBase` assumes that a call to os.read will not block (timeout parameter is ignored). This is not the case for POSIX file-like objects such as sockets and serial ports. Use :func:...
[ "Read", "from", "the", "file", "descriptor", "and", "return", "the", "result", "as", "a", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L118-L148
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
clear_caches
def clear_caches(): """Jinja2 keeps internal caches for environments and lexers. These are used so that Jinja2 doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches. """...
python
def clear_caches(): """Jinja2 keeps internal caches for environments and lexers. These are used so that Jinja2 doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches. """...
[ "def", "clear_caches", "(", ")", ":", "from", "jinja2", ".", "environment", "import", "_spontaneous_environments", "from", "jinja2", ".", "lexer", "import", "_lexer_cache", "_spontaneous_environments", ".", "clear", "(", ")", "_lexer_cache", ".", "clear", "(", ")"...
Jinja2 keeps internal caches for environments and lexers. These are used so that Jinja2 doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches.
[ "Jinja2", "keeps", "internal", "caches", "for", "environments", "and", "lexers", ".", "These", "are", "used", "so", "that", "Jinja2", "doesn", "t", "have", "to", "recreate", "environments", "and", "lexers", "all", "the", "time", ".", "Normally", "you", "don"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L111-L120
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
import_string
def import_string(import_name, silent=False): """Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (``xml.sax.saxutils.escape``) or with a colon as object delimiter (``xml.sax...
python
def import_string(import_name, silent=False): """Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (``xml.sax.saxutils.escape``) or with a colon as object delimiter (``xml.sax...
[ "def", "import_string", "(", "import_name", ",", "silent", "=", "False", ")", ":", "try", ":", "if", "':'", "in", "import_name", ":", "module", ",", "obj", "=", "import_name", ".", "split", "(", "':'", ",", "1", ")", "elif", "'.'", "in", "import_name",...
Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (``xml.sax.saxutils.escape``) or with a colon as object delimiter (``xml.sax.saxutils:escape``). If the `silent` is True the...
[ "Imports", "an", "object", "based", "on", "a", "string", ".", "This", "is", "useful", "if", "you", "want", "to", "use", "import", "paths", "as", "endpoints", "or", "something", "similar", ".", "An", "import", "path", "can", "be", "specified", "either", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L123-L146
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
pformat
def pformat(obj, verbose=False): """Prettyprint an object. Either use the `pretty` library or the builtin `pprint`. """ try: from pretty import pretty return pretty(obj, verbose=verbose) except ImportError: from pprint import pformat return pformat(obj)
python
def pformat(obj, verbose=False): """Prettyprint an object. Either use the `pretty` library or the builtin `pprint`. """ try: from pretty import pretty return pretty(obj, verbose=verbose) except ImportError: from pprint import pformat return pformat(obj)
[ "def", "pformat", "(", "obj", ",", "verbose", "=", "False", ")", ":", "try", ":", "from", "pretty", "import", "pretty", "return", "pretty", "(", "obj", ",", "verbose", "=", "verbose", ")", "except", "ImportError", ":", "from", "pprint", "import", "pforma...
Prettyprint an object. Either use the `pretty` library or the builtin `pprint`.
[ "Prettyprint", "an", "object", ".", "Either", "use", "the", "pretty", "library", "or", "the", "builtin", "pprint", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L177-L186
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
unicode_urlencode
def unicode_urlencode(obj, charset='utf-8', for_qs=False): """URL escapes a single bytestring or unicode string with the given charset if applicable to URL safe quoting under all rules that need to be considered under all supported Python versions. If non strings are provided they are converted to thei...
python
def unicode_urlencode(obj, charset='utf-8', for_qs=False): """URL escapes a single bytestring or unicode string with the given charset if applicable to URL safe quoting under all rules that need to be considered under all supported Python versions. If non strings are provided they are converted to thei...
[ "def", "unicode_urlencode", "(", "obj", ",", "charset", "=", "'utf-8'", ",", "for_qs", "=", "False", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "string_types", ")", ":", "obj", "=", "text_type", "(", "obj", ")", "if", "isinstance", "(", "obj...
URL escapes a single bytestring or unicode string with the given charset if applicable to URL safe quoting under all rules that need to be considered under all supported Python versions. If non strings are provided they are converted to their unicode representation first.
[ "URL", "escapes", "a", "single", "bytestring", "or", "unicode", "string", "with", "the", "given", "charset", "if", "applicable", "to", "URL", "safe", "quoting", "under", "all", "rules", "that", "need", "to", "be", "considered", "under", "all", "supported", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L287-L303
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
select_autoescape
def select_autoescape(enabled_extensions=('html', 'htm', 'xml'), disabled_extensions=(), default_for_string=True, default=False): """Intelligently sets the initial value of autoescaping based on the filename of the template. This is the recommen...
python
def select_autoescape(enabled_extensions=('html', 'htm', 'xml'), disabled_extensions=(), default_for_string=True, default=False): """Intelligently sets the initial value of autoescaping based on the filename of the template. This is the recommen...
[ "def", "select_autoescape", "(", "enabled_extensions", "=", "(", "'html'", ",", "'htm'", ",", "'xml'", ")", ",", "disabled_extensions", "=", "(", ")", ",", "default_for_string", "=", "True", ",", "default", "=", "False", ")", ":", "enabled_patterns", "=", "t...
Intelligently sets the initial value of autoescaping based on the filename of the template. This is the recommended way to configure autoescaping if you do not want to write a custom function yourself. If you want to enable it for all templates created from strings or for all templates with `.html` an...
[ "Intelligently", "sets", "the", "initial", "value", "of", "autoescaping", "based", "on", "the", "filename", "of", "the", "template", ".", "This", "is", "the", "recommended", "way", "to", "configure", "autoescaping", "if", "you", "do", "not", "want", "to", "w...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L491-L542
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
htmlsafe_json_dumps
def htmlsafe_json_dumps(obj, dumper=None, **kwargs): """Works exactly like :func:`dumps` but is safe for use in ``<script>`` tags. It accepts the same arguments and returns a JSON string. Note that this is available in templates through the ``|tojson`` filter which will also mark the result as safe. ...
python
def htmlsafe_json_dumps(obj, dumper=None, **kwargs): """Works exactly like :func:`dumps` but is safe for use in ``<script>`` tags. It accepts the same arguments and returns a JSON string. Note that this is available in templates through the ``|tojson`` filter which will also mark the result as safe. ...
[ "def", "htmlsafe_json_dumps", "(", "obj", ",", "dumper", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "dumper", "is", "None", ":", "dumper", "=", "json", ".", "dumps", "rv", "=", "dumper", "(", "obj", ",", "*", "*", "kwargs", ")", ".", "...
Works exactly like :func:`dumps` but is safe for use in ``<script>`` tags. It accepts the same arguments and returns a JSON string. Note that this is available in templates through the ``|tojson`` filter which will also mark the result as safe. Due to how this function escapes certain characters this...
[ "Works", "exactly", "like", ":", "func", ":", "dumps", "but", "is", "safe", "for", "use", "in", "<script", ">", "tags", ".", "It", "accepts", "the", "same", "arguments", "and", "returns", "a", "JSON", "string", ".", "Note", "that", "this", "is", "avail...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L545-L570
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
LRUCache.copy
def copy(self): """Return a shallow copy of the instance.""" rv = self.__class__(self.capacity) rv._mapping.update(self._mapping) rv._queue = deque(self._queue) return rv
python
def copy(self): """Return a shallow copy of the instance.""" rv = self.__class__(self.capacity) rv._mapping.update(self._mapping) rv._queue = deque(self._queue) return rv
[ "def", "copy", "(", "self", ")", ":", "rv", "=", "self", ".", "__class__", "(", "self", ".", "capacity", ")", "rv", ".", "_mapping", ".", "update", "(", "self", ".", "_mapping", ")", "rv", ".", "_queue", "=", "deque", "(", "self", ".", "_queue", ...
Return a shallow copy of the instance.
[ "Return", "a", "shallow", "copy", "of", "the", "instance", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L341-L346
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
LRUCache.setdefault
def setdefault(self, key, default=None): """Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key. """ self._wlock.acquire() try: try: return self[key] except KeyError: self[key...
python
def setdefault(self, key, default=None): """Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key. """ self._wlock.acquire() try: try: return self[key] except KeyError: self[key...
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "self", ".", "_wlock", ".", "acquire", "(", ")", "try", ":", "try", ":", "return", "self", "[", "key", "]", "except", "KeyError", ":", "self", "[", "key", "]", "...
Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key.
[ "Set", "default", "if", "the", "key", "is", "not", "in", "the", "cache", "otherwise", "leave", "unchanged", ".", "Return", "the", "value", "of", "this", "key", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L355-L367
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
LRUCache.clear
def clear(self): """Clear the cache.""" self._wlock.acquire() try: self._mapping.clear() self._queue.clear() finally: self._wlock.release()
python
def clear(self): """Clear the cache.""" self._wlock.acquire() try: self._mapping.clear() self._queue.clear() finally: self._wlock.release()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_wlock", ".", "acquire", "(", ")", "try", ":", "self", ".", "_mapping", ".", "clear", "(", ")", "self", ".", "_queue", ".", "clear", "(", ")", "finally", ":", "self", ".", "_wlock", ".", "relea...
Clear the cache.
[ "Clear", "the", "cache", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L369-L376
train
pypa/pipenv
pipenv/vendor/jinja2/utils.py
LRUCache.items
def items(self): """Return a list of items.""" result = [(key, self._mapping[key]) for key in list(self._queue)] result.reverse() return result
python
def items(self): """Return a list of items.""" result = [(key, self._mapping[key]) for key in list(self._queue)] result.reverse() return result
[ "def", "items", "(", "self", ")", ":", "result", "=", "[", "(", "key", ",", "self", ".", "_mapping", "[", "key", "]", ")", "for", "key", "in", "list", "(", "self", ".", "_queue", ")", "]", "result", ".", "reverse", "(", ")", "return", "result" ]
Return a list of items.
[ "Return", "a", "list", "of", "items", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L444-L448
train
pypa/pipenv
tasks/vendoring/__init__.py
license_fallback
def license_fallback(vendor_dir, sdist_name): """Hardcoded license URLs. Check when updating if those are still needed""" libname = libname_from_dir(sdist_name) if libname not in HARDCODED_LICENSE_URLS: raise ValueError('No hardcoded URL for {} license'.format(libname)) url = HARDCODED_LICENSE_...
python
def license_fallback(vendor_dir, sdist_name): """Hardcoded license URLs. Check when updating if those are still needed""" libname = libname_from_dir(sdist_name) if libname not in HARDCODED_LICENSE_URLS: raise ValueError('No hardcoded URL for {} license'.format(libname)) url = HARDCODED_LICENSE_...
[ "def", "license_fallback", "(", "vendor_dir", ",", "sdist_name", ")", ":", "libname", "=", "libname_from_dir", "(", "sdist_name", ")", "if", "libname", "not", "in", "HARDCODED_LICENSE_URLS", ":", "raise", "ValueError", "(", "'No hardcoded URL for {} license'", ".", ...
Hardcoded license URLs. Check when updating if those are still needed
[ "Hardcoded", "license", "URLs", ".", "Check", "when", "updating", "if", "those", "are", "still", "needed" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L588-L600
train
pypa/pipenv
tasks/vendoring/__init__.py
libname_from_dir
def libname_from_dir(dirname): """Reconstruct the library name without it's version""" parts = [] for part in dirname.split('-'): if part[0].isdigit(): break parts.append(part) return '-'.join(parts)
python
def libname_from_dir(dirname): """Reconstruct the library name without it's version""" parts = [] for part in dirname.split('-'): if part[0].isdigit(): break parts.append(part) return '-'.join(parts)
[ "def", "libname_from_dir", "(", "dirname", ")", ":", "parts", "=", "[", "]", "for", "part", "in", "dirname", ".", "split", "(", "'-'", ")", ":", "if", "part", "[", "0", "]", ".", "isdigit", "(", ")", ":", "break", "parts", ".", "append", "(", "pa...
Reconstruct the library name without it's version
[ "Reconstruct", "the", "library", "name", "without", "it", "s", "version" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L603-L610
train
pypa/pipenv
tasks/vendoring/__init__.py
license_destination
def license_destination(vendor_dir, libname, filename): """Given the (reconstructed) library name, find appropriate destination""" normal = vendor_dir / libname if normal.is_dir(): return normal / filename lowercase = vendor_dir / libname.lower().replace('-', '_') if lowercase.is_dir(): ...
python
def license_destination(vendor_dir, libname, filename): """Given the (reconstructed) library name, find appropriate destination""" normal = vendor_dir / libname if normal.is_dir(): return normal / filename lowercase = vendor_dir / libname.lower().replace('-', '_') if lowercase.is_dir(): ...
[ "def", "license_destination", "(", "vendor_dir", ",", "libname", ",", "filename", ")", ":", "normal", "=", "vendor_dir", "/", "libname", "if", "normal", ".", "is_dir", "(", ")", ":", "return", "normal", "/", "filename", "lowercase", "=", "vendor_dir", "/", ...
Given the (reconstructed) library name, find appropriate destination
[ "Given", "the", "(", "reconstructed", ")", "library", "name", "find", "appropriate", "destination" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L613-L634
train
pypa/pipenv
pipenv/vendor/passa/internals/_pip.py
_convert_hashes
def _convert_hashes(values): """Convert Pipfile.lock hash lines into InstallRequirement option format. The option format uses a str-list mapping. Keys are hash algorithms, and the list contains all values of that algorithm. """ hashes = {} if not values: return hashes for value in v...
python
def _convert_hashes(values): """Convert Pipfile.lock hash lines into InstallRequirement option format. The option format uses a str-list mapping. Keys are hash algorithms, and the list contains all values of that algorithm. """ hashes = {} if not values: return hashes for value in v...
[ "def", "_convert_hashes", "(", "values", ")", ":", "hashes", "=", "{", "}", "if", "not", "values", ":", "return", "hashes", "for", "value", "in", "values", ":", "try", ":", "name", ",", "value", "=", "value", ".", "split", "(", "\":\"", ",", "1", "...
Convert Pipfile.lock hash lines into InstallRequirement option format. The option format uses a str-list mapping. Keys are hash algorithms, and the list contains all values of that algorithm.
[ "Convert", "Pipfile", ".", "lock", "hash", "lines", "into", "InstallRequirement", "option", "format", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L113-L130
train
pypa/pipenv
pipenv/vendor/passa/internals/_pip.py
_suppress_distutils_logs
def _suppress_distutils_logs(): """Hack to hide noise generated by `setup.py develop`. There isn't a good way to suppress them now, so let's monky-patch. See https://bugs.python.org/issue25392. """ f = distutils.log.Log._log def _log(log, level, msg, args): if level >= distutils.log.ER...
python
def _suppress_distutils_logs(): """Hack to hide noise generated by `setup.py develop`. There isn't a good way to suppress them now, so let's monky-patch. See https://bugs.python.org/issue25392. """ f = distutils.log.Log._log def _log(log, level, msg, args): if level >= distutils.log.ER...
[ "def", "_suppress_distutils_logs", "(", ")", ":", "f", "=", "distutils", ".", "log", ".", "Log", ".", "_log", "def", "_log", "(", "log", ",", "level", ",", "msg", ",", "args", ")", ":", "if", "level", ">=", "distutils", ".", "log", ".", "ERROR", ":...
Hack to hide noise generated by `setup.py develop`. There isn't a good way to suppress them now, so let's monky-patch. See https://bugs.python.org/issue25392.
[ "Hack", "to", "hide", "noise", "generated", "by", "setup", ".", "py", "develop", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L258-L272
train
pypa/pipenv
pipenv/vendor/passa/internals/_pip.py
_find_egg_info
def _find_egg_info(ireq): """Find this package's .egg-info directory. Due to how sdists are designed, the .egg-info directory cannot be reliably found without running setup.py to aggregate all configurations. This function instead uses some heuristics to locate the egg-info directory that most like...
python
def _find_egg_info(ireq): """Find this package's .egg-info directory. Due to how sdists are designed, the .egg-info directory cannot be reliably found without running setup.py to aggregate all configurations. This function instead uses some heuristics to locate the egg-info directory that most like...
[ "def", "_find_egg_info", "(", "ireq", ")", ":", "root", "=", "ireq", ".", "setup_py_dir", "directory_iterator", "=", "_iter_egg_info_directories", "(", "root", ",", "ireq", ".", "name", ")", "try", ":", "top_egg_info", "=", "next", "(", "directory_iterator", "...
Find this package's .egg-info directory. Due to how sdists are designed, the .egg-info directory cannot be reliably found without running setup.py to aggregate all configurations. This function instead uses some heuristics to locate the egg-info directory that most likely represents this package. ...
[ "Find", "this", "package", "s", ".", "egg", "-", "info", "directory", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L355-L389
train
pypa/pipenv
pipenv/vendor/vistir/compat.py
fs_str
def fs_str(string): """Encodes a string into the proper filesystem encoding Borrowed from pip-tools """ if isinstance(string, str): return string assert not isinstance(string, bytes) return string.encode(_fs_encoding)
python
def fs_str(string): """Encodes a string into the proper filesystem encoding Borrowed from pip-tools """ if isinstance(string, str): return string assert not isinstance(string, bytes) return string.encode(_fs_encoding)
[ "def", "fs_str", "(", "string", ")", ":", "if", "isinstance", "(", "string", ",", "str", ")", ":", "return", "string", "assert", "not", "isinstance", "(", "string", ",", "bytes", ")", "return", "string", ".", "encode", "(", "_fs_encoding", ")" ]
Encodes a string into the proper filesystem encoding Borrowed from pip-tools
[ "Encodes", "a", "string", "into", "the", "proper", "filesystem", "encoding" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L208-L217
train
pypa/pipenv
pipenv/vendor/vistir/compat.py
_get_path
def _get_path(path): """ Fetch the string value from a path-like object Returns **None** if there is no string value. """ if isinstance(path, (six.string_types, bytes)): return path path_type = type(path) try: path_repr = path_type.__fspath__(path) except AttributeError...
python
def _get_path(path): """ Fetch the string value from a path-like object Returns **None** if there is no string value. """ if isinstance(path, (six.string_types, bytes)): return path path_type = type(path) try: path_repr = path_type.__fspath__(path) except AttributeError...
[ "def", "_get_path", "(", "path", ")", ":", "if", "isinstance", "(", "path", ",", "(", "six", ".", "string_types", ",", "bytes", ")", ")", ":", "return", "path", "path_type", "=", "type", "(", "path", ")", "try", ":", "path_repr", "=", "path_type", "....
Fetch the string value from a path-like object Returns **None** if there is no string value.
[ "Fetch", "the", "string", "value", "from", "a", "path", "-", "like", "object" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L220-L236
train
pypa/pipenv
pipenv/vendor/vistir/compat.py
fs_encode
def fs_encode(path): """ Encode a filesystem path to the proper filesystem encoding :param Union[str, bytes] path: A string-like path :returns: A bytes-encoded filesystem path representation """ path = _get_path(path) if path is None: raise TypeError("expected a valid path to encod...
python
def fs_encode(path): """ Encode a filesystem path to the proper filesystem encoding :param Union[str, bytes] path: A string-like path :returns: A bytes-encoded filesystem path representation """ path = _get_path(path) if path is None: raise TypeError("expected a valid path to encod...
[ "def", "fs_encode", "(", "path", ")", ":", "path", "=", "_get_path", "(", "path", ")", "if", "path", "is", "None", ":", "raise", "TypeError", "(", "\"expected a valid path to encode\"", ")", "if", "isinstance", "(", "path", ",", "six", ".", "text_type", ")...
Encode a filesystem path to the proper filesystem encoding :param Union[str, bytes] path: A string-like path :returns: A bytes-encoded filesystem path representation
[ "Encode", "a", "filesystem", "path", "to", "the", "proper", "filesystem", "encoding" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L239-L252
train
pypa/pipenv
pipenv/vendor/vistir/compat.py
fs_decode
def fs_decode(path): """ Decode a filesystem path using the proper filesystem encoding :param path: The filesystem path to decode from bytes or string :return: [description] :rtype: [type] """ path = _get_path(path) if path is None: raise TypeError("expected a valid path to dec...
python
def fs_decode(path): """ Decode a filesystem path using the proper filesystem encoding :param path: The filesystem path to decode from bytes or string :return: [description] :rtype: [type] """ path = _get_path(path) if path is None: raise TypeError("expected a valid path to dec...
[ "def", "fs_decode", "(", "path", ")", ":", "path", "=", "_get_path", "(", "path", ")", "if", "path", "is", "None", ":", "raise", "TypeError", "(", "\"expected a valid path to decode\"", ")", "if", "isinstance", "(", "path", ",", "six", ".", "binary_type", ...
Decode a filesystem path using the proper filesystem encoding :param path: The filesystem path to decode from bytes or string :return: [description] :rtype: [type]
[ "Decode", "a", "filesystem", "path", "using", "the", "proper", "filesystem", "encoding" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L255-L269
train
pypa/pipenv
pipenv/vendor/passa/internals/traces.py
trace_graph
def trace_graph(graph): """Build a collection of "traces" for each package. A trace is a list of names that eventually leads to the package. For example, if A and B are root dependencies, A depends on C and D, B depends on C, and C depends on D, the return value would be like:: { N...
python
def trace_graph(graph): """Build a collection of "traces" for each package. A trace is a list of names that eventually leads to the package. For example, if A and B are root dependencies, A depends on C and D, B depends on C, and C depends on D, the return value would be like:: { N...
[ "def", "trace_graph", "(", "graph", ")", ":", "result", "=", "{", "None", ":", "[", "]", "}", "for", "vertex", "in", "graph", ":", "result", "[", "vertex", "]", "=", "[", "]", "for", "root", "in", "graph", ".", "iter_children", "(", "None", ")", ...
Build a collection of "traces" for each package. A trace is a list of names that eventually leads to the package. For example, if A and B are root dependencies, A depends on C and D, B depends on C, and C depends on D, the return value would be like:: { None: [], "A": [None...
[ "Build", "a", "collection", "of", "traces", "for", "each", "package", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/traces.py#L18-L40
train
pypa/pipenv
pipenv/vendor/urllib3/util/timeout.py
Timeout._validate_timeout
def _validate_timeout(cls, value, name): """ Check that a timeout attribute is valid. :param value: The timeout value to validate :param name: The name of the timeout attribute to validate. This is used to specify in error messages. :return: The validated and casted version ...
python
def _validate_timeout(cls, value, name): """ Check that a timeout attribute is valid. :param value: The timeout value to validate :param name: The name of the timeout attribute to validate. This is used to specify in error messages. :return: The validated and casted version ...
[ "def", "_validate_timeout", "(", "cls", ",", "value", ",", "name", ")", ":", "if", "value", "is", "_Default", ":", "return", "cls", ".", "DEFAULT_TIMEOUT", "if", "value", "is", "None", "or", "value", "is", "cls", ".", "DEFAULT_TIMEOUT", ":", "return", "v...
Check that a timeout attribute is valid. :param value: The timeout value to validate :param name: The name of the timeout attribute to validate. This is used to specify in error messages. :return: The validated and casted version of the given value. :raises ValueError: If it...
[ "Check", "that", "a", "timeout", "attribute", "is", "valid", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L104-L138
train
pypa/pipenv
pipenv/vendor/urllib3/util/timeout.py
Timeout.clone
def clone(self): """ Create a copy of the timeout object Timeout properties are stored per-pool but each request needs a fresh Timeout object to ensure each one has its own start/stop configured. :return: a copy of the timeout object :rtype: :class:`Timeout` """ ...
python
def clone(self): """ Create a copy of the timeout object Timeout properties are stored per-pool but each request needs a fresh Timeout object to ensure each one has its own start/stop configured. :return: a copy of the timeout object :rtype: :class:`Timeout` """ ...
[ "def", "clone", "(", "self", ")", ":", "# We can't use copy.deepcopy because that will also create a new object", "# for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to", "# detect the user default.", "return", "Timeout", "(", "connect", "=", "self", ".", "_connect", ...
Create a copy of the timeout object Timeout properties are stored per-pool but each request needs a fresh Timeout object to ensure each one has its own start/stop configured. :return: a copy of the timeout object :rtype: :class:`Timeout`
[ "Create", "a", "copy", "of", "the", "timeout", "object" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L156-L169
train
pypa/pipenv
pipenv/vendor/urllib3/util/timeout.py
Timeout.start_connect
def start_connect(self): """ Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already. """ if self._start_connect is not None: raise TimeoutStateError("Tim...
python
def start_connect(self): """ Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already. """ if self._start_connect is not None: raise TimeoutStateError("Tim...
[ "def", "start_connect", "(", "self", ")", ":", "if", "self", ".", "_start_connect", "is", "not", "None", ":", "raise", "TimeoutStateError", "(", "\"Timeout timer has already been started.\"", ")", "self", ".", "_start_connect", "=", "current_time", "(", ")", "retu...
Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already.
[ "Start", "the", "timeout", "clock", "used", "during", "a", "connect", "()", "attempt" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L171-L180
train
pypa/pipenv
pipenv/vendor/urllib3/util/timeout.py
Timeout.connect_timeout
def connect_timeout(self): """ Get the value to use when setting a connection timeout. This will be a positive float or integer, the value None (never timeout), or the default system timeout. :return: Connect timeout. :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None ...
python
def connect_timeout(self): """ Get the value to use when setting a connection timeout. This will be a positive float or integer, the value None (never timeout), or the default system timeout. :return: Connect timeout. :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None ...
[ "def", "connect_timeout", "(", "self", ")", ":", "if", "self", ".", "total", "is", "None", ":", "return", "self", ".", "_connect", "if", "self", ".", "_connect", "is", "None", "or", "self", ".", "_connect", "is", "self", ".", "DEFAULT_TIMEOUT", ":", "r...
Get the value to use when setting a connection timeout. This will be a positive float or integer, the value None (never timeout), or the default system timeout. :return: Connect timeout. :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
[ "Get", "the", "value", "to", "use", "when", "setting", "a", "connection", "timeout", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L196-L211
train
pypa/pipenv
pipenv/vendor/urllib3/util/timeout.py
Timeout.read_timeout
def read_timeout(self): """ Get the value for the read timeout. This assumes some time has elapsed in the connection timeout and computes the read timeout appropriately. If self.total is set, the read timeout is dependent on the amount of time taken by the connect timeout. If t...
python
def read_timeout(self): """ Get the value for the read timeout. This assumes some time has elapsed in the connection timeout and computes the read timeout appropriately. If self.total is set, the read timeout is dependent on the amount of time taken by the connect timeout. If t...
[ "def", "read_timeout", "(", "self", ")", ":", "if", "(", "self", ".", "total", "is", "not", "None", "and", "self", ".", "total", "is", "not", "self", ".", "DEFAULT_TIMEOUT", "and", "self", ".", "_read", "is", "not", "None", "and", "self", ".", "_read...
Get the value for the read timeout. This assumes some time has elapsed in the connection timeout and computes the read timeout appropriately. If self.total is set, the read timeout is dependent on the amount of time taken by the connect timeout. If the connection time has not been ...
[ "Get", "the", "value", "for", "the", "read", "timeout", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L214-L242
train
pypa/pipenv
pipenv/vendor/urllib3/contrib/socks.py
SOCKSConnection._new_conn
def _new_conn(self): """ Establish a new connection via the SOCKS proxy. """ extra_kw = {} if self.source_address: extra_kw['source_address'] = self.source_address if self.socket_options: extra_kw['socket_options'] = self.socket_options t...
python
def _new_conn(self): """ Establish a new connection via the SOCKS proxy. """ extra_kw = {} if self.source_address: extra_kw['source_address'] = self.source_address if self.socket_options: extra_kw['socket_options'] = self.socket_options t...
[ "def", "_new_conn", "(", "self", ")", ":", "extra_kw", "=", "{", "}", "if", "self", ".", "source_address", ":", "extra_kw", "[", "'source_address'", "]", "=", "self", ".", "source_address", "if", "self", ".", "socket_options", ":", "extra_kw", "[", "'socke...
Establish a new connection via the SOCKS proxy.
[ "Establish", "a", "new", "connection", "via", "the", "SOCKS", "proxy", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/socks.py#L67-L122
train
pypa/pipenv
pipenv/patched/notpip/_internal/operations/freeze.py
get_requirement_info
def get_requirement_info(dist): # type: (Distribution) -> RequirementInfo """ Compute and return values (req, editable, comments) for use in FrozenRequirement.from_dist(). """ if not dist_is_editable(dist): return (None, False, []) location = os.path.normcase(os.path.abspath(dist.lo...
python
def get_requirement_info(dist): # type: (Distribution) -> RequirementInfo """ Compute and return values (req, editable, comments) for use in FrozenRequirement.from_dist(). """ if not dist_is_editable(dist): return (None, False, []) location = os.path.normcase(os.path.abspath(dist.lo...
[ "def", "get_requirement_info", "(", "dist", ")", ":", "# type: (Distribution) -> RequirementInfo", "if", "not", "dist_is_editable", "(", "dist", ")", ":", "return", "(", "None", ",", "False", ",", "[", "]", ")", "location", "=", "os", ".", "path", ".", "norm...
Compute and return values (req, editable, comments) for use in FrozenRequirement.from_dist().
[ "Compute", "and", "return", "values", "(", "req", "editable", "comments", ")", "for", "use", "in", "FrozenRequirement", ".", "from_dist", "()", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/freeze.py#L164-L223
train
pypa/pipenv
pipenv/vendor/shellingham/posix/proc.py
detect_proc
def detect_proc(): """Detect /proc filesystem style. This checks the /proc/{pid} directory for possible formats. Returns one of the followings as str: * `stat`: Linux-style, i.e. ``/proc/{pid}/stat``. * `status`: BSD-style, i.e. ``/proc/{pid}/status``. """ pid = os.getpid() for name in...
python
def detect_proc(): """Detect /proc filesystem style. This checks the /proc/{pid} directory for possible formats. Returns one of the followings as str: * `stat`: Linux-style, i.e. ``/proc/{pid}/stat``. * `status`: BSD-style, i.e. ``/proc/{pid}/status``. """ pid = os.getpid() for name in...
[ "def", "detect_proc", "(", ")", ":", "pid", "=", "os", ".", "getpid", "(", ")", "for", "name", "in", "(", "'stat'", ",", "'status'", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "'/proc'", ",", "st...
Detect /proc filesystem style. This checks the /proc/{pid} directory for possible formats. Returns one of the followings as str: * `stat`: Linux-style, i.e. ``/proc/{pid}/stat``. * `status`: BSD-style, i.e. ``/proc/{pid}/status``.
[ "Detect", "/", "proc", "filesystem", "style", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/proc.py#L15-L28
train
pypa/pipenv
pipenv/vendor/shellingham/posix/proc.py
get_process_mapping
def get_process_mapping(): """Try to look up the process tree via the /proc interface. """ stat_name = detect_proc() self_tty = _get_stat(os.getpid(), stat_name)[0] processes = {} for pid in os.listdir('/proc'): if not pid.isdigit(): continue try: tty, ppi...
python
def get_process_mapping(): """Try to look up the process tree via the /proc interface. """ stat_name = detect_proc() self_tty = _get_stat(os.getpid(), stat_name)[0] processes = {} for pid in os.listdir('/proc'): if not pid.isdigit(): continue try: tty, ppi...
[ "def", "get_process_mapping", "(", ")", ":", "stat_name", "=", "detect_proc", "(", ")", "self_tty", "=", "_get_stat", "(", "os", ".", "getpid", "(", ")", ",", "stat_name", ")", "[", "0", "]", "processes", "=", "{", "}", "for", "pid", "in", "os", ".",...
Try to look up the process tree via the /proc interface.
[ "Try", "to", "look", "up", "the", "process", "tree", "via", "the", "/", "proc", "interface", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/proc.py#L54-L72
train
pypa/pipenv
pipenv/vendor/vistir/backports/tempfile.py
NamedTemporaryFile
def NamedTemporaryFile( mode="w+b", buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, delete=True, wrapper_class_override=None, ): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the...
python
def NamedTemporaryFile( mode="w+b", buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, delete=True, wrapper_class_override=None, ): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the...
[ "def", "NamedTemporaryFile", "(", "mode", "=", "\"w+b\"", ",", "buffering", "=", "-", "1", ",", "encoding", "=", "None", ",", "newline", "=", "None", ",", "suffix", "=", "None", ",", "prefix", "=", "None", ",", "dir", "=", "None", ",", "delete", "=",...
Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to io.open (default "w+b"). 'buffering' -- the buffer size argument to io.open (default -1). 'encoding' -- the encoding argument to io.open (default None) 'newline' -- the newl...
[ "Create", "and", "return", "a", "temporary", "file", ".", "Arguments", ":", "prefix", "suffix", "dir", "--", "as", "for", "mkstemp", ".", "mode", "--", "the", "mode", "argument", "to", "io", ".", "open", "(", "default", "w", "+", "b", ")", ".", "buff...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/backports/tempfile.py#L168-L216
train
pypa/pipenv
pipenv/vendor/click/core.py
fast_exit
def fast_exit(code): """Exit without garbage collection, this speeds up exit by about 10ms for things like bash completion. """ sys.stdout.flush() sys.stderr.flush() os._exit(code)
python
def fast_exit(code): """Exit without garbage collection, this speeds up exit by about 10ms for things like bash completion. """ sys.stdout.flush() sys.stderr.flush() os._exit(code)
[ "def", "fast_exit", "(", "code", ")", ":", "sys", ".", "stdout", ".", "flush", "(", ")", "sys", ".", "stderr", ".", "flush", "(", ")", "os", ".", "_exit", "(", "code", ")" ]
Exit without garbage collection, this speeds up exit by about 10ms for things like bash completion.
[ "Exit", "without", "garbage", "collection", "this", "speeds", "up", "exit", "by", "about", "10ms", "for", "things", "like", "bash", "completion", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L39-L45
train
pypa/pipenv
pipenv/vendor/click/core.py
_bashcomplete
def _bashcomplete(cmd, prog_name, complete_var=None): """Internal handler for the bash completion support.""" if complete_var is None: complete_var = '_%s_COMPLETE' % (prog_name.replace('-', '_')).upper() complete_instr = os.environ.get(complete_var) if not complete_instr: return fr...
python
def _bashcomplete(cmd, prog_name, complete_var=None): """Internal handler for the bash completion support.""" if complete_var is None: complete_var = '_%s_COMPLETE' % (prog_name.replace('-', '_')).upper() complete_instr = os.environ.get(complete_var) if not complete_instr: return fr...
[ "def", "_bashcomplete", "(", "cmd", ",", "prog_name", ",", "complete_var", "=", "None", ")", ":", "if", "complete_var", "is", "None", ":", "complete_var", "=", "'_%s_COMPLETE'", "%", "(", "prog_name", ".", "replace", "(", "'-'", ",", "'_'", ")", ")", "."...
Internal handler for the bash completion support.
[ "Internal", "handler", "for", "the", "bash", "completion", "support", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L48-L58
train
pypa/pipenv
pipenv/vendor/click/core.py
augment_usage_errors
def augment_usage_errors(ctx, param=None): """Context manager that attaches extra information to exceptions that fly. """ try: yield except BadParameter as e: if e.ctx is None: e.ctx = ctx if param is not None and e.param is None: e.param = param ...
python
def augment_usage_errors(ctx, param=None): """Context manager that attaches extra information to exceptions that fly. """ try: yield except BadParameter as e: if e.ctx is None: e.ctx = ctx if param is not None and e.param is None: e.param = param ...
[ "def", "augment_usage_errors", "(", "ctx", ",", "param", "=", "None", ")", ":", "try", ":", "yield", "except", "BadParameter", "as", "e", ":", "if", "e", ".", "ctx", "is", "None", ":", "e", ".", "ctx", "=", "ctx", "if", "param", "is", "not", "None"...
Context manager that attaches extra information to exceptions that fly.
[ "Context", "manager", "that", "attaches", "extra", "information", "to", "exceptions", "that", "fly", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L100-L115
train
pypa/pipenv
pipenv/vendor/click/core.py
iter_params_for_processing
def iter_params_for_processing(invocation_order, declaration_order): """Given a sequence of parameters in the order as should be considered for processing and an iterable of parameters that exist, this returns a list in the correct order as they should be processed. """ def sort_key(item): t...
python
def iter_params_for_processing(invocation_order, declaration_order): """Given a sequence of parameters in the order as should be considered for processing and an iterable of parameters that exist, this returns a list in the correct order as they should be processed. """ def sort_key(item): t...
[ "def", "iter_params_for_processing", "(", "invocation_order", ",", "declaration_order", ")", ":", "def", "sort_key", "(", "item", ")", ":", "try", ":", "idx", "=", "invocation_order", ".", "index", "(", "item", ")", "except", "ValueError", ":", "idx", "=", "...
Given a sequence of parameters in the order as should be considered for processing and an iterable of parameters that exist, this returns a list in the correct order as they should be processed.
[ "Given", "a", "sequence", "of", "parameters", "in", "the", "order", "as", "should", "be", "considered", "for", "processing", "and", "an", "iterable", "of", "parameters", "that", "exist", "this", "returns", "a", "list", "in", "the", "correct", "order", "as", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L118-L130
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.scope
def scope(self, cleanup=True): """This helper method can be used with the context object to promote it to the current thread local (see :func:`get_current_context`). The default behavior of this is to invoke the cleanup functions which can be disabled by setting `cleanup` to `False`. Th...
python
def scope(self, cleanup=True): """This helper method can be used with the context object to promote it to the current thread local (see :func:`get_current_context`). The default behavior of this is to invoke the cleanup functions which can be disabled by setting `cleanup` to `False`. Th...
[ "def", "scope", "(", "self", ",", "cleanup", "=", "True", ")", ":", "if", "not", "cleanup", ":", "self", ".", "_depth", "+=", "1", "try", ":", "with", "self", "as", "rv", ":", "yield", "rv", "finally", ":", "if", "not", "cleanup", ":", "self", "....
This helper method can be used with the context object to promote it to the current thread local (see :func:`get_current_context`). The default behavior of this is to invoke the cleanup functions which can be disabled by setting `cleanup` to `False`. The cleanup functions are typically ...
[ "This", "helper", "method", "can", "be", "used", "with", "the", "context", "object", "to", "promote", "it", "to", "the", "current", "thread", "local", "(", "see", ":", "func", ":", "get_current_context", ")", ".", "The", "default", "behavior", "of", "this"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L355-L390
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.command_path
def command_path(self): """The computed command path. This is used for the ``usage`` information on the help page. It's automatically created by combining the info names of the chain of contexts to the root. """ rv = '' if self.info_name is not None: rv = se...
python
def command_path(self): """The computed command path. This is used for the ``usage`` information on the help page. It's automatically created by combining the info names of the chain of contexts to the root. """ rv = '' if self.info_name is not None: rv = se...
[ "def", "command_path", "(", "self", ")", ":", "rv", "=", "''", "if", "self", ".", "info_name", "is", "not", "None", ":", "rv", "=", "self", ".", "info_name", "if", "self", ".", "parent", "is", "not", "None", ":", "rv", "=", "self", ".", "parent", ...
The computed command path. This is used for the ``usage`` information on the help page. It's automatically created by combining the info names of the chain of contexts to the root.
[ "The", "computed", "command", "path", ".", "This", "is", "used", "for", "the", "usage", "information", "on", "the", "help", "page", ".", "It", "s", "automatically", "created", "by", "combining", "the", "info", "names", "of", "the", "chain", "of", "contexts...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L444-L454
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.find_root
def find_root(self): """Finds the outermost context.""" node = self while node.parent is not None: node = node.parent return node
python
def find_root(self): """Finds the outermost context.""" node = self while node.parent is not None: node = node.parent return node
[ "def", "find_root", "(", "self", ")", ":", "node", "=", "self", "while", "node", ".", "parent", "is", "not", "None", ":", "node", "=", "node", ".", "parent", "return", "node" ]
Finds the outermost context.
[ "Finds", "the", "outermost", "context", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L456-L461
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.find_object
def find_object(self, object_type): """Finds the closest object of a given type.""" node = self while node is not None: if isinstance(node.obj, object_type): return node.obj node = node.parent
python
def find_object(self, object_type): """Finds the closest object of a given type.""" node = self while node is not None: if isinstance(node.obj, object_type): return node.obj node = node.parent
[ "def", "find_object", "(", "self", ",", "object_type", ")", ":", "node", "=", "self", "while", "node", "is", "not", "None", ":", "if", "isinstance", "(", "node", ".", "obj", ",", "object_type", ")", ":", "return", "node", ".", "obj", "node", "=", "no...
Finds the closest object of a given type.
[ "Finds", "the", "closest", "object", "of", "a", "given", "type", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L463-L469
train