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
serialize
Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the :py:class:`html5lib.serializer.HTMLSerializer` that gets created ...
pipenv/patched/notpip/_vendor/html5lib/serializer.py
def serialize(input, tree="etree", encoding=None, **serializer_opts): """Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the...
def serialize(input, tree="etree", encoding=None, **serializer_opts): """Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the...
[ "Serializes", "the", "input", "token", "stream", "using", "the", "specified", "treewalker" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/serializer.py#L75-L101
[ "def", "serialize", "(", "input", ",", "tree", "=", "\"etree\"", ",", "encoding", "=", "None", ",", "*", "*", "serializer_opts", ")", ":", "# XXX: Should we cache this?", "walker", "=", "treewalkers", ".", "getTreeWalker", "(", "tree", ")", "s", "=", "HTMLSe...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
HTMLSerializer.render
Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTreeWalker >>> from html5lib.serializer import HTM...
pipenv/patched/notpip/_vendor/html5lib/serializer.py
def render(self, treewalker, encoding=None): """Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTr...
def render(self, treewalker, encoding=None): """Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTr...
[ "Serializes", "the", "stream", "from", "the", "treewalker", "into", "a", "string" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/serializer.py#L375-L398
[ "def", "render", "(", "self", ",", "treewalker", ",", "encoding", "=", "None", ")", ":", "if", "encoding", ":", "return", "b\"\"", ".", "join", "(", "list", "(", "self", ".", "serialize", "(", "treewalker", ",", "encoding", ")", ")", ")", "else", ":"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git.get_current_branch
Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD).
pipenv/patched/notpip/_internal/vcs/git.py
def get_current_branch(self, location): """ Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). """ # git-symbolic-ref exits with empty stdout if "HEAD" is a detached # HEAD rather than a symbolic ref. In addition, the -q causes the ...
def get_current_branch(self, location): """ Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). """ # git-symbolic-ref exits with empty stdout if "HEAD" is a detached # HEAD rather than a symbolic ref. In addition, the -q causes the ...
[ "Return", "the", "current", "branch", "or", "None", "if", "HEAD", "isn", "t", "at", "a", "branch", "(", "e", ".", "g", ".", "detached", "HEAD", ")", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L82-L100
[ "def", "get_current_branch", "(", "self", ",", "location", ")", ":", "# git-symbolic-ref exits with empty stdout if \"HEAD\" is a detached", "# HEAD rather than a symbolic ref. In addition, the -q causes the", "# command to exit with status code 1 instead of 128 in this case", "# and to suppr...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git.get_revision_sha
Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name.
pipenv/patched/notpip/_internal/vcs/git.py
def get_revision_sha(self, dest, rev): """ Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name. """ # Pass rev t...
def get_revision_sha(self, dest, rev): """ Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name. """ # Pass rev t...
[ "Return", "(", "sha_or_none", "is_branch", ")", "where", "sha_or_none", "is", "a", "commit", "hash", "if", "the", "revision", "names", "a", "remote", "branch", "or", "tag", "otherwise", "None", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L114-L146
[ "def", "get_revision_sha", "(", "self", ",", "dest", ",", "rev", ")", ":", "# Pass rev to pre-filter the list.", "output", "=", "self", ".", "run_command", "(", "[", "'show-ref'", ",", "rev", "]", ",", "cwd", "=", "dest", ",", "show_stdout", "=", "False", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git.resolve_revision
Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object.
pipenv/patched/notpip/_internal/vcs/git.py
def resolve_revision(self, dest, url, rev_options): """ Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object. """ rev = rev_options.arg_rev sha, is_branch = self.get_revi...
def resolve_revision(self, dest, url, rev_options): """ Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object. """ rev = rev_options.arg_rev sha, is_branch = self.get_revi...
[ "Resolve", "a", "revision", "to", "a", "new", "RevOptions", "object", "with", "the", "SHA1", "of", "the", "branch", "tag", "or", "ref", "if", "found", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L148-L185
[ "def", "resolve_revision", "(", "self", ",", "dest", ",", "url", ",", "rev_options", ")", ":", "rev", "=", "rev_options", ".", "arg_rev", "sha", ",", "is_branch", "=", "self", ".", "get_revision_sha", "(", "dest", ",", "rev", ")", "if", "sha", "is", "n...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git.is_commit_id_equal
Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name.
pipenv/patched/notpip/_internal/vcs/git.py
def is_commit_id_equal(self, dest, name): """ Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. """ if not name: # Then avoid an unnecessary subprocess call. return...
def is_commit_id_equal(self, dest, name): """ Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. """ if not name: # Then avoid an unnecessary subprocess call. return...
[ "Return", "whether", "the", "current", "commit", "hash", "equals", "the", "given", "name", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L187-L199
[ "def", "is_commit_id_equal", "(", "self", ",", "dest", ",", "name", ")", ":", "if", "not", "name", ":", "# Then avoid an unnecessary subprocess call.", "return", "False", "return", "self", ".", "get_revision", "(", "dest", ")", "==", "name" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git.get_remote_url
Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured.
pipenv/patched/notpip/_internal/vcs/git.py
def get_remote_url(cls, location): """ Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. """ # We need to pass 1 for extra_ok_returncodes since the command # exits with return code 1 if...
def get_remote_url(cls, location): """ Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. """ # We need to pass 1 for extra_ok_returncodes since the command # exits with return code 1 if...
[ "Return", "URL", "of", "the", "first", "remote", "encountered", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L253-L277
[ "def", "get_remote_url", "(", "cls", ",", "location", ")", ":", "# We need to pass 1 for extra_ok_returncodes since the command", "# exits with return code 1 if there are no matching lines.", "stdout", "=", "cls", ".", "run_command", "(", "[", "'config'", ",", "'--get-regexp'",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git._get_subdirectory
Return the relative path of setup.py to the git repo root.
pipenv/patched/notpip/_internal/vcs/git.py
def _get_subdirectory(cls, location): """Return the relative path of setup.py to the git repo root.""" # find the repo root git_dir = cls.run_command(['rev-parse', '--git-dir'], show_stdout=False, cwd=location).strip() if not os.path.isabs(git_dir): ...
def _get_subdirectory(cls, location): """Return the relative path of setup.py to the git repo root.""" # find the repo root git_dir = cls.run_command(['rev-parse', '--git-dir'], show_stdout=False, cwd=location).strip() if not os.path.isabs(git_dir): ...
[ "Return", "the", "relative", "path", "of", "setup", ".", "py", "to", "the", "git", "repo", "root", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L289-L314
[ "def", "_get_subdirectory", "(", "cls", ",", "location", ")", ":", "# find the repo root", "git_dir", "=", "cls", ".", "run_command", "(", "[", "'rev-parse'", ",", "'--git-dir'", "]", ",", "show_stdout", "=", "False", ",", "cwd", "=", "location", ")", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Git.get_url_rev_and_auth
Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub.
pipenv/patched/notpip/_internal/vcs/git.py
def get_url_rev_and_auth(self, url): """ Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again aft...
def get_url_rev_and_auth(self, url): """ Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again aft...
[ "Prefixes", "stub", "URLs", "like", "user" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L328-L343
[ "def", "get_url_rev_and_auth", "(", "self", ",", "url", ")", ":", "if", "'://'", "not", "in", "url", ":", "assert", "'file:'", "not", "in", "url", "url", "=", "url", ".", "replace", "(", "'git+'", ",", "'git+ssh://'", ")", "url", ",", "rev", ",", "us...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_normalize_name
Make a name consistent regardless of source (environment or file)
pipenv/patched/notpip/_internal/configuration.py
def _normalize_name(name): # type: (str) -> str """Make a name consistent regardless of source (environment or file) """ name = name.lower().replace('_', '-') if name.startswith('--'): name = name[2:] # only prefer long opts return name
def _normalize_name(name): # type: (str) -> str """Make a name consistent regardless of source (environment or file) """ name = name.lower().replace('_', '-') if name.startswith('--'): name = name[2:] # only prefer long opts return name
[ "Make", "a", "name", "consistent", "regardless", "of", "source", "(", "environment", "or", "file", ")" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L43-L50
[ "def", "_normalize_name", "(", "name", ")", ":", "# type: (str) -> str", "name", "=", "name", ".", "lower", "(", ")", ".", "replace", "(", "'_'", ",", "'-'", ")", "if", "name", ".", "startswith", "(", "'--'", ")", ":", "name", "=", "name", "[", "2", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration.get_value
Get a value from the configuration.
pipenv/patched/notpip/_internal/configuration.py
def get_value(self, key): # type: (str) -> Any """Get a value from the configuration. """ try: return self._dictionary[key] except KeyError: raise ConfigurationError("No such key - {}".format(key))
def get_value(self, key): # type: (str) -> Any """Get a value from the configuration. """ try: return self._dictionary[key] except KeyError: raise ConfigurationError("No such key - {}".format(key))
[ "Get", "a", "value", "from", "the", "configuration", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L139-L146
[ "def", "get_value", "(", "self", ",", "key", ")", ":", "# type: (str) -> Any", "try", ":", "return", "self", ".", "_dictionary", "[", "key", "]", "except", "KeyError", ":", "raise", "ConfigurationError", "(", "\"No such key - {}\"", ".", "format", "(", "key", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration.set_value
Modify a value in the configuration.
pipenv/patched/notpip/_internal/configuration.py
def set_value(self, key, value): # type: (str, Any) -> None """Modify a value in the configuration. """ self._ensure_have_load_only() fname, parser = self._get_parser_to_modify() if parser is not None: section, name = _disassemble_key(key) # Mod...
def set_value(self, key, value): # type: (str, Any) -> None """Modify a value in the configuration. """ self._ensure_have_load_only() fname, parser = self._get_parser_to_modify() if parser is not None: section, name = _disassemble_key(key) # Mod...
[ "Modify", "a", "value", "in", "the", "configuration", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L148-L165
[ "def", "set_value", "(", "self", ",", "key", ",", "value", ")", ":", "# type: (str, Any) -> None", "self", ".", "_ensure_have_load_only", "(", ")", "fname", ",", "parser", "=", "self", ".", "_get_parser_to_modify", "(", ")", "if", "parser", "is", "not", "Non...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration.unset_value
Unset a value in the configuration.
pipenv/patched/notpip/_internal/configuration.py
def unset_value(self, key): # type: (str) -> None """Unset a value in the configuration. """ self._ensure_have_load_only() if key not in self._config[self.load_only]: raise ConfigurationError("No such key - {}".format(key)) fname, parser = self._get_parser_t...
def unset_value(self, key): # type: (str) -> None """Unset a value in the configuration. """ self._ensure_have_load_only() if key not in self._config[self.load_only]: raise ConfigurationError("No such key - {}".format(key)) fname, parser = self._get_parser_t...
[ "Unset", "a", "value", "in", "the", "configuration", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L167-L204
[ "def", "unset_value", "(", "self", ",", "key", ")", ":", "# type: (str) -> None", "self", ".", "_ensure_have_load_only", "(", ")", "if", "key", "not", "in", "self", ".", "_config", "[", "self", ".", "load_only", "]", ":", "raise", "ConfigurationError", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration.save
Save the currentin-memory state.
pipenv/patched/notpip/_internal/configuration.py
def save(self): # type: () -> None """Save the currentin-memory state. """ self._ensure_have_load_only() for fname, parser in self._modified_parsers: logger.info("Writing to %s", fname) # Ensure directory exists. ensure_dir(os.path.dirname(fn...
def save(self): # type: () -> None """Save the currentin-memory state. """ self._ensure_have_load_only() for fname, parser in self._modified_parsers: logger.info("Writing to %s", fname) # Ensure directory exists. ensure_dir(os.path.dirname(fn...
[ "Save", "the", "currentin", "-", "memory", "state", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L206-L219
[ "def", "save", "(", "self", ")", ":", "# type: () -> None", "self", ".", "_ensure_have_load_only", "(", ")", "for", "fname", ",", "parser", "in", "self", ".", "_modified_parsers", ":", "logger", ".", "info", "(", "\"Writing to %s\"", ",", "fname", ")", "# En...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration._dictionary
A dictionary representing the loaded configuration.
pipenv/patched/notpip/_internal/configuration.py
def _dictionary(self): # type: () -> Dict[str, Any] """A dictionary representing the loaded configuration. """ # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} for variant in self._override_order: ...
def _dictionary(self): # type: () -> Dict[str, Any] """A dictionary representing the loaded configuration. """ # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} for variant in self._override_order: ...
[ "A", "dictionary", "representing", "the", "loaded", "configuration", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L232-L243
[ "def", "_dictionary", "(", "self", ")", ":", "# type: () -> Dict[str, Any]", "# NOTE: Dictionaries are not populated if not loaded. So, conditionals", "# are not needed here.", "retval", "=", "{", "}", "for", "variant", "in", "self", ".", "_override_order", ":", "retval...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration._load_config_files
Loads configuration from configuration files
pipenv/patched/notpip/_internal/configuration.py
def _load_config_files(self): # type: () -> None """Loads configuration from configuration files """ config_files = dict(self._iter_config_files()) if config_files[kinds.ENV][0:1] == [os.devnull]: logger.debug( "Skipping loading configuration files due...
def _load_config_files(self): # type: () -> None """Loads configuration from configuration files """ config_files = dict(self._iter_config_files()) if config_files[kinds.ENV][0:1] == [os.devnull]: logger.debug( "Skipping loading configuration files due...
[ "Loads", "configuration", "from", "configuration", "files" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L245-L270
[ "def", "_load_config_files", "(", "self", ")", ":", "# type: () -> None", "config_files", "=", "dict", "(", "self", ".", "_iter_config_files", "(", ")", ")", "if", "config_files", "[", "kinds", ".", "ENV", "]", "[", "0", ":", "1", "]", "==", "[", "os", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration._load_environment_vars
Loads configuration from environment variables
pipenv/patched/notpip/_internal/configuration.py
def _load_environment_vars(self): # type: () -> None """Loads configuration from environment variables """ self._config[kinds.ENV_VAR].update( self._normalized_keys(":env:", self._get_environ_vars()) )
def _load_environment_vars(self): # type: () -> None """Loads configuration from environment variables """ self._config[kinds.ENV_VAR].update( self._normalized_keys(":env:", self._get_environ_vars()) )
[ "Loads", "configuration", "from", "environment", "variables" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L306-L312
[ "def", "_load_environment_vars", "(", "self", ")", ":", "# type: () -> None", "self", ".", "_config", "[", "kinds", ".", "ENV_VAR", "]", ".", "update", "(", "self", ".", "_normalized_keys", "(", "\":env:\"", ",", "self", ".", "_get_environ_vars", "(", ")", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration._normalized_keys
Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or environment.
pipenv/patched/notpip/_internal/configuration.py
def _normalized_keys(self, section, items): # type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any] """Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or envi...
def _normalized_keys(self, section, items): # type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any] """Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or envi...
[ "Normalizes", "items", "to", "construct", "a", "dictionary", "with", "normalized", "keys", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L314-L325
[ "def", "_normalized_keys", "(", "self", ",", "section", ",", "items", ")", ":", "# type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any]", "normalized", "=", "{", "}", "for", "name", ",", "val", "in", "items", ":", "key", "=", "section", "+", "\".\"", "+", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration._get_environ_vars
Returns a generator with all environmental vars with prefix PIP_
pipenv/patched/notpip/_internal/configuration.py
def _get_environ_vars(self): # type: () -> Iterable[Tuple[str, str]] """Returns a generator with all environmental vars with prefix PIP_""" for key, val in os.environ.items(): should_be_yielded = ( key.startswith("PIP_") and key[4:].lower() not in self...
def _get_environ_vars(self): # type: () -> Iterable[Tuple[str, str]] """Returns a generator with all environmental vars with prefix PIP_""" for key, val in os.environ.items(): should_be_yielded = ( key.startswith("PIP_") and key[4:].lower() not in self...
[ "Returns", "a", "generator", "with", "all", "environmental", "vars", "with", "prefix", "PIP_" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L327-L336
[ "def", "_get_environ_vars", "(", "self", ")", ":", "# type: () -> Iterable[Tuple[str, str]]", "for", "key", ",", "val", "in", "os", ".", "environ", ".", "items", "(", ")", ":", "should_be_yielded", "=", "(", "key", ".", "startswith", "(", "\"PIP_\"", ")", "a...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configuration._iter_config_files
Yields variant and configuration files associated with it. This should be treated like items of a dictionary.
pipenv/patched/notpip/_internal/configuration.py
def _iter_config_files(self): # type: () -> Iterable[Tuple[Kind, List[str]]] """Yields variant and configuration files associated with it. This should be treated like items of a dictionary. """ # SMELL: Move the conditions out of this function # environment variables ha...
def _iter_config_files(self): # type: () -> Iterable[Tuple[Kind, List[str]]] """Yields variant and configuration files associated with it. This should be treated like items of a dictionary. """ # SMELL: Move the conditions out of this function # environment variables ha...
[ "Yields", "variant", "and", "configuration", "files", "associated", "with", "it", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L339-L367
[ "def", "_iter_config_files", "(", "self", ")", ":", "# type: () -> Iterable[Tuple[Kind, List[str]]]", "# SMELL: Move the conditions out of this function", "# environment variables have the lowest priority", "config_file", "=", "os", ".", "environ", ".", "get", "(", "'PIP_CONFIG_FIL...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ConfigurationCommand._get_n_args
Helper to make sure the command got the right number of arguments
pipenv/patched/notpip/_internal/commands/configuration.py
def _get_n_args(self, args, example, n): """Helper to make sure the command got the right number of arguments """ if len(args) != n: msg = ( 'Got unexpected number of arguments, expected {}. ' '(example: "{} config {}")' ).format(n, get_pro...
def _get_n_args(self, args, example, n): """Helper to make sure the command got the right number of arguments """ if len(args) != n: msg = ( 'Got unexpected number of arguments, expected {}. ' '(example: "{} config {}")' ).format(n, get_pro...
[ "Helper", "to", "make", "sure", "the", "command", "got", "the", "right", "number", "of", "arguments" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/configuration.py#L192-L205
[ "def", "_get_n_args", "(", "self", ",", "args", ",", "example", ",", "n", ")", ":", "if", "len", "(", "args", ")", "!=", "n", ":", "msg", "=", "(", "'Got unexpected number of arguments, expected {}. '", "'(example: \"{} config {}\")'", ")", ".", "format", "(",...
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/cmdparse.py
def cmdify(self): """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 ...
def cmdify(self): """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 ...
[ "Encode", "into", "a", "cmd", "-", "executable", "string", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cmdparse.py#L51-L98
[ "def", "cmdify", "(", "self", ")", ":", "return", "\" \"", ".", "join", "(", "itertools", ".", "chain", "(", "[", "_quote_if_contains", "(", "self", ".", "command", ",", "r'[\\s^()]'", ")", "]", ",", "(", "_quote_if_contains", "(", "arg", ",", "r'[\\s^]'...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
normalize_path
Return a case-normalized absolute variable-expanded path. :param str path: The non-normalized path :return: A normalized, expanded, case-normalized path :rtype: str
pipenv/vendor/vistir/path.py
def normalize_path(path): # type: (AnyStr) -> AnyStr """ Return a case-normalized absolute variable-expanded path. :param str path: The non-normalized path :return: A normalized, expanded, case-normalized path :rtype: str """ return os.path.normpath( os.path.normcase( ...
def normalize_path(path): # type: (AnyStr) -> AnyStr """ Return a case-normalized absolute variable-expanded path. :param str path: The non-normalized path :return: A normalized, expanded, case-normalized path :rtype: str """ return os.path.normpath( os.path.normcase( ...
[ "Return", "a", "case", "-", "normalized", "absolute", "variable", "-", "expanded", "path", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L97-L111
[ "def", "normalize_path", "(", "path", ")", ":", "# type: (AnyStr) -> AnyStr", "return", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expandvars", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
path_to_url
Convert the supplied local path to a file uri. :param str path: A string pointing to or representing a local path :return: A `file://` uri for the same location :rtype: str >>> path_to_url("/home/user/code/myrepo/myfile.zip") 'file:///home/user/code/myrepo/myfile.zip'
pipenv/vendor/vistir/path.py
def path_to_url(path): # type: (str) -> Text """Convert the supplied local path to a file uri. :param str path: A string pointing to or representing a local path :return: A `file://` uri for the same location :rtype: str >>> path_to_url("/home/user/code/myrepo/myfile.zip") 'file:///home/us...
def path_to_url(path): # type: (str) -> Text """Convert the supplied local path to a file uri. :param str path: A string pointing to or representing a local path :return: A `file://` uri for the same location :rtype: str >>> path_to_url("/home/user/code/myrepo/myfile.zip") 'file:///home/us...
[ "Convert", "the", "supplied", "local", "path", "to", "a", "file", "uri", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L149-L166
[ "def", "path_to_url", "(", "path", ")", ":", "# type: (str) -> Text", "from", ".", "misc", "import", "to_text", ",", "to_bytes", "if", "not", "path", ":", "return", "path", "path", "=", "to_bytes", "(", "path", ",", "encoding", "=", "\"utf-8\"", ")", "norm...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
url_to_path
Convert a valid file url to a local filesystem path Follows logic taken from pip's equivalent function
pipenv/vendor/vistir/path.py
def url_to_path(url): # type: (str) -> ByteString """ Convert a valid file url to a local filesystem path Follows logic taken from pip's equivalent function """ from .misc import to_bytes assert is_file_url(url), "Only file: urls can be converted to local paths" _, netloc, path, _, _ =...
def url_to_path(url): # type: (str) -> ByteString """ Convert a valid file url to a local filesystem path Follows logic taken from pip's equivalent function """ from .misc import to_bytes assert is_file_url(url), "Only file: urls can be converted to local paths" _, netloc, path, _, _ =...
[ "Convert", "a", "valid", "file", "url", "to", "a", "local", "filesystem", "path" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L169-L185
[ "def", "url_to_path", "(", "url", ")", ":", "# type: (str) -> ByteString", "from", ".", "misc", "import", "to_bytes", "assert", "is_file_url", "(", "url", ")", ",", "\"Only file: urls can be converted to local paths\"", "_", ",", "netloc", ",", "path", ",", "_", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_valid_url
Checks if a given string is an url
pipenv/vendor/vistir/path.py
def is_valid_url(url): """Checks if a given string is an url""" from .misc import to_text if not url: return url pieces = urllib_parse.urlparse(to_text(url)) return all([pieces.scheme, pieces.netloc])
def is_valid_url(url): """Checks if a given string is an url""" from .misc import to_text if not url: return url pieces = urllib_parse.urlparse(to_text(url)) return all([pieces.scheme, pieces.netloc])
[ "Checks", "if", "a", "given", "string", "is", "an", "url" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L188-L195
[ "def", "is_valid_url", "(", "url", ")", ":", "from", ".", "misc", "import", "to_text", "if", "not", "url", ":", "return", "url", "pieces", "=", "urllib_parse", ".", "urlparse", "(", "to_text", "(", "url", ")", ")", "return", "all", "(", "[", "pieces", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_file_url
Returns true if the given url is a file url
pipenv/vendor/vistir/path.py
def is_file_url(url): """Returns true if the given url is a file url""" from .misc import to_text if not url: return False if not isinstance(url, six.string_types): try: url = getattr(url, "url") except AttributeError: raise ValueError("Cannot parse url f...
def is_file_url(url): """Returns true if the given url is a file url""" from .misc import to_text if not url: return False if not isinstance(url, six.string_types): try: url = getattr(url, "url") except AttributeError: raise ValueError("Cannot parse url f...
[ "Returns", "true", "if", "the", "given", "url", "is", "a", "file", "url" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L198-L210
[ "def", "is_file_url", "(", "url", ")", ":", "from", ".", "misc", "import", "to_text", "if", "not", "url", ":", "return", "False", "if", "not", "isinstance", "(", "url", ",", "six", ".", "string_types", ")", ":", "try", ":", "url", "=", "getattr", "("...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_readonly_path
Check if a provided path exists and is readonly. Permissions check is `bool(path.stat & stat.S_IREAD)` or `not os.access(path, os.W_OK)`
pipenv/vendor/vistir/path.py
def is_readonly_path(fn): """Check if a provided path exists and is readonly. Permissions check is `bool(path.stat & stat.S_IREAD)` or `not os.access(path, os.W_OK)` """ fn = fs_encode(fn) if os.path.exists(fn): file_stat = os.stat(fn).st_mode return not bool(file_stat & stat.S_IWR...
def is_readonly_path(fn): """Check if a provided path exists and is readonly. Permissions check is `bool(path.stat & stat.S_IREAD)` or `not os.access(path, os.W_OK)` """ fn = fs_encode(fn) if os.path.exists(fn): file_stat = os.stat(fn).st_mode return not bool(file_stat & stat.S_IWR...
[ "Check", "if", "a", "provided", "path", "exists", "and", "is", "readonly", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L213-L223
[ "def", "is_readonly_path", "(", "fn", ")", ":", "fn", "=", "fs_encode", "(", "fn", ")", "if", "os", ".", "path", ".", "exists", "(", "fn", ")", ":", "file_stat", "=", "os", ".", "stat", "(", "fn", ")", ".", "st_mode", "return", "not", "bool", "("...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
mkdir_p
Recursively creates the target directory and all of its parents if they do not already exist. Fails silently if they do. :param str newdir: The directory path to ensure :raises: OSError if a file is encountered along the way
pipenv/vendor/vistir/path.py
def mkdir_p(newdir, mode=0o777): """Recursively creates the target directory and all of its parents if they do not already exist. Fails silently if they do. :param str newdir: The directory path to ensure :raises: OSError if a file is encountered along the way """ # http://code.activestate.com...
def mkdir_p(newdir, mode=0o777): """Recursively creates the target directory and all of its parents if they do not already exist. Fails silently if they do. :param str newdir: The directory path to ensure :raises: OSError if a file is encountered along the way """ # http://code.activestate.com...
[ "Recursively", "creates", "the", "target", "directory", "and", "all", "of", "its", "parents", "if", "they", "do", "not", "already", "exist", ".", "Fails", "silently", "if", "they", "do", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L226-L258
[ "def", "mkdir_p", "(", "newdir", ",", "mode", "=", "0o777", ")", ":", "# http://code.activestate.com/recipes/82465-a-friendly-mkdir/", "newdir", "=", "fs_encode", "(", "newdir", ")", "if", "os", ".", "path", ".", "exists", "(", "newdir", ")", ":", "if", "not",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ensure_mkdir_p
Decorator to ensure `mkdir_p` is called to the function's return value.
pipenv/vendor/vistir/path.py
def ensure_mkdir_p(mode=0o777): """Decorator to ensure `mkdir_p` is called to the function's return value. """ def decorator(f): @functools.wraps(f) def decorated(*args, **kwargs): path = f(*args, **kwargs) mkdir_p(path, mode=mode) return path re...
def ensure_mkdir_p(mode=0o777): """Decorator to ensure `mkdir_p` is called to the function's return value. """ def decorator(f): @functools.wraps(f) def decorated(*args, **kwargs): path = f(*args, **kwargs) mkdir_p(path, mode=mode) return path re...
[ "Decorator", "to", "ensure", "mkdir_p", "is", "called", "to", "the", "function", "s", "return", "value", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L261-L274
[ "def", "ensure_mkdir_p", "(", "mode", "=", "0o777", ")", ":", "def", "decorator", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "f", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
create_tracked_tempdir
Create a tracked temporary directory. This uses `TemporaryDirectory`, but does not remove the directory when the return value goes out of scope, instead registers a handler to cleanup on program exit. The return value is the path to the created directory.
pipenv/vendor/vistir/path.py
def create_tracked_tempdir(*args, **kwargs): """Create a tracked temporary directory. This uses `TemporaryDirectory`, but does not remove the directory when the return value goes out of scope, instead registers a handler to cleanup on program exit. The return value is the path to the created direc...
def create_tracked_tempdir(*args, **kwargs): """Create a tracked temporary directory. This uses `TemporaryDirectory`, but does not remove the directory when the return value goes out of scope, instead registers a handler to cleanup on program exit. The return value is the path to the created direc...
[ "Create", "a", "tracked", "temporary", "directory", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L280-L294
[ "def", "create_tracked_tempdir", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "tempdir", "=", "TemporaryDirectory", "(", "*", "args", ",", "*", "*", "kwargs", ")", "TRACKED_TEMPORARY_DIRECTORIES", ".", "append", "(", "tempdir", ")", "atexit", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
set_write_bit
Set read-write permissions for the current user on the target path. Fail silently if the path doesn't exist. :param str fn: The target filename or path :return: None
pipenv/vendor/vistir/path.py
def set_write_bit(fn): # type: (str) -> None """ Set read-write permissions for the current user on the target path. Fail silently if the path doesn't exist. :param str fn: The target filename or path :return: None """ fn = fs_encode(fn) if not os.path.exists(fn): return ...
def set_write_bit(fn): # type: (str) -> None """ Set read-write permissions for the current user on the target path. Fail silently if the path doesn't exist. :param str fn: The target filename or path :return: None """ fn = fs_encode(fn) if not os.path.exists(fn): return ...
[ "Set", "read", "-", "write", "permissions", "for", "the", "current", "user", "on", "the", "target", "path", ".", "Fail", "silently", "if", "the", "path", "doesn", "t", "exist", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L310-L336
[ "def", "set_write_bit", "(", "fn", ")", ":", "# type: (str) -> None", "fn", "=", "fs_encode", "(", "fn", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "fn", ")", ":", "return", "file_stat", "=", "os", ".", "stat", "(", "fn", ")", ".", "s...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
rmtree
Stand-in for :func:`~shutil.rmtree` with additional error-handling. This version of `rmtree` handles read-only paths, especially in the case of index files written by certain source control systems. :param str directory: The target directory to remove :param bool ignore_errors: Whether to ignore error...
pipenv/vendor/vistir/path.py
def rmtree(directory, ignore_errors=False, onerror=None): # type: (str, bool, Optional[Callable]) -> None """ Stand-in for :func:`~shutil.rmtree` with additional error-handling. This version of `rmtree` handles read-only paths, especially in the case of index files written by certain source control...
def rmtree(directory, ignore_errors=False, onerror=None): # type: (str, bool, Optional[Callable]) -> None """ Stand-in for :func:`~shutil.rmtree` with additional error-handling. This version of `rmtree` handles read-only paths, especially in the case of index files written by certain source control...
[ "Stand", "-", "in", "for", ":", "func", ":", "~shutil", ".", "rmtree", "with", "additional", "error", "-", "handling", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L339-L364
[ "def", "rmtree", "(", "directory", ",", "ignore_errors", "=", "False", ",", "onerror", "=", "None", ")", ":", "# type: (str, bool, Optional[Callable]) -> None", "directory", "=", "fs_encode", "(", "directory", ")", "if", "onerror", "is", "None", ":", "onerror", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_wait_for_files
Retry with backoff up to 1 second to delete files from a directory. :param str path: The path to crawl to delete files from :return: A list of remaining paths or None :rtype: Optional[List[str]]
pipenv/vendor/vistir/path.py
def _wait_for_files(path): """ Retry with backoff up to 1 second to delete files from a directory. :param str path: The path to crawl to delete files from :return: A list of remaining paths or None :rtype: Optional[List[str]] """ timeout = 0.001 remaining = [] while timeout < 1.0: ...
def _wait_for_files(path): """ Retry with backoff up to 1 second to delete files from a directory. :param str path: The path to crawl to delete files from :return: A list of remaining paths or None :rtype: Optional[List[str]] """ timeout = 0.001 remaining = [] while timeout < 1.0: ...
[ "Retry", "with", "backoff", "up", "to", "1", "second", "to", "delete", "files", "from", "a", "directory", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L367-L397
[ "def", "_wait_for_files", "(", "path", ")", ":", "timeout", "=", "0.001", "remaining", "=", "[", "]", "while", "timeout", "<", "1.0", ":", "remaining", "=", "[", "]", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "L", "=", "os", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
handle_remove_readonly
Error handler for shutil.rmtree. Windows source repo folders are read-only by default, so this error handler attempts to set them as writeable and then proceed with deletion. :param function func: The caller function :param str path: The target path for removal :param Exception exc: The raised exc...
pipenv/vendor/vistir/path.py
def handle_remove_readonly(func, path, exc): """Error handler for shutil.rmtree. Windows source repo folders are read-only by default, so this error handler attempts to set them as writeable and then proceed with deletion. :param function func: The caller function :param str path: The target path ...
def handle_remove_readonly(func, path, exc): """Error handler for shutil.rmtree. Windows source repo folders are read-only by default, so this error handler attempts to set them as writeable and then proceed with deletion. :param function func: The caller function :param str path: The target path ...
[ "Error", "handler", "for", "shutil", ".", "rmtree", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L400-L455
[ "def", "handle_remove_readonly", "(", "func", ",", "path", ",", "exc", ")", ":", "# Check for read-only attribute", "from", ".", "compat", "import", "ResourceWarning", ",", "FileNotFoundError", ",", "PermissionError", "PERM_ERRORS", "=", "(", "errno", ".", "EACCES",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
check_for_unc_path
Checks to see if a pathlib `Path` object is a unc path or not
pipenv/vendor/vistir/path.py
def check_for_unc_path(path): """ Checks to see if a pathlib `Path` object is a unc path or not""" if ( os.name == "nt" and len(path.drive) > 2 and not path.drive[0].isalpha() and path.drive[1] != ":" ): return True else: return False
def check_for_unc_path(path): """ Checks to see if a pathlib `Path` object is a unc path or not""" if ( os.name == "nt" and len(path.drive) > 2 and not path.drive[0].isalpha() and path.drive[1] != ":" ): return True else: return False
[ "Checks", "to", "see", "if", "a", "pathlib", "Path", "object", "is", "a", "unc", "path", "or", "not" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L486-L496
[ "def", "check_for_unc_path", "(", "path", ")", ":", "if", "(", "os", ".", "name", "==", "\"nt\"", "and", "len", "(", "path", ".", "drive", ")", ">", "2", "and", "not", "path", ".", "drive", "[", "0", "]", ".", "isalpha", "(", ")", "and", "path", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_converted_relative_path
Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: A relative posix-style path with a leading `./` This perfor...
pipenv/vendor/vistir/path.py
def get_converted_relative_path(path, relative_to=None): """Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: ...
def get_converted_relative_path(path, relative_to=None): """Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: ...
[ "Convert", "path", "to", "be", "relative", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L499-L551
[ "def", "get_converted_relative_path", "(", "path", ",", "relative_to", "=", "None", ")", ":", "from", ".", "misc", "import", "to_text", ",", "to_bytes", "# noqa", "if", "not", "relative_to", ":", "relative_to", "=", "os", ".", "getcwdu", "(", ")", "if", "s...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_fp_closed
Checks whether a given file-like object is closed. :param obj: The file-like object to check.
pipenv/vendor/urllib3/util/response.py
def is_fp_closed(obj): """ Checks whether a given file-like object is closed. :param obj: The file-like object to check. """ try: # Check `isclosed()` first, in case Python3 doesn't set `closed`. # GH Issue #928 return obj.isclosed() except AttributeError: ...
def is_fp_closed(obj): """ Checks whether a given file-like object is closed. :param obj: The file-like object to check. """ try: # Check `isclosed()` first, in case Python3 doesn't set `closed`. # GH Issue #928 return obj.isclosed() except AttributeError: ...
[ "Checks", "whether", "a", "given", "file", "-", "like", "object", "is", "closed", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/response.py#L7-L35
[ "def", "is_fp_closed", "(", "obj", ")", ":", "try", ":", "# Check `isclosed()` first, in case Python3 doesn't set `closed`.", "# GH Issue #928", "return", "obj", ".", "isclosed", "(", ")", "except", "AttributeError", ":", "pass", "try", ":", "# Check via the official file...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
assert_header_parsing
Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers. Only works on Python 3. :param headers: Headers to verify. :type headers: `httplib.HTTPMessage`. :raises urllib3.exceptions.HeaderParsingError: If parsing errors are ...
pipenv/vendor/urllib3/util/response.py
def assert_header_parsing(headers): """ Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers. Only works on Python 3. :param headers: Headers to verify. :type headers: `httplib.HTTPMessage`. :raises urllib3.exceptions.He...
def assert_header_parsing(headers): """ Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers. Only works on Python 3. :param headers: Headers to verify. :type headers: `httplib.HTTPMessage`. :raises urllib3.exceptions.He...
[ "Asserts", "whether", "all", "headers", "have", "been", "successfully", "parsed", ".", "Extracts", "encountered", "errors", "from", "the", "result", "of", "parsing", "headers", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/response.py#L38-L72
[ "def", "assert_header_parsing", "(", "headers", ")", ":", "# This will fail silently if we pass in the wrong kind of parameter.", "# To make debugging easier add an explicit check.", "if", "not", "isinstance", "(", "headers", ",", "httplib", ".", "HTTPMessage", ")", ":", "raise...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_response_to_head
Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine. :param conn: :type conn: :class:`httplib.HTTPResponse`
pipenv/vendor/urllib3/util/response.py
def is_response_to_head(response): """ Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine. :param conn: :type conn: :class:`httplib.HTTPResponse` """ # FIXME: Can we do this somehow without accessing private httplib _method? method = respon...
def is_response_to_head(response): """ Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine. :param conn: :type conn: :class:`httplib.HTTPResponse` """ # FIXME: Can we do this somehow without accessing private httplib _method? method = respon...
[ "Checks", "whether", "the", "request", "of", "a", "response", "has", "been", "a", "HEAD", "-", "request", ".", "Handles", "the", "quirks", "of", "AppEngine", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/response.py#L75-L87
[ "def", "is_response_to_head", "(", "response", ")", ":", "# FIXME: Can we do this somehow without accessing private httplib _method?", "method", "=", "response", ".", "_method", "if", "isinstance", "(", "method", ",", "int", ")", ":", "# Platform-specific: Appengine", "retu...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.levenshtein_distance
This calculates the Levenshtein distance between a and b.
pipenv/vendor/pexpect/pxssh.py
def levenshtein_distance(self, a, b): '''This calculates the Levenshtein distance between a and b. ''' n, m = len(a), len(b) if n > m: a,b = b,a n,m = m,n current = range(n+1) for i in range(1,m+1): previous, current = current, [i]+[0]...
def levenshtein_distance(self, a, b): '''This calculates the Levenshtein distance between a and b. ''' n, m = len(a), len(b) if n > m: a,b = b,a n,m = m,n current = range(n+1) for i in range(1,m+1): previous, current = current, [i]+[0]...
[ "This", "calculates", "the", "Levenshtein", "distance", "between", "a", "and", "b", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L164-L181
[ "def", "levenshtein_distance", "(", "self", ",", "a", ",", "b", ")", ":", "n", ",", "m", "=", "len", "(", "a", ")", ",", "len", "(", "b", ")", "if", "n", ">", "m", ":", "a", ",", "b", "=", "b", ",", "a", "n", ",", "m", "=", "m", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.try_read_prompt
This facilitates using communication timeouts to perform synchronization as quickly as possible, while supporting high latency connections with a tunable worst case performance. Fast connections should be read almost immediately. Worst case performance for this method is timeout_multipli...
pipenv/vendor/pexpect/pxssh.py
def try_read_prompt(self, timeout_multiplier): '''This facilitates using communication timeouts to perform synchronization as quickly as possible, while supporting high latency connections with a tunable worst case performance. Fast connections should be read almost immediately. Worst ca...
def try_read_prompt(self, timeout_multiplier): '''This facilitates using communication timeouts to perform synchronization as quickly as possible, while supporting high latency connections with a tunable worst case performance. Fast connections should be read almost immediately. Worst ca...
[ "This", "facilitates", "using", "communication", "timeouts", "to", "perform", "synchronization", "as", "quickly", "as", "possible", "while", "supporting", "high", "latency", "connections", "with", "a", "tunable", "worst", "case", "performance", ".", "Fast", "connect...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L183-L213
[ "def", "try_read_prompt", "(", "self", ",", "timeout_multiplier", ")", ":", "# maximum time allowed to read the first response", "first_char_timeout", "=", "timeout_multiplier", "*", "0.5", "# maximum time allowed between subsequent characters", "inter_char_timeout", "=", "timeout_...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.sync_original_prompt
This attempts to find the prompt. Basically, press enter and record the response; press enter again and record the response; if the two responses are similar then assume we are at the original prompt. This can be a slow function. Worst case with the default sync_multiplier can take 12 se...
pipenv/vendor/pexpect/pxssh.py
def sync_original_prompt (self, sync_multiplier=1.0): '''This attempts to find the prompt. Basically, press enter and record the response; press enter again and record the response; if the two responses are similar then assume we are at the original prompt. This can be a slow function. W...
def sync_original_prompt (self, sync_multiplier=1.0): '''This attempts to find the prompt. Basically, press enter and record the response; press enter again and record the response; if the two responses are similar then assume we are at the original prompt. This can be a slow function. W...
[ "This", "attempts", "to", "find", "the", "prompt", ".", "Basically", "press", "enter", "and", "record", "the", "response", ";", "press", "enter", "again", "and", "record", "the", "response", ";", "if", "the", "two", "responses", "are", "similar", "then", "...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L215-L251
[ "def", "sync_original_prompt", "(", "self", ",", "sync_multiplier", "=", "1.0", ")", ":", "# All of these timing pace values are magic.", "# I came up with these based on what seemed reliable for", "# connecting to a heavily loaded machine I have.", "self", ".", "sendline", "(", ")...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.login
This logs the user into the given server. It uses 'original_prompt' to try to find the prompt right after login. When it finds the prompt it immediately tries to reset the prompt to something more easily matched. The default 'original_prompt' is very optimistic and is easily foo...
pipenv/vendor/pexpect/pxssh.py
def login (self, server, username, password='', terminal_type='ansi', original_prompt=r"[#$]", login_timeout=10, port=None, auto_prompt_reset=True, ssh_key=None, quiet=True, sync_multiplier=1, check_local_ip=True, password_regex=r'(?i)(?:password:)|(?:pass...
def login (self, server, username, password='', terminal_type='ansi', original_prompt=r"[#$]", login_timeout=10, port=None, auto_prompt_reset=True, ssh_key=None, quiet=True, sync_multiplier=1, check_local_ip=True, password_regex=r'(?i)(?:password:)|(?:pass...
[ "This", "logs", "the", "user", "into", "the", "given", "server", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L256-L435
[ "def", "login", "(", "self", ",", "server", ",", "username", ",", "password", "=", "''", ",", "terminal_type", "=", "'ansi'", ",", "original_prompt", "=", "r\"[#$]\"", ",", "login_timeout", "=", "10", ",", "port", "=", "None", ",", "auto_prompt_reset", "="...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.logout
Sends exit to the remote shell. If there are stopped jobs then this automatically sends exit twice.
pipenv/vendor/pexpect/pxssh.py
def logout (self): '''Sends exit to the remote shell. If there are stopped jobs then this automatically sends exit twice. ''' self.sendline("exit") index = self.expect([EOF, "(?i)there are stopped jobs"]) if index==1: self.sendline("exit") self.ex...
def logout (self): '''Sends exit to the remote shell. If there are stopped jobs then this automatically sends exit twice. ''' self.sendline("exit") index = self.expect([EOF, "(?i)there are stopped jobs"]) if index==1: self.sendline("exit") self.ex...
[ "Sends", "exit", "to", "the", "remote", "shell", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L437-L447
[ "def", "logout", "(", "self", ")", ":", "self", ".", "sendline", "(", "\"exit\"", ")", "index", "=", "self", ".", "expect", "(", "[", "EOF", ",", "\"(?i)there are stopped jobs\"", "]", ")", "if", "index", "==", "1", ":", "self", ".", "sendline", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.prompt
Match the next shell prompt. This is little more than a short-cut to the :meth:`~pexpect.spawn.expect` method. Note that if you called :meth:`login` with ``auto_prompt_reset=False``, then before calling :meth:`prompt` you must set the :attr:`PROMPT` attribute to a regex that it will use...
pipenv/vendor/pexpect/pxssh.py
def prompt(self, timeout=-1): '''Match the next shell prompt. This is little more than a short-cut to the :meth:`~pexpect.spawn.expect` method. Note that if you called :meth:`login` with ``auto_prompt_reset=False``, then before calling :meth:`prompt` you must set the :attr:`PROM...
def prompt(self, timeout=-1): '''Match the next shell prompt. This is little more than a short-cut to the :meth:`~pexpect.spawn.expect` method. Note that if you called :meth:`login` with ``auto_prompt_reset=False``, then before calling :meth:`prompt` you must set the :attr:`PROM...
[ "Match", "the", "next", "shell", "prompt", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L449-L471
[ "def", "prompt", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "if", "timeout", "==", "-", "1", ":", "timeout", "=", "self", ".", "timeout", "i", "=", "self", ".", "expect", "(", "[", "self", ".", "PROMPT", ",", "TIMEOUT", "]", ",", "ti...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
pxssh.set_unique_prompt
This sets the remote prompt to something more unique than ``#`` or ``$``. This makes it easier for the :meth:`prompt` method to match the shell prompt unambiguously. This method is called automatically by the :meth:`login` method, but you may want to call it manually if you somehow reset the ...
pipenv/vendor/pexpect/pxssh.py
def set_unique_prompt(self): '''This sets the remote prompt to something more unique than ``#`` or ``$``. This makes it easier for the :meth:`prompt` method to match the shell prompt unambiguously. This method is called automatically by the :meth:`login` method, but you may want to call ...
def set_unique_prompt(self): '''This sets the remote prompt to something more unique than ``#`` or ``$``. This makes it easier for the :meth:`prompt` method to match the shell prompt unambiguously. This method is called automatically by the :meth:`login` method, but you may want to call ...
[ "This", "sets", "the", "remote", "prompt", "to", "something", "more", "unique", "than", "#", "or", "$", ".", "This", "makes", "it", "easier", "for", "the", ":", "meth", ":", "prompt", "method", "to", "match", "the", "shell", "prompt", "unambiguously", "....
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L473-L497
[ "def", "set_unique_prompt", "(", "self", ")", ":", "self", ".", "sendline", "(", "\"unset PROMPT_COMMAND\"", ")", "self", ".", "sendline", "(", "self", ".", "PROMPT_SET_SH", ")", "# sh-style", "i", "=", "self", ".", "expect", "(", "[", "TIMEOUT", ",", "sel...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
user_agent
Return a string representing the user agent.
pipenv/patched/notpip/_internal/download.py
def user_agent(): """ Return a string representing the user agent. """ data = { "installer": {"name": "pip", "version": pipenv.patched.notpip.__version__}, "python": platform.python_version(), "implementation": { "name": platform.python_implementation(), }, ...
def user_agent(): """ Return a string representing the user agent. """ data = { "installer": {"name": "pip", "version": pipenv.patched.notpip.__version__}, "python": platform.python_version(), "implementation": { "name": platform.python_implementation(), }, ...
[ "Return", "a", "string", "representing", "the", "user", "agent", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L75-L141
[ "def", "user_agent", "(", ")", ":", "data", "=", "{", "\"installer\"", ":", "{", "\"name\"", ":", "\"pip\"", ",", "\"version\"", ":", "pipenv", ".", "patched", ".", "notpip", ".", "__version__", "}", ",", "\"python\"", ":", "platform", ".", "python_version...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
url_to_path
Convert a file: URL to a path.
pipenv/patched/notpip/_internal/download.py
def url_to_path(url): # type: (str) -> str """ Convert a file: URL to a path. """ assert url.startswith('file:'), ( "You can only turn file: urls into filenames (not %r)" % url) _, netloc, path, _, _ = urllib_parse.urlsplit(url) # if we have a UNC path, prepend UNC share notation ...
def url_to_path(url): # type: (str) -> str """ Convert a file: URL to a path. """ assert url.startswith('file:'), ( "You can only turn file: urls into filenames (not %r)" % url) _, netloc, path, _, _ = urllib_parse.urlsplit(url) # if we have a UNC path, prepend UNC share notation ...
[ "Convert", "a", "file", ":", "URL", "to", "a", "path", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L466-L481
[ "def", "url_to_path", "(", "url", ")", ":", "# type: (str) -> str", "assert", "url", ".", "startswith", "(", "'file:'", ")", ",", "(", "\"You can only turn file: urls into filenames (not %r)\"", "%", "url", ")", "_", ",", "netloc", ",", "path", ",", "_", ",", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
path_to_url
Convert a path to a file: URL. The path will be made absolute and have quoted path parts.
pipenv/patched/notpip/_internal/download.py
def path_to_url(path): # type: (Union[str, Text]) -> str """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path)) return url
def path_to_url(path): # type: (Union[str, Text]) -> str """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path)) return url
[ "Convert", "a", "path", "to", "a", "file", ":", "URL", ".", "The", "path", "will", "be", "made", "absolute", "and", "have", "quoted", "path", "parts", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L484-L492
[ "def", "path_to_url", "(", "path", ")", ":", "# type: (Union[str, Text]) -> str", "path", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "path", ")", ")", "url", "=", "urllib_parse", ".", "urljoin", "(", "'file:'", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_archive_file
Return True if `name` is a considered as an archive file.
pipenv/patched/notpip/_internal/download.py
def is_archive_file(name): # type: (str) -> bool """Return True if `name` is a considered as an archive file.""" ext = splitext(name)[1].lower() if ext in ARCHIVE_EXTENSIONS: return True return False
def is_archive_file(name): # type: (str) -> bool """Return True if `name` is a considered as an archive file.""" ext = splitext(name)[1].lower() if ext in ARCHIVE_EXTENSIONS: return True return False
[ "Return", "True", "if", "name", "is", "a", "considered", "as", "an", "archive", "file", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L495-L501
[ "def", "is_archive_file", "(", "name", ")", ":", "# type: (str) -> bool", "ext", "=", "splitext", "(", "name", ")", "[", "1", "]", ".", "lower", "(", ")", "if", "ext", "in", "ARCHIVE_EXTENSIONS", ":", "return", "True", "return", "False" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
is_dir_url
Return whether a file:// Link points to a directory. ``link`` must not have any other scheme but file://. Call is_file_url() first.
pipenv/patched/notpip/_internal/download.py
def is_dir_url(link): # type: (Link) -> bool """Return whether a file:// Link points to a directory. ``link`` must not have any other scheme but file://. Call is_file_url() first. """ link_path = url_to_path(link.url_without_fragment) return os.path.isdir(link_path)
def is_dir_url(link): # type: (Link) -> bool """Return whether a file:// Link points to a directory. ``link`` must not have any other scheme but file://. Call is_file_url() first. """ link_path = url_to_path(link.url_without_fragment) return os.path.isdir(link_path)
[ "Return", "whether", "a", "file", ":", "//", "Link", "points", "to", "a", "directory", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L526-L535
[ "def", "is_dir_url", "(", "link", ")", ":", "# type: (Link) -> bool", "link_path", "=", "url_to_path", "(", "link", ".", "url_without_fragment", ")", "return", "os", ".", "path", ".", "isdir", "(", "link_path", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
unpack_file_url
Unpack link into location. If download_dir is provided and link points to a file, make a copy of the link file inside download_dir.
pipenv/patched/notpip/_internal/download.py
def unpack_file_url( link, # type: Link location, # type: str download_dir=None, # type: Optional[str] hashes=None # type: Optional[Hashes] ): # type: (...) -> None """Unpack link into location. If download_dir is provided and link points to a file, make a copy of the link file insi...
def unpack_file_url( link, # type: Link location, # type: str download_dir=None, # type: Optional[str] hashes=None # type: Optional[Hashes] ): # type: (...) -> None """Unpack link into location. If download_dir is provided and link points to a file, make a copy of the link file insi...
[ "Unpack", "link", "into", "location", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L716-L767
[ "def", "unpack_file_url", "(", "link", ",", "# type: Link", "location", ",", "# type: str", "download_dir", "=", "None", ",", "# type: Optional[str]", "hashes", "=", "None", "# type: Optional[Hashes]", ")", ":", "# type: (...) -> None", "link_path", "=", "url_to_path", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_copy_dist_from_dir
Copy distribution files in `link_path` to `location`. Invoked when user requests to install a local directory. E.g.: pip install . pip install ~/dev/git-repos/python-prompt-toolkit
pipenv/patched/notpip/_internal/download.py
def _copy_dist_from_dir(link_path, location): """Copy distribution files in `link_path` to `location`. Invoked when user requests to install a local directory. E.g.: pip install . pip install ~/dev/git-repos/python-prompt-toolkit """ # Note: This is currently VERY SLOW if you have a ...
def _copy_dist_from_dir(link_path, location): """Copy distribution files in `link_path` to `location`. Invoked when user requests to install a local directory. E.g.: pip install . pip install ~/dev/git-repos/python-prompt-toolkit """ # Note: This is currently VERY SLOW if you have a ...
[ "Copy", "distribution", "files", "in", "link_path", "to", "location", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L770-L803
[ "def", "_copy_dist_from_dir", "(", "link_path", ",", "location", ")", ":", "# Note: This is currently VERY SLOW if you have a lot of data in the", "# directory, because it copies everything with `shutil.copytree`.", "# What it should really do is build an sdist and install that.", "# See https...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
unpack_url
Unpack link. If link is a VCS link: if only_download, export into download_dir and ignore location else unpack into location for other types of link: - unpack into location - if download_dir, copy the file into download_dir - if only_download, mark location fo...
pipenv/patched/notpip/_internal/download.py
def unpack_url( link, # type: Optional[Link] location, # type: Optional[str] download_dir=None, # type: Optional[str] only_download=False, # type: bool session=None, # type: Optional[PipSession] hashes=None, # type: Optional[Hashes] progress_bar="on" # type: str ): # type: (...) -...
def unpack_url( link, # type: Optional[Link] location, # type: Optional[str] download_dir=None, # type: Optional[str] only_download=False, # type: bool session=None, # type: Optional[PipSession] hashes=None, # type: Optional[Hashes] progress_bar="on" # type: str ): # type: (...) -...
[ "Unpack", "link", ".", "If", "link", "is", "a", "VCS", "link", ":", "if", "only_download", "export", "into", "download_dir", "and", "ignore", "location", "else", "unpack", "into", "location", "for", "other", "types", "of", "link", ":", "-", "unpack", "into...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L835-L881
[ "def", "unpack_url", "(", "link", ",", "# type: Optional[Link]", "location", ",", "# type: Optional[str]", "download_dir", "=", "None", ",", "# type: Optional[str]", "only_download", "=", "False", ",", "# type: bool", "session", "=", "None", ",", "# type: Optional[PipSe...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_check_download_dir
Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None
pipenv/patched/notpip/_internal/download.py
def _check_download_dir(link, download_dir, hashes): # type: (Link, str, Hashes) -> Optional[str] """ Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None """ download_path = os.path.join(download_dir, link.filename) if os.p...
def _check_download_dir(link, download_dir, hashes): # type: (Link, str, Hashes) -> Optional[str] """ Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None """ download_path = os.path.join(download_dir, link.filename) if os.p...
[ "Check", "download_dir", "for", "previously", "downloaded", "file", "with", "correct", "hash", "If", "a", "correct", "file", "is", "found", "return", "its", "path", "else", "None" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L950-L971
[ "def", "_check_download_dir", "(", "link", ",", "download_dir", ",", "hashes", ")", ":", "# type: (Link, str, Hashes) -> Optional[str]", "download_path", "=", "os", ".", "path", ".", "join", "(", "download_dir", ",", "link", ".", "filename", ")", "if", "os", "."...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_default_key_normalizer
Create a pool key out of a request context dictionary. According to RFC 3986, both the scheme and host are case-insensitive. Therefore, this function normalizes both before constructing the pool key for an HTTPS request. If you wish to change this behaviour, provide alternate callables to ``key_fn_by_s...
pipenv/vendor/urllib3/poolmanager.py
def _default_key_normalizer(key_class, request_context): """ Create a pool key out of a request context dictionary. According to RFC 3986, both the scheme and host are case-insensitive. Therefore, this function normalizes both before constructing the pool key for an HTTPS request. If you wish to ch...
def _default_key_normalizer(key_class, request_context): """ Create a pool key out of a request context dictionary. According to RFC 3986, both the scheme and host are case-insensitive. Therefore, this function normalizes both before constructing the pool key for an HTTPS request. If you wish to ch...
[ "Create", "a", "pool", "key", "out", "of", "a", "request", "context", "dictionary", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L58-L104
[ "def", "_default_key_normalizer", "(", "key_class", ",", "request_context", ")", ":", "# Since we mutate the dictionary, make a copy first", "context", "=", "request_context", ".", "copy", "(", ")", "context", "[", "'scheme'", "]", "=", "context", "[", "'scheme'", "]"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager._new_pool
Create a new :class:`ConnectionPool` based on host, port, scheme, and any additional pool keyword arguments. If ``request_context`` is provided, it is provided as keyword arguments to the pool class used. This method is used to actually create the connection pools handed out by :meth:`c...
pipenv/vendor/urllib3/poolmanager.py
def _new_pool(self, scheme, host, port, request_context=None): """ Create a new :class:`ConnectionPool` based on host, port, scheme, and any additional pool keyword arguments. If ``request_context`` is provided, it is provided as keyword arguments to the pool class used. This me...
def _new_pool(self, scheme, host, port, request_context=None): """ Create a new :class:`ConnectionPool` based on host, port, scheme, and any additional pool keyword arguments. If ``request_context`` is provided, it is provided as keyword arguments to the pool class used. This me...
[ "Create", "a", "new", ":", "class", ":", "ConnectionPool", "based", "on", "host", "port", "scheme", "and", "any", "additional", "pool", "keyword", "arguments", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L171-L196
[ "def", "_new_pool", "(", "self", ",", "scheme", ",", "host", ",", "port", ",", "request_context", "=", "None", ")", ":", "pool_cls", "=", "self", ".", "pool_classes_by_scheme", "[", "scheme", "]", "if", "request_context", "is", "None", ":", "request_context"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager.connection_from_host
Get a :class:`ConnectionPool` based on the host, port, and scheme. If ``port`` isn't given, it will be derived from the ``scheme`` using ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is provided, it is merged with the instance's ``connection_pool_kw`` variable and used t...
pipenv/vendor/urllib3/poolmanager.py
def connection_from_host(self, host, port=None, scheme='http', pool_kwargs=None): """ Get a :class:`ConnectionPool` based on the host, port, and scheme. If ``port`` isn't given, it will be derived from the ``scheme`` using ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is...
def connection_from_host(self, host, port=None, scheme='http', pool_kwargs=None): """ Get a :class:`ConnectionPool` based on the host, port, and scheme. If ``port`` isn't given, it will be derived from the ``scheme`` using ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is...
[ "Get", "a", ":", "class", ":", "ConnectionPool", "based", "on", "the", "host", "port", "and", "scheme", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L207-L228
[ "def", "connection_from_host", "(", "self", ",", "host", ",", "port", "=", "None", ",", "scheme", "=", "'http'", ",", "pool_kwargs", "=", "None", ")", ":", "if", "not", "host", ":", "raise", "LocationValueError", "(", "\"No host specified.\"", ")", "request_...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager.connection_from_context
Get a :class:`ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable.
pipenv/vendor/urllib3/poolmanager.py
def connection_from_context(self, request_context): """ Get a :class:`ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. """ scheme = request_co...
def connection_from_context(self, request_context): """ Get a :class:`ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. """ scheme = request_co...
[ "Get", "a", ":", "class", ":", "ConnectionPool", "based", "on", "the", "request", "context", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L230-L241
[ "def", "connection_from_context", "(", "self", ",", "request_context", ")", ":", "scheme", "=", "request_context", "[", "'scheme'", "]", ".", "lower", "(", ")", "pool_key_constructor", "=", "self", ".", "key_fn_by_scheme", "[", "scheme", "]", "pool_key", "=", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager.connection_from_pool_key
Get a :class:`ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields.
pipenv/vendor/urllib3/poolmanager.py
def connection_from_pool_key(self, pool_key, request_context=None): """ Get a :class:`ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields...
def connection_from_pool_key(self, pool_key, request_context=None): """ Get a :class:`ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields...
[ "Get", "a", ":", "class", ":", "ConnectionPool", "based", "on", "the", "provided", "pool", "key", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L243-L265
[ "def", "connection_from_pool_key", "(", "self", ",", "pool_key", ",", "request_context", "=", "None", ")", ":", "with", "self", ".", "pools", ".", "lock", ":", "# If the scheme, host, or port doesn't match existing open", "# connections, open a new ConnectionPool.", "pool",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager.connection_from_url
Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` is provided, it is used inst...
pipenv/vendor/urllib3/poolmanager.py
def connection_from_url(self, url, pool_kwargs=None): """ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpoo...
def connection_from_url(self, url, pool_kwargs=None): """ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpoo...
[ "Similar", "to", ":", "func", ":", "urllib3", ".", "connectionpool", ".", "connection_from_url", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L267-L280
[ "def", "connection_from_url", "(", "self", ",", "url", ",", "pool_kwargs", "=", "None", ")", ":", "u", "=", "parse_url", "(", "url", ")", "return", "self", ".", "connection_from_host", "(", "u", ".", "host", ",", "port", "=", "u", ".", "port", ",", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager._merge_pool_kwargs
Merge a dictionary of override values for self.connection_pool_kw. This does not modify self.connection_pool_kw and returns a new dict. Any keys in the override dictionary with a value of ``None`` are removed from the merged dictionary.
pipenv/vendor/urllib3/poolmanager.py
def _merge_pool_kwargs(self, override): """ Merge a dictionary of override values for self.connection_pool_kw. This does not modify self.connection_pool_kw and returns a new dict. Any keys in the override dictionary with a value of ``None`` are removed from the merged dictionary...
def _merge_pool_kwargs(self, override): """ Merge a dictionary of override values for self.connection_pool_kw. This does not modify self.connection_pool_kw and returns a new dict. Any keys in the override dictionary with a value of ``None`` are removed from the merged dictionary...
[ "Merge", "a", "dictionary", "of", "override", "values", "for", "self", ".", "connection_pool_kw", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L282-L300
[ "def", "_merge_pool_kwargs", "(", "self", ",", "override", ")", ":", "base_pool_kwargs", "=", "self", ".", "connection_pool_kw", ".", "copy", "(", ")", "if", "override", ":", "for", "key", ",", "value", "in", "override", ".", "items", "(", ")", ":", "if"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
PoolManager.urlopen
Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen` with custom cross-host redirect logic and only sends the request-uri portion of the ``url``. The given ``url`` parameter must be absolute, such that an appropriate :class:`urllib3.connectionpool.ConnectionPool` can be cho...
pipenv/vendor/urllib3/poolmanager.py
def urlopen(self, method, url, redirect=True, **kw): """ Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen` with custom cross-host redirect logic and only sends the request-uri portion of the ``url``. The given ``url`` parameter must be absolute, such that an appr...
def urlopen(self, method, url, redirect=True, **kw): """ Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen` with custom cross-host redirect logic and only sends the request-uri portion of the ``url``. The given ``url`` parameter must be absolute, such that an appr...
[ "Same", "as", ":", "meth", ":", "urllib3", ".", "connectionpool", ".", "HTTPConnectionPool", ".", "urlopen", "with", "custom", "cross", "-", "host", "redirect", "logic", "and", "only", "sends", "the", "request", "-", "uri", "portion", "of", "the", "url", "...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L302-L359
[ "def", "urlopen", "(", "self", ",", "method", ",", "url", ",", "redirect", "=", "True", ",", "*", "*", "kw", ")", ":", "u", "=", "parse_url", "(", "url", ")", "conn", "=", "self", ".", "connection_from_host", "(", "u", ".", "host", ",", "port", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ProxyManager._set_proxy_headers
Sets headers needed by proxies: specifically, the Accept and Host headers. Only sets headers not provided by the user.
pipenv/vendor/urllib3/poolmanager.py
def _set_proxy_headers(self, url, headers=None): """ Sets headers needed by proxies: specifically, the Accept and Host headers. Only sets headers not provided by the user. """ headers_ = {'Accept': '*/*'} netloc = parse_url(url).netloc if netloc: head...
def _set_proxy_headers(self, url, headers=None): """ Sets headers needed by proxies: specifically, the Accept and Host headers. Only sets headers not provided by the user. """ headers_ = {'Accept': '*/*'} netloc = parse_url(url).netloc if netloc: head...
[ "Sets", "headers", "needed", "by", "proxies", ":", "specifically", "the", "Accept", "and", "Host", "headers", ".", "Only", "sets", "headers", "not", "provided", "by", "the", "user", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L420-L433
[ "def", "_set_proxy_headers", "(", "self", ",", "url", ",", "headers", "=", "None", ")", ":", "headers_", "=", "{", "'Accept'", ":", "'*/*'", "}", "netloc", "=", "parse_url", "(", "url", ")", ".", "netloc", "if", "netloc", ":", "headers_", "[", "'Host'"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ProxyManager.urlopen
Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.
pipenv/vendor/urllib3/poolmanager.py
def urlopen(self, method, url, redirect=True, **kw): "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute." u = parse_url(url) if u.scheme == "http": # For proxied HTTPS requests, httplib sets the necessary headers # on the CONNECT to the proxy. For HTTP, we'...
def urlopen(self, method, url, redirect=True, **kw): "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute." u = parse_url(url) if u.scheme == "http": # For proxied HTTPS requests, httplib sets the necessary headers # on the CONNECT to the proxy. For HTTP, we'...
[ "Same", "as", "HTTP", "(", "S", ")", "ConnectionPool", ".", "urlopen", "url", "must", "be", "absolute", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L435-L446
[ "def", "urlopen", "(", "self", ",", "method", ",", "url", ",", "redirect", "=", "True", ",", "*", "*", "kw", ")", ":", "u", "=", "parse_url", "(", "url", ")", "if", "u", ".", "scheme", "==", "\"http\"", ":", "# For proxied HTTPS requests, httplib sets th...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
find_undeclared_variables
Returns a set of all variables in the AST that will be looked up from the context at runtime. Because at compile time it's not known which variables will be used depending on the path the execution takes at runtime, all variables are returned. >>> from jinja2 import Environment, meta >>> env = Env...
pipenv/vendor/jinja2/meta.py
def find_undeclared_variables(ast): """Returns a set of all variables in the AST that will be looked up from the context at runtime. Because at compile time it's not known which variables will be used depending on the path the execution takes at runtime, all variables are returned. >>> from jinja2...
def find_undeclared_variables(ast): """Returns a set of all variables in the AST that will be looked up from the context at runtime. Because at compile time it's not known which variables will be used depending on the path the execution takes at runtime, all variables are returned. >>> from jinja2...
[ "Returns", "a", "set", "of", "all", "variables", "in", "the", "AST", "that", "will", "be", "looked", "up", "from", "the", "context", "at", "runtime", ".", "Because", "at", "compile", "time", "it", "s", "not", "known", "which", "variables", "will", "be", ...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/meta.py#L36-L57
[ "def", "find_undeclared_variables", "(", "ast", ")", ":", "codegen", "=", "TrackingCodeGenerator", "(", "ast", ".", "environment", ")", "codegen", ".", "visit", "(", "ast", ")", "return", "codegen", ".", "undeclared_identifiers" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
find_referenced_templates
Finds all the referenced templates from the AST. This will return an iterator over all the hardcoded template extensions, inclusions and imports. If dynamic inheritance or inclusion is used, `None` will be yielded. >>> from jinja2 import Environment, meta >>> env = Environment() >>> ast = env...
pipenv/vendor/jinja2/meta.py
def find_referenced_templates(ast): """Finds all the referenced templates from the AST. This will return an iterator over all the hardcoded template extensions, inclusions and imports. If dynamic inheritance or inclusion is used, `None` will be yielded. >>> from jinja2 import Environment, meta ...
def find_referenced_templates(ast): """Finds all the referenced templates from the AST. This will return an iterator over all the hardcoded template extensions, inclusions and imports. If dynamic inheritance or inclusion is used, `None` will be yielded. >>> from jinja2 import Environment, meta ...
[ "Finds", "all", "the", "referenced", "templates", "from", "the", "AST", ".", "This", "will", "return", "an", "iterator", "over", "all", "the", "hardcoded", "template", "extensions", "inclusions", "and", "imports", ".", "If", "dynamic", "inheritance", "or", "in...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/meta.py#L60-L106
[ "def", "find_referenced_templates", "(", "ast", ")", ":", "for", "node", "in", "ast", ".", "find_all", "(", "(", "nodes", ".", "Extends", ",", "nodes", ".", "FromImport", ",", "nodes", ".", "Import", ",", "nodes", ".", "Include", ")", ")", ":", "if", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
TrackingCodeGenerator.enter_frame
Remember all undeclared identifiers.
pipenv/vendor/jinja2/meta.py
def enter_frame(self, frame): """Remember all undeclared identifiers.""" CodeGenerator.enter_frame(self, frame) for _, (action, param) in iteritems(frame.symbols.loads): if action == 'resolve': self.undeclared_identifiers.add(param)
def enter_frame(self, frame): """Remember all undeclared identifiers.""" CodeGenerator.enter_frame(self, frame) for _, (action, param) in iteritems(frame.symbols.loads): if action == 'resolve': self.undeclared_identifiers.add(param)
[ "Remember", "all", "undeclared", "identifiers", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/meta.py#L28-L33
[ "def", "enter_frame", "(", "self", ",", "frame", ")", ":", "CodeGenerator", ".", "enter_frame", "(", "self", ",", "frame", ")", "for", "_", ",", "(", "action", ",", "param", ")", "in", "iteritems", "(", "frame", ".", "symbols", ".", "loads", ")", ":"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
parse_marker
Parse a marker string and return a dictionary containing a marker expression. The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in the expression grammar, or strings. A string contained in quotes is to be interpreted as a literal string, and a string not contained in quotes is a ...
pipenv/vendor/distlib/util.py
def parse_marker(marker_string): """ Parse a marker string and return a dictionary containing a marker expression. The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in the expression grammar, or strings. A string contained in quotes is to be interpreted as a literal string, a...
def parse_marker(marker_string): """ Parse a marker string and return a dictionary containing a marker expression. The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in the expression grammar, or strings. A string contained in quotes is to be interpreted as a literal string, a...
[ "Parse", "a", "marker", "string", "and", "return", "a", "dictionary", "containing", "a", "marker", "expression", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L56-L142
[ "def", "parse_marker", "(", "marker_string", ")", ":", "def", "marker_var", "(", "remaining", ")", ":", "# either identifier, or literal string", "m", "=", "IDENTIFIER", ".", "match", "(", "remaining", ")", "if", "m", ":", "result", "=", "m", ".", "groups", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
parse_requirement
Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement.
pipenv/vendor/distlib/util.py
def parse_requirement(req): """ Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement. """ remaining = req.strip() if not remaining or remaining.startswith('#'): return None m = IDENTIFIER.match(remaining) if n...
def parse_requirement(req): """ Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement. """ remaining = req.strip() if not remaining or remaining.startswith('#'): return None m = IDENTIFIER.match(remaining) if n...
[ "Parse", "a", "requirement", "passed", "in", "as", "a", "string", ".", "Return", "a", "Container", "whose", "attributes", "contain", "the", "various", "parts", "of", "the", "requirement", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L145-L263
[ "def", "parse_requirement", "(", "req", ")", ":", "remaining", "=", "req", ".", "strip", "(", ")", "if", "not", "remaining", "or", "remaining", ".", "startswith", "(", "'#'", ")", ":", "return", "None", "m", "=", "IDENTIFIER", ".", "match", "(", "remai...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
convert_path
Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we ca...
pipenv/vendor/distlib/util.py
def convert_path(pathname): """Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to th...
def convert_path(pathname): """Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to th...
[ "Return", "pathname", "as", "a", "name", "that", "will", "work", "on", "the", "native", "filesystem", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L451-L475
[ "def", "convert_path", "(", "pathname", ")", ":", "if", "os", ".", "sep", "==", "'/'", ":", "return", "pathname", "if", "not", "pathname", ":", "return", "pathname", "if", "pathname", "[", "0", "]", "==", "'/'", ":", "raise", "ValueError", "(", "\"path...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
get_cache_base
Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will ...
pipenv/vendor/distlib/util.py
def get_cache_base(suffix=None): """ Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then i...
def get_cache_base(suffix=None): """ Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then i...
[ "Return", "the", "default", "base", "location", "for", "distlib", "caches", ".", "If", "the", "directory", "does", "not", "exist", "it", "is", "created", ".", "Use", "the", "suffix", "provided", "for", "the", "base", "directory", "and", "default", "to", "....
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L740-L778
[ "def", "get_cache_base", "(", "suffix", "=", "None", ")", ":", "if", "suffix", "is", "None", ":", "suffix", "=", "'.distlib'", "if", "os", ".", "name", "==", "'nt'", "and", "'LOCALAPPDATA'", "in", "os", ".", "environ", ":", "result", "=", "os", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
path_to_cache_dir
Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended.
pipenv/vendor/distlib/util.py
def path_to_cache_dir(path): """ Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. """ d, p ...
def path_to_cache_dir(path): """ Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. """ d, p ...
[ "Convert", "an", "absolute", "path", "to", "a", "directory", "name", "for", "use", "in", "a", "cache", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L781-L795
[ "def", "path_to_cache_dir", "(", "path", ")", ":", "d", ",", "p", "=", "os", ".", "path", ".", "splitdrive", "(", "os", ".", "path", ".", "abspath", "(", "path", ")", ")", "if", "d", ":", "d", "=", "d", ".", "replace", "(", "':'", ",", "'---'",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
split_filename
Extract name, version, python version from a filename (no extension) Return name, version, pyver or None
pipenv/vendor/distlib/util.py
def split_filename(filename, project_name=None): """ Extract name, version, python version from a filename (no extension) Return name, version, pyver or None """ result = None pyver = None filename = unquote(filename).replace(' ', '-') m = PYTHON_VERSION.search(filename) if m: ...
def split_filename(filename, project_name=None): """ Extract name, version, python version from a filename (no extension) Return name, version, pyver or None """ result = None pyver = None filename = unquote(filename).replace(' ', '-') m = PYTHON_VERSION.search(filename) if m: ...
[ "Extract", "name", "version", "python", "version", "from", "a", "filename", "(", "no", "extension", ")" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L835-L857
[ "def", "split_filename", "(", "filename", ",", "project_name", "=", "None", ")", ":", "result", "=", "None", "pyver", "=", "None", "filename", "=", "unquote", "(", "filename", ")", ".", "replace", "(", "' '", ",", "'-'", ")", "m", "=", "PYTHON_VERSION", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
parse_name_and_version
A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple.
pipenv/vendor/distlib/util.py
def parse_name_and_version(p): """ A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. """ m = NAME_VERSION_RE.match(p) if not m: raise DistlibException('...
def parse_name_and_version(p): """ A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. """ m = NAME_VERSION_RE.match(p) if not m: raise DistlibException('...
[ "A", "utility", "method", "used", "to", "get", "name", "and", "version", "from", "a", "string", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L863-L876
[ "def", "parse_name_and_version", "(", "p", ")", ":", "m", "=", "NAME_VERSION_RE", ".", "match", "(", "p", ")", "if", "not", "m", ":", "raise", "DistlibException", "(", "'Ill-formed name/version string: \\'%s\\''", "%", "p", ")", "d", "=", "m", ".", "groupdic...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
zip_dir
zip a directory tree into a BytesIO object
pipenv/vendor/distlib/util.py
def zip_dir(directory): """zip a directory tree into a BytesIO object""" result = io.BytesIO() dlen = len(directory) with ZipFile(result, "w") as zf: for root, dirs, files in os.walk(directory): for name in files: full = os.path.join(root, name) rel = ...
def zip_dir(directory): """zip a directory tree into a BytesIO object""" result = io.BytesIO() dlen = len(directory) with ZipFile(result, "w") as zf: for root, dirs, files in os.walk(directory): for name in files: full = os.path.join(root, name) rel = ...
[ "zip", "a", "directory", "tree", "into", "a", "BytesIO", "object" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1249-L1260
[ "def", "zip_dir", "(", "directory", ")", ":", "result", "=", "io", ".", "BytesIO", "(", ")", "dlen", "=", "len", "(", "directory", ")", "with", "ZipFile", "(", "result", ",", "\"w\"", ")", "as", "zf", ":", "for", "root", ",", "dirs", ",", "files", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
iglob
Extended globbing function that supports ** and {opt1,opt2,opt3}.
pipenv/vendor/distlib/util.py
def iglob(path_glob): """Extended globbing function that supports ** and {opt1,opt2,opt3}.""" if _CHECK_RECURSIVE_GLOB.search(path_glob): msg = """invalid glob %r: recursive glob "**" must be used alone""" raise ValueError(msg % path_glob) if _CHECK_MISMATCH_SET.search(path_glob): ms...
def iglob(path_glob): """Extended globbing function that supports ** and {opt1,opt2,opt3}.""" if _CHECK_RECURSIVE_GLOB.search(path_glob): msg = """invalid glob %r: recursive glob "**" must be used alone""" raise ValueError(msg % path_glob) if _CHECK_MISMATCH_SET.search(path_glob): ms...
[ "Extended", "globbing", "function", "that", "supports", "**", "and", "{", "opt1", "opt2", "opt3", "}", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1367-L1375
[ "def", "iglob", "(", "path_glob", ")", ":", "if", "_CHECK_RECURSIVE_GLOB", ".", "search", "(", "path_glob", ")", ":", "msg", "=", "\"\"\"invalid glob %r: recursive glob \"**\" must be used alone\"\"\"", "raise", "ValueError", "(", "msg", "%", "path_glob", ")", "if", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
FileOperator.newer
Tell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' ...
pipenv/vendor/distlib/util.py
def newer(self, source, target): """Tell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'so...
def newer(self, source, target): """Tell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'so...
[ "Tell", "if", "the", "target", "is", "newer", "than", "the", "source", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L493-L511
[ "def", "newer", "(", "self", ",", "source", ",", "target", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "source", ")", ":", "raise", "DistlibException", "(", "\"file '%r' does not exist\"", "%", "os", ".", "path", ".", "abspath", "(", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
FileOperator.copy_file
Copy a file respecting dry-run and force flags.
pipenv/vendor/distlib/util.py
def copy_file(self, infile, outfile, check=True): """Copy a file respecting dry-run and force flags. """ self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying %s to %s', infile, outfile) if not self.dry_run: msg = None if check: if...
def copy_file(self, infile, outfile, check=True): """Copy a file respecting dry-run and force flags. """ self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying %s to %s', infile, outfile) if not self.dry_run: msg = None if check: if...
[ "Copy", "a", "file", "respecting", "dry", "-", "run", "and", "force", "flags", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L513-L528
[ "def", "copy_file", "(", "self", ",", "infile", ",", "outfile", ",", "check", "=", "True", ")", ":", "self", ".", "ensure_dir", "(", "os", ".", "path", ".", "dirname", "(", "outfile", ")", ")", "logger", ".", "info", "(", "'Copying %s to %s'", ",", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
FileOperator.commit
Commit recorded changes, turn off recording, return changes.
pipenv/vendor/distlib/util.py
def commit(self): """ Commit recorded changes, turn off recording, return changes. """ assert self.record result = self.files_written, self.dirs_created self._init_record() return result
def commit(self): """ Commit recorded changes, turn off recording, return changes. """ assert self.record result = self.files_written, self.dirs_created self._init_record() return result
[ "Commit", "recorded", "changes", "turn", "off", "recording", "return", "changes", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L633-L641
[ "def", "commit", "(", "self", ")", ":", "assert", "self", ".", "record", "result", "=", "self", ".", "files_written", ",", "self", ".", "dirs_created", "self", ".", "_init_record", "(", ")", "return", "result" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Cache.clear
Clear the cache.
pipenv/vendor/distlib/util.py
def clear(self): """ Clear the cache. """ not_removed = [] for fn in os.listdir(self.base): fn = os.path.join(self.base, fn) try: if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.is...
def clear(self): """ Clear the cache. """ not_removed = [] for fn in os.listdir(self.base): fn = os.path.join(self.base, fn) try: if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.is...
[ "Clear", "the", "cache", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L964-L978
[ "def", "clear", "(", "self", ")", ":", "not_removed", "=", "[", "]", "for", "fn", "in", "os", ".", "listdir", "(", "self", ".", "base", ")", ":", "fn", "=", "os", ".", "path", ".", "join", "(", "self", ".", "base", ",", "fn", ")", "try", ":",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
EventMixin.add
Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list ...
pipenv/vendor/distlib/util.py
def add(self, event, subscriber, append=True): """ Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend th...
def add(self, event, subscriber, append=True): """ Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend th...
[ "Add", "a", "subscriber", "for", "an", "event", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L988-L1006
[ "def", "add", "(", "self", ",", "event", ",", "subscriber", ",", "append", "=", "True", ")", ":", "subs", "=", "self", ".", "_subscribers", "if", "event", "not", "in", "subs", ":", "subs", "[", "event", "]", "=", "deque", "(", "[", "subscriber", "]...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
EventMixin.remove
Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed.
pipenv/vendor/distlib/util.py
def remove(self, event, subscriber): """ Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. """ subs = self._subscribers if event not in subs: raise ValueError('No subscribers: %r' % ...
def remove(self, event, subscriber): """ Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. """ subs = self._subscribers if event not in subs: raise ValueError('No subscribers: %r' % ...
[ "Remove", "a", "subscriber", "for", "an", "event", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1008-L1018
[ "def", "remove", "(", "self", ",", "event", ",", "subscriber", ")", ":", "subs", "=", "self", ".", "_subscribers", "if", "event", "not", "in", "subs", ":", "raise", "ValueError", "(", "'No subscribers: %r'", "%", "event", ")", "subs", "[", "event", "]", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
EventMixin.publish
Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's ...
pipenv/vendor/distlib/util.py
def publish(self, event, *args, **kwargs): """ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The k...
def publish(self, event, *args, **kwargs): """ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The k...
[ "Publish", "a", "event", "and", "return", "a", "list", "of", "values", "returned", "by", "its", "subscribers", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1027-L1048
[ "def", "publish", "(", "self", ",", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", "=", "[", "]", "for", "subscriber", "in", "self", ".", "get_subscribers", "(", "event", ")", ":", "try", ":", "value", "=", "subscriber", "(...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
Configurator.inc_convert
Default converter for the inc:// protocol.
pipenv/vendor/distlib/util.py
def inc_convert(self, value): """Default converter for the inc:// protocol.""" if not os.path.isabs(value): value = os.path.join(self.base, value) with codecs.open(value, 'r', encoding='utf-8') as f: result = json.load(f) return result
def inc_convert(self, value): """Default converter for the inc:// protocol.""" if not os.path.isabs(value): value = os.path.join(self.base, value) with codecs.open(value, 'r', encoding='utf-8') as f: result = json.load(f) return result
[ "Default", "converter", "for", "the", "inc", ":", "//", "protocol", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1698-L1704
[ "def", "inc_convert", "(", "self", ",", "value", ")", ":", "if", "not", "os", ".", "path", ".", "isabs", "(", "value", ")", ":", "value", "=", "os", ".", "path", ".", "join", "(", "self", ".", "base", ",", "value", ")", "with", "codecs", ".", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
SubprocessMixin.reader
Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr.
pipenv/vendor/distlib/util.py
def reader(self, stream, context): """ Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. """ progress = self.progress verbose = self.verbose while True: s = st...
def reader(self, stream, context): """ Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. """ progress = self.progress verbose = self.verbose while True: s = st...
[ "Read", "lines", "from", "a", "subprocess", "output", "stream", "and", "either", "pass", "to", "a", "progress", "callable", "(", "if", "specified", ")", "or", "write", "progress", "information", "to", "sys", ".", "stderr", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1715-L1734
[ "def", "reader", "(", "self", ",", "stream", ",", "context", ")", ":", "progress", "=", "self", ".", "progress", "verbose", "=", "self", ".", "verbose", "while", "True", ":", "s", "=", "stream", ".", "readline", "(", ")", "if", "not", "s", ":", "br...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_get
Query the PyPI RSS feed and return a list of XML items.
pipenv/vendor/yarg/parse.py
def _get(pypi_server): """ Query the PyPI RSS feed and return a list of XML items. """ response = requests.get(pypi_server) if response.status_code >= 300: raise HTTPError(status_code=response.status_code, reason=response.reason) if hasattr(response.content, '...
def _get(pypi_server): """ Query the PyPI RSS feed and return a list of XML items. """ response = requests.get(pypi_server) if response.status_code >= 300: raise HTTPError(status_code=response.status_code, reason=response.reason) if hasattr(response.content, '...
[ "Query", "the", "PyPI", "RSS", "feed", "and", "return", "a", "list", "of", "XML", "items", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/parse.py#L33-L47
[ "def", "_get", "(", "pypi_server", ")", ":", "response", "=", "requests", ".", "get", "(", "pypi_server", ")", "if", "response", ".", "status_code", ">=", "300", ":", "raise", "HTTPError", "(", "status_code", "=", "response", ".", "status_code", ",", "reas...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
newest_packages
Constructs a request to the PyPI server and returns a list of :class:`yarg.parse.Package`. :param pypi_server: (option) URL to the PyPI server. >>> import yarg >>> yarg.newest_packages() [<Package yarg>, <Package gray>, <Package ragy>]
pipenv/vendor/yarg/parse.py
def newest_packages( pypi_server="https://pypi.python.org/pypi?%3Aaction=packages_rss"): """ Constructs a request to the PyPI server and returns a list of :class:`yarg.parse.Package`. :param pypi_server: (option) URL to the PyPI server. >>> import yarg >>> yarg.newest_packages(...
def newest_packages( pypi_server="https://pypi.python.org/pypi?%3Aaction=packages_rss"): """ Constructs a request to the PyPI server and returns a list of :class:`yarg.parse.Package`. :param pypi_server: (option) URL to the PyPI server. >>> import yarg >>> yarg.newest_packages(...
[ "Constructs", "a", "request", "to", "the", "PyPI", "server", "and", "returns", "a", "list", "of", ":", "class", ":", "yarg", ".", "parse", ".", "Package", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/parse.py#L50-L70
[ "def", "newest_packages", "(", "pypi_server", "=", "\"https://pypi.python.org/pypi?%3Aaction=packages_rss\"", ")", ":", "items", "=", "_get", "(", "pypi_server", ")", "i", "=", "[", "]", "for", "item", "in", "items", ":", "i_dict", "=", "{", "'name'", ":", "it...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_get_requirements
Produce a mapping of identifier: requirement from the section.
pipenv/vendor/passa/models/lockers.py
def _get_requirements(model, section_name): """Produce a mapping of identifier: requirement from the section. """ if not model: return {} return {identify_requirment(r): r for r in ( requirementslib.Requirement.from_pipfile(name, package._data) for name, package in model.get(sect...
def _get_requirements(model, section_name): """Produce a mapping of identifier: requirement from the section. """ if not model: return {} return {identify_requirment(r): r for r in ( requirementslib.Requirement.from_pipfile(name, package._data) for name, package in model.get(sect...
[ "Produce", "a", "mapping", "of", "identifier", ":", "requirement", "from", "the", "section", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/lockers.py#L22-L30
[ "def", "_get_requirements", "(", "model", ",", "section_name", ")", ":", "if", "not", "model", ":", "return", "{", "}", "return", "{", "identify_requirment", "(", "r", ")", ":", "r", "for", "r", "in", "(", "requirementslib", ".", "Requirement", ".", "fro...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_collect_derived_entries
Produce a mapping containing all candidates derived from `identifiers`. `identifiers` should provide a collection of requirement identifications from a section (i.e. `packages` or `dev-packages`). This function uses `trace` to filter out candidates in the state that are present because of an entry in t...
pipenv/vendor/passa/models/lockers.py
def _collect_derived_entries(state, traces, identifiers): """Produce a mapping containing all candidates derived from `identifiers`. `identifiers` should provide a collection of requirement identifications from a section (i.e. `packages` or `dev-packages`). This function uses `trace` to filter out cand...
def _collect_derived_entries(state, traces, identifiers): """Produce a mapping containing all candidates derived from `identifiers`. `identifiers` should provide a collection of requirement identifications from a section (i.e. `packages` or `dev-packages`). This function uses `trace` to filter out cand...
[ "Produce", "a", "mapping", "containing", "all", "candidates", "derived", "from", "identifiers", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/lockers.py#L48-L78
[ "def", "_collect_derived_entries", "(", "state", ",", "traces", ",", "identifiers", ")", ":", "identifiers", "=", "set", "(", "identifiers", ")", "if", "not", "identifiers", ":", "return", "{", "}", "entries", "=", "{", "}", "extras", "=", "{", "}", "for...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
AbstractLocker.lock
Lock specified (abstract) requirements into (concrete) candidates. The locking procedure consists of four stages: * Resolve versions and dependency graph (powered by ResolveLib). * Walk the graph to determine "why" each candidate came to be, i.e. what top-level requirements result in...
pipenv/vendor/passa/models/lockers.py
def lock(self): """Lock specified (abstract) requirements into (concrete) candidates. The locking procedure consists of four stages: * Resolve versions and dependency graph (powered by ResolveLib). * Walk the graph to determine "why" each candidate came to be, i.e. what top-l...
def lock(self): """Lock specified (abstract) requirements into (concrete) candidates. The locking procedure consists of four stages: * Resolve versions and dependency graph (powered by ResolveLib). * Walk the graph to determine "why" each candidate came to be, i.e. what top-l...
[ "Lock", "specified", "(", "abstract", ")", "requirements", "into", "(", "concrete", ")", "candidates", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/lockers.py#L124-L163
[ "def", "lock", "(", "self", ")", ":", "provider", "=", "self", ".", "get_provider", "(", ")", "reporter", "=", "self", ".", "get_reporter", "(", ")", "resolver", "=", "resolvelib", ".", "Resolver", "(", "provider", ",", "reporter", ")", "with", "vistir",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
setup_logging
Configures and sets up all of the logging Returns the requested logging level, as its integer value.
pipenv/patched/notpip/_internal/utils/logging.py
def setup_logging(verbosity, no_color, user_log_file): """Configures and sets up all of the logging Returns the requested logging level, as its integer value. """ # Determine the level to be logging at. if verbosity >= 1: level = "DEBUG" elif verbosity == -1: level = "WARNING" ...
def setup_logging(verbosity, no_color, user_log_file): """Configures and sets up all of the logging Returns the requested logging level, as its integer value. """ # Determine the level to be logging at. if verbosity >= 1: level = "DEBUG" elif verbosity == -1: level = "WARNING" ...
[ "Configures", "and", "sets", "up", "all", "of", "the", "logging" ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/logging.py#L217-L318
[ "def", "setup_logging", "(", "verbosity", ",", "no_color", ",", "user_log_file", ")", ":", "# Determine the level to be logging at.", "if", "verbosity", ">=", "1", ":", "level", "=", "\"DEBUG\"", "elif", "verbosity", "==", "-", "1", ":", "level", "=", "\"WARNING...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
IndentingFormatter.format
Calls the standard formatter, but will indent all of the log messages by our current indentation level.
pipenv/patched/notpip/_internal/utils/logging.py
def format(self, record): """ Calls the standard formatter, but will indent all of the log messages by our current indentation level. """ formatted = super(IndentingFormatter, self).format(record) prefix = '' if self.add_timestamp: prefix = self.format...
def format(self, record): """ Calls the standard formatter, but will indent all of the log messages by our current indentation level. """ formatted = super(IndentingFormatter, self).format(record) prefix = '' if self.add_timestamp: prefix = self.format...
[ "Calls", "the", "standard", "formatter", "but", "will", "indent", "all", "of", "the", "log", "messages", "by", "our", "current", "indentation", "level", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/logging.py#L103-L117
[ "def", "format", "(", "self", ",", "record", ")", ":", "formatted", "=", "super", "(", "IndentingFormatter", ",", "self", ")", ".", "format", "(", "record", ")", "prefix", "=", "''", "if", "self", ".", "add_timestamp", ":", "prefix", "=", "self", ".", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
ColorizedStreamHandler._using_stdout
Return whether the handler is using sys.stdout.
pipenv/patched/notpip/_internal/utils/logging.py
def _using_stdout(self): """ Return whether the handler is using sys.stdout. """ if WINDOWS and colorama: # Then self.stream is an AnsiToWin32 object. return self.stream.wrapped is sys.stdout return self.stream is sys.stdout
def _using_stdout(self): """ Return whether the handler is using sys.stdout. """ if WINDOWS and colorama: # Then self.stream is an AnsiToWin32 object. return self.stream.wrapped is sys.stdout return self.stream is sys.stdout
[ "Return", "whether", "the", "handler", "is", "using", "sys", ".", "stdout", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/logging.py#L145-L153
[ "def", "_using_stdout", "(", "self", ")", ":", "if", "WINDOWS", "and", "colorama", ":", "# Then self.stream is an AnsiToWin32 object.", "return", "self", ".", "stream", ".", "wrapped", "is", "sys", ".", "stdout", "return", "self", ".", "stream", "is", "sys", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
_cast_boolean
Helper to convert config values to boolean as ConfigParser do.
pipenv/vendor/dotenv/environ.py
def _cast_boolean(value): """ Helper to convert config values to boolean as ConfigParser do. """ _BOOLEANS = {'1': True, 'yes': True, 'true': True, 'on': True, '0': False, 'no': False, 'false': False, 'off': False, '': False} value = str(value) if value.lower() not in _BOOLEANS:...
def _cast_boolean(value): """ Helper to convert config values to boolean as ConfigParser do. """ _BOOLEANS = {'1': True, 'yes': True, 'true': True, 'on': True, '0': False, 'no': False, 'false': False, 'off': False, '': False} value = str(value) if value.lower() not in _BOOLEANS:...
[ "Helper", "to", "convert", "config", "values", "to", "boolean", "as", "ConfigParser", "do", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/environ.py#L17-L27
[ "def", "_cast_boolean", "(", "value", ")", ":", "_BOOLEANS", "=", "{", "'1'", ":", "True", ",", "'yes'", ":", "True", ",", "'true'", ":", "True", ",", "'on'", ":", "True", ",", "'0'", ":", "False", ",", "'no'", ":", "False", ",", "'false'", ":", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
getenv
Return the value for option or default if defined.
pipenv/vendor/dotenv/environ.py
def getenv(option, default=undefined, cast=undefined): """ Return the value for option or default if defined. """ # We can't avoid __contains__ because value may be empty. if option in os.environ: value = os.environ[option] else: if isinstance(default, Undefined): ra...
def getenv(option, default=undefined, cast=undefined): """ Return the value for option or default if defined. """ # We can't avoid __contains__ because value may be empty. if option in os.environ: value = os.environ[option] else: if isinstance(default, Undefined): ra...
[ "Return", "the", "value", "for", "option", "or", "default", "if", "defined", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/environ.py#L30-L54
[ "def", "getenv", "(", "option", ",", "default", "=", "undefined", ",", "cast", "=", "undefined", ")", ":", "# We can't avoid __contains__ because value may be empty.", "if", "option", "in", "os", ".", "environ", ":", "value", "=", "os", ".", "environ", "[", "o...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
join_options
Given a list of option strings this joins them in the most appropriate way and returns them in the form ``(formatted_string, any_prefix_is_slash)`` where the second item in the tuple is a flag that indicates if any of the option prefixes was a slash.
pipenv/vendor/click/formatting.py
def join_options(options): """Given a list of option strings this joins them in the most appropriate way and returns them in the form ``(formatted_string, any_prefix_is_slash)`` where the second item in the tuple is a flag that indicates if any of the option prefixes was a slash. """ rv = [] ...
def join_options(options): """Given a list of option strings this joins them in the most appropriate way and returns them in the form ``(formatted_string, any_prefix_is_slash)`` where the second item in the tuple is a flag that indicates if any of the option prefixes was a slash. """ rv = [] ...
[ "Given", "a", "list", "of", "option", "strings", "this", "joins", "them", "in", "the", "most", "appropriate", "way", "and", "returns", "them", "in", "the", "form", "(", "formatted_string", "any_prefix_is_slash", ")", "where", "the", "second", "item", "in", "...
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L239-L256
[ "def", "join_options", "(", "options", ")", ":", "rv", "=", "[", "]", "any_prefix_is_slash", "=", "False", "for", "opt", "in", "options", ":", "prefix", "=", "split_opt", "(", "opt", ")", "[", "0", "]", "if", "prefix", "==", "'/'", ":", "any_prefix_is_...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
HelpFormatter.write_usage
Writes a usage line into the buffer. :param prog: the program name. :param args: whitespace separated list of arguments. :param prefix: the prefix for the first line.
pipenv/vendor/click/formatting.py
def write_usage(self, prog, args='', prefix='Usage: '): """Writes a usage line into the buffer. :param prog: the program name. :param args: whitespace separated list of arguments. :param prefix: the prefix for the first line. """ usage_prefix = '%*s%s ' % (self.current_i...
def write_usage(self, prog, args='', prefix='Usage: '): """Writes a usage line into the buffer. :param prog: the program name. :param args: whitespace separated list of arguments. :param prefix: the prefix for the first line. """ usage_prefix = '%*s%s ' % (self.current_i...
[ "Writes", "a", "usage", "line", "into", "the", "buffer", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L125-L150
[ "def", "write_usage", "(", "self", ",", "prog", ",", "args", "=", "''", ",", "prefix", "=", "'Usage: '", ")", ":", "usage_prefix", "=", "'%*s%s '", "%", "(", "self", ".", "current_indent", ",", "prefix", ",", "prog", ")", "text_width", "=", "self", "."...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
train
HelpFormatter.write_text
Writes re-indented text into the buffer. This rewraps and preserves paragraphs.
pipenv/vendor/click/formatting.py
def write_text(self, text): """Writes re-indented text into the buffer. This rewraps and preserves paragraphs. """ text_width = max(self.width - self.current_indent, 11) indent = ' ' * self.current_indent self.write(wrap_text(text, text_width, ...
def write_text(self, text): """Writes re-indented text into the buffer. This rewraps and preserves paragraphs. """ text_width = max(self.width - self.current_indent, 11) indent = ' ' * self.current_indent self.write(wrap_text(text, text_width, ...
[ "Writes", "re", "-", "indented", "text", "into", "the", "buffer", ".", "This", "rewraps", "and", "preserves", "paragraphs", "." ]
pypa/pipenv
python
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L161-L171
[ "def", "write_text", "(", "self", ",", "text", ")", ":", "text_width", "=", "max", "(", "self", ".", "width", "-", "self", ".", "current_indent", ",", "11", ")", "indent", "=", "' '", "*", "self", ".", "current_indent", "self", ".", "write", "(", "wr...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde