id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
25,400 | pypa/pipenv | pipenv/core.py | cleanup_virtualenv | def cleanup_virtualenv(bare=True):
"""Removes the virtualenv directory from the system."""
if not bare:
click.echo(crayons.red("Environment creation aborted."))
try:
# Delete the virtualenv.
vistir.path.rmtree(project.virtualenv_location)
except OSError as e:
click.echo(
... | python | def cleanup_virtualenv(bare=True):
"""Removes the virtualenv directory from the system."""
if not bare:
click.echo(crayons.red("Environment creation aborted."))
try:
# Delete the virtualenv.
vistir.path.rmtree(project.virtualenv_location)
except OSError as e:
click.echo(
... | [
"def",
"cleanup_virtualenv",
"(",
"bare",
"=",
"True",
")",
":",
"if",
"not",
"bare",
":",
"click",
".",
"echo",
"(",
"crayons",
".",
"red",
"(",
"\"Environment creation aborted.\"",
")",
")",
"try",
":",
"# Delete the virtualenv.",
"vistir",
".",
"path",
".... | Removes the virtualenv directory from the system. | [
"Removes",
"the",
"virtualenv",
"directory",
"from",
"the",
"system",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L165-L180 |
25,401 | pypa/pipenv | pipenv/core.py | find_a_system_python | def find_a_system_python(line):
"""Find a Python installation from a given line.
This tries to parse the line in various of ways:
* Looks like an absolute path? Use it directly.
* Looks like a py.exe call? Use py.exe to get the executable.
* Starts with "py" something? Looks like a python command.... | python | def find_a_system_python(line):
"""Find a Python installation from a given line.
This tries to parse the line in various of ways:
* Looks like an absolute path? Use it directly.
* Looks like a py.exe call? Use py.exe to get the executable.
* Starts with "py" something? Looks like a python command.... | [
"def",
"find_a_system_python",
"(",
"line",
")",
":",
"from",
".",
"vendor",
".",
"pythonfinder",
"import",
"Finder",
"finder",
"=",
"Finder",
"(",
"system",
"=",
"False",
",",
"global_search",
"=",
"True",
")",
"if",
"not",
"line",
":",
"return",
"next",
... | Find a Python installation from a given line.
This tries to parse the line in various of ways:
* Looks like an absolute path? Use it directly.
* Looks like a py.exe call? Use py.exe to get the executable.
* Starts with "py" something? Looks like a python command. Try to find it
in PATH, and use ... | [
"Find",
"a",
"Python",
"installation",
"from",
"a",
"given",
"line",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L318-L339 |
25,402 | pypa/pipenv | pipenv/core.py | ensure_virtualenv | def ensure_virtualenv(three=None, python=None, site_packages=False, pypi_mirror=None):
"""Creates a virtualenv, if one doesn't exist."""
from .environments import PIPENV_USE_SYSTEM
def abort():
sys.exit(1)
global USING_DEFAULT_PYTHON
if not project.virtualenv_exists:
try:
... | python | def ensure_virtualenv(three=None, python=None, site_packages=False, pypi_mirror=None):
"""Creates a virtualenv, if one doesn't exist."""
from .environments import PIPENV_USE_SYSTEM
def abort():
sys.exit(1)
global USING_DEFAULT_PYTHON
if not project.virtualenv_exists:
try:
... | [
"def",
"ensure_virtualenv",
"(",
"three",
"=",
"None",
",",
"python",
"=",
"None",
",",
"site_packages",
"=",
"False",
",",
"pypi_mirror",
"=",
"None",
")",
":",
"from",
".",
"environments",
"import",
"PIPENV_USE_SYSTEM",
"def",
"abort",
"(",
")",
":",
"sy... | Creates a virtualenv, if one doesn't exist. | [
"Creates",
"a",
"virtualenv",
"if",
"one",
"doesn",
"t",
"exist",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L455-L516 |
25,403 | pypa/pipenv | pipenv/core.py | ensure_project | def ensure_project(
three=None,
python=None,
validate=True,
system=False,
warn=True,
site_packages=False,
deploy=False,
skip_requirements=False,
pypi_mirror=None,
clear=False,
):
"""Ensures both Pipfile and virtualenv exist for the project."""
from .environments import PI... | python | def ensure_project(
three=None,
python=None,
validate=True,
system=False,
warn=True,
site_packages=False,
deploy=False,
skip_requirements=False,
pypi_mirror=None,
clear=False,
):
"""Ensures both Pipfile and virtualenv exist for the project."""
from .environments import PI... | [
"def",
"ensure_project",
"(",
"three",
"=",
"None",
",",
"python",
"=",
"None",
",",
"validate",
"=",
"True",
",",
"system",
"=",
"False",
",",
"warn",
"=",
"True",
",",
"site_packages",
"=",
"False",
",",
"deploy",
"=",
"False",
",",
"skip_requirements"... | Ensures both Pipfile and virtualenv exist for the project. | [
"Ensures",
"both",
"Pipfile",
"and",
"virtualenv",
"exist",
"for",
"the",
"project",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L519-L594 |
25,404 | pypa/pipenv | pipenv/core.py | shorten_path | def shorten_path(location, bold=False):
"""Returns a visually shorter representation of a given system path."""
original = location
short = os.sep.join(
[s[0] if len(s) > (len("2long4")) else s for s in location.split(os.sep)]
)
short = short.split(os.sep)
short[-1] = original.split(os.s... | python | def shorten_path(location, bold=False):
"""Returns a visually shorter representation of a given system path."""
original = location
short = os.sep.join(
[s[0] if len(s) > (len("2long4")) else s for s in location.split(os.sep)]
)
short = short.split(os.sep)
short[-1] = original.split(os.s... | [
"def",
"shorten_path",
"(",
"location",
",",
"bold",
"=",
"False",
")",
":",
"original",
"=",
"location",
"short",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"s",
"[",
"0",
"]",
"if",
"len",
"(",
"s",
")",
">",
"(",
"len",
"(",
"\"2long4\"",
... | Returns a visually shorter representation of a given system path. | [
"Returns",
"a",
"visually",
"shorter",
"representation",
"of",
"a",
"given",
"system",
"path",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L597-L607 |
25,405 | pypa/pipenv | pipenv/core.py | do_where | def do_where(virtualenv=False, bare=True):
"""Executes the where functionality."""
if not virtualenv:
if not project.pipfile_exists:
click.echo(
"No Pipfile present at project home. Consider running "
"{0} first to automatically generate a Pipfile for you."
... | python | def do_where(virtualenv=False, bare=True):
"""Executes the where functionality."""
if not virtualenv:
if not project.pipfile_exists:
click.echo(
"No Pipfile present at project home. Consider running "
"{0} first to automatically generate a Pipfile for you."
... | [
"def",
"do_where",
"(",
"virtualenv",
"=",
"False",
",",
"bare",
"=",
"True",
")",
":",
"if",
"not",
"virtualenv",
":",
"if",
"not",
"project",
".",
"pipfile_exists",
":",
"click",
".",
"echo",
"(",
"\"No Pipfile present at project home. Consider running \"",
"\... | Executes the where functionality. | [
"Executes",
"the",
"where",
"functionality",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L611-L640 |
25,406 | pypa/pipenv | pipenv/core.py | fallback_which | def fallback_which(command, location=None, allow_global=False, system=False):
"""
A fallback implementation of the `which` utility command that relies exclusively on
searching the path for commands.
:param str command: The command to search for, optional
:param str location: The search location to ... | python | def fallback_which(command, location=None, allow_global=False, system=False):
"""
A fallback implementation of the `which` utility command that relies exclusively on
searching the path for commands.
:param str command: The command to search for, optional
:param str location: The search location to ... | [
"def",
"fallback_which",
"(",
"command",
",",
"location",
"=",
"None",
",",
"allow_global",
"=",
"False",
",",
"system",
"=",
"False",
")",
":",
"from",
".",
"vendor",
".",
"pythonfinder",
"import",
"Finder",
"if",
"not",
"command",
":",
"raise",
"ValueErr... | A fallback implementation of the `which` utility command that relies exclusively on
searching the path for commands.
:param str command: The command to search for, optional
:param str location: The search location to prioritize (prepend to path), defaults to None
:param bool allow_global: Whether to se... | [
"A",
"fallback",
"implementation",
"of",
"the",
"which",
"utility",
"command",
"that",
"relies",
"exclusively",
"on",
"searching",
"the",
"path",
"for",
"commands",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L1544-L1575 |
25,407 | pypa/pipenv | pipenv/core.py | which_pip | def which_pip(allow_global=False):
"""Returns the location of virtualenv-installed pip."""
location = None
if "VIRTUAL_ENV" in os.environ:
location = os.environ["VIRTUAL_ENV"]
if allow_global:
if location:
pip = which("pip", location=location)
if pip:
... | python | def which_pip(allow_global=False):
"""Returns the location of virtualenv-installed pip."""
location = None
if "VIRTUAL_ENV" in os.environ:
location = os.environ["VIRTUAL_ENV"]
if allow_global:
if location:
pip = which("pip", location=location)
if pip:
... | [
"def",
"which_pip",
"(",
"allow_global",
"=",
"False",
")",
":",
"location",
"=",
"None",
"if",
"\"VIRTUAL_ENV\"",
"in",
"os",
".",
"environ",
":",
"location",
"=",
"os",
".",
"environ",
"[",
"\"VIRTUAL_ENV\"",
"]",
"if",
"allow_global",
":",
"if",
"locati... | Returns the location of virtualenv-installed pip. | [
"Returns",
"the",
"location",
"of",
"virtualenv",
"-",
"installed",
"pip",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L1578-L1598 |
25,408 | pypa/pipenv | pipenv/core.py | system_which | def system_which(command, mult=False):
"""Emulates the system's which. Returns None if not found."""
_which = "which -a" if not os.name == "nt" else "where"
os.environ = {
vistir.compat.fs_str(k): vistir.compat.fs_str(val)
for k, val in os.environ.items()
}
result = None
try:
... | python | def system_which(command, mult=False):
"""Emulates the system's which. Returns None if not found."""
_which = "which -a" if not os.name == "nt" else "where"
os.environ = {
vistir.compat.fs_str(k): vistir.compat.fs_str(val)
for k, val in os.environ.items()
}
result = None
try:
... | [
"def",
"system_which",
"(",
"command",
",",
"mult",
"=",
"False",
")",
":",
"_which",
"=",
"\"which -a\"",
"if",
"not",
"os",
".",
"name",
"==",
"\"nt\"",
"else",
"\"where\"",
"os",
".",
"environ",
"=",
"{",
"vistir",
".",
"compat",
".",
"fs_str",
"(",... | Emulates the system's which. Returns None if not found. | [
"Emulates",
"the",
"system",
"s",
"which",
".",
"Returns",
"None",
"if",
"not",
"found",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L1601-L1635 |
25,409 | pypa/pipenv | pipenv/core.py | _inline_activate_venv | def _inline_activate_venv():
"""Built-in venv doesn't have activate_this.py, but doesn't need it anyway.
As long as we find the correct executable, built-in venv sets up the
environment automatically.
See: https://bugs.python.org/issue21496#msg218455
"""
components = []
for name in ("bin",... | python | def _inline_activate_venv():
"""Built-in venv doesn't have activate_this.py, but doesn't need it anyway.
As long as we find the correct executable, built-in venv sets up the
environment automatically.
See: https://bugs.python.org/issue21496#msg218455
"""
components = []
for name in ("bin",... | [
"def",
"_inline_activate_venv",
"(",
")",
":",
"components",
"=",
"[",
"]",
"for",
"name",
"in",
"(",
"\"bin\"",
",",
"\"Scripts\"",
")",
":",
"bindir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"project",
".",
"virtualenv_location",
",",
"name",
")",
... | Built-in venv doesn't have activate_this.py, but doesn't need it anyway.
As long as we find the correct executable, built-in venv sets up the
environment automatically.
See: https://bugs.python.org/issue21496#msg218455 | [
"Built",
"-",
"in",
"venv",
"doesn",
"t",
"have",
"activate_this",
".",
"py",
"but",
"doesn",
"t",
"need",
"it",
"anyway",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L2376-L2391 |
25,410 | pypa/pipenv | pipenv/core.py | do_run | def do_run(command, args, three=None, python=False, pypi_mirror=None):
"""Attempt to run command either pulling from project or interpreting as executable.
Args are appended to the command in [scripts] section of project if found.
"""
from .cmdparse import ScriptEmptyError
# Ensure that virtualenv... | python | def do_run(command, args, three=None, python=False, pypi_mirror=None):
"""Attempt to run command either pulling from project or interpreting as executable.
Args are appended to the command in [scripts] section of project if found.
"""
from .cmdparse import ScriptEmptyError
# Ensure that virtualenv... | [
"def",
"do_run",
"(",
"command",
",",
"args",
",",
"three",
"=",
"None",
",",
"python",
"=",
"False",
",",
"pypi_mirror",
"=",
"None",
")",
":",
"from",
".",
"cmdparse",
"import",
"ScriptEmptyError",
"# Ensure that virtualenv is available.",
"ensure_project",
"(... | Attempt to run command either pulling from project or interpreting as executable.
Args are appended to the command in [scripts] section of project if found. | [
"Attempt",
"to",
"run",
"command",
"either",
"pulling",
"from",
"project",
"or",
"interpreting",
"as",
"executable",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/core.py#L2464-L2511 |
25,411 | pypa/pipenv | pipenv/vendor/shellingham/nt.py | _iter_process | def _iter_process():
"""Iterate through processes, yielding process ID and properties of each.
Example usage::
>>> for pid, info in _iter_process():
... print(pid, '->', info)
1509 -> {'parent_pid': 1201, 'executable': 'python.exe'}
"""
# TODO: Process32{First,Next} does no... | python | def _iter_process():
"""Iterate through processes, yielding process ID and properties of each.
Example usage::
>>> for pid, info in _iter_process():
... print(pid, '->', info)
1509 -> {'parent_pid': 1201, 'executable': 'python.exe'}
"""
# TODO: Process32{First,Next} does no... | [
"def",
"_iter_process",
"(",
")",
":",
"# TODO: Process32{First,Next} does not return full executable path, only",
"# the name. To get the full path, Module32{First,Next} is needed, but that",
"# does not contain parent process information. We probably need to call",
"# BOTH to build the correct pro... | Iterate through processes, yielding process ID and properties of each.
Example usage::
>>> for pid, info in _iter_process():
... print(pid, '->', info)
1509 -> {'parent_pid': 1201, 'executable': 'python.exe'} | [
"Iterate",
"through",
"processes",
"yielding",
"process",
"ID",
"and",
"properties",
"of",
"each",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/nt.py#L44-L93 |
25,412 | pypa/pipenv | pipenv/vendor/click/types.py | ParamType.fail | def fail(self, message, param=None, ctx=None):
"""Helper method to fail with an invalid value message."""
raise BadParameter(message, ctx=ctx, param=param) | python | def fail(self, message, param=None, ctx=None):
"""Helper method to fail with an invalid value message."""
raise BadParameter(message, ctx=ctx, param=param) | [
"def",
"fail",
"(",
"self",
",",
"message",
",",
"param",
"=",
"None",
",",
"ctx",
"=",
"None",
")",
":",
"raise",
"BadParameter",
"(",
"message",
",",
"ctx",
"=",
"ctx",
",",
"param",
"=",
"param",
")"
] | Helper method to fail with an invalid value message. | [
"Helper",
"method",
"to",
"fail",
"with",
"an",
"invalid",
"value",
"message",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/types.py#L67-L69 |
25,413 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/encoding.py | auto_decode | def auto_decode(data):
# type: (bytes) -> Text
"""Check a bytes string for a BOM to correctly detect the encoding
Fallback to locale.getpreferredencoding(False) like open() on Python3"""
for bom, encoding in BOMS:
if data.startswith(bom):
return data[len(bom):].decode(encoding)
... | python | def auto_decode(data):
# type: (bytes) -> Text
"""Check a bytes string for a BOM to correctly detect the encoding
Fallback to locale.getpreferredencoding(False) like open() on Python3"""
for bom, encoding in BOMS:
if data.startswith(bom):
return data[len(bom):].decode(encoding)
... | [
"def",
"auto_decode",
"(",
"data",
")",
":",
"# type: (bytes) -> Text",
"for",
"bom",
",",
"encoding",
"in",
"BOMS",
":",
"if",
"data",
".",
"startswith",
"(",
"bom",
")",
":",
"return",
"data",
"[",
"len",
"(",
"bom",
")",
":",
"]",
".",
"decode",
"... | Check a bytes string for a BOM to correctly detect the encoding
Fallback to locale.getpreferredencoding(False) like open() on Python3 | [
"Check",
"a",
"bytes",
"string",
"for",
"a",
"BOM",
"to",
"correctly",
"detect",
"the",
"encoding"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/encoding.py#L24-L39 |
25,414 | pypa/pipenv | pipenv/vendor/click/globals.py | resolve_color_default | def resolve_color_default(color=None):
""""Internal helper to get the default value of the color flag. If a
value is passed it's returned unchanged, otherwise it's looked up from
the current context.
"""
if color is not None:
return color
ctx = get_current_context(silent=True)
if ct... | python | def resolve_color_default(color=None):
""""Internal helper to get the default value of the color flag. If a
value is passed it's returned unchanged, otherwise it's looked up from
the current context.
"""
if color is not None:
return color
ctx = get_current_context(silent=True)
if ct... | [
"def",
"resolve_color_default",
"(",
"color",
"=",
"None",
")",
":",
"if",
"color",
"is",
"not",
"None",
":",
"return",
"color",
"ctx",
"=",
"get_current_context",
"(",
"silent",
"=",
"True",
")",
"if",
"ctx",
"is",
"not",
"None",
":",
"return",
"ctx",
... | Internal helper to get the default value of the color flag. If a
value is passed it's returned unchanged, otherwise it's looked up from
the current context. | [
"Internal",
"helper",
"to",
"get",
"the",
"default",
"value",
"of",
"the",
"color",
"flag",
".",
"If",
"a",
"value",
"is",
"passed",
"it",
"s",
"returned",
"unchanged",
"otherwise",
"it",
"s",
"looked",
"up",
"from",
"the",
"current",
"context",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/globals.py#L39-L48 |
25,415 | pypa/pipenv | pipenv/vendor/toml/decoder.py | load | def load(f, _dict=dict, decoder=None):
"""Parses named file or files as toml and returns a dictionary
Args:
f: Path to the file to open, array of files to read into single dict
or a file descriptor
_dict: (optional) Specifies the class of the returned toml dictionary
Returns:
... | python | def load(f, _dict=dict, decoder=None):
"""Parses named file or files as toml and returns a dictionary
Args:
f: Path to the file to open, array of files to read into single dict
or a file descriptor
_dict: (optional) Specifies the class of the returned toml dictionary
Returns:
... | [
"def",
"load",
"(",
"f",
",",
"_dict",
"=",
"dict",
",",
"decoder",
"=",
"None",
")",
":",
"if",
"_ispath",
"(",
"f",
")",
":",
"with",
"io",
".",
"open",
"(",
"_getpath",
"(",
"f",
")",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"ffile",
":",... | Parses named file or files as toml and returns a dictionary
Args:
f: Path to the file to open, array of files to read into single dict
or a file descriptor
_dict: (optional) Specifies the class of the returned toml dictionary
Returns:
Parsed toml file represented as a dictio... | [
"Parses",
"named",
"file",
"or",
"files",
"as",
"toml",
"and",
"returns",
"a",
"dictionary"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/toml/decoder.py#L92-L137 |
25,416 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | markup_join | def markup_join(seq):
"""Concatenation that escapes if necessary and converts to unicode."""
buf = []
iterator = imap(soft_unicode, seq)
for arg in iterator:
buf.append(arg)
if hasattr(arg, '__html__'):
return Markup(u'').join(chain(buf, iterator))
return concat(buf) | python | def markup_join(seq):
"""Concatenation that escapes if necessary and converts to unicode."""
buf = []
iterator = imap(soft_unicode, seq)
for arg in iterator:
buf.append(arg)
if hasattr(arg, '__html__'):
return Markup(u'').join(chain(buf, iterator))
return concat(buf) | [
"def",
"markup_join",
"(",
"seq",
")",
":",
"buf",
"=",
"[",
"]",
"iterator",
"=",
"imap",
"(",
"soft_unicode",
",",
"seq",
")",
"for",
"arg",
"in",
"iterator",
":",
"buf",
".",
"append",
"(",
"arg",
")",
"if",
"hasattr",
"(",
"arg",
",",
"'__html_... | Concatenation that escapes if necessary and converts to unicode. | [
"Concatenation",
"that",
"escapes",
"if",
"necessary",
"and",
"converts",
"to",
"unicode",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L43-L51 |
25,417 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | new_context | def new_context(environment, template_name, blocks, vars=None,
shared=None, globals=None, locals=None):
"""Internal helper to for context creation."""
if vars is None:
vars = {}
if shared:
parent = vars
else:
parent = dict(globals or (), **vars)
if locals:
... | python | def new_context(environment, template_name, blocks, vars=None,
shared=None, globals=None, locals=None):
"""Internal helper to for context creation."""
if vars is None:
vars = {}
if shared:
parent = vars
else:
parent = dict(globals or (), **vars)
if locals:
... | [
"def",
"new_context",
"(",
"environment",
",",
"template_name",
",",
"blocks",
",",
"vars",
"=",
"None",
",",
"shared",
"=",
"None",
",",
"globals",
"=",
"None",
",",
"locals",
"=",
"None",
")",
":",
"if",
"vars",
"is",
"None",
":",
"vars",
"=",
"{",... | Internal helper to for context creation. | [
"Internal",
"helper",
"to",
"for",
"context",
"creation",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L59-L77 |
25,418 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | make_logging_undefined | def make_logging_undefined(logger=None, base=None):
"""Given a logger object this returns a new undefined class that will
log certain failures. It will log iterations and printing. If no
logger is given a default logger is created.
Example::
logger = logging.getLogger(__name__)
Loggi... | python | def make_logging_undefined(logger=None, base=None):
"""Given a logger object this returns a new undefined class that will
log certain failures. It will log iterations and printing. If no
logger is given a default logger is created.
Example::
logger = logging.getLogger(__name__)
Loggi... | [
"def",
"make_logging_undefined",
"(",
"logger",
"=",
"None",
",",
"base",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"None",
":",
"import",
"logging",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"addHandler",
"(",
"... | Given a logger object this returns a new undefined class that will
log certain failures. It will log iterations and printing. If no
logger is given a default logger is created.
Example::
logger = logging.getLogger(__name__)
LoggingUndefined = make_logging_undefined(
logger=lo... | [
"Given",
"a",
"logger",
"object",
"this",
"returns",
"a",
"new",
"undefined",
"class",
"that",
"will",
"log",
"certain",
"failures",
".",
"It",
"will",
"log",
"iterations",
"and",
"printing",
".",
"If",
"no",
"logger",
"is",
"given",
"a",
"default",
"logge... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L677-L755 |
25,419 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | Context.super | def super(self, name, current):
"""Render a parent block."""
try:
blocks = self.blocks[name]
index = blocks.index(current) + 1
blocks[index]
except LookupError:
return self.environment.undefined('there is no parent block '
... | python | def super(self, name, current):
"""Render a parent block."""
try:
blocks = self.blocks[name]
index = blocks.index(current) + 1
blocks[index]
except LookupError:
return self.environment.undefined('there is no parent block '
... | [
"def",
"super",
"(",
"self",
",",
"name",
",",
"current",
")",
":",
"try",
":",
"blocks",
"=",
"self",
".",
"blocks",
"[",
"name",
"]",
"index",
"=",
"blocks",
".",
"index",
"(",
"current",
")",
"+",
"1",
"blocks",
"[",
"index",
"]",
"except",
"L... | Render a parent block. | [
"Render",
"a",
"parent",
"block",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L175-L185 |
25,420 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | Context.get_exported | def get_exported(self):
"""Get a new dict with the exported variables."""
return dict((k, self.vars[k]) for k in self.exported_vars) | python | def get_exported(self):
"""Get a new dict with the exported variables."""
return dict((k, self.vars[k]) for k in self.exported_vars) | [
"def",
"get_exported",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"(",
"k",
",",
"self",
".",
"vars",
"[",
"k",
"]",
")",
"for",
"k",
"in",
"self",
".",
"exported_vars",
")"
] | Get a new dict with the exported variables. | [
"Get",
"a",
"new",
"dict",
"with",
"the",
"exported",
"variables",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L219-L221 |
25,421 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | Context.get_all | def get_all(self):
"""Return the complete context as dict including the exported
variables. For optimizations reasons this might not return an
actual copy so be careful with using it.
"""
if not self.vars:
return self.parent
if not self.parent:
re... | python | def get_all(self):
"""Return the complete context as dict including the exported
variables. For optimizations reasons this might not return an
actual copy so be careful with using it.
"""
if not self.vars:
return self.parent
if not self.parent:
re... | [
"def",
"get_all",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"vars",
":",
"return",
"self",
".",
"parent",
"if",
"not",
"self",
".",
"parent",
":",
"return",
"self",
".",
"vars",
"return",
"dict",
"(",
"self",
".",
"parent",
",",
"*",
"*",
... | Return the complete context as dict including the exported
variables. For optimizations reasons this might not return an
actual copy so be careful with using it. | [
"Return",
"the",
"complete",
"context",
"as",
"dict",
"including",
"the",
"exported",
"variables",
".",
"For",
"optimizations",
"reasons",
"this",
"might",
"not",
"return",
"an",
"actual",
"copy",
"so",
"be",
"careful",
"with",
"using",
"it",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L223-L232 |
25,422 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | Context.derived | def derived(self, locals=None):
"""Internal helper function to create a derived context. This is
used in situations where the system needs a new context in the same
template that is independent.
"""
context = new_context(self.environment, self.name, {},
... | python | def derived(self, locals=None):
"""Internal helper function to create a derived context. This is
used in situations where the system needs a new context in the same
template that is independent.
"""
context = new_context(self.environment, self.name, {},
... | [
"def",
"derived",
"(",
"self",
",",
"locals",
"=",
"None",
")",
":",
"context",
"=",
"new_context",
"(",
"self",
".",
"environment",
",",
"self",
".",
"name",
",",
"{",
"}",
",",
"self",
".",
"get_all",
"(",
")",
",",
"True",
",",
"None",
",",
"l... | Internal helper function to create a derived context. This is
used in situations where the system needs a new context in the same
template that is independent. | [
"Internal",
"helper",
"function",
"to",
"create",
"a",
"derived",
"context",
".",
"This",
"is",
"used",
"in",
"situations",
"where",
"the",
"system",
"needs",
"a",
"new",
"context",
"in",
"the",
"same",
"template",
"that",
"is",
"independent",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L268-L277 |
25,423 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | BlockReference.super | def super(self):
"""Super the block."""
if self._depth + 1 >= len(self._stack):
return self._context.environment. \
undefined('there is no parent block called %r.' %
self.name, name='super')
return BlockReference(self.name, self._context, sel... | python | def super(self):
"""Super the block."""
if self._depth + 1 >= len(self._stack):
return self._context.environment. \
undefined('there is no parent block called %r.' %
self.name, name='super')
return BlockReference(self.name, self._context, sel... | [
"def",
"super",
"(",
"self",
")",
":",
"if",
"self",
".",
"_depth",
"+",
"1",
">=",
"len",
"(",
"self",
".",
"_stack",
")",
":",
"return",
"self",
".",
"_context",
".",
"environment",
".",
"undefined",
"(",
"'there is no parent block called %r.'",
"%",
"... | Super the block. | [
"Super",
"the",
"block",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L334-L341 |
25,424 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | LoopContextBase.cycle | def cycle(self, *args):
"""Cycles among the arguments with the current loop index."""
if not args:
raise TypeError('no items for cycling given')
return args[self.index0 % len(args)] | python | def cycle(self, *args):
"""Cycles among the arguments with the current loop index."""
if not args:
raise TypeError('no items for cycling given')
return args[self.index0 % len(args)] | [
"def",
"cycle",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"args",
":",
"raise",
"TypeError",
"(",
"'no items for cycling given'",
")",
"return",
"args",
"[",
"self",
".",
"index0",
"%",
"len",
"(",
"args",
")",
"]"
] | Cycles among the arguments with the current loop index. | [
"Cycles",
"among",
"the",
"arguments",
"with",
"the",
"current",
"loop",
"index",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L366-L370 |
25,425 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | LoopContextBase.changed | def changed(self, *value):
"""Checks whether the value has changed since the last call."""
if self._last_checked_value != value:
self._last_checked_value = value
return True
return False | python | def changed(self, *value):
"""Checks whether the value has changed since the last call."""
if self._last_checked_value != value:
self._last_checked_value = value
return True
return False | [
"def",
"changed",
"(",
"self",
",",
"*",
"value",
")",
":",
"if",
"self",
".",
"_last_checked_value",
"!=",
"value",
":",
"self",
".",
"_last_checked_value",
"=",
"value",
"return",
"True",
"return",
"False"
] | Checks whether the value has changed since the last call. | [
"Checks",
"whether",
"the",
"value",
"has",
"changed",
"since",
"the",
"last",
"call",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L372-L377 |
25,426 | pypa/pipenv | pipenv/vendor/jinja2/runtime.py | Macro._invoke | def _invoke(self, arguments, autoescape):
"""This method is being swapped out by the async implementation."""
rv = self._func(*arguments)
if autoescape:
rv = Markup(rv)
return rv | python | def _invoke(self, arguments, autoescape):
"""This method is being swapped out by the async implementation."""
rv = self._func(*arguments)
if autoescape:
rv = Markup(rv)
return rv | [
"def",
"_invoke",
"(",
"self",
",",
"arguments",
",",
"autoescape",
")",
":",
"rv",
"=",
"self",
".",
"_func",
"(",
"*",
"arguments",
")",
"if",
"autoescape",
":",
"rv",
"=",
"Markup",
"(",
"rv",
")",
"return",
"rv"
] | This method is being swapped out by the async implementation. | [
"This",
"method",
"is",
"being",
"swapped",
"out",
"by",
"the",
"async",
"implementation",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/runtime.py#L577-L582 |
25,427 | pypa/pipenv | pipenv/vendor/pexpect/FSM.py | FSM.add_transition_list | def add_transition_list (self, list_input_symbols, state, action=None, next_state=None):
'''This adds the same transition for a list of input symbols.
You can pass a list or a string. Note that it is handy to use
string.digits, string.whitespace, string.letters, etc. to add
transitions ... | python | def add_transition_list (self, list_input_symbols, state, action=None, next_state=None):
'''This adds the same transition for a list of input symbols.
You can pass a list or a string. Note that it is handy to use
string.digits, string.whitespace, string.letters, etc. to add
transitions ... | [
"def",
"add_transition_list",
"(",
"self",
",",
"list_input_symbols",
",",
"state",
",",
"action",
"=",
"None",
",",
"next_state",
"=",
"None",
")",
":",
"if",
"next_state",
"is",
"None",
":",
"next_state",
"=",
"state",
"for",
"input_symbol",
"in",
"list_in... | This adds the same transition for a list of input symbols.
You can pass a list or a string. Note that it is handy to use
string.digits, string.whitespace, string.letters, etc. to add
transitions that match character classes.
The action may be set to None in which case the process() meth... | [
"This",
"adds",
"the",
"same",
"transition",
"for",
"a",
"list",
"of",
"input",
"symbols",
".",
"You",
"can",
"pass",
"a",
"list",
"or",
"a",
"string",
".",
"Note",
"that",
"it",
"is",
"handy",
"to",
"use",
"string",
".",
"digits",
"string",
".",
"wh... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/FSM.py#L148-L162 |
25,428 | pypa/pipenv | pipenv/patched/notpip/_vendor/ipaddress.py | IPv4Network.is_global | def is_global(self):
"""Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
iana-ipv4-special-registry.
"""
return (not (self.network_address in IPv4Network('100.64.0.0/10') and
self.... | python | def is_global(self):
"""Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
iana-ipv4-special-registry.
"""
return (not (self.network_address in IPv4Network('100.64.0.0/10') and
self.... | [
"def",
"is_global",
"(",
"self",
")",
":",
"return",
"(",
"not",
"(",
"self",
".",
"network_address",
"in",
"IPv4Network",
"(",
"'100.64.0.0/10'",
")",
"and",
"self",
".",
"broadcast_address",
"in",
"IPv4Network",
"(",
"'100.64.0.0/10'",
")",
")",
"and",
"no... | Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
iana-ipv4-special-registry. | [
"Test",
"if",
"this",
"address",
"is",
"allocated",
"for",
"public",
"networks",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/ipaddress.py#L1663-L1673 |
25,429 | pypa/pipenv | pipenv/patched/notpip/_vendor/ipaddress.py | IPv6Address.teredo | def teredo(self):
"""Tuple of embedded teredo IPs.
Returns:
Tuple of the (server, client) IPs or None if the address
doesn't appear to be a teredo address (doesn't start with
2001::/32)
"""
if (self._ip >> 96) != 0x20010000:
return None
... | python | def teredo(self):
"""Tuple of embedded teredo IPs.
Returns:
Tuple of the (server, client) IPs or None if the address
doesn't appear to be a teredo address (doesn't start with
2001::/32)
"""
if (self._ip >> 96) != 0x20010000:
return None
... | [
"def",
"teredo",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_ip",
">>",
"96",
")",
"!=",
"0x20010000",
":",
"return",
"None",
"return",
"(",
"IPv4Address",
"(",
"(",
"self",
".",
"_ip",
">>",
"64",
")",
"&",
"0xFFFFFFFF",
")",
",",
"IPv4Addres... | Tuple of embedded teredo IPs.
Returns:
Tuple of the (server, client) IPs or None if the address
doesn't appear to be a teredo address (doesn't start with
2001::/32) | [
"Tuple",
"of",
"embedded",
"teredo",
"IPs",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/ipaddress.py#L2148-L2160 |
25,430 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/serializer.py | serialize | 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... | python | 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",
")",
":",
"# XXX: Should we cache this?",
"walker",
"=",
"treewalkers",
".",
"getTreeWalker",
"(",
"tree",
")",
"s",
"=",
"HTMLSe... | 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
... | [
"Serializes",
"the",
"input",
"token",
"stream",
"using",
"the",
"specified",
"treewalker"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/serializer.py#L75-L101 |
25,431 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/serializer.py | HTMLSerializer.render | 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... | python | 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",
")",
":",
"if",
"encoding",
":",
"return",
"b\"\"",
".",
"join",
"(",
"list",
"(",
"self",
".",
"serialize",
"(",
"treewalker",
",",
"encoding",
")",
")",
")",
"else",
":"... | 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... | [
"Serializes",
"the",
"stream",
"from",
"the",
"treewalker",
"into",
"a",
"string"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/serializer.py#L375-L398 |
25,432 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/git.py | Git.resolve_revision | 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... | python | 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",
")",
":",
"rev",
"=",
"rev_options",
".",
"arg_rev",
"sha",
",",
"is_branch",
"=",
"self",
".",
"get_revision_sha",
"(",
"dest",
",",
"rev",
")",
"if",
"sha",
"is",
"n... | 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. | [
"Resolve",
"a",
"revision",
"to",
"a",
"new",
"RevOptions",
"object",
"with",
"the",
"SHA1",
"of",
"the",
"branch",
"tag",
"or",
"ref",
"if",
"found",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L148-L185 |
25,433 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/git.py | Git.is_commit_id_equal | 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... | python | 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",
")",
":",
"if",
"not",
"name",
":",
"# Then avoid an unnecessary subprocess call.",
"return",
"False",
"return",
"self",
".",
"get_revision",
"(",
"dest",
")",
"==",
"name"
] | Return whether the current commit hash equals the given name.
Args:
dest: the repository directory.
name: a string name. | [
"Return",
"whether",
"the",
"current",
"commit",
"hash",
"equals",
"the",
"given",
"name",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L187-L199 |
25,434 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/git.py | Git.get_remote_url | 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... | python | 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",
")",
":",
"# 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'",... | Return URL of the first remote encountered.
Raises RemoteNotFoundError if the repository does not have a remote
url configured. | [
"Return",
"URL",
"of",
"the",
"first",
"remote",
"encountered",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L253-L277 |
25,435 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/git.py | Git._get_subdirectory | 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):
... | python | 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",
")",
":",
"# find the repo root",
"git_dir",
"=",
"cls",
".",
"run_command",
"(",
"[",
"'rev-parse'",
",",
"'--git-dir'",
"]",
",",
"show_stdout",
"=",
"False",
",",
"cwd",
"=",
"location",
")",
".",
... | Return the relative path of setup.py to the git repo root. | [
"Return",
"the",
"relative",
"path",
"of",
"setup",
".",
"py",
"to",
"the",
"git",
"repo",
"root",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/git.py#L289-L314 |
25,436 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration.get_value | 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)) | python | 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",
"try",
":",
"return",
"self",
".",
"_dictionary",
"[",
"key",
"]",
"except",
"KeyError",
":",
"raise",
"ConfigurationError",
"(",
"\"No such key - {}\"",
".",
"format",
"(",
"key",
... | Get a value from the configuration. | [
"Get",
"a",
"value",
"from",
"the",
"configuration",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L139-L146 |
25,437 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration.set_value | 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... | python | 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",
"self",
".",
"_ensure_have_load_only",
"(",
")",
"fname",
",",
"parser",
"=",
"self",
".",
"_get_parser_to_modify",
"(",
")",
"if",
"parser",
"is",
"not",
"Non... | Modify a value in the configuration. | [
"Modify",
"a",
"value",
"in",
"the",
"configuration",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L148-L165 |
25,438 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration.unset_value | 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... | python | 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",
"self",
".",
"_ensure_have_load_only",
"(",
")",
"if",
"key",
"not",
"in",
"self",
".",
"_config",
"[",
"self",
".",
"load_only",
"]",
":",
"raise",
"ConfigurationError",
"(",
... | Unset a value in the configuration. | [
"Unset",
"a",
"value",
"in",
"the",
"configuration",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L167-L204 |
25,439 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration.save | 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... | python | 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",
"self",
".",
"_ensure_have_load_only",
"(",
")",
"for",
"fname",
",",
"parser",
"in",
"self",
".",
"_modified_parsers",
":",
"logger",
".",
"info",
"(",
"\"Writing to %s\"",
",",
"fname",
")",
"# En... | Save the currentin-memory state. | [
"Save",
"the",
"currentin",
"-",
"memory",
"state",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L206-L219 |
25,440 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration._dictionary | 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:
... | python | 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]",
"# NOTE: Dictionaries are not populated if not loaded. So, conditionals",
"# are not needed here.",
"retval",
"=",
"{",
"}",
"for",
"variant",
"in",
"self",
".",
"_override_order",
":",
"retval... | A dictionary representing the loaded configuration. | [
"A",
"dictionary",
"representing",
"the",
"loaded",
"configuration",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L232-L243 |
25,441 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration._load_config_files | 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... | python | 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",
"config_files",
"=",
"dict",
"(",
"self",
".",
"_iter_config_files",
"(",
")",
")",
"if",
"config_files",
"[",
"kinds",
".",
"ENV",
"]",
"[",
"0",
":",
"1",
"]",
"==",
"[",
"os",
... | Loads configuration from configuration files | [
"Loads",
"configuration",
"from",
"configuration",
"files"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L245-L270 |
25,442 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration._load_environment_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())
) | python | 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",
"self",
".",
"_config",
"[",
"kinds",
".",
"ENV_VAR",
"]",
".",
"update",
"(",
"self",
".",
"_normalized_keys",
"(",
"\":env:\"",
",",
"self",
".",
"_get_environ_vars",
"(",
")",
"... | Loads configuration from environment variables | [
"Loads",
"configuration",
"from",
"environment",
"variables"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L306-L312 |
25,443 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration._normalized_keys | 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... | python | 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]",
"normalized",
"=",
"{",
"}",
"for",
"name",
",",
"val",
"in",
"items",
":",
"key",
"=",
"section",
"+",
"\".\"",
"+",
... | 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. | [
"Normalizes",
"items",
"to",
"construct",
"a",
"dictionary",
"with",
"normalized",
"keys",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L314-L325 |
25,444 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration._get_environ_vars | 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... | python | 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]]",
"for",
"key",
",",
"val",
"in",
"os",
".",
"environ",
".",
"items",
"(",
")",
":",
"should_be_yielded",
"=",
"(",
"key",
".",
"startswith",
"(",
"\"PIP_\"",
")",
"a... | Returns a generator with all environmental vars with prefix PIP_ | [
"Returns",
"a",
"generator",
"with",
"all",
"environmental",
"vars",
"with",
"prefix",
"PIP_"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L327-L336 |
25,445 | pypa/pipenv | pipenv/patched/notpip/_internal/configuration.py | Configuration._iter_config_files | 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... | python | 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]]]",
"# SMELL: Move the conditions out of this function",
"# environment variables have the lowest priority",
"config_file",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'PIP_CONFIG_FIL... | Yields variant and configuration files associated with it.
This should be treated like items of a dictionary. | [
"Yields",
"variant",
"and",
"configuration",
"files",
"associated",
"with",
"it",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/configuration.py#L339-L367 |
25,446 | pypa/pipenv | pipenv/patched/notpip/_internal/commands/configuration.py | ConfigurationCommand._get_n_args | 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... | python | 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",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"n",
":",
"msg",
"=",
"(",
"'Got unexpected number of arguments, expected {}. '",
"'(example: \"{} config {}\")'",
")",
".",
"format",
"(",... | Helper to make sure the command got the right number of arguments | [
"Helper",
"to",
"make",
"sure",
"the",
"command",
"got",
"the",
"right",
"number",
"of",
"arguments"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/configuration.py#L192-L205 |
25,447 | pypa/pipenv | pipenv/vendor/vistir/path.py | normalize_path | 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(
... | python | 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",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"normcase",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expandvars",
"(",
... | 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",
"a",
"case",
"-",
"normalized",
"absolute",
"variable",
"-",
"expanded",
"path",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L97-L111 |
25,448 | pypa/pipenv | pipenv/vendor/vistir/path.py | path_to_url | 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... | python | 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",
"from",
".",
"misc",
"import",
"to_text",
",",
"to_bytes",
"if",
"not",
"path",
":",
"return",
"path",
"path",
"=",
"to_bytes",
"(",
"path",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"norm... | 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' | [
"Convert",
"the",
"supplied",
"local",
"path",
"to",
"a",
"file",
"uri",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L149-L166 |
25,449 | pypa/pipenv | pipenv/vendor/vistir/path.py | url_to_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, _, _ =... | python | 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",
"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
Follows logic taken from pip's equivalent function | [
"Convert",
"a",
"valid",
"file",
"url",
"to",
"a",
"local",
"filesystem",
"path"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L169-L185 |
25,450 | pypa/pipenv | pipenv/vendor/vistir/path.py | is_file_url | 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... | python | 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",
")",
":",
"from",
".",
"misc",
"import",
"to_text",
"if",
"not",
"url",
":",
"return",
"False",
"if",
"not",
"isinstance",
"(",
"url",
",",
"six",
".",
"string_types",
")",
":",
"try",
":",
"url",
"=",
"getattr",
"("... | Returns true if the given url is a file url | [
"Returns",
"true",
"if",
"the",
"given",
"url",
"is",
"a",
"file",
"url"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L198-L210 |
25,451 | pypa/pipenv | pipenv/vendor/vistir/path.py | mkdir_p | 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... | python | 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",
")",
":",
"# http://code.activestate.com/recipes/82465-a-friendly-mkdir/",
"newdir",
"=",
"fs_encode",
"(",
"newdir",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"newdir",
")",
":",
"if",
"not",... | 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 | [
"Recursively",
"creates",
"the",
"target",
"directory",
"and",
"all",
"of",
"its",
"parents",
"if",
"they",
"do",
"not",
"already",
"exist",
".",
"Fails",
"silently",
"if",
"they",
"do",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L226-L258 |
25,452 | pypa/pipenv | pipenv/vendor/vistir/path.py | ensure_mkdir_p | 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... | python | 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",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"decorated",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"f",
"(",
... | Decorator to ensure `mkdir_p` is called to the function's return value. | [
"Decorator",
"to",
"ensure",
"mkdir_p",
"is",
"called",
"to",
"the",
"function",
"s",
"return",
"value",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L261-L274 |
25,453 | pypa/pipenv | pipenv/vendor/vistir/path.py | create_tracked_tempdir | 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... | python | 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",
")",
":",
"tempdir",
"=",
"TemporaryDirectory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"TRACKED_TEMPORARY_DIRECTORIES",
".",
"append",
"(",
"tempdir",
")",
"atexit",
".",
... | 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. | [
"Create",
"a",
"tracked",
"temporary",
"directory",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L280-L294 |
25,454 | pypa/pipenv | pipenv/vendor/vistir/path.py | _wait_for_files | 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:
... | python | 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",
")",
":",
"timeout",
"=",
"0.001",
"remaining",
"=",
"[",
"]",
"while",
"timeout",
"<",
"1.0",
":",
"remaining",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"L",
"=",
"os",
"... | 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]] | [
"Retry",
"with",
"backoff",
"up",
"to",
"1",
"second",
"to",
"delete",
"files",
"from",
"a",
"directory",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L367-L397 |
25,455 | pypa/pipenv | pipenv/vendor/vistir/path.py | check_for_unc_path | 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 | python | 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",
")",
":",
"if",
"(",
"os",
".",
"name",
"==",
"\"nt\"",
"and",
"len",
"(",
"path",
".",
"drive",
")",
">",
"2",
"and",
"not",
"path",
".",
"drive",
"[",
"0",
"]",
".",
"isalpha",
"(",
")",
"and",
"path",
... | Checks to see if a pathlib `Path` object is a unc path or not | [
"Checks",
"to",
"see",
"if",
"a",
"pathlib",
"Path",
"object",
"is",
"a",
"unc",
"path",
"or",
"not"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L486-L496 |
25,456 | pypa/pipenv | pipenv/vendor/vistir/path.py | get_converted_relative_path | 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: ... | python | 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",
")",
":",
"from",
".",
"misc",
"import",
"to_text",
",",
"to_bytes",
"# noqa",
"if",
"not",
"relative_to",
":",
"relative_to",
"=",
"os",
".",
"getcwdu",
"(",
")",
"if",
"s... | 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... | [
"Convert",
"path",
"to",
"be",
"relative",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L499-L551 |
25,457 | pypa/pipenv | pipenv/vendor/urllib3/util/response.py | is_fp_closed | 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:
... | python | 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",
")",
":",
"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... | Checks whether a given file-like object is closed.
:param obj:
The file-like object to check. | [
"Checks",
"whether",
"a",
"given",
"file",
"-",
"like",
"object",
"is",
"closed",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/response.py#L7-L35 |
25,458 | pypa/pipenv | pipenv/vendor/urllib3/util/response.py | is_response_to_head | 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... | python | 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",
")",
":",
"# FIXME: Can we do this somehow without accessing private httplib _method?",
"method",
"=",
"response",
".",
"_method",
"if",
"isinstance",
"(",
"method",
",",
"int",
")",
":",
"# Platform-specific: Appengine",
"retu... | Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine.
:param conn:
:type conn: :class:`httplib.HTTPResponse` | [
"Checks",
"whether",
"the",
"request",
"of",
"a",
"response",
"has",
"been",
"a",
"HEAD",
"-",
"request",
".",
"Handles",
"the",
"quirks",
"of",
"AppEngine",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/response.py#L75-L87 |
25,459 | pypa/pipenv | pipenv/vendor/pexpect/pxssh.py | pxssh.levenshtein_distance | 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]... | python | 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",
")",
":",
"n",
",",
"m",
"=",
"len",
"(",
"a",
")",
",",
"len",
"(",
"b",
")",
"if",
"n",
">",
"m",
":",
"a",
",",
"b",
"=",
"b",
",",
"a",
"n",
",",
"m",
"=",
"m",
",",
... | This calculates the Levenshtein distance between a and b. | [
"This",
"calculates",
"the",
"Levenshtein",
"distance",
"between",
"a",
"and",
"b",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L164-L181 |
25,460 | pypa/pipenv | pipenv/vendor/pexpect/pxssh.py | pxssh.logout | 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... | python | 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",
")",
":",
"self",
".",
"sendline",
"(",
"\"exit\"",
")",
"index",
"=",
"self",
".",
"expect",
"(",
"[",
"EOF",
",",
"\"(?i)there are stopped jobs\"",
"]",
")",
"if",
"index",
"==",
"1",
":",
"self",
".",
"sendline",
"(",
... | Sends exit to the remote shell.
If there are stopped jobs then this automatically sends exit twice. | [
"Sends",
"exit",
"to",
"the",
"remote",
"shell",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L437-L447 |
25,461 | pypa/pipenv | pipenv/vendor/pexpect/pxssh.py | pxssh.prompt | 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... | python | 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",
")",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self",
".",
"timeout",
"i",
"=",
"self",
".",
"expect",
"(",
"[",
"self",
".",
"PROMPT",
",",
"TIMEOUT",
"]",
",",
"ti... | 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... | [
"Match",
"the",
"next",
"shell",
"prompt",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/pxssh.py#L449-L471 |
25,462 | pypa/pipenv | pipenv/patched/notpip/_internal/download.py | user_agent | 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(),
},
... | python | 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",
"(",
")",
":",
"data",
"=",
"{",
"\"installer\"",
":",
"{",
"\"name\"",
":",
"\"pip\"",
",",
"\"version\"",
":",
"pipenv",
".",
"patched",
".",
"notpip",
".",
"__version__",
"}",
",",
"\"python\"",
":",
"platform",
".",
"python_version... | Return a string representing the user agent. | [
"Return",
"a",
"string",
"representing",
"the",
"user",
"agent",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L75-L141 |
25,463 | pypa/pipenv | pipenv/patched/notpip/_internal/download.py | is_archive_file | 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 | python | 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",
"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. | [
"Return",
"True",
"if",
"name",
"is",
"a",
"considered",
"as",
"an",
"archive",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L495-L501 |
25,464 | pypa/pipenv | pipenv/patched/notpip/_internal/download.py | unpack_file_url | 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... | python | 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",
"link_path",
"=",
"url_to_path",
... | 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. | [
"Unpack",
"link",
"into",
"location",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L716-L767 |
25,465 | pypa/pipenv | pipenv/patched/notpip/_internal/download.py | _copy_dist_from_dir | 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 ... | python | 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",
")",
":",
"# 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... | 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 | [
"Copy",
"distribution",
"files",
"in",
"link_path",
"to",
"location",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L770-L803 |
25,466 | pypa/pipenv | pipenv/patched/notpip/_internal/download.py | _check_download_dir | 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... | python | 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]",
"download_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"download_dir",
",",
"link",
".",
"filename",
")",
"if",
"os",
"."... | Check download_dir for previously downloaded file with correct hash
If a correct file is found return its path else None | [
"Check",
"download_dir",
"for",
"previously",
"downloaded",
"file",
"with",
"correct",
"hash",
"If",
"a",
"correct",
"file",
"is",
"found",
"return",
"its",
"path",
"else",
"None"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L950-L971 |
25,467 | pypa/pipenv | pipenv/vendor/urllib3/poolmanager.py | _default_key_normalizer | 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... | python | 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",
")",
":",
"# Since we mutate the dictionary, make a copy first",
"context",
"=",
"request_context",
".",
"copy",
"(",
")",
"context",
"[",
"'scheme'",
"]",
"=",
"context",
"[",
"'scheme'",
"]"... | 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... | [
"Create",
"a",
"pool",
"key",
"out",
"of",
"a",
"request",
"context",
"dictionary",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L58-L104 |
25,468 | pypa/pipenv | pipenv/vendor/urllib3/poolmanager.py | PoolManager._merge_pool_kwargs | 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... | python | 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",
")",
":",
"base_pool_kwargs",
"=",
"self",
".",
"connection_pool_kw",
".",
"copy",
"(",
")",
"if",
"override",
":",
"for",
"key",
",",
"value",
"in",
"override",
".",
"items",
"(",
")",
":",
"if"... | 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",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/poolmanager.py#L282-L300 |
25,469 | pypa/pipenv | pipenv/vendor/jinja2/meta.py | find_undeclared_variables | 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... | python | 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",
")",
":",
"codegen",
"=",
"TrackingCodeGenerator",
"(",
"ast",
".",
"environment",
")",
"codegen",
".",
"visit",
"(",
"ast",
")",
"return",
"codegen",
".",
"undeclared_identifiers"
] | 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... | [
"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",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/meta.py#L36-L57 |
25,470 | pypa/pipenv | pipenv/vendor/jinja2/meta.py | find_referenced_templates | 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
... | python | 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",
")",
":",
"for",
"node",
"in",
"ast",
".",
"find_all",
"(",
"(",
"nodes",
".",
"Extends",
",",
"nodes",
".",
"FromImport",
",",
"nodes",
".",
"Import",
",",
"nodes",
".",
"Include",
")",
")",
":",
"if",
... | 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... | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/meta.py#L60-L106 |
25,471 | pypa/pipenv | pipenv/vendor/jinja2/meta.py | TrackingCodeGenerator.enter_frame | 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) | python | 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",
")",
":",
"CodeGenerator",
".",
"enter_frame",
"(",
"self",
",",
"frame",
")",
"for",
"_",
",",
"(",
"action",
",",
"param",
")",
"in",
"iteritems",
"(",
"frame",
".",
"symbols",
".",
"loads",
")",
":"... | Remember all undeclared identifiers. | [
"Remember",
"all",
"undeclared",
"identifiers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/meta.py#L28-L33 |
25,472 | pypa/pipenv | pipenv/vendor/distlib/util.py | parse_marker | 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... | python | 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",
")",
":",
"def",
"marker_var",
"(",
"remaining",
")",
":",
"# either identifier, or literal string",
"m",
"=",
"IDENTIFIER",
".",
"match",
"(",
"remaining",
")",
"if",
"m",
":",
"result",
"=",
"m",
".",
"groups",
... | 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
... | [
"Parse",
"a",
"marker",
"string",
"and",
"return",
"a",
"dictionary",
"containing",
"a",
"marker",
"expression",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L56-L142 |
25,473 | pypa/pipenv | pipenv/vendor/distlib/util.py | convert_path | 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... | python | 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",
")",
":",
"if",
"os",
".",
"sep",
"==",
"'/'",
":",
"return",
"pathname",
"if",
"not",
"pathname",
":",
"return",
"pathname",
"if",
"pathname",
"[",
"0",
"]",
"==",
"'/'",
":",
"raise",
"ValueError",
"(",
"\"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... | [
"Return",
"pathname",
"as",
"a",
"name",
"that",
"will",
"work",
"on",
"the",
"native",
"filesystem",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L451-L475 |
25,474 | pypa/pipenv | pipenv/vendor/distlib/util.py | get_cache_base | 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... | python | 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",
")",
":",
"if",
"suffix",
"is",
"None",
":",
"suffix",
"=",
"'.distlib'",
"if",
"os",
".",
"name",
"==",
"'nt'",
"and",
"'LOCALAPPDATA'",
"in",
"os",
".",
"environ",
":",
"result",
"=",
"os",
".",
... | 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 ... | [
"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",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L740-L778 |
25,475 | pypa/pipenv | pipenv/vendor/distlib/util.py | path_to_cache_dir | 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 ... | python | 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",
")",
":",
"d",
",",
"p",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
")",
"if",
"d",
":",
"d",
"=",
"d",
".",
"replace",
"(",
"':'",
",",
"'---'",... | 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. | [
"Convert",
"an",
"absolute",
"path",
"to",
"a",
"directory",
"name",
"for",
"use",
"in",
"a",
"cache",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L781-L795 |
25,476 | pypa/pipenv | pipenv/vendor/distlib/util.py | parse_name_and_version | 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('... | python | 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",
")",
":",
"m",
"=",
"NAME_VERSION_RE",
".",
"match",
"(",
"p",
")",
"if",
"not",
"m",
":",
"raise",
"DistlibException",
"(",
"'Ill-formed name/version string: \\'%s\\''",
"%",
"p",
")",
"d",
"=",
"m",
".",
"groupdic... | 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. | [
"A",
"utility",
"method",
"used",
"to",
"get",
"name",
"and",
"version",
"from",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L863-L876 |
25,477 | pypa/pipenv | pipenv/vendor/distlib/util.py | zip_dir | 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 = ... | python | 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",
")",
":",
"result",
"=",
"io",
".",
"BytesIO",
"(",
")",
"dlen",
"=",
"len",
"(",
"directory",
")",
"with",
"ZipFile",
"(",
"result",
",",
"\"w\"",
")",
"as",
"zf",
":",
"for",
"root",
",",
"dirs",
",",
"files",
... | zip a directory tree into a BytesIO object | [
"zip",
"a",
"directory",
"tree",
"into",
"a",
"BytesIO",
"object"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1249-L1260 |
25,478 | pypa/pipenv | pipenv/vendor/distlib/util.py | FileOperator.newer | 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... | python | 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",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"source",
")",
":",
"raise",
"DistlibException",
"(",
"\"file '%r' does not exist\"",
"%",
"os",
".",
"path",
".",
"abspath",
"(",
... | 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' ... | [
"Tell",
"if",
"the",
"target",
"is",
"newer",
"than",
"the",
"source",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L493-L511 |
25,479 | pypa/pipenv | pipenv/vendor/distlib/util.py | FileOperator.copy_file | 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... | python | 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",
")",
":",
"self",
".",
"ensure_dir",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"outfile",
")",
")",
"logger",
".",
"info",
"(",
"'Copying %s to %s'",
",",
"... | Copy a file respecting dry-run and force flags. | [
"Copy",
"a",
"file",
"respecting",
"dry",
"-",
"run",
"and",
"force",
"flags",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L513-L528 |
25,480 | pypa/pipenv | pipenv/vendor/distlib/util.py | FileOperator.commit | 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 | python | 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",
")",
":",
"assert",
"self",
".",
"record",
"result",
"=",
"self",
".",
"files_written",
",",
"self",
".",
"dirs_created",
"self",
".",
"_init_record",
"(",
")",
"return",
"result"
] | Commit recorded changes, turn off recording, return
changes. | [
"Commit",
"recorded",
"changes",
"turn",
"off",
"recording",
"return",
"changes",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L633-L641 |
25,481 | pypa/pipenv | pipenv/vendor/distlib/util.py | EventMixin.add | 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... | python | 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",
")",
":",
"subs",
"=",
"self",
".",
"_subscribers",
"if",
"event",
"not",
"in",
"subs",
":",
"subs",
"[",
"event",
"]",
"=",
"deque",
"(",
"[",
"subscriber",
"]... | 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 ... | [
"Add",
"a",
"subscriber",
"for",
"an",
"event",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L988-L1006 |
25,482 | pypa/pipenv | pipenv/vendor/distlib/util.py | EventMixin.remove | 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' % ... | python | 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",
")",
":",
"subs",
"=",
"self",
".",
"_subscribers",
"if",
"event",
"not",
"in",
"subs",
":",
"raise",
"ValueError",
"(",
"'No subscribers: %r'",
"%",
"event",
")",
"subs",
"[",
"event",
"]",
... | Remove a subscriber for an event.
:param event: The name of an event.
:param subscriber: The subscriber to be removed. | [
"Remove",
"a",
"subscriber",
"for",
"an",
"event",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1008-L1018 |
25,483 | pypa/pipenv | pipenv/vendor/distlib/util.py | EventMixin.publish | 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... | python | 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",
")",
":",
"result",
"=",
"[",
"]",
"for",
"subscriber",
"in",
"self",
".",
"get_subscribers",
"(",
"event",
")",
":",
"try",
":",
"value",
"=",
"subscriber",
"(... | 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
... | [
"Publish",
"a",
"event",
"and",
"return",
"a",
"list",
"of",
"values",
"returned",
"by",
"its",
"subscribers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L1027-L1048 |
25,484 | pypa/pipenv | pipenv/vendor/yarg/parse.py | _get | 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, '... | python | 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",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"pypi_server",
")",
"if",
"response",
".",
"status_code",
">=",
"300",
":",
"raise",
"HTTPError",
"(",
"status_code",
"=",
"response",
".",
"status_code",
",",
"reas... | Query the PyPI RSS feed and return a list
of XML items. | [
"Query",
"the",
"PyPI",
"RSS",
"feed",
"and",
"return",
"a",
"list",
"of",
"XML",
"items",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/parse.py#L33-L47 |
25,485 | pypa/pipenv | pipenv/vendor/passa/models/lockers.py | _collect_derived_entries | 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... | python | 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",
")",
":",
"identifiers",
"=",
"set",
"(",
"identifiers",
")",
"if",
"not",
"identifiers",
":",
"return",
"{",
"}",
"entries",
"=",
"{",
"}",
"extras",
"=",
"{",
"}",
"for... | 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... | [
"Produce",
"a",
"mapping",
"containing",
"all",
"candidates",
"derived",
"from",
"identifiers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/lockers.py#L48-L78 |
25,486 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/logging.py | setup_logging | 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"
... | python | 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",
")",
":",
"# 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
Returns the requested logging level, as its integer value. | [
"Configures",
"and",
"sets",
"up",
"all",
"of",
"the",
"logging"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/logging.py#L217-L318 |
25,487 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/logging.py | IndentingFormatter.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... | python | 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",
")",
":",
"formatted",
"=",
"super",
"(",
"IndentingFormatter",
",",
"self",
")",
".",
"format",
"(",
"record",
")",
"prefix",
"=",
"''",
"if",
"self",
".",
"add_timestamp",
":",
"prefix",
"=",
"self",
".",
... | Calls the standard formatter, but will indent all of the log messages
by our current indentation level. | [
"Calls",
"the",
"standard",
"formatter",
"but",
"will",
"indent",
"all",
"of",
"the",
"log",
"messages",
"by",
"our",
"current",
"indentation",
"level",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/logging.py#L103-L117 |
25,488 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/logging.py | ColorizedStreamHandler._using_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 | python | 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",
")",
":",
"if",
"WINDOWS",
"and",
"colorama",
":",
"# Then self.stream is an AnsiToWin32 object.",
"return",
"self",
".",
"stream",
".",
"wrapped",
"is",
"sys",
".",
"stdout",
"return",
"self",
".",
"stream",
"is",
"sys",
"... | Return whether the handler is using sys.stdout. | [
"Return",
"whether",
"the",
"handler",
"is",
"using",
"sys",
".",
"stdout",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/logging.py#L145-L153 |
25,489 | pypa/pipenv | pipenv/vendor/click/formatting.py | HelpFormatter.write_text | 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,
... | python | 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",
")",
":",
"text_width",
"=",
"max",
"(",
"self",
".",
"width",
"-",
"self",
".",
"current_indent",
",",
"11",
")",
"indent",
"=",
"' '",
"*",
"self",
".",
"current_indent",
"self",
".",
"write",
"(",
"wr... | Writes re-indented text into the buffer. This rewraps and
preserves paragraphs. | [
"Writes",
"re",
"-",
"indented",
"text",
"into",
"the",
"buffer",
".",
"This",
"rewraps",
"and",
"preserves",
"paragraphs",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L161-L171 |
25,490 | pypa/pipenv | pipenv/vendor/click/formatting.py | HelpFormatter.write_dl | def write_dl(self, rows, col_max=30, col_spacing=2):
"""Writes a definition list into the buffer. This is how options
and commands are usually formatted.
:param rows: a list of two item tuples for the terms and values.
:param col_max: the maximum width of the first column.
:par... | python | def write_dl(self, rows, col_max=30, col_spacing=2):
"""Writes a definition list into the buffer. This is how options
and commands are usually formatted.
:param rows: a list of two item tuples for the terms and values.
:param col_max: the maximum width of the first column.
:par... | [
"def",
"write_dl",
"(",
"self",
",",
"rows",
",",
"col_max",
"=",
"30",
",",
"col_spacing",
"=",
"2",
")",
":",
"rows",
"=",
"list",
"(",
"rows",
")",
"widths",
"=",
"measure_table",
"(",
"rows",
")",
"if",
"len",
"(",
"widths",
")",
"!=",
"2",
"... | Writes a definition list into the buffer. This is how options
and commands are usually formatted.
:param rows: a list of two item tuples for the terms and values.
:param col_max: the maximum width of the first column.
:param col_spacing: the number of spaces between the first and
... | [
"Writes",
"a",
"definition",
"list",
"into",
"the",
"buffer",
".",
"This",
"is",
"how",
"options",
"and",
"commands",
"are",
"usually",
"formatted",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L173-L208 |
25,491 | pypa/pipenv | pipenv/vendor/click/formatting.py | HelpFormatter.section | def section(self, name):
"""Helpful context manager that writes a paragraph, a heading,
and the indents.
:param name: the section name that is written as heading.
"""
self.write_paragraph()
self.write_heading(name)
self.indent()
try:
yield
... | python | def section(self, name):
"""Helpful context manager that writes a paragraph, a heading,
and the indents.
:param name: the section name that is written as heading.
"""
self.write_paragraph()
self.write_heading(name)
self.indent()
try:
yield
... | [
"def",
"section",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"write_paragraph",
"(",
")",
"self",
".",
"write_heading",
"(",
"name",
")",
"self",
".",
"indent",
"(",
")",
"try",
":",
"yield",
"finally",
":",
"self",
".",
"dedent",
"(",
")"
] | Helpful context manager that writes a paragraph, a heading,
and the indents.
:param name: the section name that is written as heading. | [
"Helpful",
"context",
"manager",
"that",
"writes",
"a",
"paragraph",
"a",
"heading",
"and",
"the",
"indents",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L211-L223 |
25,492 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/parser.py | invalid_config_error_message | def invalid_config_error_message(action, key, val):
"""Returns a better error message when invalid configuration option
is provided."""
if action in ('store_true', 'store_false'):
return ("{0} is not a valid value for {1} option, "
"please specify a boolean value like yes/no, "
... | python | def invalid_config_error_message(action, key, val):
"""Returns a better error message when invalid configuration option
is provided."""
if action in ('store_true', 'store_false'):
return ("{0} is not a valid value for {1} option, "
"please specify a boolean value like yes/no, "
... | [
"def",
"invalid_config_error_message",
"(",
"action",
",",
"key",
",",
"val",
")",
":",
"if",
"action",
"in",
"(",
"'store_true'",
",",
"'store_false'",
")",
":",
"return",
"(",
"\"{0} is not a valid value for {1} option, \"",
"\"please specify a boolean value like yes/no... | Returns a better error message when invalid configuration option
is provided. | [
"Returns",
"a",
"better",
"error",
"message",
"when",
"invalid",
"configuration",
"option",
"is",
"provided",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L251-L261 |
25,493 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/parser.py | PrettyHelpFormatter._format_option_strings | def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
"""
Return a comma-separated list of option strings and metavars.
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
... | python | def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
"""
Return a comma-separated list of option strings and metavars.
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
... | [
"def",
"_format_option_strings",
"(",
"self",
",",
"option",
",",
"mvarfmt",
"=",
"' <%s>'",
",",
"optsep",
"=",
"', '",
")",
":",
"opts",
"=",
"[",
"]",
"if",
"option",
".",
"_short_opts",
":",
"opts",
".",
"append",
"(",
"option",
".",
"_short_opts",
... | Return a comma-separated list of option strings and metavars.
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
:param optsep: separator | [
"Return",
"a",
"comma",
"-",
"separated",
"list",
"of",
"option",
"strings",
"and",
"metavars",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L32-L53 |
25,494 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/parser.py | PrettyHelpFormatter.format_usage | def format_usage(self, usage):
"""
Ensure there is only one newline between usage and the first heading
if there is no description.
"""
msg = '\nUsage: %s\n' % self.indent_lines(textwrap.dedent(usage), " ")
return msg | python | def format_usage(self, usage):
"""
Ensure there is only one newline between usage and the first heading
if there is no description.
"""
msg = '\nUsage: %s\n' % self.indent_lines(textwrap.dedent(usage), " ")
return msg | [
"def",
"format_usage",
"(",
"self",
",",
"usage",
")",
":",
"msg",
"=",
"'\\nUsage: %s\\n'",
"%",
"self",
".",
"indent_lines",
"(",
"textwrap",
".",
"dedent",
"(",
"usage",
")",
",",
"\" \"",
")",
"return",
"msg"
] | Ensure there is only one newline between usage and the first heading
if there is no description. | [
"Ensure",
"there",
"is",
"only",
"one",
"newline",
"between",
"usage",
"and",
"the",
"first",
"heading",
"if",
"there",
"is",
"no",
"description",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L60-L66 |
25,495 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/parser.py | CustomOptionParser.insert_option_group | def insert_option_group(self, idx, *args, **kwargs):
"""Insert an OptionGroup at a given position."""
group = self.add_option_group(*args, **kwargs)
self.option_groups.pop()
self.option_groups.insert(idx, group)
return group | python | def insert_option_group(self, idx, *args, **kwargs):
"""Insert an OptionGroup at a given position."""
group = self.add_option_group(*args, **kwargs)
self.option_groups.pop()
self.option_groups.insert(idx, group)
return group | [
"def",
"insert_option_group",
"(",
"self",
",",
"idx",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"group",
"=",
"self",
".",
"add_option_group",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"option_groups",
".",
"pop",
"(",
... | Insert an OptionGroup at a given position. | [
"Insert",
"an",
"OptionGroup",
"at",
"a",
"given",
"position",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L113-L120 |
25,496 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/parser.py | CustomOptionParser.option_list_all | def option_list_all(self):
"""Get a list of all options, including those in option groups."""
res = self.option_list[:]
for i in self.option_groups:
res.extend(i.option_list)
return res | python | def option_list_all(self):
"""Get a list of all options, including those in option groups."""
res = self.option_list[:]
for i in self.option_groups:
res.extend(i.option_list)
return res | [
"def",
"option_list_all",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"option_list",
"[",
":",
"]",
"for",
"i",
"in",
"self",
".",
"option_groups",
":",
"res",
".",
"extend",
"(",
"i",
".",
"option_list",
")",
"return",
"res"
] | Get a list of all options, including those in option groups. | [
"Get",
"a",
"list",
"of",
"all",
"options",
"including",
"those",
"in",
"option",
"groups",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L123-L129 |
25,497 | pypa/pipenv | pipenv/environment.py | Environment.safe_import | def safe_import(self, name):
"""Helper utility for reimporting previously imported modules while inside the env"""
module = None
if name not in self._modules:
self._modules[name] = importlib.import_module(name)
module = self._modules[name]
if not module:
d... | python | def safe_import(self, name):
"""Helper utility for reimporting previously imported modules while inside the env"""
module = None
if name not in self._modules:
self._modules[name] = importlib.import_module(name)
module = self._modules[name]
if not module:
d... | [
"def",
"safe_import",
"(",
"self",
",",
"name",
")",
":",
"module",
"=",
"None",
"if",
"name",
"not",
"in",
"self",
".",
"_modules",
":",
"self",
".",
"_modules",
"[",
"name",
"]",
"=",
"importlib",
".",
"import_module",
"(",
"name",
")",
"module",
"... | Helper utility for reimporting previously imported modules while inside the env | [
"Helper",
"utility",
"for",
"reimporting",
"previously",
"imported",
"modules",
"while",
"inside",
"the",
"env"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L51-L71 |
25,498 | pypa/pipenv | pipenv/environment.py | Environment.resolve_dist | def resolve_dist(cls, dist, working_set):
"""Given a local distribution and a working set, returns all dependencies from the set.
:param dist: A single distribution to find the dependencies of
:type dist: :class:`pkg_resources.Distribution`
:param working_set: A working set to search fo... | python | def resolve_dist(cls, dist, working_set):
"""Given a local distribution and a working set, returns all dependencies from the set.
:param dist: A single distribution to find the dependencies of
:type dist: :class:`pkg_resources.Distribution`
:param working_set: A working set to search fo... | [
"def",
"resolve_dist",
"(",
"cls",
",",
"dist",
",",
"working_set",
")",
":",
"deps",
"=",
"set",
"(",
")",
"deps",
".",
"add",
"(",
"dist",
")",
"try",
":",
"reqs",
"=",
"dist",
".",
"requires",
"(",
")",
"except",
"(",
"AttributeError",
",",
"OSE... | Given a local distribution and a working set, returns all dependencies from the set.
:param dist: A single distribution to find the dependencies of
:type dist: :class:`pkg_resources.Distribution`
:param working_set: A working set to search for all packages
:type working_set: :class:`pkg... | [
"Given",
"a",
"local",
"distribution",
"and",
"a",
"working",
"set",
"returns",
"all",
"dependencies",
"from",
"the",
"set",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L74-L94 |
25,499 | pypa/pipenv | pipenv/environment.py | Environment.base_paths | def base_paths(self):
"""
Returns the context appropriate paths for the environment.
:return: A dictionary of environment specific paths to be used for installation operations
:rtype: dict
.. note:: The implementation of this is borrowed from a combination of pip and
... | python | def base_paths(self):
"""
Returns the context appropriate paths for the environment.
:return: A dictionary of environment specific paths to be used for installation operations
:rtype: dict
.. note:: The implementation of this is borrowed from a combination of pip and
... | [
"def",
"base_paths",
"(",
"self",
")",
":",
"prefix",
"=",
"make_posix",
"(",
"self",
".",
"prefix",
".",
"as_posix",
"(",
")",
")",
"install_scheme",
"=",
"'nt'",
"if",
"(",
"os",
".",
"name",
"==",
"'nt'",
")",
"else",
"'posix_prefix'",
"paths",
"=",... | Returns the context appropriate paths for the environment.
:return: A dictionary of environment specific paths to be used for installation operations
:rtype: dict
.. note:: The implementation of this is borrowed from a combination of pip and
virtualenv and is likely to change at som... | [
"Returns",
"the",
"context",
"appropriate",
"paths",
"for",
"the",
"environment",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L124-L173 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.