partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
PackageIndex._reader
Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The l...
pipenv/vendor/distlib/index.py
def _reader(self, name, stream, outbuf): """ Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to th...
def _reader(self, name, stream, outbuf): """ Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to th...
[ "Thread", "runner", "for", "reading", "lines", "of", "from", "a", "subprocess", "into", "a", "buffer", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L134-L150
[ "def", "_reader", "(", "self", ",", "name", ",", "stream", ",", "outbuf", ")", ":", "while", "True", ":", "s", "=", "stream", ".", "readline", "(", ")", "if", "not", "s", ":", "break", "s", "=", "s", ".", "decode", "(", "'utf-8'", ")", ".", "rs...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.get_sign_command
Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystor...
pipenv/vendor/distlib/index.py
def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_pas...
def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_pas...
[ "Return", "a", "suitable", "command", "for", "signing", "a", "file", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L152-L179
[ "def", "get_sign_command", "(", "self", ",", "filename", ",", "signer", ",", "sign_password", ",", "keystore", "=", "None", ")", ":", "cmd", "=", "[", "self", ".", "gpg", ",", "'--status-fd'", ",", "'2'", ",", "'--no-tty'", "]", "if", "keystore", "is", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.run_command
Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit cod...
pipenv/vendor/distlib/index.py
def run_command(self, cmd, input_data=None): """ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process...
def run_command(self, cmd, input_data=None): """ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process...
[ "Run", "a", "command", "in", "a", "child", "process", "passing", "it", "any", "input", "data", "specified", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L181-L214
[ "def", "run_command", "(", "self", ",", "cmd", ",", "input_data", "=", "None", ")", ":", "kwargs", "=", "{", "'stdout'", ":", "subprocess", ".", "PIPE", ",", "'stderr'", ":", "subprocess", ".", "PIPE", ",", "}", "if", "input_data", "is", "not", "None",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.sign_file
Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which ...
pipenv/vendor/distlib/index.py
def sign_file(self, filename, signer, sign_password, keystore=None): """ Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's ...
def sign_file(self, filename, signer, sign_password, keystore=None): """ Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's ...
[ "Sign", "a", "file", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L216-L237
[ "def", "sign_file", "(", "self", ",", "filename", ",", "signer", ",", "sign_password", ",", "keystore", "=", "None", ")", ":", "cmd", ",", "sig_file", "=", "self", ".", "get_sign_command", "(", "filename", ",", "signer", ",", "sign_password", ",", "keystor...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.upload_documentation
Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the d...
pipenv/vendor/distlib/index.py
def upload_documentation(self, metadata, doc_dir): """ Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The...
def upload_documentation(self, metadata, doc_dir): """ Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The...
[ "Upload", "documentation", "to", "the", "index", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L296-L322
[ "def", "upload_documentation", "(", "self", ",", "metadata", ",", "doc_dir", ")", ":", "self", ".", "check_credentials", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "doc_dir", ")", ":", "raise", "DistlibException", "(", "'not a directory: %r...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.get_verify_command
Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to ...
pipenv/vendor/distlib/index.py
def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_fil...
def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_fil...
[ "Return", "a", "suitable", "command", "for", "verifying", "a", "file", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L324-L346
[ "def", "get_verify_command", "(", "self", ",", "signature_filename", ",", "data_filename", ",", "keystore", "=", "None", ")", ":", "cmd", "=", "[", "self", ".", "gpg", ",", "'--status-fd'", ",", "'2'", ",", "'--no-tty'", "]", "if", "keystore", "is", "None"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.verify_signature
Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which...
pipenv/vendor/distlib/index.py
def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname t...
def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname t...
[ "Verify", "a", "signature", "for", "a", "file", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L348-L371
[ "def", "verify_signature", "(", "self", ",", "signature_filename", ",", "data_filename", ",", "keystore", "=", "None", ")", ":", "if", "not", "self", ".", "gpg", ":", "raise", "DistlibException", "(", "'verification unavailable because gpg '", "'unavailable'", ")", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.download_file
This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard libra...
pipenv/vendor/distlib/index.py
def download_file(self, url, destfile, digest=None, reporthook=None): """ This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). ...
def download_file(self, url, destfile, digest=None, reporthook=None): """ This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). ...
[ "This", "is", "a", "convenience", "method", "for", "downloading", "a", "file", "from", "an", "URL", ".", "Normally", "this", "will", "be", "a", "file", "from", "the", "index", "though", "currently", "no", "check", "is", "made", "for", "this", "(", "i", ...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L373-L448
[ "def", "download_file", "(", "self", ",", "url", ",", "destfile", ",", "digest", "=", "None", ",", "reporthook", "=", "None", ")", ":", "if", "digest", "is", "None", ":", "digester", "=", "None", "logger", ".", "debug", "(", "'No digest specified'", ")",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.send_request
Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse).
pipenv/vendor/distlib/index.py
def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler:...
def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler:...
[ "Send", "a", "standard", "library", ":", "class", ":", "Request", "to", "PyPI", "and", "return", "its", "response", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L450-L464
[ "def", "send_request", "(", "self", ",", "req", ")", ":", "handlers", "=", "[", "]", "if", "self", ".", "password_handler", ":", "handlers", ".", "append", "(", "self", ".", "password_handler", ")", "if", "self", ".", "ssl_verifier", ":", "handlers", "."...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PackageIndex.encode_request
Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple.
pipenv/vendor/distlib/index.py
def encode_request(self, fields, files): """ Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, f...
def encode_request(self, fields, files): """ Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, f...
[ "Encode", "fields", "and", "files", "for", "posting", "to", "an", "HTTP", "server", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L466-L507
[ "def", "encode_request", "(", "self", ",", "fields", ",", "files", ")", ":", "# Adapted from packaging, which in turn was adapted from", "# http://code.activestate.com/recipes/146306", "parts", "=", "[", "]", "boundary", "=", "self", ".", "boundary", "for", "k", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
do_bash_complete
Do the completion for bash Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False otherwise
pipenv/vendor/click_completion/core.py
def do_bash_complete(cli, prog_name): """Do the completion for bash Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, F...
def do_bash_complete(cli, prog_name): """Do the completion for bash Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, F...
[ "Do", "the", "completion", "for", "bash" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L141-L176
[ "def", "do_bash_complete", "(", "cli", ",", "prog_name", ")", ":", "comp_words", "=", "os", ".", "environ", "[", "'COMP_WORDS'", "]", "try", ":", "cwords", "=", "shlex", ".", "split", "(", "comp_words", ")", "quoted", "=", "False", "except", "ValueError", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
do_fish_complete
Do the fish completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False otherwise
pipenv/vendor/click_completion/core.py
def do_fish_complete(cli, prog_name): """Do the fish completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False...
def do_fish_complete(cli, prog_name): """Do the fish completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False...
[ "Do", "the", "fish", "completion" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L179-L208
[ "def", "do_fish_complete", "(", "cli", ",", "prog_name", ")", ":", "commandline", "=", "os", ".", "environ", "[", "'COMMANDLINE'", "]", "args", "=", "split_args", "(", "commandline", ")", "[", "1", ":", "]", "if", "args", "and", "not", "commandline", "."...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
do_powershell_complete
Do the powershell completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False otherwise
pipenv/vendor/click_completion/core.py
def do_powershell_complete(cli, prog_name): """Do the powershell completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was succe...
def do_powershell_complete(cli, prog_name): """Do the powershell completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was succe...
[ "Do", "the", "powershell", "completion" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L250-L279
[ "def", "do_powershell_complete", "(", "cli", ",", "prog_name", ")", ":", "commandline", "=", "os", ".", "environ", "[", "'COMMANDLINE'", "]", "args", "=", "split_args", "(", "commandline", ")", "[", "1", ":", "]", "quote", "=", "single_quote", "incomplete", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_code
Returns the completion code to be evaluated by the shell Parameters ---------- shell : Shell The shell type (Default value = None) prog_name : str The program name on the command line (Default value = None) env_name : str The environment variable used to control the completi...
pipenv/vendor/click_completion/core.py
def get_code(shell=None, prog_name=None, env_name=None, extra_env=None): """Returns the completion code to be evaluated by the shell Parameters ---------- shell : Shell The shell type (Default value = None) prog_name : str The program name on the command line (Default value = None) ...
def get_code(shell=None, prog_name=None, env_name=None, extra_env=None): """Returns the completion code to be evaluated by the shell Parameters ---------- shell : Shell The shell type (Default value = None) prog_name : str The program name on the command line (Default value = None) ...
[ "Returns", "the", "completion", "code", "to", "be", "evaluated", "by", "the", "shell" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L282-L311
[ "def", "get_code", "(", "shell", "=", "None", ",", "prog_name", "=", "None", ",", "env_name", "=", "None", ",", "extra_env", "=", "None", ")", ":", "from", "jinja2", "import", "Environment", ",", "FileSystemLoader", "if", "shell", "in", "[", "None", ",",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
install
Install the completion Parameters ---------- shell : Shell The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None) prog_name : str The program name on the command line. It will be automatically computed if the value is None (...
pipenv/vendor/click_completion/core.py
def install(shell=None, prog_name=None, env_name=None, path=None, append=None, extra_env=None): """Install the completion Parameters ---------- shell : Shell The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None) prog_name : str ...
def install(shell=None, prog_name=None, env_name=None, path=None, append=None, extra_env=None): """Install the completion Parameters ---------- shell : Shell The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None) prog_name : str ...
[ "Install", "the", "completion" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L314-L377
[ "def", "install", "(", "shell", "=", "None", ",", "prog_name", "=", "None", ",", "env_name", "=", "None", ",", "path", "=", "None", ",", "append", "=", "None", ",", "extra_env", "=", "None", ")", ":", "prog_name", "=", "prog_name", "or", "click", "."...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
getTreeBuilder
Get a TreeBuilder class for various types of trees with built-in support :arg treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom" - A generic builder for DOM implementations, defaulting to a xml.dom.minidom based implementation. * "etree...
pipenv/patched/notpip/_vendor/html5lib/treebuilders/__init__.py
def getTreeBuilder(treeType, implementation=None, **kwargs): """Get a TreeBuilder class for various types of trees with built-in support :arg treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom" - A generic builder for DOM implementations, defaulting t...
def getTreeBuilder(treeType, implementation=None, **kwargs): """Get a TreeBuilder class for various types of trees with built-in support :arg treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom" - A generic builder for DOM implementations, defaulting t...
[ "Get", "a", "TreeBuilder", "class", "for", "various", "types", "of", "trees", "with", "built", "-", "in", "support" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/__init__.py#L39-L88
[ "def", "getTreeBuilder", "(", "treeType", ",", "implementation", "=", "None", ",", "*", "*", "kwargs", ")", ":", "treeType", "=", "treeType", ".", "lower", "(", ")", "if", "treeType", "not", "in", "treeBuilderCache", ":", "if", "treeType", "==", "\"dom\"",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
choose_boundary
Our embarrassingly-simple replacement for mimetools.choose_boundary.
pipenv/vendor/urllib3/filepost.py
def choose_boundary(): """ Our embarrassingly-simple replacement for mimetools.choose_boundary. """ boundary = binascii.hexlify(os.urandom(16)) if six.PY3: boundary = boundary.decode('ascii') return boundary
def choose_boundary(): """ Our embarrassingly-simple replacement for mimetools.choose_boundary. """ boundary = binascii.hexlify(os.urandom(16)) if six.PY3: boundary = boundary.decode('ascii') return boundary
[ "Our", "embarrassingly", "-", "simple", "replacement", "for", "mimetools", ".", "choose_boundary", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L15-L22
[ "def", "choose_boundary", "(", ")", ":", "boundary", "=", "binascii", ".", "hexlify", "(", "os", ".", "urandom", "(", "16", ")", ")", "if", "six", ".", "PY3", ":", "boundary", "=", "boundary", ".", "decode", "(", "'ascii'", ")", "return", "boundary" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
iter_field_objects
Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`.
pipenv/vendor/urllib3/filepost.py
def iter_field_objects(fields): """ Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`. """ if isinstance(fields, dict): i = six.iteritems(fields) else: i = iter(fields) for field in i: if isinstanc...
def iter_field_objects(fields): """ Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`. """ if isinstance(fields, dict): i = six.iteritems(fields) else: i = iter(fields) for field in i: if isinstanc...
[ "Iterate", "over", "fields", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L25-L42
[ "def", "iter_field_objects", "(", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "dict", ")", ":", "i", "=", "six", ".", "iteritems", "(", "fields", ")", "else", ":", "i", "=", "iter", "(", "fields", ")", "for", "field", "in", "i", ":"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
iter_fields
.. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples and dicts.
pipenv/vendor/urllib3/filepost.py
def iter_fields(fields): """ .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples an...
def iter_fields(fields): """ .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples an...
[ "..", "deprecated", "::", "1", ".", "6" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L45-L60
[ "def", "iter_fields", "(", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "dict", ")", ":", "return", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "fields", ")", ")", "return", "(", "(", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
encode_multipart_formdata
Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary will be generated using :func:`urllib3.filepost.choose_bou...
pipenv/vendor/urllib3/filepost.py
def encode_multipart_formdata(fields, boundary=None): """ Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary ...
def encode_multipart_formdata(fields, boundary=None): """ Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary ...
[ "Encode", "a", "dictionary", "of", "fields", "using", "the", "multipart", "/", "form", "-", "data", "MIME", "format", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L63-L98
[ "def", "encode_multipart_formdata", "(", "fields", ",", "boundary", "=", "None", ")", ":", "body", "=", "BytesIO", "(", ")", "if", "boundary", "is", "None", ":", "boundary", "=", "choose_boundary", "(", ")", "for", "field", "in", "iter_field_objects", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
finder
Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package.
pipenv/vendor/distlib/resources.py
def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: ...
def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: ...
[ "Return", "a", "resource", "finder", "for", "a", "package", ".", ":", "param", "package", ":", "The", "name", "of", "the", "package", ".", ":", "return", ":", "A", ":", "class", ":", "ResourceFinder", "instance", "for", "the", "package", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L310-L332
[ "def", "finder", "(", "package", ")", ":", "if", "package", "in", "_finder_cache", ":", "result", "=", "_finder_cache", "[", "package", "]", "else", ":", "if", "package", "not", "in", "sys", ".", "modules", ":", "__import__", "(", "package", ")", "module...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
finder_for_path
Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path.
pipenv/vendor/distlib/resources.py
def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) load...
def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) load...
[ "Return", "a", "resource", "finder", "for", "a", "path", "which", "should", "represent", "a", "container", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L338-L355
[ "def", "finder_for_path", "(", "path", ")", ":", "result", "=", "None", "# calls any path hooks, gets importer into cache", "pkgutil", ".", "get_importer", "(", "path", ")", "loader", "=", "sys", ".", "path_importer_cache", ".", "get", "(", "path", ")", "finder", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ResourceCache.get
Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache.
pipenv/vendor/distlib/resources.py
def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path...
def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path...
[ "Get", "a", "resource", "into", "the", "cache" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L46-L69
[ "def", "get", "(", "self", ",", "resource", ")", ":", "prefix", ",", "path", "=", "resource", ".", "finder", ".", "get_cache_info", "(", "resource", ")", "if", "prefix", "is", "None", ":", "result", "=", "path", "else", ":", "result", "=", "os", ".",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
to_sax
Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use
pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py
def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use """ handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixM...
def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use """ handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixM...
[ "Call", "SAX", "-", "like", "content", "handler", "based", "on", "treewalker", "walker" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py#L13-L50
[ "def", "to_sax", "(", "walker", ",", "handler", ")", ":", "handler", ".", "startDocument", "(", ")", "for", "prefix", ",", "namespace", "in", "prefix_mapping", ".", "items", "(", ")", ":", "handler", ".", "startPrefixMapping", "(", "prefix", ",", "namespac...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
retry
Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object
pipenv/patched/notpip/_vendor/retrying.py
def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and cal...
def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and cal...
[ "Decorator", "function", "that", "instantiates", "the", "Retrying", "object" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L26-L53
[ "def", "retry", "(", "*", "dargs", ",", "*", "*", "dkw", ")", ":", "# support both @retry and @retry() as valid syntax", "if", "len", "(", "dargs", ")", "==", "1", "and", "callable", "(", "dargs", "[", "0", "]", ")", ":", "def", "wrap_simple", "(", "f", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Retrying.random_sleep
Sleep a random amount of time between wait_random_min and wait_random_max
pipenv/patched/notpip/_vendor/retrying.py
def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a random amount of time between wait_random_min and wait_random_max""" return random.randint(self._wait_random_min, self._wait_random_max)
def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a random amount of time between wait_random_min and wait_random_max""" return random.randint(self._wait_random_min, self._wait_random_max)
[ "Sleep", "a", "random", "amount", "of", "time", "between", "wait_random_min", "and", "wait_random_max" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L157-L159
[ "def", "random_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "random", ".", "randint", "(", "self", ".", "_wait_random_min", ",", "self", ".", "_wait_random_max", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Retrying.incrementing_sleep
Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment
pipenv/patched/notpip/_vendor/retrying.py
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ result = self._wait_incrementing_start + (self....
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ result = self._wait_incrementing_start + (self....
[ "Sleep", "an", "incremental", "amount", "of", "time", "after", "each", "attempt", "starting", "at", "wait_incrementing_start", "and", "incrementing", "by", "wait_incrementing_increment" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L161-L169
[ "def", "incrementing_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "result", "=", "self", ".", "_wait_incrementing_start", "+", "(", "self", ".", "_wait_incrementing_increment", "*", "(", "previous_attempt_number", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Attempt.get
Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised.
pipenv/patched/notpip/_vendor/retrying.py
def get(self, wrap_exception=False): """ Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. """ if self.has_exception: if wrap_exception: ...
def get(self, wrap_exception=False): """ Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. """ if self.has_exception: if wrap_exception: ...
[ "Return", "the", "return", "value", "of", "this", "Attempt", "instance", "or", "raise", "an", "Exception", ".", "If", "wrap_exception", "is", "true", "this", "Attempt", "is", "wrapped", "inside", "of", "a", "RetryError", "before", "being", "raised", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L237-L249
[ "def", "get", "(", "self", ",", "wrap_exception", "=", "False", ")", ":", "if", "self", ".", "has_exception", ":", "if", "wrap_exception", ":", "raise", "RetryError", "(", "self", ")", "else", ":", "six", ".", "reraise", "(", "self", ".", "value", "[",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
safe_range
A range that can't generate ranges with a length of more than MAX_RANGE items.
pipenv/vendor/jinja2/sandbox.py
def safe_range(*args): """A range that can't generate ranges with a length of more than MAX_RANGE items. """ rng = range(*args) if len(rng) > MAX_RANGE: raise OverflowError('range too big, maximum size for range is %d' % MAX_RANGE) return rng
def safe_range(*args): """A range that can't generate ranges with a length of more than MAX_RANGE items. """ rng = range(*args) if len(rng) > MAX_RANGE: raise OverflowError('range too big, maximum size for range is %d' % MAX_RANGE) return rng
[ "A", "range", "that", "can", "t", "generate", "ranges", "with", "a", "length", "of", "more", "than", "MAX_RANGE", "items", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L147-L155
[ "def", "safe_range", "(", "*", "args", ")", ":", "rng", "=", "range", "(", "*", "args", ")", "if", "len", "(", "rng", ")", ">", "MAX_RANGE", ":", "raise", "OverflowError", "(", "'range too big, maximum size for range is %d'", "%", "MAX_RANGE", ")", "return",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_internal_attribute
Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >>> from jinja2.sandbox import is_internal_att...
pipenv/vendor/jinja2/sandbox.py
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >...
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >...
[ "Test", "if", "the", "attribute", "given", "is", "an", "internal", "python", "attribute", ".", "For", "example", "this", "function", "returns", "True", "for", "the", "func_code", "attribute", "of", "python", "objects", ".", "This", "is", "useful", "if", "the...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L171-L204
[ "def", "is_internal_attribute", "(", "obj", ",", "attr", ")", ":", "if", "isinstance", "(", "obj", ",", "types", ".", "FunctionType", ")", ":", "if", "attr", "in", "UNSAFE_FUNCTION_ATTRIBUTES", ":", "return", "True", "elif", "isinstance", "(", "obj", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
modifies_known_mutable
This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `MutableSet`, `MutableMapping`, and `MutableSe...
pipenv/vendor/jinja2/sandbox.py
def modifies_known_mutable(obj, attr): """This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `Mut...
def modifies_known_mutable(obj, attr): """This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `Mut...
[ "This", "function", "checks", "if", "an", "attribute", "on", "a", "builtin", "mutable", "object", "(", "list", "dict", "set", "or", "deque", ")", "would", "modify", "it", "if", "called", ".", "It", "also", "supports", "the", "user", "-", "versions", "of"...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L207-L232
[ "def", "modifies_known_mutable", "(", "obj", ",", "attr", ")", ":", "for", "typespec", ",", "unsafe", "in", "_mutable_spec", ":", "if", "isinstance", "(", "obj", ",", "typespec", ")", ":", "return", "attr", "in", "unsafe", "return", "False" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SandboxedEnvironment.is_safe_attribute
The sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python objects as returned by the :func:`is_internal_attr...
pipenv/vendor/jinja2/sandbox.py
def is_safe_attribute(self, obj, attr, value): """The sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python ...
def is_safe_attribute(self, obj, attr, value): """The sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python ...
[ "The", "sandboxed", "environment", "will", "call", "this", "method", "to", "check", "if", "the", "attribute", "of", "an", "object", "is", "safe", "to", "access", ".", "Per", "default", "all", "attributes", "starting", "with", "an", "underscore", "are", "cons...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L323-L330
[ "def", "is_safe_attribute", "(", "self", ",", "obj", ",", "attr", ",", "value", ")", ":", "return", "not", "(", "attr", ".", "startswith", "(", "'_'", ")", "or", "is_internal_attribute", "(", "obj", ",", "attr", ")", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SandboxedEnvironment.call_binop
For intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6
pipenv/vendor/jinja2/sandbox.py
def call_binop(self, context, operator, left, right): """For intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6 """ ...
def call_binop(self, context, operator, left, right): """For intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6 """ ...
[ "For", "intercepted", "binary", "operator", "calls", "(", ":", "meth", ":", "intercepted_binops", ")", "this", "function", "is", "executed", "instead", "of", "the", "builtin", "operator", ".", "This", "can", "be", "used", "to", "fine", "tune", "the", "behavi...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L341-L348
[ "def", "call_binop", "(", "self", ",", "context", ",", "operator", ",", "left", ",", "right", ")", ":", "return", "self", ".", "binop_table", "[", "operator", "]", "(", "left", ",", "right", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SandboxedEnvironment.getattr
Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring.
pipenv/vendor/jinja2/sandbox.py
def getattr(self, obj, attribute): """Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring. """ try: value = getattr(obj, attribute) except AttributeError: try: return obj[attribute]...
def getattr(self, obj, attribute): """Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring. """ try: value = getattr(obj, attribute) except AttributeError: try: return obj[attribute]...
[ "Subscribe", "an", "object", "from", "sandboxed", "code", "and", "prefer", "the", "attribute", ".", "The", "attribute", "passed", "*", "must", "*", "be", "a", "bytestring", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L380-L395
[ "def", "getattr", "(", "self", ",", "obj", ",", "attribute", ")", ":", "try", ":", "value", "=", "getattr", "(", "obj", ",", "attribute", ")", "except", "AttributeError", ":", "try", ":", "return", "obj", "[", "attribute", "]", "except", "(", "TypeErro...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SandboxedEnvironment.unsafe_undefined
Return an undefined object for unsafe attributes.
pipenv/vendor/jinja2/sandbox.py
def unsafe_undefined(self, obj, attribute): """Return an undefined object for unsafe attributes.""" return self.undefined('access to attribute %r of %r ' 'object is unsafe.' % ( attribute, obj.__class__.__name__ ), name=attribute, obj=obj, ex...
def unsafe_undefined(self, obj, attribute): """Return an undefined object for unsafe attributes.""" return self.undefined('access to attribute %r of %r ' 'object is unsafe.' % ( attribute, obj.__class__.__name__ ), name=attribute, obj=obj, ex...
[ "Return", "an", "undefined", "object", "for", "unsafe", "attributes", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L397-L403
[ "def", "unsafe_undefined", "(", "self", ",", "obj", ",", "attribute", ")", ":", "return", "self", ".", "undefined", "(", "'access to attribute %r of %r '", "'object is unsafe.'", "%", "(", "attribute", ",", "obj", ".", "__class__", ".", "__name__", ")", ",", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SandboxedEnvironment.format_string
If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it.
pipenv/vendor/jinja2/sandbox.py
def format_string(self, s, args, kwargs): """If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it. """ if isinstance(s, Markup): formatter = SandboxedEscapeFormatter(self, s.escape) else: forma...
def format_string(self, s, args, kwargs): """If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it. """ if isinstance(s, Markup): formatter = SandboxedEscapeFormatter(self, s.escape) else: forma...
[ "If", "a", "format", "call", "is", "detected", "then", "this", "is", "routed", "through", "this", "method", "so", "that", "our", "safety", "sandbox", "can", "be", "used", "for", "it", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L405-L415
[ "def", "format_string", "(", "self", ",", "s", ",", "args", ",", "kwargs", ")", ":", "if", "isinstance", "(", "s", ",", "Markup", ")", ":", "formatter", "=", "SandboxedEscapeFormatter", "(", "self", ",", "s", ".", "escape", ")", "else", ":", "formatter...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SandboxedEnvironment.call
Call an object from sandboxed code.
pipenv/vendor/jinja2/sandbox.py
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" fmt = inspect_format_method(__obj) if fmt is not None: return __self.format_string(fmt, args, kwargs) # the double prefixes are to avoid double keyword argument # errors wh...
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" fmt = inspect_format_method(__obj) if fmt is not None: return __self.format_string(fmt, args, kwargs) # the double prefixes are to avoid double keyword argument # errors wh...
[ "Call", "an", "object", "from", "sandboxed", "code", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L417-L427
[ "def", "call", "(", "__self", ",", "__context", ",", "__obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "fmt", "=", "inspect_format_method", "(", "__obj", ")", "if", "fmt", "is", "not", "None", ":", "return", "__self", ".", "format_string", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
attrib
Create a new attribute on a class. .. warning:: Does *not* do anything unless the class is also decorated with :func:`attr.s`! :param default: A value that is used if an ``attrs``-generated ``__init__`` is used and no value is passed while instantiating or the attribute is ex...
pipenv/vendor/attr/_make.py
def attrib( default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=None, type=None, converter=None, factory=None, kw_only=False, ): """ Create a new attribute on a class. .. warning:: Does *not* do anythin...
def attrib( default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=None, type=None, converter=None, factory=None, kw_only=False, ): """ Create a new attribute on a class. .. warning:: Does *not* do anythin...
[ "Create", "a", "new", "attribute", "on", "a", "class", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L70-L219
[ "def", "attrib", "(", "default", "=", "NOTHING", ",", "validator", "=", "None", ",", "repr", "=", "True", ",", "cmp", "=", "True", ",", "hash", "=", "None", ",", "init", "=", "True", ",", "convert", "=", "None", ",", "metadata", "=", "None", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_make_attr_tuple_class
Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0))
pipenv/vendor/attr/_make.py
def _make_attr_tuple_class(cls_name, attr_names): """ Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) """ attr_class_name = "{}A...
def _make_attr_tuple_class(cls_name, attr_names): """ Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) """ attr_class_name = "{}A...
[ "Create", "a", "tuple", "subclass", "to", "hold", "Attribute", "s", "for", "an", "attrs", "class", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L222-L247
[ "def", "_make_attr_tuple_class", "(", "cls_name", ",", "attr_names", ")", ":", "attr_class_name", "=", "\"{}Attributes\"", ".", "format", "(", "cls_name", ")", "attr_class_template", "=", "[", "\"class {}(tuple):\"", ".", "format", "(", "attr_class_name", ")", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_get_annotations
Get annotations for *cls*.
pipenv/vendor/attr/_make.py
def _get_annotations(cls): """ Get annotations for *cls*. """ anns = getattr(cls, "__annotations__", None) if anns is None: return {} # Verify that the annotations aren't merely inherited. for base_cls in cls.__mro__[1:]: if anns is getattr(base_cls, "__annotations__", None)...
def _get_annotations(cls): """ Get annotations for *cls*. """ anns = getattr(cls, "__annotations__", None) if anns is None: return {} # Verify that the annotations aren't merely inherited. for base_cls in cls.__mro__[1:]: if anns is getattr(base_cls, "__annotations__", None)...
[ "Get", "annotations", "for", "*", "cls", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L276-L289
[ "def", "_get_annotations", "(", "cls", ")", ":", "anns", "=", "getattr", "(", "cls", ",", "\"__annotations__\"", ",", "None", ")", "if", "anns", "is", "None", ":", "return", "{", "}", "# Verify that the annotations aren't merely inherited.", "for", "base_cls", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_transform_attrs
Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. Return an `_Attributes`.
pipenv/vendor/attr/_make.py
def _transform_attrs(cls, these, auto_attribs, kw_only): """ Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. Return an `_Attributes`. """ cd = cls.__dict__ anns = _get_annotations(cls) if these is not No...
def _transform_attrs(cls, these, auto_attribs, kw_only): """ Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. Return an `_Attributes`. """ cd = cls.__dict__ anns = _get_annotations(cls) if these is not No...
[ "Transform", "all", "_CountingAttr", "s", "on", "a", "class", "into", "Attribute", "s", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L299-L421
[ "def", "_transform_attrs", "(", "cls", ",", "these", ",", "auto_attribs", ",", "kw_only", ")", ":", "cd", "=", "cls", ".", "__dict__", "anns", "=", "_get_annotations", "(", "cls", ")", "if", "these", "is", "not", "None", ":", "ca_list", "=", "[", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
attrs
r""" A class decorator that adds `dunder <https://wiki.python.org/moin/DunderAlias>`_\ -methods according to the specified attributes using :func:`attr.ib` or the *these* argument. :param these: A dictionary of name to :func:`attr.ib` mappings. This is useful to avoid the definition of your at...
pipenv/vendor/attr/_make.py
def attrs( maybe_cls=None, these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, ): r""" A class decorator that...
def attrs( maybe_cls=None, these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, ): r""" A class decorator that...
[ "r", "A", "class", "decorator", "that", "adds", "dunder", "<https", ":", "//", "wiki", ".", "python", ".", "org", "/", "moin", "/", "DunderAlias", ">", "_", "\\", "-", "methods", "according", "to", "the", "specified", "attributes", "using", ":", "func", ...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L730-L959
[ "def", "attrs", "(", "maybe_cls", "=", "None", ",", "these", "=", "None", ",", "repr_ns", "=", "None", ",", "repr", "=", "True", ",", "cmp", "=", "True", ",", "hash", "=", "None", ",", "init", "=", "True", ",", "slots", "=", "False", ",", "frozen...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_attrs_to_tuple
Create a tuple of all values of *obj*'s *attrs*.
pipenv/vendor/attr/_make.py
def _attrs_to_tuple(obj, attrs): """ Create a tuple of all values of *obj*'s *attrs*. """ return tuple(getattr(obj, a.name) for a in attrs)
def _attrs_to_tuple(obj, attrs): """ Create a tuple of all values of *obj*'s *attrs*. """ return tuple(getattr(obj, a.name) for a in attrs)
[ "Create", "a", "tuple", "of", "all", "values", "of", "*", "obj", "*", "s", "*", "attrs", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L993-L997
[ "def", "_attrs_to_tuple", "(", "obj", ",", "attrs", ")", ":", "return", "tuple", "(", "getattr", "(", "obj", ",", "a", ".", "name", ")", "for", "a", "in", "attrs", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_add_hash
Add a hash method to *cls*.
pipenv/vendor/attr/_make.py
def _add_hash(cls, attrs): """ Add a hash method to *cls*. """ cls.__hash__ = _make_hash(attrs, frozen=False, cache_hash=False) return cls
def _add_hash(cls, attrs): """ Add a hash method to *cls*. """ cls.__hash__ = _make_hash(attrs, frozen=False, cache_hash=False) return cls
[ "Add", "a", "hash", "method", "to", "*", "cls", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1065-L1070
[ "def", "_add_hash", "(", "cls", ",", "attrs", ")", ":", "cls", ".", "__hash__", "=", "_make_hash", "(", "attrs", ",", "frozen", "=", "False", ",", "cache_hash", "=", "False", ")", "return", "cls" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_add_cmp
Add comparison methods to *cls*.
pipenv/vendor/attr/_make.py
def _add_cmp(cls, attrs=None): """ Add comparison methods to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__eq__, cls.__ne__, cls.__lt__, cls.__le__, cls.__gt__, cls.__ge__ = _make_cmp( # noqa attrs ) return cls
def _add_cmp(cls, attrs=None): """ Add comparison methods to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__eq__, cls.__ne__, cls.__lt__, cls.__le__, cls.__gt__, cls.__ge__ = _make_cmp( # noqa attrs ) return cls
[ "Add", "comparison", "methods", "to", "*", "cls", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1194-L1205
[ "def", "_add_cmp", "(", "cls", ",", "attrs", "=", "None", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "cls", ".", "__attrs_attrs__", "cls", ".", "__eq__", ",", "cls", ".", "__ne__", ",", "cls", ".", "__lt__", ",", "cls", ".", "__le__"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_make_repr
Make a repr method for *attr_names* adding *ns* to the full name.
pipenv/vendor/attr/_make.py
def _make_repr(attrs, ns): """ Make a repr method for *attr_names* adding *ns* to the full name. """ attr_names = tuple(a.name for a in attrs if a.repr) def __repr__(self): """ Automatically created by attrs. """ try: working_set = _already_repring.workin...
def _make_repr(attrs, ns): """ Make a repr method for *attr_names* adding *ns* to the full name. """ attr_names = tuple(a.name for a in attrs if a.repr) def __repr__(self): """ Automatically created by attrs. """ try: working_set = _already_repring.workin...
[ "Make", "a", "repr", "method", "for", "*", "attr_names", "*", "adding", "*", "ns", "*", "to", "the", "full", "name", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1211-L1257
[ "def", "_make_repr", "(", "attrs", ",", "ns", ")", ":", "attr_names", "=", "tuple", "(", "a", ".", "name", "for", "a", "in", "attrs", "if", "a", ".", "repr", ")", "def", "__repr__", "(", "self", ")", ":", "\"\"\"\n Automatically created by attrs.\n ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_add_repr
Add a repr method to *cls*.
pipenv/vendor/attr/_make.py
def _add_repr(cls, ns=None, attrs=None): """ Add a repr method to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__repr__ = _make_repr(attrs, ns) return cls
def _add_repr(cls, ns=None, attrs=None): """ Add a repr method to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__repr__ = _make_repr(attrs, ns) return cls
[ "Add", "a", "repr", "method", "to", "*", "cls", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1260-L1268
[ "def", "_add_repr", "(", "cls", ",", "ns", "=", "None", ",", "attrs", "=", "None", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "cls", ".", "__attrs_attrs__", "cls", ".", "__repr__", "=", "_make_repr", "(", "attrs", ",", "ns", ")", "re...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
fields
Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` ...
pipenv/vendor/attr/_make.py
def fields(cls): """ Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *...
def fields(cls): """ Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *...
[ "Return", "the", "tuple", "of", "attrs", "attributes", "for", "a", "class", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1311-L1336
[ "def", "fields", "(", "cls", ")", ":", "if", "not", "isclass", "(", "cls", ")", ":", "raise", "TypeError", "(", "\"Passed object must be a class.\"", ")", "attrs", "=", "getattr", "(", "cls", ",", "\"__attrs_attrs__\"", ",", "None", ")", "if", "attrs", "is...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
fields_dict
Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` class. :rtype: an ordered dict w...
pipenv/vendor/attr/_make.py
def fields_dict(cls): """ Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` cla...
def fields_dict(cls): """ Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` cla...
[ "Return", "an", "ordered", "dictionary", "of", "attrs", "attributes", "for", "a", "class", "whose", "keys", "are", "the", "attribute", "names", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1339-L1364
[ "def", "fields_dict", "(", "cls", ")", ":", "if", "not", "isclass", "(", "cls", ")", ":", "raise", "TypeError", "(", "\"Passed object must be a class.\"", ")", "attrs", "=", "getattr", "(", "cls", ",", "\"__attrs_attrs__\"", ",", "None", ")", "if", "attrs", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
validate
Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes.
pipenv/vendor/attr/_make.py
def validate(inst): """ Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes. """ if _config._run_validators is False: return for a in fields(inst.__class__): v = a.validator ...
def validate(inst): """ Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes. """ if _config._run_validators is False: return for a in fields(inst.__class__): v = a.validator ...
[ "Validate", "all", "attributes", "on", "*", "inst", "*", "that", "have", "a", "validator", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1367-L1381
[ "def", "validate", "(", "inst", ")", ":", "if", "_config", ".", "_run_validators", "is", "False", ":", "return", "for", "a", "in", "fields", "(", "inst", ".", "__class__", ")", ":", "v", "=", "a", ".", "validator", "if", "v", "is", "not", "None", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_attrs_to_init_script
Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cached ``object.__setattr__``.
pipenv/vendor/attr/_make.py
def _attrs_to_init_script( attrs, frozen, slots, post_init, cache_hash, base_attr_map, is_exc ): """ Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cac...
def _attrs_to_init_script( attrs, frozen, slots, post_init, cache_hash, base_attr_map, is_exc ): """ Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cac...
[ "Return", "a", "script", "of", "an", "initializer", "for", "*", "attrs", "*", "and", "a", "dict", "of", "globals", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1395-L1672
[ "def", "_attrs_to_init_script", "(", "attrs", ",", "frozen", ",", "slots", ",", "post_init", ",", "cache_hash", ",", "base_attr_map", ",", "is_exc", ")", ":", "lines", "=", "[", "]", "any_slot_ancestors", "=", "any", "(", "_is_slot_attr", "(", "a", ".", "n...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
make_class
A quick way to create a new class called *name* with *attrs*. :param name: The name for the new class. :type name: str :param attrs: A list of names or a dictionary of mappings of names to attributes. If *attrs* is a list or an ordered dict (:class:`dict` on Python 3.6+, :class:`c...
pipenv/vendor/attr/_make.py
def make_class(name, attrs, bases=(object,), **attributes_arguments): """ A quick way to create a new class called *name* with *attrs*. :param name: The name for the new class. :type name: str :param attrs: A list of names or a dictionary of mappings of names to attributes. If *at...
def make_class(name, attrs, bases=(object,), **attributes_arguments): """ A quick way to create a new class called *name* with *attrs*. :param name: The name for the new class. :type name: str :param attrs: A list of names or a dictionary of mappings of names to attributes. If *at...
[ "A", "quick", "way", "to", "create", "a", "new", "class", "called", "*", "name", "*", "with", "*", "attrs", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1997-L2047
[ "def", "make_class", "(", "name", ",", "attrs", ",", "bases", "=", "(", "object", ",", ")", ",", "*", "*", "attributes_arguments", ")", ":", "if", "isinstance", "(", "attrs", ",", "dict", ")", ":", "cls_dict", "=", "attrs", "elif", "isinstance", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
and_
A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param validators: Arbitrary number of validators. :type validators: callables .. versionadded:: 17.1.0
pipenv/vendor/attr/_make.py
def and_(*validators): """ A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param validators: Arbitrary number of validators. :type validators: callables .. versionadded:: 17.1.0 """ vals = [] for validator in validat...
def and_(*validators): """ A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param validators: Arbitrary number of validators. :type validators: callables .. versionadded:: 17.1.0 """ vals = [] for validator in validat...
[ "A", "validator", "that", "composes", "multiple", "validators", "into", "one", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L2067-L2086
[ "def", "and_", "(", "*", "validators", ")", ":", "vals", "=", "[", "]", "for", "validator", "in", "validators", ":", "vals", ".", "extend", "(", "validator", ".", "_validators", "if", "isinstance", "(", "validator", ",", "_AndValidator", ")", "else", "["...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_ClassBuilder._patch_original_class
Apply accumulated methods and return the class.
pipenv/vendor/attr/_make.py
def _patch_original_class(self): """ Apply accumulated methods and return the class. """ cls = self._cls base_names = self._base_names # Clean class of attribute definitions (`attr.ib()`s). if self._delete_attribs: for name in self._attr_names: ...
def _patch_original_class(self): """ Apply accumulated methods and return the class. """ cls = self._cls base_names = self._base_names # Clean class of attribute definitions (`attr.ib()`s). if self._delete_attribs: for name in self._attr_names: ...
[ "Apply", "accumulated", "methods", "and", "return", "the", "class", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L509-L555
[ "def", "_patch_original_class", "(", "self", ")", ":", "cls", "=", "self", ".", "_cls", "base_names", "=", "self", ".", "_base_names", "# Clean class of attribute definitions (`attr.ib()`s).", "if", "self", ".", "_delete_attribs", ":", "for", "name", "in", "self", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_ClassBuilder._create_slots_class
Build and return a new class with a `__slots__` attribute.
pipenv/vendor/attr/_make.py
def _create_slots_class(self): """ Build and return a new class with a `__slots__` attribute. """ base_names = self._base_names cd = { k: v for k, v in iteritems(self._cls_dict) if k not in tuple(self._attr_names) + ("__dict__", "__weakref__") ...
def _create_slots_class(self): """ Build and return a new class with a `__slots__` attribute. """ base_names = self._base_names cd = { k: v for k, v in iteritems(self._cls_dict) if k not in tuple(self._attr_names) + ("__dict__", "__weakref__") ...
[ "Build", "and", "return", "a", "new", "class", "with", "a", "__slots__", "attribute", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L557-L651
[ "def", "_create_slots_class", "(", "self", ")", ":", "base_names", "=", "self", ".", "_base_names", "cd", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "iteritems", "(", "self", ".", "_cls_dict", ")", "if", "k", "not", "in", "tuple", "(", "s...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_ClassBuilder._add_method_dunders
Add __module__ and __qualname__ to a *method* if possible.
pipenv/vendor/attr/_make.py
def _add_method_dunders(self, method): """ Add __module__ and __qualname__ to a *method* if possible. """ try: method.__module__ = self._cls.__module__ except AttributeError: pass try: method.__qualname__ = ".".join( (s...
def _add_method_dunders(self, method): """ Add __module__ and __qualname__ to a *method* if possible. """ try: method.__module__ = self._cls.__module__ except AttributeError: pass try: method.__qualname__ = ".".join( (s...
[ "Add", "__module__", "and", "__qualname__", "to", "a", "*", "method", "*", "if", "possible", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L711-L727
[ "def", "_add_method_dunders", "(", "self", ",", "method", ")", ":", "try", ":", "method", ".", "__module__", "=", "self", ".", "_cls", ".", "__module__", "except", "AttributeError", ":", "pass", "try", ":", "method", ".", "__qualname__", "=", "\".\"", ".",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Attribute._assoc
Copy *self* and apply *changes*.
pipenv/vendor/attr/_make.py
def _assoc(self, **changes): """ Copy *self* and apply *changes*. """ new = copy.copy(self) new._setattrs(changes.items()) return new
def _assoc(self, **changes): """ Copy *self* and apply *changes*. """ new = copy.copy(self) new._setattrs(changes.items()) return new
[ "Copy", "*", "self", "*", "and", "apply", "*", "changes", "*", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1796-L1804
[ "def", "_assoc", "(", "self", ",", "*", "*", "changes", ")", ":", "new", "=", "copy", ".", "copy", "(", "self", ")", "new", ".", "_setattrs", "(", "changes", ".", "items", "(", ")", ")", "return", "new" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_CountingAttr.validator
Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0
pipenv/vendor/attr/_make.py
def validator(self, meth): """ Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 """ if self._validator is None: self._validator = meth else: self._validator = and_(self._validator, m...
def validator(self, meth): """ Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 """ if self._validator is None: self._validator = meth else: self._validator = and_(self._validator, m...
[ "Decorator", "that", "adds", "*", "meth", "*", "to", "the", "list", "of", "validators", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1934-L1946
[ "def", "validator", "(", "self", ",", "meth", ")", ":", "if", "self", ".", "_validator", "is", "None", ":", "self", ".", "_validator", "=", "meth", "else", ":", "self", ".", "_validator", "=", "and_", "(", "self", ".", "_validator", ",", "meth", ")",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_CountingAttr.default
Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0
pipenv/vendor/attr/_make.py
def default(self, meth): """ Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 """ if self._default is not NOTHING: raise Def...
def default(self, meth): """ Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 """ if self._default is not NOTHING: raise Def...
[ "Decorator", "that", "allows", "to", "set", "the", "default", "for", "an", "attribute", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1948-L1963
[ "def", "default", "(", "self", ",", "meth", ")", ":", "if", "self", ".", "_default", "is", "not", "NOTHING", ":", "raise", "DefaultAlreadySetError", "(", ")", "self", ".", "_default", "=", "Factory", "(", "meth", ",", "takes_self", "=", "True", ")", "r...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_expand_args
Parses command strings and returns a Popen-ready list.
pipenv/vendor/delegator.py
def _expand_args(command): """Parses command strings and returns a Popen-ready list.""" # Prepare arguments. if isinstance(command, STR_TYPES): if sys.version_info[0] == 2: splitter = shlex.shlex(command.encode("utf-8")) elif sys.version_info[0] == 3: splitter = shle...
def _expand_args(command): """Parses command strings and returns a Popen-ready list.""" # Prepare arguments. if isinstance(command, STR_TYPES): if sys.version_info[0] == 2: splitter = shlex.shlex(command.encode("utf-8")) elif sys.version_info[0] == 3: splitter = shle...
[ "Parses", "command", "strings", "and", "returns", "a", "Popen", "-", "ready", "list", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L290-L314
[ "def", "_expand_args", "(", "command", ")", ":", "# Prepare arguments.", "if", "isinstance", "(", "command", ",", "STR_TYPES", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "==", "2", ":", "splitter", "=", "shlex", ".", "shlex", "(", "comman...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Command.out
Std/out output (cached)
pipenv/vendor/delegator.py
def out(self): """Std/out output (cached)""" if self.__out is not None: return self.__out if self._uses_subprocess: self.__out = self.std_out.read() else: self.__out = self._pexpect_out return self.__out
def out(self): """Std/out output (cached)""" if self.__out is not None: return self.__out if self._uses_subprocess: self.__out = self.std_out.read() else: self.__out = self._pexpect_out return self.__out
[ "Std", "/", "out", "output", "(", "cached", ")" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L125-L135
[ "def", "out", "(", "self", ")", ":", "if", "self", ".", "__out", "is", "not", "None", ":", "return", "self", ".", "__out", "if", "self", ".", "_uses_subprocess", ":", "self", ".", "__out", "=", "self", ".", "std_out", ".", "read", "(", ")", "else",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Command.expect
Waits on the given pattern to appear in std_out
pipenv/vendor/delegator.py
def expect(self, pattern, timeout=-1): """Waits on the given pattern to appear in std_out""" if self.blocking: raise RuntimeError("expect can only be used on non-blocking commands.") try: self.subprocess.expect(pattern=pattern, timeout=timeout) except pexpect.EO...
def expect(self, pattern, timeout=-1): """Waits on the given pattern to appear in std_out""" if self.blocking: raise RuntimeError("expect can only be used on non-blocking commands.") try: self.subprocess.expect(pattern=pattern, timeout=timeout) except pexpect.EO...
[ "Waits", "on", "the", "given", "pattern", "to", "appear", "in", "std_out" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L208-L217
[ "def", "expect", "(", "self", ",", "pattern", ",", "timeout", "=", "-", "1", ")", ":", "if", "self", ".", "blocking", ":", "raise", "RuntimeError", "(", "\"expect can only be used on non-blocking commands.\"", ")", "try", ":", "self", ".", "subprocess", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Command.block
Blocks until process is complete.
pipenv/vendor/delegator.py
def block(self): """Blocks until process is complete.""" if self._uses_subprocess: # consume stdout and stderr if self.blocking: try: stdout, stderr = self.subprocess.communicate() self.__out = stdout sel...
def block(self): """Blocks until process is complete.""" if self._uses_subprocess: # consume stdout and stderr if self.blocking: try: stdout, stderr = self.subprocess.communicate() self.__out = stdout sel...
[ "Blocks", "until", "process", "is", "complete", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L242-L264
[ "def", "block", "(", "self", ")", ":", "if", "self", ".", "_uses_subprocess", ":", "# consume stdout and stderr", "if", "self", ".", "blocking", ":", "try", ":", "stdout", ",", "stderr", "=", "self", ".", "subprocess", ".", "communicate", "(", ")", "self",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Command.pipe
Runs the current command and passes its output to the next given process.
pipenv/vendor/delegator.py
def pipe(self, command, timeout=None, cwd=None): """Runs the current command and passes its output to the next given process. """ if not timeout: timeout = self.timeout if not self.was_run: self.run(block=False, cwd=cwd) data = self.out ...
def pipe(self, command, timeout=None, cwd=None): """Runs the current command and passes its output to the next given process. """ if not timeout: timeout = self.timeout if not self.was_run: self.run(block=False, cwd=cwd) data = self.out ...
[ "Runs", "the", "current", "command", "and", "passes", "its", "output", "to", "the", "next", "given", "process", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L266-L287
[ "def", "pipe", "(", "self", ",", "command", ",", "timeout", "=", "None", ",", "cwd", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "self", ".", "timeout", "if", "not", "self", ".", "was_run", ":", "self", ".", "run", "(", "b...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
backport_makefile
Backport of ``socket.makefile`` from Python 3.5.
pipenv/vendor/urllib3/packages/backports/makefile.py
def backport_makefile(self, mode="r", buffering=None, encoding=None, errors=None, newline=None): """ Backport of ``socket.makefile`` from Python 3.5. """ if not set(mode) <= {"r", "w", "b"}: raise ValueError( "invalid mode %r (only r, w, b allowed)" % (mode,) ...
def backport_makefile(self, mode="r", buffering=None, encoding=None, errors=None, newline=None): """ Backport of ``socket.makefile`` from Python 3.5. """ if not set(mode) <= {"r", "w", "b"}: raise ValueError( "invalid mode %r (only r, w, b allowed)" % (mode,) ...
[ "Backport", "of", "socket", ".", "makefile", "from", "Python", "3", ".", "5", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/packages/backports/makefile.py#L14-L53
[ "def", "backport_makefile", "(", "self", ",", "mode", "=", "\"r\"", ",", "buffering", "=", "None", ",", "encoding", "=", "None", ",", "errors", "=", "None", ",", "newline", "=", "None", ")", ":", "if", "not", "set", "(", "mode", ")", "<=", "{", "\"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
make_traceback
Creates a processed traceback object from the exc_info.
pipenv/vendor/jinja2/debug.py
def make_traceback(exc_info, source_hint=None): """Creates a processed traceback object from the exc_info.""" exc_type, exc_value, tb = exc_info if isinstance(exc_value, TemplateSyntaxError): exc_info = translate_syntax_error(exc_value, source_hint) initial_skip = 0 else: initial...
def make_traceback(exc_info, source_hint=None): """Creates a processed traceback object from the exc_info.""" exc_type, exc_value, tb = exc_info if isinstance(exc_value, TemplateSyntaxError): exc_info = translate_syntax_error(exc_value, source_hint) initial_skip = 0 else: initial...
[ "Creates", "a", "processed", "traceback", "object", "from", "the", "exc_info", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L132-L140
[ "def", "make_traceback", "(", "exc_info", ",", "source_hint", "=", "None", ")", ":", "exc_type", ",", "exc_value", ",", "tb", "=", "exc_info", "if", "isinstance", "(", "exc_value", ",", "TemplateSyntaxError", ")", ":", "exc_info", "=", "translate_syntax_error", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
translate_syntax_error
Rewrites a syntax error to please traceback systems.
pipenv/vendor/jinja2/debug.py
def translate_syntax_error(error, source=None): """Rewrites a syntax error to please traceback systems.""" error.source = source error.translated = True exc_info = (error.__class__, error, None) filename = error.filename if filename is None: filename = '<unknown>' return fake_exc_inf...
def translate_syntax_error(error, source=None): """Rewrites a syntax error to please traceback systems.""" error.source = source error.translated = True exc_info = (error.__class__, error, None) filename = error.filename if filename is None: filename = '<unknown>' return fake_exc_inf...
[ "Rewrites", "a", "syntax", "error", "to", "please", "traceback", "systems", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L143-L151
[ "def", "translate_syntax_error", "(", "error", ",", "source", "=", "None", ")", ":", "error", ".", "source", "=", "source", "error", ".", "translated", "=", "True", "exc_info", "=", "(", "error", ".", "__class__", ",", "error", ",", "None", ")", "filenam...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ProcessedTraceback.render_as_text
Return a string with the traceback.
pipenv/vendor/jinja2/debug.py
def render_as_text(self, limit=None): """Return a string with the traceback.""" lines = traceback.format_exception(self.exc_type, self.exc_value, self.frames[0], limit=limit) return ''.join(lines).rstrip()
def render_as_text(self, limit=None): """Return a string with the traceback.""" lines = traceback.format_exception(self.exc_type, self.exc_value, self.frames[0], limit=limit) return ''.join(lines).rstrip()
[ "Return", "a", "string", "with", "the", "traceback", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L97-L101
[ "def", "render_as_text", "(", "self", ",", "limit", "=", "None", ")", ":", "lines", "=", "traceback", ".", "format_exception", "(", "self", ".", "exc_type", ",", "self", ".", "exc_value", ",", "self", ".", "frames", "[", "0", "]", ",", "limit", "=", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ProcessedTraceback.render_as_html
Return a unicode string with the traceback as rendered HTML.
pipenv/vendor/jinja2/debug.py
def render_as_html(self, full=False): """Return a unicode string with the traceback as rendered HTML.""" from jinja2.debugrenderer import render_traceback return u'%s\n\n<!--\n%s\n-->' % ( render_traceback(self, full=full), self.render_as_text().decode('utf-8', 'replace')...
def render_as_html(self, full=False): """Return a unicode string with the traceback as rendered HTML.""" from jinja2.debugrenderer import render_traceback return u'%s\n\n<!--\n%s\n-->' % ( render_traceback(self, full=full), self.render_as_text().decode('utf-8', 'replace')...
[ "Return", "a", "unicode", "string", "with", "the", "traceback", "as", "rendered", "HTML", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L103-L109
[ "def", "render_as_html", "(", "self", ",", "full", "=", "False", ")", ":", "from", "jinja2", ".", "debugrenderer", "import", "render_traceback", "return", "u'%s\\n\\n<!--\\n%s\\n-->'", "%", "(", "render_traceback", "(", "self", ",", "full", "=", "full", ")", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ProcessedTraceback.standard_exc_info
Standard python exc_info for re-raising
pipenv/vendor/jinja2/debug.py
def standard_exc_info(self): """Standard python exc_info for re-raising""" tb = self.frames[0] # the frame will be an actual traceback (or transparent proxy) if # we are on pypy or a python implementation with support for tproxy if type(tb) is not TracebackType: tb = ...
def standard_exc_info(self): """Standard python exc_info for re-raising""" tb = self.frames[0] # the frame will be an actual traceback (or transparent proxy) if # we are on pypy or a python implementation with support for tproxy if type(tb) is not TracebackType: tb = ...
[ "Standard", "python", "exc_info", "for", "re", "-", "raising" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L122-L129
[ "def", "standard_exc_info", "(", "self", ")", ":", "tb", "=", "self", ".", "frames", "[", "0", "]", "# the frame will be an actual traceback (or transparent proxy) if", "# we are on pypy or a python implementation with support for tproxy", "if", "type", "(", "tb", ")", "is"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
DYMMixin.resolve_command
Overrides clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the raised exception message.
pipenv/vendor/click_didyoumean/__init__.py
def resolve_command(self, ctx, args): """ Overrides clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the raised exception message. """ original_cmd_name = click.utils.make_str(args[0]) try: return super(DYMMixin, self).r...
def resolve_command(self, ctx, args): """ Overrides clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the raised exception message. """ original_cmd_name = click.utils.make_str(args[0]) try: return super(DYMMixin, self).r...
[ "Overrides", "clicks", "resolve_command", "method", "and", "appends", "*", "Did", "you", "mean", "...", "*", "suggestions", "to", "the", "raised", "exception", "message", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_didyoumean/__init__.py#L25-L42
[ "def", "resolve_command", "(", "self", ",", "ctx", ",", "args", ")", ":", "original_cmd_name", "=", "click", ".", "utils", ".", "make_str", "(", "args", "[", "0", "]", ")", "try", ":", "return", "super", "(", "DYMMixin", ",", "self", ")", ".", "resol...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Script.cmdify
Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes before a quote are doubled, so they are all ...
pipenv/vendor/plette/models/scripts.py
def cmdify(self, extra_args=None): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes be...
def cmdify(self, extra_args=None): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes be...
[ "Encode", "into", "a", "cmd", "-", "executable", "string", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/plette/models/scripts.py#L48-L79
[ "def", "cmdify", "(", "self", ",", "extra_args", "=", "None", ")", ":", "parts", "=", "list", "(", "self", ".", "_parts", ")", "if", "extra_args", ":", "parts", ".", "extend", "(", "extra_args", ")", "return", "\" \"", ".", "join", "(", "arg", "if", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
make_abstract_dist
Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction.
pipenv/patched/notpip/_internal/operations/prepare.py
def make_abstract_dist(req): # type: (InstallRequirement) -> DistAbstraction """Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction. """ ...
def make_abstract_dist(req): # type: (InstallRequirement) -> DistAbstraction """Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction. """ ...
[ "Factory", "to", "make", "an", "abstract", "dist", "object", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L34-L48
[ "def", "make_abstract_dist", "(", "req", ")", ":", "# type: (InstallRequirement) -> DistAbstraction", "if", "req", ".", "editable", ":", "return", "IsSDist", "(", "req", ")", "elif", "req", ".", "link", "and", "req", ".", "link", ".", "is_wheel", ":", "return"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
RequirementPreparer.prepare_linked_requirement
Prepare a requirement that would be obtained from req.link
pipenv/patched/notpip/_internal/operations/prepare.py
def prepare_linked_requirement( self, req, # type: InstallRequirement session, # type: PipSession finder, # type: PackageFinder upgrade_allowed, # type: bool require_hashes # type: bool ): # type: (...) -> DistAbstraction """Prepare a requirement ...
def prepare_linked_requirement( self, req, # type: InstallRequirement session, # type: PipSession finder, # type: PackageFinder upgrade_allowed, # type: bool require_hashes # type: bool ): # type: (...) -> DistAbstraction """Prepare a requirement ...
[ "Prepare", "a", "requirement", "that", "would", "be", "obtained", "from", "req", ".", "link" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L230-L347
[ "def", "prepare_linked_requirement", "(", "self", ",", "req", ",", "# type: InstallRequirement", "session", ",", "# type: PipSession", "finder", ",", "# type: PackageFinder", "upgrade_allowed", ",", "# type: bool", "require_hashes", "# type: bool", ")", ":", "# type: (...) ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
RequirementPreparer.prepare_editable_requirement
Prepare an editable requirement
pipenv/patched/notpip/_internal/operations/prepare.py
def prepare_editable_requirement( self, req, # type: InstallRequirement require_hashes, # type: bool use_user_site, # type: bool finder # type: PackageFinder ): # type: (...) -> DistAbstraction """Prepare an editable requirement """ assert ...
def prepare_editable_requirement( self, req, # type: InstallRequirement require_hashes, # type: bool use_user_site, # type: bool finder # type: PackageFinder ): # type: (...) -> DistAbstraction """Prepare an editable requirement """ assert ...
[ "Prepare", "an", "editable", "requirement" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L349-L381
[ "def", "prepare_editable_requirement", "(", "self", ",", "req", ",", "# type: InstallRequirement", "require_hashes", ",", "# type: bool", "use_user_site", ",", "# type: bool", "finder", "# type: PackageFinder", ")", ":", "# type: (...) -> DistAbstraction", "assert", "req", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
RequirementPreparer.prepare_installed_requirement
Prepare an already-installed requirement
pipenv/patched/notpip/_internal/operations/prepare.py
def prepare_installed_requirement(self, req, require_hashes, skip_reason): # type: (InstallRequirement, bool, Optional[str]) -> DistAbstraction """Prepare an already-installed requirement """ assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason i...
def prepare_installed_requirement(self, req, require_hashes, skip_reason): # type: (InstallRequirement, bool, Optional[str]) -> DistAbstraction """Prepare an already-installed requirement """ assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason i...
[ "Prepare", "an", "already", "-", "installed", "requirement" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L383-L406
[ "def", "prepare_installed_requirement", "(", "self", ",", "req", ",", "require_hashes", ",", "skip_reason", ")", ":", "# type: (InstallRequirement, bool, Optional[str]) -> DistAbstraction", "assert", "req", ".", "satisfied_by", ",", "\"req should have been satisfied but isn't\"",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
install_given_reqs
Install everything in the given list. (to be called after having downloaded and unpacked the packages)
pipenv/patched/notpip/_internal/req/__init__.py
def install_given_reqs( to_install, # type: List[InstallRequirement] install_options, # type: List[str] global_options=(), # type: Sequence[str] *args, **kwargs ): # type: (...) -> List[InstallRequirement] """ Install everything in the given list. (to be called after having downloade...
def install_given_reqs( to_install, # type: List[InstallRequirement] install_options, # type: List[str] global_options=(), # type: Sequence[str] *args, **kwargs ): # type: (...) -> List[InstallRequirement] """ Install everything in the given list. (to be called after having downloade...
[ "Install", "everything", "in", "the", "given", "list", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/__init__.py#L22-L77
[ "def", "install_given_reqs", "(", "to_install", ",", "# type: List[InstallRequirement]", "install_options", ",", "# type: List[str]", "global_options", "=", "(", ")", ",", "# type: Sequence[str]", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (...) -> List[In...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
cprint
Print colorize text. It accepts arguments of print function.
pipenv/vendor/yaspin/termcolor.py
def cprint(text, color=None, on_color=None, attrs=None, **kwargs): """Print colorize text. It accepts arguments of print function. """ print((colored(text, color, on_color, attrs)), **kwargs)
def cprint(text, color=None, on_color=None, attrs=None, **kwargs): """Print colorize text. It accepts arguments of print function. """ print((colored(text, color, on_color, attrs)), **kwargs)
[ "Print", "colorize", "text", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/termcolor.py#L118-L124
[ "def", "cprint", "(", "text", ",", "color", "=", "None", ",", "on_color", "=", "None", ",", "attrs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "print", "(", "(", "colored", "(", "text", ",", "color", ",", "on_color", ",", "attrs", ")", ")",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_provider
Return an IResourceProvider for the named module or requirement
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(mo...
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(mo...
[ "Return", "an", "IResourceProvider", "for", "the", "named", "module", "or", "requirement" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L352-L362
[ "def", "get_provider", "(", "moduleOrReq", ")", ":", "if", "isinstance", "(", "moduleOrReq", ",", "Requirement", ")", ":", "return", "working_set", ".", "find", "(", "moduleOrReq", ")", "or", "require", "(", "str", "(", "moduleOrReq", ")", ")", "[", "0", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_build_platform
Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ from sysconfig import get_platform plat = get_platform() if sys.platform =...
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ from sysconfig import get_platform plat = get_platform() if sys.platform =...
[ "Return", "this", "platform", "s", "string", "for", "platform", "-", "specific", "distributions" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L385-L406
[ "def", "get_build_platform", "(", ")", ":", "from", "sysconfig", "import", "get_platform", "plat", "=", "get_platform", "(", ")", "if", "sys", ".", "platform", "==", "\"darwin\"", "and", "not", "plat", ".", "startswith", "(", "'macosx-'", ")", ":", "try", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
compatible_platforms
Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def compatible_platforms(provided, required): """Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. """ if provided is None or required is None ...
def compatible_platforms(provided, required): """Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. """ if provided is None or required is None ...
[ "Can", "code", "for", "the", "provided", "platform", "run", "on", "the", "required", "platform?" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L415-L458
[ "def", "compatible_platforms", "(", "provided", ",", "required", ")", ":", "if", "provided", "is", "None", "or", "required", "is", "None", "or", "provided", "==", "required", ":", "# easy case", "return", "True", "# Mac OS X special cases", "reqMac", "=", "macos...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
run_script
Locate distribution `dist_spec` and run its `script_name` script
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns)
def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns)
[ "Locate", "distribution", "dist_spec", "and", "run", "its", "script_name", "script" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L461-L467
[ "def", "run_script", "(", "dist_spec", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", "]", "=", "n...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_distribution
Return a current distribution object for a Requirement or string
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
[ "Return", "a", "current", "distribution", "object", "for", "a", "Requirement", "or", "string" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L474-L482
[ "def", "get_distribution", "(", "dist", ")", ":", "if", "isinstance", "(", "dist", ",", "six", ".", "string_types", ")", ":", "dist", "=", "Requirement", ".", "parse", "(", "dist", ")", "if", "isinstance", "(", "dist", ",", "Requirement", ")", ":", "di...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
safe_version
Convert an arbitrary string to a standard version string
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def safe_version(version): """ Convert an arbitrary string to a standard version string """ try: # normalize the version return str(packaging.version.Version(version)) except packaging.version.InvalidVersion: version = version.replace(' ', '.') return re.sub('[^A-Za-z...
def safe_version(version): """ Convert an arbitrary string to a standard version string """ try: # normalize the version return str(packaging.version.Version(version)) except packaging.version.InvalidVersion: version = version.replace(' ', '.') return re.sub('[^A-Za-z...
[ "Convert", "an", "arbitrary", "string", "to", "a", "standard", "version", "string" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1323-L1332
[ "def", "safe_version", "(", "version", ")", ":", "try", ":", "# normalize the version", "return", "str", "(", "packaging", ".", "version", ".", "Version", "(", "version", ")", ")", "except", "packaging", ".", "version", ".", "InvalidVersion", ":", "version", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
invalid_marker
Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def invalid_marker(text): """ Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. """ try: evaluate_marker(text) except SyntaxError as e: e.filename = None e.lineno = None return e return False
def invalid_marker(text): """ Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. """ try: evaluate_marker(text) except SyntaxError as e: e.filename = None e.lineno = None return e return False
[ "Validate", "text", "as", "a", "PEP", "508", "environment", "marker", ";", "return", "an", "exception", "if", "invalid", "or", "False", "otherwise", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1352-L1363
[ "def", "invalid_marker", "(", "text", ")", ":", "try", ":", "evaluate_marker", "(", "text", ")", "except", "SyntaxError", "as", "e", ":", "e", ".", "filename", "=", "None", "e", ".", "lineno", "=", "None", "return", "e", "return", "False" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
evaluate_marker
Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def evaluate_marker(text, extra=None): """ Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. """ try: marker = packaging.markers.Marker(te...
def evaluate_marker(text, extra=None): """ Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. """ try: marker = packaging.markers.Marker(te...
[ "Evaluate", "a", "PEP", "508", "environment", "marker", ".", "Return", "a", "boolean", "indicating", "the", "marker", "result", "in", "this", "environment", ".", "Raise", "SyntaxError", "if", "marker", "is", "invalid", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1366-L1378
[ "def", "evaluate_marker", "(", "text", ",", "extra", "=", "None", ")", ":", "try", ":", "marker", "=", "packaging", ".", "markers", ".", "Marker", "(", "text", ")", "return", "marker", ".", "evaluate", "(", ")", "except", "packaging", ".", "markers", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
find_distributions
Yield distributions accessible via `path_item`
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def find_distributions(path_item, only=False): """Yield distributions accessible via `path_item`""" importer = get_importer(path_item) finder = _find_adapter(_distribution_finders, importer) return finder(importer, path_item, only)
def find_distributions(path_item, only=False): """Yield distributions accessible via `path_item`""" importer = get_importer(path_item) finder = _find_adapter(_distribution_finders, importer) return finder(importer, path_item, only)
[ "Yield", "distributions", "accessible", "via", "path_item" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1870-L1874
[ "def", "find_distributions", "(", "path_item", ",", "only", "=", "False", ")", ":", "importer", "=", "get_importer", "(", "path_item", ")", "finder", "=", "_find_adapter", "(", "_distribution_finders", ",", "importer", ")", "return", "finder", "(", "importer", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
find_eggs_in_zip
Find eggs in zip files; possibly multiple nested eggs.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
[ "Find", "eggs", "in", "zip", "files", ";", "possibly", "multiple", "nested", "eggs", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1877-L1901
[ "def", "find_eggs_in_zip", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "if", "importer", ".", "archive", ".", "endswith", "(", "'.whl'", ")", ":", "# wheels are not supported with this finder", "# they don't have PKG-INFO metadata, and won't ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_by_version_descending
Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg' ...
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def _by_version_descending(names): """ Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setup...
def _by_version_descending(names): """ Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setup...
[ "Given", "a", "list", "of", "filenames", "return", "them", "in", "descending", "order", "by", "version", "number", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1914-L1937
[ "def", "_by_version_descending", "(", "names", ")", ":", "def", "_by_version", "(", "name", ")", ":", "\"\"\"\n Parse each component of the filename\n \"\"\"", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "name", ")", "parts", "=...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
find_on_path
Yield distributions accessible on a sys.path directory
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if _is_unpacked_egg(path_item): yield Distribution.from_filename( path_item, metadata=PathMetadata( path_item, os.path...
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if _is_unpacked_egg(path_item): yield Distribution.from_filename( path_item, metadata=PathMetadata( path_item, os.path...
[ "Yield", "distributions", "accessible", "on", "a", "sys", ".", "path", "directory" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1940-L1969
[ "def", "find_on_path", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "path_item", "=", "_normalize_cached", "(", "path_item", ")", "if", "_is_unpacked_egg", "(", "path_item", ")", ":", "yield", "Distribution", ".", "from_filename", "(...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
dist_factory
Return a dist_factory for a path_item and entry
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def dist_factory(path_item, entry, only): """ Return a dist_factory for a path_item and entry """ lower = entry.lower() is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info'))) return ( distributions_from_metadata if is_meta else find_distributions if not o...
def dist_factory(path_item, entry, only): """ Return a dist_factory for a path_item and entry """ lower = entry.lower() is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info'))) return ( distributions_from_metadata if is_meta else find_distributions if not o...
[ "Return", "a", "dist_factory", "for", "a", "path_item", "and", "entry" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1972-L1986
[ "def", "dist_factory", "(", "path_item", ",", "entry", ",", "only", ")", ":", "lower", "=", "entry", ".", "lower", "(", ")", "is_meta", "=", "any", "(", "map", "(", "lower", ".", "endswith", ",", "(", "'.egg-info'", ",", "'.dist-info'", ")", ")", ")"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
safe_listdir
Attempt to list contents of path, but suppress some exceptions.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def safe_listdir(path): """ Attempt to list contents of path, but suppress some exceptions. """ try: return os.listdir(path) except (PermissionError, NotADirectoryError): pass except OSError as e: # Ignore the directory if does not exist, not a directory or # perm...
def safe_listdir(path): """ Attempt to list contents of path, but suppress some exceptions. """ try: return os.listdir(path) except (PermissionError, NotADirectoryError): pass except OSError as e: # Ignore the directory if does not exist, not a directory or # perm...
[ "Attempt", "to", "list", "contents", "of", "path", "but", "suppress", "some", "exceptions", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2006-L2024
[ "def", "safe_listdir", "(", "path", ")", ":", "try", ":", "return", "os", ".", "listdir", "(", "path", ")", "except", "(", "PermissionError", ",", "NotADirectoryError", ")", ":", "pass", "except", "OSError", "as", "e", ":", "# Ignore the directory if does not ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
non_empty_lines
Yield non-empty lines from file at path
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def non_empty_lines(path): """ Yield non-empty lines from file at path """ with open(path) as f: for line in f: line = line.strip() if line: yield line
def non_empty_lines(path): """ Yield non-empty lines from file at path """ with open(path) as f: for line in f: line = line.strip() if line: yield line
[ "Yield", "non", "-", "empty", "lines", "from", "file", "at", "path" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2042-L2050
[ "def", "non_empty_lines", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "for", "line", "in", "f", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "line", ":", "yield", "line" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
resolve_egg_link
Given a path to an .egg-link, resolve distributions present in the referenced path.
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def resolve_egg_link(path): """ Given a path to an .egg-link, resolve distributions present in the referenced path. """ referenced_paths = non_empty_lines(path) resolved_paths = ( os.path.join(os.path.dirname(path), ref) for ref in referenced_paths ) dist_groups = map(fin...
def resolve_egg_link(path): """ Given a path to an .egg-link, resolve distributions present in the referenced path. """ referenced_paths = non_empty_lines(path) resolved_paths = ( os.path.join(os.path.dirname(path), ref) for ref in referenced_paths ) dist_groups = map(fin...
[ "Given", "a", "path", "to", "an", ".", "egg", "-", "link", "resolve", "distributions", "present", "in", "the", "referenced", "path", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2053-L2064
[ "def", "resolve_egg_link", "(", "path", ")", ":", "referenced_paths", "=", "non_empty_lines", "(", "path", ")", "resolved_paths", "=", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ",", "ref", ")", "for"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_handle_ns
Ensure that named package includes a subpath of path_item (if needed)
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None # capture warnings due to #1111 with warnings.catch_warnings(): warnings.simplefilter("ignore") ...
def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None # capture warnings due to #1111 with warnings.catch_warnings(): warnings.simplefilter("ignore") ...
[ "Ensure", "that", "named", "package", "includes", "a", "subpath", "of", "path_item", "(", "if", "needed", ")" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2094-L2122
[ "def", "_handle_ns", "(", "packageName", ",", "path_item", ")", ":", "importer", "=", "get_importer", "(", "path_item", ")", "if", "importer", "is", "None", ":", "return", "None", "# capture warnings due to #1111", "with", "warnings", ".", "catch_warnings", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_rebuild_mod_path
Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def _rebuild_mod_path(orig_path, package_name, module): """ Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order """ sys_path = [_normalize_cached(p) for p in sys.path] def safe_sys_path_index(entry): """ Workaround for #520 and #51...
def _rebuild_mod_path(orig_path, package_name, module): """ Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order """ sys_path = [_normalize_cached(p) for p in sys.path] def safe_sys_path_index(entry): """ Workaround for #520 and #51...
[ "Rebuild", "module", ".", "__path__", "ensuring", "that", "all", "entries", "are", "ordered", "corresponding", "to", "their", "sys", ".", "path", "order" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2125-L2156
[ "def", "_rebuild_mod_path", "(", "orig_path", ",", "package_name", ",", "module", ")", ":", "sys_path", "=", "[", "_normalize_cached", "(", "p", ")", "for", "p", "in", "sys", ".", "path", "]", "def", "safe_sys_path_index", "(", "entry", ")", ":", "\"\"\"\n...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
declare_namespace
Declare that package 'packageName' is a namespace package
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" _imp.acquire_lock() try: if packageName in _namespace_packages: return path = sys.path parent, _, _ = packageName.rpartition('.') if parent: declare_...
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" _imp.acquire_lock() try: if packageName in _namespace_packages: return path = sys.path parent, _, _ = packageName.rpartition('.') if parent: declare_...
[ "Declare", "that", "package", "packageName", "is", "a", "namespace", "package" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2159-L2190
[ "def", "declare_namespace", "(", "packageName", ")", ":", "_imp", ".", "acquire_lock", "(", ")", "try", ":", "if", "packageName", "in", "_namespace_packages", ":", "return", "path", "=", "sys", ".", "path", "parent", ",", "_", ",", "_", "=", "packageName",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
fixup_namespace_packages
Ensure that previously-declared namespace packages include path_item
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def fixup_namespace_packages(path_item, parent=None): """Ensure that previously-declared namespace packages include path_item""" _imp.acquire_lock() try: for package in _namespace_packages.get(parent, ()): subpath = _handle_ns(package, path_item) if subpath: f...
def fixup_namespace_packages(path_item, parent=None): """Ensure that previously-declared namespace packages include path_item""" _imp.acquire_lock() try: for package in _namespace_packages.get(parent, ()): subpath = _handle_ns(package, path_item) if subpath: f...
[ "Ensure", "that", "previously", "-", "declared", "namespace", "packages", "include", "path_item" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2193-L2202
[ "def", "fixup_namespace_packages", "(", "path_item", ",", "parent", "=", "None", ")", ":", "_imp", ".", "acquire_lock", "(", ")", "try", ":", "for", "package", "in", "_namespace_packages", ".", "get", "(", "parent", ",", "(", ")", ")", ":", "subpath", "=...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
file_ns_handler
Compute an ns-package subpath for a filesystem or zipfile importer
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item) =...
def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item) =...
[ "Compute", "an", "ns", "-", "package", "subpath", "for", "a", "filesystem", "or", "zipfile", "importer" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2205-L2215
[ "def", "file_ns_handler", "(", "importer", ",", "path_item", ",", "packageName", ",", "module", ")", ":", "subpath", "=", "os", ".", "path", ".", "join", "(", "path_item", ",", "packageName", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "n...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
normalize_path
Normalize a file/dir name for comparison purposes
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
def normalize_path(filename): """Normalize a file/dir name for comparison purposes""" return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
def normalize_path(filename): """Normalize a file/dir name for comparison purposes""" return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
[ "Normalize", "a", "file", "/", "dir", "name", "for", "comparison", "purposes" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2232-L2234
[ "def", "normalize_path", "(", "filename", ")", ":", "return", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "normpath", "(", "_cygwin_patch", "(", "filename", ")", ")", ")", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde