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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,900 | pypa/pipenv | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | get_subj_alt_name | def get_subj_alt_name(peer_cert):
"""
Given an PyOpenSSL certificate, provides all the subject alternative names.
"""
# Pass the cert to cryptography, which has much better APIs for this.
if hasattr(peer_cert, "to_cryptography"):
cert = peer_cert.to_cryptography()
else:
# This is... | python | def get_subj_alt_name(peer_cert):
"""
Given an PyOpenSSL certificate, provides all the subject alternative names.
"""
# Pass the cert to cryptography, which has much better APIs for this.
if hasattr(peer_cert, "to_cryptography"):
cert = peer_cert.to_cryptography()
else:
# This is... | [
"def",
"get_subj_alt_name",
"(",
"peer_cert",
")",
":",
"# Pass the cert to cryptography, which has much better APIs for this.",
"if",
"hasattr",
"(",
"peer_cert",
",",
"\"to_cryptography\"",
")",
":",
"cert",
"=",
"peer_cert",
".",
"to_cryptography",
"(",
")",
"else",
... | Given an PyOpenSSL certificate, provides all the subject alternative names. | [
"Given",
"an",
"PyOpenSSL",
"certificate",
"provides",
"all",
"the",
"subject",
"alternative",
"names",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L195-L244 |
24,901 | pypa/pipenv | pipenv/utils.py | _get_requests_session | def _get_requests_session():
"""Load requests lazily."""
global requests_session
if requests_session is not None:
return requests_session
import requests
requests_session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
max_retries=environments.PIPENV_MAX_RETRIES
... | python | def _get_requests_session():
"""Load requests lazily."""
global requests_session
if requests_session is not None:
return requests_session
import requests
requests_session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
max_retries=environments.PIPENV_MAX_RETRIES
... | [
"def",
"_get_requests_session",
"(",
")",
":",
"global",
"requests_session",
"if",
"requests_session",
"is",
"not",
"None",
":",
"return",
"requests_session",
"import",
"requests",
"requests_session",
"=",
"requests",
".",
"Session",
"(",
")",
"adapter",
"=",
"req... | Load requests lazily. | [
"Load",
"requests",
"lazily",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L53-L65 |
24,902 | pypa/pipenv | pipenv/utils.py | convert_toml_outline_tables | def convert_toml_outline_tables(parsed):
"""Converts all outline tables to inline tables."""
def convert_tomlkit_table(section):
for key, value in section._body:
if not key:
continue
if hasattr(value, "keys") and not isinstance(value, tomlkit.items.InlineTable):
... | python | def convert_toml_outline_tables(parsed):
"""Converts all outline tables to inline tables."""
def convert_tomlkit_table(section):
for key, value in section._body:
if not key:
continue
if hasattr(value, "keys") and not isinstance(value, tomlkit.items.InlineTable):
... | [
"def",
"convert_toml_outline_tables",
"(",
"parsed",
")",
":",
"def",
"convert_tomlkit_table",
"(",
"section",
")",
":",
"for",
"key",
",",
"value",
"in",
"section",
".",
"_body",
":",
"if",
"not",
"key",
":",
"continue",
"if",
"hasattr",
"(",
"value",
","... | Converts all outline tables to inline tables. | [
"Converts",
"all",
"outline",
"tables",
"to",
"inline",
"tables",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L91-L119 |
24,903 | pypa/pipenv | pipenv/utils.py | run_command | def run_command(cmd, *args, **kwargs):
"""
Take an input command and run it, handling exceptions and error codes and returning
its stdout and stderr.
:param cmd: The list of command and arguments.
:type cmd: list
:returns: A 2-tuple of the output and error from the command
:rtype: Tuple[str... | python | def run_command(cmd, *args, **kwargs):
"""
Take an input command and run it, handling exceptions and error codes and returning
its stdout and stderr.
:param cmd: The list of command and arguments.
:type cmd: list
:returns: A 2-tuple of the output and error from the command
:rtype: Tuple[str... | [
"def",
"run_command",
"(",
"cmd",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pipenv",
".",
"vendor",
"import",
"delegator",
"from",
".",
"_compat",
"import",
"decode_for_output",
"from",
".",
"cmdparse",
"import",
"Script",
"catch_exceptio... | Take an input command and run it, handling exceptions and error codes and returning
its stdout and stderr.
:param cmd: The list of command and arguments.
:type cmd: list
:returns: A 2-tuple of the output and error from the command
:rtype: Tuple[str, str]
:raises: exceptions.PipenvCmdError | [
"Take",
"an",
"input",
"command",
"and",
"run",
"it",
"handling",
"exceptions",
"and",
"error",
"codes",
"and",
"returning",
"its",
"stdout",
"and",
"stderr",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L122-L160 |
24,904 | pypa/pipenv | pipenv/utils.py | convert_deps_to_pip | def convert_deps_to_pip(deps, project=None, r=True, include_index=True):
""""Converts a Pipfile-formatted dependency to a pip-formatted one."""
from .vendor.requirementslib.models.requirements import Requirement
dependencies = []
for dep_name, dep in deps.items():
if project:
projec... | python | def convert_deps_to_pip(deps, project=None, r=True, include_index=True):
""""Converts a Pipfile-formatted dependency to a pip-formatted one."""
from .vendor.requirementslib.models.requirements import Requirement
dependencies = []
for dep_name, dep in deps.items():
if project:
projec... | [
"def",
"convert_deps_to_pip",
"(",
"deps",
",",
"project",
"=",
"None",
",",
"r",
"=",
"True",
",",
"include_index",
"=",
"True",
")",
":",
"from",
".",
"vendor",
".",
"requirementslib",
".",
"models",
".",
"requirements",
"import",
"Requirement",
"dependenc... | Converts a Pipfile-formatted dependency to a pip-formatted one. | [
"Converts",
"a",
"Pipfile",
"-",
"formatted",
"dependency",
"to",
"a",
"pip",
"-",
"formatted",
"one",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1127-L1149 |
24,905 | pypa/pipenv | pipenv/utils.py | is_required_version | def is_required_version(version, specified_version):
"""Check to see if there's a hard requirement for version
number provided in the Pipfile.
"""
# Certain packages may be defined with multiple values.
if isinstance(specified_version, dict):
specified_version = specified_version.get("versio... | python | def is_required_version(version, specified_version):
"""Check to see if there's a hard requirement for version
number provided in the Pipfile.
"""
# Certain packages may be defined with multiple values.
if isinstance(specified_version, dict):
specified_version = specified_version.get("versio... | [
"def",
"is_required_version",
"(",
"version",
",",
"specified_version",
")",
":",
"# Certain packages may be defined with multiple values.",
"if",
"isinstance",
"(",
"specified_version",
",",
"dict",
")",
":",
"specified_version",
"=",
"specified_version",
".",
"get",
"("... | Check to see if there's a hard requirement for version
number provided in the Pipfile. | [
"Check",
"to",
"see",
"if",
"there",
"s",
"a",
"hard",
"requirement",
"for",
"version",
"number",
"provided",
"in",
"the",
"Pipfile",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1185-L1195 |
24,906 | pypa/pipenv | pipenv/utils.py | is_file | def is_file(package):
"""Determine if a package name is for a File dependency."""
if hasattr(package, "keys"):
return any(key for key in package.keys() if key in ["file", "path"])
if os.path.exists(str(package)):
return True
for start in SCHEME_LIST:
if str(package).startswith(... | python | def is_file(package):
"""Determine if a package name is for a File dependency."""
if hasattr(package, "keys"):
return any(key for key in package.keys() if key in ["file", "path"])
if os.path.exists(str(package)):
return True
for start in SCHEME_LIST:
if str(package).startswith(... | [
"def",
"is_file",
"(",
"package",
")",
":",
"if",
"hasattr",
"(",
"package",
",",
"\"keys\"",
")",
":",
"return",
"any",
"(",
"key",
"for",
"key",
"in",
"package",
".",
"keys",
"(",
")",
"if",
"key",
"in",
"[",
"\"file\"",
",",
"\"path\"",
"]",
")"... | Determine if a package name is for a File dependency. | [
"Determine",
"if",
"a",
"package",
"name",
"is",
"for",
"a",
"File",
"dependency",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1244-L1256 |
24,907 | pypa/pipenv | pipenv/utils.py | pep423_name | def pep423_name(name):
"""Normalize package name to PEP 423 style standard."""
name = name.lower()
if any(i not in name for i in (VCS_LIST + SCHEME_LIST)):
return name.replace("_", "-")
else:
return name | python | def pep423_name(name):
"""Normalize package name to PEP 423 style standard."""
name = name.lower()
if any(i not in name for i in (VCS_LIST + SCHEME_LIST)):
return name.replace("_", "-")
else:
return name | [
"def",
"pep423_name",
"(",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"any",
"(",
"i",
"not",
"in",
"name",
"for",
"i",
"in",
"(",
"VCS_LIST",
"+",
"SCHEME_LIST",
")",
")",
":",
"return",
"name",
".",
"replace",
"(",
"\"... | Normalize package name to PEP 423 style standard. | [
"Normalize",
"package",
"name",
"to",
"PEP",
"423",
"style",
"standard",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1267-L1274 |
24,908 | pypa/pipenv | pipenv/utils.py | proper_case | def proper_case(package_name):
"""Properly case project name from pypi.org."""
# Hit the simple API.
r = _get_requests_session().get(
"https://pypi.org/pypi/{0}/json".format(package_name), timeout=0.3, stream=True
)
if not r.ok:
raise IOError(
"Unable to find package {0} ... | python | def proper_case(package_name):
"""Properly case project name from pypi.org."""
# Hit the simple API.
r = _get_requests_session().get(
"https://pypi.org/pypi/{0}/json".format(package_name), timeout=0.3, stream=True
)
if not r.ok:
raise IOError(
"Unable to find package {0} ... | [
"def",
"proper_case",
"(",
"package_name",
")",
":",
"# Hit the simple API.",
"r",
"=",
"_get_requests_session",
"(",
")",
".",
"get",
"(",
"\"https://pypi.org/pypi/{0}/json\"",
".",
"format",
"(",
"package_name",
")",
",",
"timeout",
"=",
"0.3",
",",
"stream",
... | Properly case project name from pypi.org. | [
"Properly",
"case",
"project",
"name",
"from",
"pypi",
".",
"org",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1277-L1290 |
24,909 | pypa/pipenv | pipenv/utils.py | find_windows_executable | def find_windows_executable(bin_path, exe_name):
"""Given an executable name, search the given location for an executable"""
requested_path = get_windows_path(bin_path, exe_name)
if os.path.isfile(requested_path):
return requested_path
try:
pathext = os.environ["PATHEXT"]
except Key... | python | def find_windows_executable(bin_path, exe_name):
"""Given an executable name, search the given location for an executable"""
requested_path = get_windows_path(bin_path, exe_name)
if os.path.isfile(requested_path):
return requested_path
try:
pathext = os.environ["PATHEXT"]
except Key... | [
"def",
"find_windows_executable",
"(",
"bin_path",
",",
"exe_name",
")",
":",
"requested_path",
"=",
"get_windows_path",
"(",
"bin_path",
",",
"exe_name",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"requested_path",
")",
":",
"return",
"requested_path",
... | Given an executable name, search the given location for an executable | [
"Given",
"an",
"executable",
"name",
"search",
"the",
"given",
"location",
"for",
"an",
"executable"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1300-L1316 |
24,910 | pypa/pipenv | pipenv/utils.py | get_canonical_names | def get_canonical_names(packages):
"""Canonicalize a list of packages and return a set of canonical names"""
from .vendor.packaging.utils import canonicalize_name
if not isinstance(packages, Sequence):
if not isinstance(packages, six.string_types):
return packages
packages = [pa... | python | def get_canonical_names(packages):
"""Canonicalize a list of packages and return a set of canonical names"""
from .vendor.packaging.utils import canonicalize_name
if not isinstance(packages, Sequence):
if not isinstance(packages, six.string_types):
return packages
packages = [pa... | [
"def",
"get_canonical_names",
"(",
"packages",
")",
":",
"from",
".",
"vendor",
".",
"packaging",
".",
"utils",
"import",
"canonicalize_name",
"if",
"not",
"isinstance",
"(",
"packages",
",",
"Sequence",
")",
":",
"if",
"not",
"isinstance",
"(",
"packages",
... | Canonicalize a list of packages and return a set of canonical names | [
"Canonicalize",
"a",
"list",
"of",
"packages",
"and",
"return",
"a",
"set",
"of",
"canonical",
"names"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1337-L1345 |
24,911 | pypa/pipenv | pipenv/utils.py | download_file | def download_file(url, filename):
"""Downloads file from url to a path with filename"""
r = _get_requests_session().get(url, stream=True)
if not r.ok:
raise IOError("Unable to download file")
with open(filename, "wb") as f:
f.write(r.content) | python | def download_file(url, filename):
"""Downloads file from url to a path with filename"""
r = _get_requests_session().get(url, stream=True)
if not r.ok:
raise IOError("Unable to download file")
with open(filename, "wb") as f:
f.write(r.content) | [
"def",
"download_file",
"(",
"url",
",",
"filename",
")",
":",
"r",
"=",
"_get_requests_session",
"(",
")",
".",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
"if",
"not",
"r",
".",
"ok",
":",
"raise",
"IOError",
"(",
"\"Unable to download file\"",... | Downloads file from url to a path with filename | [
"Downloads",
"file",
"from",
"url",
"to",
"a",
"path",
"with",
"filename"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1451-L1458 |
24,912 | pypa/pipenv | pipenv/utils.py | normalize_drive | def normalize_drive(path):
"""Normalize drive in path so they stay consistent.
This currently only affects local drives on Windows, which can be
identified with either upper or lower cased drive names. The case is
always converted to uppercase because it seems to be preferred.
See: <https://github... | python | def normalize_drive(path):
"""Normalize drive in path so they stay consistent.
This currently only affects local drives on Windows, which can be
identified with either upper or lower cased drive names. The case is
always converted to uppercase because it seems to be preferred.
See: <https://github... | [
"def",
"normalize_drive",
"(",
"path",
")",
":",
"if",
"os",
".",
"name",
"!=",
"\"nt\"",
"or",
"not",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"return",
"path",
"drive",
",",
"tail",
"=",
"os",
".",
"path",
".",
"splitdr... | Normalize drive in path so they stay consistent.
This currently only affects local drives on Windows, which can be
identified with either upper or lower cased drive names. The case is
always converted to uppercase because it seems to be preferred.
See: <https://github.com/pypa/pipenv/issues/1218> | [
"Normalize",
"drive",
"in",
"path",
"so",
"they",
"stay",
"consistent",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1461-L1478 |
24,913 | pypa/pipenv | pipenv/utils.py | safe_expandvars | def safe_expandvars(value):
"""Call os.path.expandvars if value is a string, otherwise do nothing.
"""
if isinstance(value, six.string_types):
return os.path.expandvars(value)
return value | python | def safe_expandvars(value):
"""Call os.path.expandvars if value is a string, otherwise do nothing.
"""
if isinstance(value, six.string_types):
return os.path.expandvars(value)
return value | [
"def",
"safe_expandvars",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"return",
"os",
".",
"path",
".",
"expandvars",
"(",
"value",
")",
"return",
"value"
] | Call os.path.expandvars if value is a string, otherwise do nothing. | [
"Call",
"os",
".",
"path",
".",
"expandvars",
"if",
"value",
"is",
"a",
"string",
"otherwise",
"do",
"nothing",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1539-L1544 |
24,914 | pypa/pipenv | pipenv/utils.py | translate_markers | def translate_markers(pipfile_entry):
"""Take a pipfile entry and normalize its markers
Provide a pipfile entry which may have 'markers' as a key or it may have
any valid key from `packaging.markers.marker_context.keys()` and standardize
the format into {'markers': 'key == "some_value"'}.
:param p... | python | def translate_markers(pipfile_entry):
"""Take a pipfile entry and normalize its markers
Provide a pipfile entry which may have 'markers' as a key or it may have
any valid key from `packaging.markers.marker_context.keys()` and standardize
the format into {'markers': 'key == "some_value"'}.
:param p... | [
"def",
"translate_markers",
"(",
"pipfile_entry",
")",
":",
"if",
"not",
"isinstance",
"(",
"pipfile_entry",
",",
"Mapping",
")",
":",
"raise",
"TypeError",
"(",
"\"Entry is not a pipfile formatted mapping.\"",
")",
"from",
".",
"vendor",
".",
"distlib",
".",
"mar... | Take a pipfile entry and normalize its markers
Provide a pipfile entry which may have 'markers' as a key or it may have
any valid key from `packaging.markers.marker_context.keys()` and standardize
the format into {'markers': 'key == "some_value"'}.
:param pipfile_entry: A dictionariy of keys and value... | [
"Take",
"a",
"pipfile",
"entry",
"and",
"normalize",
"its",
"markers"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1597-L1633 |
24,915 | pypa/pipenv | pipenv/utils.py | is_virtual_environment | def is_virtual_environment(path):
"""Check if a given path is a virtual environment's root.
This is done by checking if the directory contains a Python executable in
its bin/Scripts directory. Not technically correct, but good enough for
general usage.
"""
if not path.is_dir():
return F... | python | def is_virtual_environment(path):
"""Check if a given path is a virtual environment's root.
This is done by checking if the directory contains a Python executable in
its bin/Scripts directory. Not technically correct, but good enough for
general usage.
"""
if not path.is_dir():
return F... | [
"def",
"is_virtual_environment",
"(",
"path",
")",
":",
"if",
"not",
"path",
".",
"is_dir",
"(",
")",
":",
"return",
"False",
"for",
"bindir_name",
"in",
"(",
"'bin'",
",",
"'Scripts'",
")",
":",
"for",
"python",
"in",
"path",
".",
"joinpath",
"(",
"bi... | Check if a given path is a virtual environment's root.
This is done by checking if the directory contains a Python executable in
its bin/Scripts directory. Not technically correct, but good enough for
general usage. | [
"Check",
"if",
"a",
"given",
"path",
"is",
"a",
"virtual",
"environment",
"s",
"root",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1707-L1724 |
24,916 | pypa/pipenv | pipenv/utils.py | sys_version | def sys_version(version_tuple):
"""
Set a temporary sys.version_info tuple
:param version_tuple: a fake sys.version_info tuple
"""
old_version = sys.version_info
sys.version_info = version_tuple
yield
sys.version_info = old_version | python | def sys_version(version_tuple):
"""
Set a temporary sys.version_info tuple
:param version_tuple: a fake sys.version_info tuple
"""
old_version = sys.version_info
sys.version_info = version_tuple
yield
sys.version_info = old_version | [
"def",
"sys_version",
"(",
"version_tuple",
")",
":",
"old_version",
"=",
"sys",
".",
"version_info",
"sys",
".",
"version_info",
"=",
"version_tuple",
"yield",
"sys",
".",
"version_info",
"=",
"old_version"
] | Set a temporary sys.version_info tuple
:param version_tuple: a fake sys.version_info tuple | [
"Set",
"a",
"temporary",
"sys",
".",
"version_info",
"tuple"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1785-L1795 |
24,917 | pypa/pipenv | pipenv/utils.py | is_url_equal | def is_url_equal(url, other_url):
# type: (str, str) -> bool
"""
Compare two urls by scheme, host, and path, ignoring auth
:param str url: The initial URL to compare
:param str url: Second url to compare to the first
:return: Whether the URLs are equal without **auth**, **query**, and **fragmen... | python | def is_url_equal(url, other_url):
# type: (str, str) -> bool
"""
Compare two urls by scheme, host, and path, ignoring auth
:param str url: The initial URL to compare
:param str url: Second url to compare to the first
:return: Whether the URLs are equal without **auth**, **query**, and **fragmen... | [
"def",
"is_url_equal",
"(",
"url",
",",
"other_url",
")",
":",
"# type: (str, str) -> bool",
"if",
"not",
"isinstance",
"(",
"url",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected string for url, received {0!r}\"",
".",
"format",
... | Compare two urls by scheme, host, and path, ignoring auth
:param str url: The initial URL to compare
:param str url: Second url to compare to the first
:return: Whether the URLs are equal without **auth**, **query**, and **fragment**
:rtype: bool
>>> is_url_equal("https://user:pass@mydomain.com/so... | [
"Compare",
"two",
"urls",
"by",
"scheme",
"host",
"and",
"path",
"ignoring",
"auth"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1811-L1837 |
24,918 | pypa/pipenv | pipenv/utils.py | find_python | def find_python(finder, line=None):
"""
Given a `pythonfinder.Finder` instance and an optional line, find a corresponding python
:param finder: A :class:`pythonfinder.Finder` instance to use for searching
:type finder: :class:pythonfinder.Finder`
:param str line: A version, path, name, or nothing, ... | python | def find_python(finder, line=None):
"""
Given a `pythonfinder.Finder` instance and an optional line, find a corresponding python
:param finder: A :class:`pythonfinder.Finder` instance to use for searching
:type finder: :class:pythonfinder.Finder`
:param str line: A version, path, name, or nothing, ... | [
"def",
"find_python",
"(",
"finder",
",",
"line",
"=",
"None",
")",
":",
"if",
"line",
"and",
"not",
"isinstance",
"(",
"line",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"Invalid python search type: expected string, received {0!r}\"",... | Given a `pythonfinder.Finder` instance and an optional line, find a corresponding python
:param finder: A :class:`pythonfinder.Finder` instance to use for searching
:type finder: :class:pythonfinder.Finder`
:param str line: A version, path, name, or nothing, defaults to None
:return: A path to python
... | [
"Given",
"a",
"pythonfinder",
".",
"Finder",
"instance",
"and",
"an",
"optional",
"line",
"find",
"a",
"corresponding",
"python"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1877-L1916 |
24,919 | pypa/pipenv | pipenv/utils.py | is_python_command | def is_python_command(line):
"""
Given an input, checks whether the input is a request for python or notself.
This can be a version, a python runtime name, or a generic 'python' or 'pythonX.Y'
:param str line: A potential request to find python
:returns: Whether the line is a python lookup
:rt... | python | def is_python_command(line):
"""
Given an input, checks whether the input is a request for python or notself.
This can be a version, a python runtime name, or a generic 'python' or 'pythonX.Y'
:param str line: A potential request to find python
:returns: Whether the line is a python lookup
:rt... | [
"def",
"is_python_command",
"(",
"line",
")",
":",
"if",
"not",
"isinstance",
"(",
"line",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"Not a valid command to check: {0!r}\"",
".",
"format",
"(",
"line",
")",
")",
"from",
"pipenv",
... | Given an input, checks whether the input is a request for python or notself.
This can be a version, a python runtime name, or a generic 'python' or 'pythonX.Y'
:param str line: A potential request to find python
:returns: Whether the line is a python lookup
:rtype: bool | [
"Given",
"an",
"input",
"checks",
"whether",
"the",
"input",
"is",
"a",
"request",
"for",
"python",
"or",
"notself",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1919-L1941 |
24,920 | pypa/pipenv | pipenv/utils.py | Resolver.get_hash | def get_hash(self, ireq, ireq_hashes=None):
"""
Retrieve hashes for a specific ``InstallRequirement`` instance.
:param ireq: An ``InstallRequirement`` to retrieve hashes for
:type ireq: :class:`~pip_shims.InstallRequirement`
:return: A set of hashes.
:rtype: Set
... | python | def get_hash(self, ireq, ireq_hashes=None):
"""
Retrieve hashes for a specific ``InstallRequirement`` instance.
:param ireq: An ``InstallRequirement`` to retrieve hashes for
:type ireq: :class:`~pip_shims.InstallRequirement`
:return: A set of hashes.
:rtype: Set
... | [
"def",
"get_hash",
"(",
"self",
",",
"ireq",
",",
"ireq_hashes",
"=",
"None",
")",
":",
"# We _ALWAYS MUST PRIORITIZE_ the inclusion of hashes from local sources",
"# PLEASE *DO NOT MODIFY THIS* TO CHECK WHETHER AN IREQ ALREADY HAS A HASH",
"# RESOLVED. The resolver will pull hashes from... | Retrieve hashes for a specific ``InstallRequirement`` instance.
:param ireq: An ``InstallRequirement`` to retrieve hashes for
:type ireq: :class:`~pip_shims.InstallRequirement`
:return: A set of hashes.
:rtype: Set | [
"Retrieve",
"hashes",
"for",
"a",
"specific",
"InstallRequirement",
"instance",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L682-L714 |
24,921 | pypa/pipenv | pipenv/vendor/shellingham/posix/__init__.py | _get_process_mapping | def _get_process_mapping():
"""Select a way to obtain process information from the system.
* `/proc` is used if supported.
* The system `ps` utility is used as a fallback option.
"""
for impl in (proc, ps):
try:
mapping = impl.get_process_mapping()
except EnvironmentErro... | python | def _get_process_mapping():
"""Select a way to obtain process information from the system.
* `/proc` is used if supported.
* The system `ps` utility is used as a fallback option.
"""
for impl in (proc, ps):
try:
mapping = impl.get_process_mapping()
except EnvironmentErro... | [
"def",
"_get_process_mapping",
"(",
")",
":",
"for",
"impl",
"in",
"(",
"proc",
",",
"ps",
")",
":",
"try",
":",
"mapping",
"=",
"impl",
".",
"get_process_mapping",
"(",
")",
"except",
"EnvironmentError",
":",
"continue",
"return",
"mapping",
"raise",
"She... | Select a way to obtain process information from the system.
* `/proc` is used if supported.
* The system `ps` utility is used as a fallback option. | [
"Select",
"a",
"way",
"to",
"obtain",
"process",
"information",
"from",
"the",
"system",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/__init__.py#L7-L19 |
24,922 | pypa/pipenv | pipenv/vendor/shellingham/posix/__init__.py | _get_login_shell | def _get_login_shell(proc_cmd):
"""Form shell information from the SHELL environment variable if possible.
"""
login_shell = os.environ.get('SHELL', '')
if login_shell:
proc_cmd = login_shell
else:
proc_cmd = proc_cmd[1:]
return (os.path.basename(proc_cmd).lower(), proc_cmd) | python | def _get_login_shell(proc_cmd):
"""Form shell information from the SHELL environment variable if possible.
"""
login_shell = os.environ.get('SHELL', '')
if login_shell:
proc_cmd = login_shell
else:
proc_cmd = proc_cmd[1:]
return (os.path.basename(proc_cmd).lower(), proc_cmd) | [
"def",
"_get_login_shell",
"(",
"proc_cmd",
")",
":",
"login_shell",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'SHELL'",
",",
"''",
")",
"if",
"login_shell",
":",
"proc_cmd",
"=",
"login_shell",
"else",
":",
"proc_cmd",
"=",
"proc_cmd",
"[",
"1",
":",... | Form shell information from the SHELL environment variable if possible. | [
"Form",
"shell",
"information",
"from",
"the",
"SHELL",
"environment",
"variable",
"if",
"possible",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/__init__.py#L39-L47 |
24,923 | pypa/pipenv | pipenv/vendor/requests/adapters.py | HTTPAdapter.init_poolmanager | def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):
"""Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
... | python | def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):
"""Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
... | [
"def",
"init_poolmanager",
"(",
"self",
",",
"connections",
",",
"maxsize",
",",
"block",
"=",
"DEFAULT_POOLBLOCK",
",",
"*",
"*",
"pool_kwargs",
")",
":",
"# save these values for pickling",
"self",
".",
"_pool_connections",
"=",
"connections",
"self",
".",
"_poo... | Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param connections: The number of urllib3 connection pools to cache.
:param maxsize: The ma... | [
"Initializes",
"a",
"urllib3",
"PoolManager",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L146-L164 |
24,924 | pypa/pipenv | pipenv/vendor/requests/adapters.py | HTTPAdapter.close | def close(self):
"""Disposes of any internal state.
Currently, this closes the PoolManager and any active ProxyManager,
which closes any pooled connections.
"""
self.poolmanager.clear()
for proxy in self.proxy_manager.values():
proxy.clear() | python | def close(self):
"""Disposes of any internal state.
Currently, this closes the PoolManager and any active ProxyManager,
which closes any pooled connections.
"""
self.poolmanager.clear()
for proxy in self.proxy_manager.values():
proxy.clear() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"poolmanager",
".",
"clear",
"(",
")",
"for",
"proxy",
"in",
"self",
".",
"proxy_manager",
".",
"values",
"(",
")",
":",
"proxy",
".",
"clear",
"(",
")"
] | Disposes of any internal state.
Currently, this closes the PoolManager and any active ProxyManager,
which closes any pooled connections. | [
"Disposes",
"of",
"any",
"internal",
"state",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L319-L327 |
24,925 | pypa/pipenv | pipenv/vendor/requirementslib/utils.py | add_ssh_scheme_to_git_uri | def add_ssh_scheme_to_git_uri(uri):
# type: (S) -> S
"""Cleans VCS uris from pipenv.patched.notpip format"""
if isinstance(uri, six.string_types):
# Add scheme for parsing purposes, this is also what pip does
if uri.startswith("git+") and "://" not in uri:
uri = uri.replace("git+... | python | def add_ssh_scheme_to_git_uri(uri):
# type: (S) -> S
"""Cleans VCS uris from pipenv.patched.notpip format"""
if isinstance(uri, six.string_types):
# Add scheme for parsing purposes, this is also what pip does
if uri.startswith("git+") and "://" not in uri:
uri = uri.replace("git+... | [
"def",
"add_ssh_scheme_to_git_uri",
"(",
"uri",
")",
":",
"# type: (S) -> S",
"if",
"isinstance",
"(",
"uri",
",",
"six",
".",
"string_types",
")",
":",
"# Add scheme for parsing purposes, this is also what pip does",
"if",
"uri",
".",
"startswith",
"(",
"\"git+\"",
"... | Cleans VCS uris from pipenv.patched.notpip format | [
"Cleans",
"VCS",
"uris",
"from",
"pipenv",
".",
"patched",
".",
"notpip",
"format"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L133-L145 |
24,926 | pypa/pipenv | pipenv/vendor/requirementslib/utils.py | is_vcs | def is_vcs(pipfile_entry):
# type: (PipfileType) -> bool
"""Determine if dictionary entry from Pipfile is for a vcs dependency."""
if isinstance(pipfile_entry, Mapping):
return any(key for key in pipfile_entry.keys() if key in VCS_LIST)
elif isinstance(pipfile_entry, six.string_types):
... | python | def is_vcs(pipfile_entry):
# type: (PipfileType) -> bool
"""Determine if dictionary entry from Pipfile is for a vcs dependency."""
if isinstance(pipfile_entry, Mapping):
return any(key for key in pipfile_entry.keys() if key in VCS_LIST)
elif isinstance(pipfile_entry, six.string_types):
... | [
"def",
"is_vcs",
"(",
"pipfile_entry",
")",
":",
"# type: (PipfileType) -> bool",
"if",
"isinstance",
"(",
"pipfile_entry",
",",
"Mapping",
")",
":",
"return",
"any",
"(",
"key",
"for",
"key",
"in",
"pipfile_entry",
".",
"keys",
"(",
")",
"if",
"key",
"in",
... | Determine if dictionary entry from Pipfile is for a vcs dependency. | [
"Determine",
"if",
"dictionary",
"entry",
"from",
"Pipfile",
"is",
"for",
"a",
"vcs",
"dependency",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L148-L160 |
24,927 | pypa/pipenv | pipenv/vendor/requirementslib/utils.py | multi_split | def multi_split(s, split):
# type: (S, Iterable[S]) -> List[S]
"""Splits on multiple given separators."""
for r in split:
s = s.replace(r, "|")
return [i for i in s.split("|") if len(i) > 0] | python | def multi_split(s, split):
# type: (S, Iterable[S]) -> List[S]
"""Splits on multiple given separators."""
for r in split:
s = s.replace(r, "|")
return [i for i in s.split("|") if len(i) > 0] | [
"def",
"multi_split",
"(",
"s",
",",
"split",
")",
":",
"# type: (S, Iterable[S]) -> List[S]",
"for",
"r",
"in",
"split",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"r",
",",
"\"|\"",
")",
"return",
"[",
"i",
"for",
"i",
"in",
"s",
".",
"split",
"(",
... | Splits on multiple given separators. | [
"Splits",
"on",
"multiple",
"given",
"separators",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L172-L177 |
24,928 | pypa/pipenv | pipenv/vendor/requirementslib/utils.py | convert_entry_to_path | def convert_entry_to_path(path):
# type: (Dict[S, Union[S, bool, Tuple[S], List[S]]]) -> S
"""Convert a pipfile entry to a string"""
if not isinstance(path, Mapping):
raise TypeError("expecting a mapping, received {0!r}".format(path))
if not any(key in path for key in ["file", "path"]):
... | python | def convert_entry_to_path(path):
# type: (Dict[S, Union[S, bool, Tuple[S], List[S]]]) -> S
"""Convert a pipfile entry to a string"""
if not isinstance(path, Mapping):
raise TypeError("expecting a mapping, received {0!r}".format(path))
if not any(key in path for key in ["file", "path"]):
... | [
"def",
"convert_entry_to_path",
"(",
"path",
")",
":",
"# type: (Dict[S, Union[S, bool, Tuple[S], List[S]]]) -> S",
"if",
"not",
"isinstance",
"(",
"path",
",",
"Mapping",
")",
":",
"raise",
"TypeError",
"(",
"\"expecting a mapping, received {0!r}\"",
".",
"format",
"(",
... | Convert a pipfile entry to a string | [
"Convert",
"a",
"pipfile",
"entry",
"to",
"a",
"string"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L187-L202 |
24,929 | pypa/pipenv | pipenv/patched/notpip/_internal/exceptions.py | HashMismatch._hash_comparison | def _hash_comparison(self):
"""
Return a comparison of actual and expected hash values.
Example::
Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
or 123451234512345123451234512345123451234512345
Got bcdefbcdefb... | python | def _hash_comparison(self):
"""
Return a comparison of actual and expected hash values.
Example::
Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
or 123451234512345123451234512345123451234512345
Got bcdefbcdefb... | [
"def",
"_hash_comparison",
"(",
"self",
")",
":",
"def",
"hash_then_or",
"(",
"hash_name",
")",
":",
"# For now, all the decent hashes have 6-char names, so we can get",
"# away with hard-coding space literals.",
"return",
"chain",
"(",
"[",
"hash_name",
"]",
",",
"repeat",... | Return a comparison of actual and expected hash values.
Example::
Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
or 123451234512345123451234512345123451234512345
Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef | [
"Return",
"a",
"comparison",
"of",
"actual",
"and",
"expected",
"hash",
"values",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/exceptions.py#L226-L250 |
24,930 | pypa/pipenv | pipenv/vendor/chardet/universaldetector.py | UniversalDetector.feed | def feed(self, byte_str):
"""
Takes a chunk of a document and feeds it through all of the relevant
charset probers.
After calling ``feed``, you can check the value of the ``done``
attribute to see if you need to continue feeding the
``UniversalDetector`` more data, or if... | python | def feed(self, byte_str):
"""
Takes a chunk of a document and feeds it through all of the relevant
charset probers.
After calling ``feed``, you can check the value of the ``done``
attribute to see if you need to continue feeding the
``UniversalDetector`` more data, or if... | [
"def",
"feed",
"(",
"self",
",",
"byte_str",
")",
":",
"if",
"self",
".",
"done",
":",
"return",
"if",
"not",
"len",
"(",
"byte_str",
")",
":",
"return",
"if",
"not",
"isinstance",
"(",
"byte_str",
",",
"bytearray",
")",
":",
"byte_str",
"=",
"bytear... | Takes a chunk of a document and feeds it through all of the relevant
charset probers.
After calling ``feed``, you can check the value of the ``done``
attribute to see if you need to continue feeding the
``UniversalDetector`` more data, or if it has made a prediction
(in the ``re... | [
"Takes",
"a",
"chunk",
"of",
"a",
"document",
"and",
"feeds",
"it",
"through",
"all",
"of",
"the",
"relevant",
"charset",
"probers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/universaldetector.py#L111-L218 |
24,931 | pypa/pipenv | pipenv/vendor/chardet/universaldetector.py | UniversalDetector.close | def close(self):
"""
Stop analyzing the current document and come up with a final
prediction.
:returns: The ``result`` attribute, a ``dict`` with the keys
`encoding`, `confidence`, and `language`.
"""
# Don't bother with checks if we're already done
... | python | def close(self):
"""
Stop analyzing the current document and come up with a final
prediction.
:returns: The ``result`` attribute, a ``dict`` with the keys
`encoding`, `confidence`, and `language`.
"""
# Don't bother with checks if we're already done
... | [
"def",
"close",
"(",
"self",
")",
":",
"# Don't bother with checks if we're already done",
"if",
"self",
".",
"done",
":",
"return",
"self",
".",
"result",
"self",
".",
"done",
"=",
"True",
"if",
"not",
"self",
".",
"_got_data",
":",
"self",
".",
"logger",
... | Stop analyzing the current document and come up with a final
prediction.
:returns: The ``result`` attribute, a ``dict`` with the keys
`encoding`, `confidence`, and `language`. | [
"Stop",
"analyzing",
"the",
"current",
"document",
"and",
"come",
"up",
"with",
"a",
"final",
"prediction",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/universaldetector.py#L220-L286 |
24,932 | pypa/pipenv | pipenv/vendor/pexpect/replwrap.py | REPLWrapper.run_command | def run_command(self, command, timeout=-1):
"""Send a command to the REPL, wait for and return output.
:param str command: The command to send. Trailing newlines are not needed.
This should be a complete block of input that will trigger execution;
if a continuation prompt is found a... | python | def run_command(self, command, timeout=-1):
"""Send a command to the REPL, wait for and return output.
:param str command: The command to send. Trailing newlines are not needed.
This should be a complete block of input that will trigger execution;
if a continuation prompt is found a... | [
"def",
"run_command",
"(",
"self",
",",
"command",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"# Split up multiline commands and feed them in bit-by-bit",
"cmdlines",
"=",
"command",
".",
"splitlines",
"(",
")",
"# splitlines ignores trailing newlines - add it back in manuall... | Send a command to the REPL, wait for and return output.
:param str command: The command to send. Trailing newlines are not needed.
This should be a complete block of input that will trigger execution;
if a continuation prompt is found after sending input, :exc:`ValueError`
will be... | [
"Send",
"a",
"command",
"to",
"the",
"REPL",
"wait",
"for",
"and",
"return",
"output",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/replwrap.py#L68-L101 |
24,933 | pypa/pipenv | pipenv/vendor/click/utils.py | safecall | def safecall(func):
"""Wraps a function so that it swallows exceptions."""
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception:
pass
return wrapper | python | def safecall(func):
"""Wraps a function so that it swallows exceptions."""
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception:
pass
return wrapper | [
"def",
"safecall",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"Exception",
":",
"pass",
"return",
"wrapper"
] | Wraps a function so that it swallows exceptions. | [
"Wraps",
"a",
"function",
"so",
"that",
"it",
"swallows",
"exceptions",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L25-L32 |
24,934 | pypa/pipenv | pipenv/vendor/click/utils.py | make_default_short_help | def make_default_short_help(help, max_length=45):
"""Return a condensed version of help string."""
words = help.split()
total_length = 0
result = []
done = False
for word in words:
if word[-1:] == '.':
done = True
new_length = result and 1 + len(word) or len(word)
... | python | def make_default_short_help(help, max_length=45):
"""Return a condensed version of help string."""
words = help.split()
total_length = 0
result = []
done = False
for word in words:
if word[-1:] == '.':
done = True
new_length = result and 1 + len(word) or len(word)
... | [
"def",
"make_default_short_help",
"(",
"help",
",",
"max_length",
"=",
"45",
")",
":",
"words",
"=",
"help",
".",
"split",
"(",
")",
"total_length",
"=",
"0",
"result",
"=",
"[",
"]",
"done",
"=",
"False",
"for",
"word",
"in",
"words",
":",
"if",
"wo... | Return a condensed version of help string. | [
"Return",
"a",
"condensed",
"version",
"of",
"help",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L45-L67 |
24,935 | pypa/pipenv | pipenv/vendor/click/utils.py | get_binary_stream | def get_binary_stream(name):
"""Returns a system stream for byte processing. This essentially
returns the stream from the sys module with the given name but it
solves some compatibility issues between different Python versions.
Primarily this function is necessary for getting binary streams on
Pyth... | python | def get_binary_stream(name):
"""Returns a system stream for byte processing. This essentially
returns the stream from the sys module with the given name but it
solves some compatibility issues between different Python versions.
Primarily this function is necessary for getting binary streams on
Pyth... | [
"def",
"get_binary_stream",
"(",
"name",
")",
":",
"opener",
"=",
"binary_streams",
".",
"get",
"(",
"name",
")",
"if",
"opener",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'Unknown standard stream %r'",
"%",
"name",
")",
"return",
"opener",
"(",
")"
] | Returns a system stream for byte processing. This essentially
returns the stream from the sys module with the given name but it
solves some compatibility issues between different Python versions.
Primarily this function is necessary for getting binary streams on
Python 3.
:param name: the name of ... | [
"Returns",
"a",
"system",
"stream",
"for",
"byte",
"processing",
".",
"This",
"essentially",
"returns",
"the",
"stream",
"from",
"the",
"sys",
"module",
"with",
"the",
"given",
"name",
"but",
"it",
"solves",
"some",
"compatibility",
"issues",
"between",
"diffe... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L264-L277 |
24,936 | pypa/pipenv | pipenv/vendor/click/utils.py | format_filename | def format_filename(filename, shorten=False):
"""Formats a filename for user display. The main purpose of this
function is to ensure that the filename can be displayed at all. This
will decode the filename to unicode if necessary in a way that it will
not fail. Optionally, it can shorten the filename... | python | def format_filename(filename, shorten=False):
"""Formats a filename for user display. The main purpose of this
function is to ensure that the filename can be displayed at all. This
will decode the filename to unicode if necessary in a way that it will
not fail. Optionally, it can shorten the filename... | [
"def",
"format_filename",
"(",
"filename",
",",
"shorten",
"=",
"False",
")",
":",
"if",
"shorten",
":",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"return",
"filename_to_ui",
"(",
"filename",
")"
] | Formats a filename for user display. The main purpose of this
function is to ensure that the filename can be displayed at all. This
will decode the filename to unicode if necessary in a way that it will
not fail. Optionally, it can shorten the filename to not include the
full path to the filename.
... | [
"Formats",
"a",
"filename",
"for",
"user",
"display",
".",
"The",
"main",
"purpose",
"of",
"this",
"function",
"is",
"to",
"ensure",
"that",
"the",
"filename",
"can",
"be",
"displayed",
"at",
"all",
".",
"This",
"will",
"decode",
"the",
"filename",
"to",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L351-L365 |
24,937 | pypa/pipenv | pipenv/vendor/click/utils.py | get_app_dir | def get_app_dir(app_name, roaming=True, force_posix=False):
r"""Returns the config folder for the application. The default behavior
is to return whatever is most appropriate for the operating system.
To give you an idea, for an app called ``"Foo Bar"``, something like
the following folders could be re... | python | def get_app_dir(app_name, roaming=True, force_posix=False):
r"""Returns the config folder for the application. The default behavior
is to return whatever is most appropriate for the operating system.
To give you an idea, for an app called ``"Foo Bar"``, something like
the following folders could be re... | [
"def",
"get_app_dir",
"(",
"app_name",
",",
"roaming",
"=",
"True",
",",
"force_posix",
"=",
"False",
")",
":",
"if",
"WIN",
":",
"key",
"=",
"roaming",
"and",
"'APPDATA'",
"or",
"'LOCALAPPDATA'",
"folder",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"... | r"""Returns the config folder for the application. The default behavior
is to return whatever is most appropriate for the operating system.
To give you an idea, for an app called ``"Foo Bar"``, something like
the following folders could be returned:
Mac OS X:
``~/Library/Application Support/Foo... | [
"r",
"Returns",
"the",
"config",
"folder",
"for",
"the",
"application",
".",
"The",
"default",
"behavior",
"is",
"to",
"return",
"whatever",
"is",
"most",
"appropriate",
"for",
"the",
"operating",
"system",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L368-L416 |
24,938 | pypa/pipenv | pipenv/vendor/click_completion/lib.py | split_args | def split_args(line):
"""Version of shlex.split that silently accept incomplete strings.
Parameters
----------
line : str
The string to split
Returns
-------
[str]
The line split in separated arguments
"""
lex = shlex.shlex(line, posix=True)
lex.whitespace_split... | python | def split_args(line):
"""Version of shlex.split that silently accept incomplete strings.
Parameters
----------
line : str
The string to split
Returns
-------
[str]
The line split in separated arguments
"""
lex = shlex.shlex(line, posix=True)
lex.whitespace_split... | [
"def",
"split_args",
"(",
"line",
")",
":",
"lex",
"=",
"shlex",
".",
"shlex",
"(",
"line",
",",
"posix",
"=",
"True",
")",
"lex",
".",
"whitespace_split",
"=",
"True",
"lex",
".",
"commenters",
"=",
"''",
"res",
"=",
"[",
"]",
"try",
":",
"while",... | Version of shlex.split that silently accept incomplete strings.
Parameters
----------
line : str
The string to split
Returns
-------
[str]
The line split in separated arguments | [
"Version",
"of",
"shlex",
".",
"split",
"that",
"silently",
"accept",
"incomplete",
"strings",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/lib.py#L94-L120 |
24,939 | pypa/pipenv | pipenv/vendor/click/termui.py | echo_via_pager | def echo_via_pager(text_or_generator, color=None):
"""This function takes a text and shows it via an environment specific
pager on stdout.
.. versionchanged:: 3.0
Added the `color` flag.
:param text_or_generator: the text to page, or alternatively, a
generator emit... | python | def echo_via_pager(text_or_generator, color=None):
"""This function takes a text and shows it via an environment specific
pager on stdout.
.. versionchanged:: 3.0
Added the `color` flag.
:param text_or_generator: the text to page, or alternatively, a
generator emit... | [
"def",
"echo_via_pager",
"(",
"text_or_generator",
",",
"color",
"=",
"None",
")",
":",
"color",
"=",
"resolve_color_default",
"(",
"color",
")",
"if",
"inspect",
".",
"isgeneratorfunction",
"(",
"text_or_generator",
")",
":",
"i",
"=",
"text_or_generator",
"(",... | This function takes a text and shows it via an environment specific
pager on stdout.
.. versionchanged:: 3.0
Added the `color` flag.
:param text_or_generator: the text to page, or alternatively, a
generator emitting the text to page.
:param color: controls if the p... | [
"This",
"function",
"takes",
"a",
"text",
"and",
"shows",
"it",
"via",
"an",
"environment",
"specific",
"pager",
"on",
"stdout",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L232-L258 |
24,940 | pypa/pipenv | pipenv/vendor/click/termui.py | clear | def clear():
"""Clears the terminal screen. This will have the effect of clearing
the whole visible space of the terminal and moving the cursor to the
top left. This does not do anything if not connected to a terminal.
.. versionadded:: 2.0
"""
if not isatty(sys.stdout):
return
# ... | python | def clear():
"""Clears the terminal screen. This will have the effect of clearing
the whole visible space of the terminal and moving the cursor to the
top left. This does not do anything if not connected to a terminal.
.. versionadded:: 2.0
"""
if not isatty(sys.stdout):
return
# ... | [
"def",
"clear",
"(",
")",
":",
"if",
"not",
"isatty",
"(",
"sys",
".",
"stdout",
")",
":",
"return",
"# If we're on Windows and we don't have colorama available, then we",
"# clear the screen by shelling out. Otherwise we can use an escape",
"# sequence.",
"if",
"WIN",
":",
... | Clears the terminal screen. This will have the effect of clearing
the whole visible space of the terminal and moving the cursor to the
top left. This does not do anything if not connected to a terminal.
.. versionadded:: 2.0 | [
"Clears",
"the",
"terminal",
"screen",
".",
"This",
"will",
"have",
"the",
"effect",
"of",
"clearing",
"the",
"whole",
"visible",
"space",
"of",
"the",
"terminal",
"and",
"moving",
"the",
"cursor",
"to",
"the",
"top",
"left",
".",
"This",
"does",
"not",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L354-L369 |
24,941 | pypa/pipenv | pipenv/vendor/click/termui.py | getchar | def getchar(echo=False):
"""Fetches a single character from the terminal and returns it. This
will always return a unicode character and under certain rare
circumstances this might return more than one character. The
situations which more than one character is returned is when for
whatever reason ... | python | def getchar(echo=False):
"""Fetches a single character from the terminal and returns it. This
will always return a unicode character and under certain rare
circumstances this might return more than one character. The
situations which more than one character is returned is when for
whatever reason ... | [
"def",
"getchar",
"(",
"echo",
"=",
"False",
")",
":",
"f",
"=",
"_getchar",
"if",
"f",
"is",
"None",
":",
"from",
".",
"_termui_impl",
"import",
"getchar",
"as",
"f",
"return",
"f",
"(",
"echo",
")"
] | Fetches a single character from the terminal and returns it. This
will always return a unicode character and under certain rare
circumstances this might return more than one character. The
situations which more than one character is returned is when for
whatever reason multiple characters end up in th... | [
"Fetches",
"a",
"single",
"character",
"from",
"the",
"terminal",
"and",
"returns",
"it",
".",
"This",
"will",
"always",
"return",
"a",
"unicode",
"character",
"and",
"under",
"certain",
"rare",
"circumstances",
"this",
"might",
"return",
"more",
"than",
"one"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L549-L572 |
24,942 | pypa/pipenv | pipenv/vendor/click/termui.py | pause | def pause(info='Press any key to continue ...', err=False):
"""This command stops execution and waits for the user to press any
key to continue. This is similar to the Windows batch "pause"
command. If the program is not run through a terminal, this command
will instead do nothing.
.. versionadde... | python | def pause(info='Press any key to continue ...', err=False):
"""This command stops execution and waits for the user to press any
key to continue. This is similar to the Windows batch "pause"
command. If the program is not run through a terminal, this command
will instead do nothing.
.. versionadde... | [
"def",
"pause",
"(",
"info",
"=",
"'Press any key to continue ...'",
",",
"err",
"=",
"False",
")",
":",
"if",
"not",
"isatty",
"(",
"sys",
".",
"stdin",
")",
"or",
"not",
"isatty",
"(",
"sys",
".",
"stdout",
")",
":",
"return",
"try",
":",
"if",
"in... | This command stops execution and waits for the user to press any
key to continue. This is similar to the Windows batch "pause"
command. If the program is not run through a terminal, this command
will instead do nothing.
.. versionadded:: 2.0
.. versionadded:: 4.0
Added the `err` parameter... | [
"This",
"command",
"stops",
"execution",
"and",
"waits",
"for",
"the",
"user",
"to",
"press",
"any",
"key",
"to",
"continue",
".",
"This",
"is",
"similar",
"to",
"the",
"Windows",
"batch",
"pause",
"command",
".",
"If",
"the",
"program",
"is",
"not",
"ru... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L580-L606 |
24,943 | pypa/pipenv | pipenv/vendor/attr/validators.py | optional | def optional(validator):
"""
A validator that makes an attribute optional. An optional attribute is one
which can be set to ``None`` in addition to satisfying the requirements of
the sub-validator.
:param validator: A validator (or a list of validators) that is used for
non-``None`` values... | python | def optional(validator):
"""
A validator that makes an attribute optional. An optional attribute is one
which can be set to ``None`` in addition to satisfying the requirements of
the sub-validator.
:param validator: A validator (or a list of validators) that is used for
non-``None`` values... | [
"def",
"optional",
"(",
"validator",
")",
":",
"if",
"isinstance",
"(",
"validator",
",",
"list",
")",
":",
"return",
"_OptionalValidator",
"(",
"_AndValidator",
"(",
"validator",
")",
")",
"return",
"_OptionalValidator",
"(",
"validator",
")"
] | A validator that makes an attribute optional. An optional attribute is one
which can be set to ``None`` in addition to satisfying the requirements of
the sub-validator.
:param validator: A validator (or a list of validators) that is used for
non-``None`` values.
:type validator: callable or :c... | [
"A",
"validator",
"that",
"makes",
"an",
"attribute",
"optional",
".",
"An",
"optional",
"attribute",
"is",
"one",
"which",
"can",
"be",
"set",
"to",
"None",
"in",
"addition",
"to",
"satisfying",
"the",
"requirements",
"of",
"the",
"sub",
"-",
"validator",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/validators.py#L114-L129 |
24,944 | pypa/pipenv | pipenv/vendor/resolvelib/structs.py | DirectedGraph.copy | def copy(self):
"""Return a shallow copy of this graph.
"""
other = DirectedGraph()
other._vertices = set(self._vertices)
other._forwards = {k: set(v) for k, v in self._forwards.items()}
other._backwards = {k: set(v) for k, v in self._backwards.items()}
return oth... | python | def copy(self):
"""Return a shallow copy of this graph.
"""
other = DirectedGraph()
other._vertices = set(self._vertices)
other._forwards = {k: set(v) for k, v in self._forwards.items()}
other._backwards = {k: set(v) for k, v in self._backwards.items()}
return oth... | [
"def",
"copy",
"(",
"self",
")",
":",
"other",
"=",
"DirectedGraph",
"(",
")",
"other",
".",
"_vertices",
"=",
"set",
"(",
"self",
".",
"_vertices",
")",
"other",
".",
"_forwards",
"=",
"{",
"k",
":",
"set",
"(",
"v",
")",
"for",
"k",
",",
"v",
... | Return a shallow copy of this graph. | [
"Return",
"a",
"shallow",
"copy",
"of",
"this",
"graph",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L18-L25 |
24,945 | pypa/pipenv | pipenv/vendor/resolvelib/structs.py | DirectedGraph.add | def add(self, key):
"""Add a new vertex to the graph.
"""
if key in self._vertices:
raise ValueError('vertex exists')
self._vertices.add(key)
self._forwards[key] = set()
self._backwards[key] = set() | python | def add(self, key):
"""Add a new vertex to the graph.
"""
if key in self._vertices:
raise ValueError('vertex exists')
self._vertices.add(key)
self._forwards[key] = set()
self._backwards[key] = set() | [
"def",
"add",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"_vertices",
":",
"raise",
"ValueError",
"(",
"'vertex exists'",
")",
"self",
".",
"_vertices",
".",
"add",
"(",
"key",
")",
"self",
".",
"_forwards",
"[",
"key",
"]",
... | Add a new vertex to the graph. | [
"Add",
"a",
"new",
"vertex",
"to",
"the",
"graph",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L27-L34 |
24,946 | pypa/pipenv | pipenv/vendor/resolvelib/structs.py | DirectedGraph.connect | def connect(self, f, t):
"""Connect two existing vertices.
Nothing happens if the vertices are already connected.
"""
if t not in self._vertices:
raise KeyError(t)
self._forwards[f].add(t)
self._backwards[t].add(f) | python | def connect(self, f, t):
"""Connect two existing vertices.
Nothing happens if the vertices are already connected.
"""
if t not in self._vertices:
raise KeyError(t)
self._forwards[f].add(t)
self._backwards[t].add(f) | [
"def",
"connect",
"(",
"self",
",",
"f",
",",
"t",
")",
":",
"if",
"t",
"not",
"in",
"self",
".",
"_vertices",
":",
"raise",
"KeyError",
"(",
"t",
")",
"self",
".",
"_forwards",
"[",
"f",
"]",
".",
"add",
"(",
"t",
")",
"self",
".",
"_backwards... | Connect two existing vertices.
Nothing happens if the vertices are already connected. | [
"Connect",
"two",
"existing",
"vertices",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L48-L56 |
24,947 | pypa/pipenv | pipenv/vendor/urllib3/util/ssl_.py | _const_compare_digest_backport | def _const_compare_digest_backport(a, b):
"""
Compare two digests of equal length in constant time.
The digests must be of type str/bytes.
Returns True if the digests match, and False otherwise.
"""
result = abs(len(a) - len(b))
for l, r in zip(bytearray(a), bytearray(b)):
result |=... | python | def _const_compare_digest_backport(a, b):
"""
Compare two digests of equal length in constant time.
The digests must be of type str/bytes.
Returns True if the digests match, and False otherwise.
"""
result = abs(len(a) - len(b))
for l, r in zip(bytearray(a), bytearray(b)):
result |=... | [
"def",
"_const_compare_digest_backport",
"(",
"a",
",",
"b",
")",
":",
"result",
"=",
"abs",
"(",
"len",
"(",
"a",
")",
"-",
"len",
"(",
"b",
")",
")",
"for",
"l",
",",
"r",
"in",
"zip",
"(",
"bytearray",
"(",
"a",
")",
",",
"bytearray",
"(",
"... | Compare two digests of equal length in constant time.
The digests must be of type str/bytes.
Returns True if the digests match, and False otherwise. | [
"Compare",
"two",
"digests",
"of",
"equal",
"length",
"in",
"constant",
"time",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L27-L37 |
24,948 | pypa/pipenv | pipenv/vendor/urllib3/util/ssl_.py | is_ipaddress | def is_ipaddress(hostname):
"""Detects whether the hostname given is an IP address.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise.
"""
if six.PY3 and isinstance(hostname, bytes):
# IDN A-label bytes are ASCII compatible.
ho... | python | def is_ipaddress(hostname):
"""Detects whether the hostname given is an IP address.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise.
"""
if six.PY3 and isinstance(hostname, bytes):
# IDN A-label bytes are ASCII compatible.
ho... | [
"def",
"is_ipaddress",
"(",
"hostname",
")",
":",
"if",
"six",
".",
"PY3",
"and",
"isinstance",
"(",
"hostname",
",",
"bytes",
")",
":",
"# IDN A-label bytes are ASCII compatible.",
"hostname",
"=",
"hostname",
".",
"decode",
"(",
"'ascii'",
")",
"families",
"... | Detects whether the hostname given is an IP address.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise. | [
"Detects",
"whether",
"the",
"hostname",
"given",
"is",
"an",
"IP",
"address",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L360-L381 |
24,949 | pypa/pipenv | pipenv/vendor/urllib3/util/retry.py | Retry.get_retry_after | def get_retry_after(self, response):
""" Get the value of Retry-After in seconds. """
retry_after = response.getheader("Retry-After")
if retry_after is None:
return None
return self.parse_retry_after(retry_after) | python | def get_retry_after(self, response):
""" Get the value of Retry-After in seconds. """
retry_after = response.getheader("Retry-After")
if retry_after is None:
return None
return self.parse_retry_after(retry_after) | [
"def",
"get_retry_after",
"(",
"self",
",",
"response",
")",
":",
"retry_after",
"=",
"response",
".",
"getheader",
"(",
"\"Retry-After\"",
")",
"if",
"retry_after",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"parse_retry_after",
"(",
"retry_a... | Get the value of Retry-After in seconds. | [
"Get",
"the",
"value",
"of",
"Retry",
"-",
"After",
"in",
"seconds",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L243-L251 |
24,950 | pypa/pipenv | pipenv/vendor/urllib3/util/retry.py | Retry.sleep | def sleep(self, response=None):
""" Sleep between retry attempts.
This method will respect a server's ``Retry-After`` response header
and sleep the duration of the time requested. If that is not present, it
will use an exponential backoff. By default, the backoff factor is 0 and
... | python | def sleep(self, response=None):
""" Sleep between retry attempts.
This method will respect a server's ``Retry-After`` response header
and sleep the duration of the time requested. If that is not present, it
will use an exponential backoff. By default, the backoff factor is 0 and
... | [
"def",
"sleep",
"(",
"self",
",",
"response",
"=",
"None",
")",
":",
"if",
"response",
":",
"slept",
"=",
"self",
".",
"sleep_for_retry",
"(",
"response",
")",
"if",
"slept",
":",
"return",
"self",
".",
"_sleep_backoff",
"(",
")"
] | Sleep between retry attempts.
This method will respect a server's ``Retry-After`` response header
and sleep the duration of the time requested. If that is not present, it
will use an exponential backoff. By default, the backoff factor is 0 and
this method will return immediately. | [
"Sleep",
"between",
"retry",
"attempts",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L267-L281 |
24,951 | pypa/pipenv | pipenv/vendor/urllib3/util/retry.py | Retry._is_method_retryable | def _is_method_retryable(self, method):
""" Checks if a given HTTP method should be retried upon, depending if
it is included on the method whitelist.
"""
if self.method_whitelist and method.upper() not in self.method_whitelist:
return False
return True | python | def _is_method_retryable(self, method):
""" Checks if a given HTTP method should be retried upon, depending if
it is included on the method whitelist.
"""
if self.method_whitelist and method.upper() not in self.method_whitelist:
return False
return True | [
"def",
"_is_method_retryable",
"(",
"self",
",",
"method",
")",
":",
"if",
"self",
".",
"method_whitelist",
"and",
"method",
".",
"upper",
"(",
")",
"not",
"in",
"self",
".",
"method_whitelist",
":",
"return",
"False",
"return",
"True"
] | Checks if a given HTTP method should be retried upon, depending if
it is included on the method whitelist. | [
"Checks",
"if",
"a",
"given",
"HTTP",
"method",
"should",
"be",
"retried",
"upon",
"depending",
"if",
"it",
"is",
"included",
"on",
"the",
"method",
"whitelist",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L295-L302 |
24,952 | pypa/pipenv | pipenv/vendor/urllib3/util/retry.py | Retry.is_exhausted | def is_exhausted(self):
""" Are we out of retries? """
retry_counts = (self.total, self.connect, self.read, self.redirect, self.status)
retry_counts = list(filter(None, retry_counts))
if not retry_counts:
return False
return min(retry_counts) < 0 | python | def is_exhausted(self):
""" Are we out of retries? """
retry_counts = (self.total, self.connect, self.read, self.redirect, self.status)
retry_counts = list(filter(None, retry_counts))
if not retry_counts:
return False
return min(retry_counts) < 0 | [
"def",
"is_exhausted",
"(",
"self",
")",
":",
"retry_counts",
"=",
"(",
"self",
".",
"total",
",",
"self",
".",
"connect",
",",
"self",
".",
"read",
",",
"self",
".",
"redirect",
",",
"self",
".",
"status",
")",
"retry_counts",
"=",
"list",
"(",
"fil... | Are we out of retries? | [
"Are",
"we",
"out",
"of",
"retries?"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L320-L327 |
24,953 | pypa/pipenv | pipenv/patched/notpip/_vendor/cachecontrol/adapter.py | CacheControlAdapter.build_response | def build_response(
self, request, response, from_cache=False, cacheable_methods=None
):
"""
Build a response by making a request or using the cache.
This will end up calling send and returning a potentially
cached response
"""
cacheable = cacheable_methods o... | python | def build_response(
self, request, response, from_cache=False, cacheable_methods=None
):
"""
Build a response by making a request or using the cache.
This will end up calling send and returning a potentially
cached response
"""
cacheable = cacheable_methods o... | [
"def",
"build_response",
"(",
"self",
",",
"request",
",",
"response",
",",
"from_cache",
"=",
"False",
",",
"cacheable_methods",
"=",
"None",
")",
":",
"cacheable",
"=",
"cacheable_methods",
"or",
"self",
".",
"cacheable_methods",
"if",
"not",
"from_cache",
"... | Build a response by making a request or using the cache.
This will end up calling send and returning a potentially
cached response | [
"Build",
"a",
"response",
"by",
"making",
"a",
"request",
"or",
"using",
"the",
"cache",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/adapter.py#L57-L129 |
24,954 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | replace_python_tag | def replace_python_tag(wheelname, new_tag):
# type: (str, str) -> str
"""Replace the Python tag in a wheel file name with a new value.
"""
parts = wheelname.split('-')
parts[-3] = new_tag
return '-'.join(parts) | python | def replace_python_tag(wheelname, new_tag):
# type: (str, str) -> str
"""Replace the Python tag in a wheel file name with a new value.
"""
parts = wheelname.split('-')
parts[-3] = new_tag
return '-'.join(parts) | [
"def",
"replace_python_tag",
"(",
"wheelname",
",",
"new_tag",
")",
":",
"# type: (str, str) -> str",
"parts",
"=",
"wheelname",
".",
"split",
"(",
"'-'",
")",
"parts",
"[",
"-",
"3",
"]",
"=",
"new_tag",
"return",
"'-'",
".",
"join",
"(",
"parts",
")"
] | Replace the Python tag in a wheel file name with a new value. | [
"Replace",
"the",
"Python",
"tag",
"in",
"a",
"wheel",
"file",
"name",
"with",
"a",
"new",
"value",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L98-L104 |
24,955 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | message_about_scripts_not_on_PATH | def message_about_scripts_not_on_PATH(scripts):
# type: (Sequence[str]) -> Optional[str]
"""Determine if any scripts are not on PATH and format a warning.
Returns a warning message if one or more scripts are not on PATH,
otherwise None.
"""
if not scripts:
return None
# Group scrip... | python | def message_about_scripts_not_on_PATH(scripts):
# type: (Sequence[str]) -> Optional[str]
"""Determine if any scripts are not on PATH and format a warning.
Returns a warning message if one or more scripts are not on PATH,
otherwise None.
"""
if not scripts:
return None
# Group scrip... | [
"def",
"message_about_scripts_not_on_PATH",
"(",
"scripts",
")",
":",
"# type: (Sequence[str]) -> Optional[str]",
"if",
"not",
"scripts",
":",
"return",
"None",
"# Group scripts by the path they were installed in",
"grouped_by_dir",
"=",
"collections",
".",
"defaultdict",
"(",
... | Determine if any scripts are not on PATH and format a warning.
Returns a warning message if one or more scripts are not on PATH,
otherwise None. | [
"Determine",
"if",
"any",
"scripts",
"are",
"not",
"on",
"PATH",
"and",
"format",
"a",
"warning",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L180-L239 |
24,956 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | sorted_outrows | def sorted_outrows(outrows):
# type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]
"""
Return the given rows of a RECORD file in sorted order.
Each row is a 3-tuple (path, hash, size) and corresponds to a record of
a RECORD file (see PEP 376 and PEP 427 for details). For the rows
passed... | python | def sorted_outrows(outrows):
# type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]
"""
Return the given rows of a RECORD file in sorted order.
Each row is a 3-tuple (path, hash, size) and corresponds to a record of
a RECORD file (see PEP 376 and PEP 427 for details). For the rows
passed... | [
"def",
"sorted_outrows",
"(",
"outrows",
")",
":",
"# type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]",
"# Normally, there should only be one row per path, in which case the",
"# second and third elements don't come into play when sorting.",
"# However, in cases in the wild where a path... | Return the given rows of a RECORD file in sorted order.
Each row is a 3-tuple (path, hash, size) and corresponds to a record of
a RECORD file (see PEP 376 and PEP 427 for details). For the rows
passed to this function, the size can be an integer as an int or string,
or the empty string. | [
"Return",
"the",
"given",
"rows",
"of",
"a",
"RECORD",
"file",
"in",
"sorted",
"order",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L242-L260 |
24,957 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | wheel_version | def wheel_version(source_dir):
# type: (Optional[str]) -> Optional[Tuple[int, ...]]
"""
Return the Wheel-Version of an extracted wheel, if possible.
Otherwise, return None if we couldn't parse / extract it.
"""
try:
dist = [d for d in pkg_resources.find_on_path(None, source_dir)][0]
... | python | def wheel_version(source_dir):
# type: (Optional[str]) -> Optional[Tuple[int, ...]]
"""
Return the Wheel-Version of an extracted wheel, if possible.
Otherwise, return None if we couldn't parse / extract it.
"""
try:
dist = [d for d in pkg_resources.find_on_path(None, source_dir)][0]
... | [
"def",
"wheel_version",
"(",
"source_dir",
")",
":",
"# type: (Optional[str]) -> Optional[Tuple[int, ...]]",
"try",
":",
"dist",
"=",
"[",
"d",
"for",
"d",
"in",
"pkg_resources",
".",
"find_on_path",
"(",
"None",
",",
"source_dir",
")",
"]",
"[",
"0",
"]",
"wh... | Return the Wheel-Version of an extracted wheel, if possible.
Otherwise, return None if we couldn't parse / extract it. | [
"Return",
"the",
"Wheel",
"-",
"Version",
"of",
"an",
"extracted",
"wheel",
"if",
"possible",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L617-L634 |
24,958 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | _contains_egg_info | def _contains_egg_info(
s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
"""Determine whether the string looks like an egg_info.
:param s: The string to parse. E.g. foo-2.1
"""
return bool(_egg_info_re.search(s)) | python | def _contains_egg_info(
s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
"""Determine whether the string looks like an egg_info.
:param s: The string to parse. E.g. foo-2.1
"""
return bool(_egg_info_re.search(s)) | [
"def",
"_contains_egg_info",
"(",
"s",
",",
"_egg_info_re",
"=",
"re",
".",
"compile",
"(",
"r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)'",
",",
"re",
".",
"I",
")",
")",
":",
"return",
"bool",
"(",
"_egg_info_re",
".",
"search",
"(",
"s",
")",
")"
] | Determine whether the string looks like an egg_info.
:param s: The string to parse. E.g. foo-2.1 | [
"Determine",
"whether",
"the",
"string",
"looks",
"like",
"an",
"egg_info",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L727-L733 |
24,959 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | should_use_ephemeral_cache | def should_use_ephemeral_cache(
req, # type: InstallRequirement
format_control, # type: FormatControl
autobuilding, # type: bool
cache_available # type: bool
):
# type: (...) -> Optional[bool]
"""
Return whether to build an InstallRequirement object using the
ephemeral cache.
:p... | python | def should_use_ephemeral_cache(
req, # type: InstallRequirement
format_control, # type: FormatControl
autobuilding, # type: bool
cache_available # type: bool
):
# type: (...) -> Optional[bool]
"""
Return whether to build an InstallRequirement object using the
ephemeral cache.
:p... | [
"def",
"should_use_ephemeral_cache",
"(",
"req",
",",
"# type: InstallRequirement",
"format_control",
",",
"# type: FormatControl",
"autobuilding",
",",
"# type: bool",
"cache_available",
"# type: bool",
")",
":",
"# type: (...) -> Optional[bool]",
"if",
"req",
".",
"constrai... | Return whether to build an InstallRequirement object using the
ephemeral cache.
:param cache_available: whether a cache directory is available for the
autobuilding=True case.
:return: True or False to build the requirement with ephem_cache=True
or False, respectively; or None not to build ... | [
"Return",
"whether",
"to",
"build",
"an",
"InstallRequirement",
"object",
"using",
"the",
"ephemeral",
"cache",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L736-L787 |
24,960 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | format_command | def format_command(
command_args, # type: List[str]
command_output, # type: str
):
# type: (...) -> str
"""
Format command information for logging.
"""
text = 'Command arguments: {}\n'.format(command_args)
if not command_output:
text += 'Command output: None'
elif logger.g... | python | def format_command(
command_args, # type: List[str]
command_output, # type: str
):
# type: (...) -> str
"""
Format command information for logging.
"""
text = 'Command arguments: {}\n'.format(command_args)
if not command_output:
text += 'Command output: None'
elif logger.g... | [
"def",
"format_command",
"(",
"command_args",
",",
"# type: List[str]",
"command_output",
",",
"# type: str",
")",
":",
"# type: (...) -> str",
"text",
"=",
"'Command arguments: {}\\n'",
".",
"format",
"(",
"command_args",
")",
"if",
"not",
"command_output",
":",
"tex... | Format command information for logging. | [
"Format",
"command",
"information",
"for",
"logging",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L790-L812 |
24,961 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | get_legacy_build_wheel_path | def get_legacy_build_wheel_path(
names, # type: List[str]
temp_dir, # type: str
req, # type: InstallRequirement
command_args, # type: List[str]
command_output, # type: str
):
# type: (...) -> Optional[str]
"""
Return the path to the wheel in the temporary build directory.
"""
... | python | def get_legacy_build_wheel_path(
names, # type: List[str]
temp_dir, # type: str
req, # type: InstallRequirement
command_args, # type: List[str]
command_output, # type: str
):
# type: (...) -> Optional[str]
"""
Return the path to the wheel in the temporary build directory.
"""
... | [
"def",
"get_legacy_build_wheel_path",
"(",
"names",
",",
"# type: List[str]",
"temp_dir",
",",
"# type: str",
"req",
",",
"# type: InstallRequirement",
"command_args",
",",
"# type: List[str]",
"command_output",
",",
"# type: str",
")",
":",
"# type: (...) -> Optional[str]",
... | Return the path to the wheel in the temporary build directory. | [
"Return",
"the",
"path",
"to",
"the",
"wheel",
"in",
"the",
"temporary",
"build",
"directory",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L815-L844 |
24,962 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | Wheel.supported | def supported(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> bool
"""Is this wheel supported on this system?"""
if tags is None: # for mock
tags = pep425tags.get_supported()
return bool(set(tags).intersection(self.file_tags)) | python | def supported(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> bool
"""Is this wheel supported on this system?"""
if tags is None: # for mock
tags = pep425tags.get_supported()
return bool(set(tags).intersection(self.file_tags)) | [
"def",
"supported",
"(",
"self",
",",
"tags",
"=",
"None",
")",
":",
"# type: (Optional[List[Pep425Tag]]) -> bool",
"if",
"tags",
"is",
"None",
":",
"# for mock",
"tags",
"=",
"pep425tags",
".",
"get_supported",
"(",
")",
"return",
"bool",
"(",
"set",
"(",
"... | Is this wheel supported on this system? | [
"Is",
"this",
"wheel",
"supported",
"on",
"this",
"system?"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L719-L724 |
24,963 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | WheelBuilder._build_one | def _build_one(self, req, output_dir, python_tag=None):
"""Build one wheel.
:return: The filename of the built wheel, or None if the build failed.
"""
# Install build deps into temporary directory (PEP 518)
with req.build_env:
return self._build_one_inside_env(req, o... | python | def _build_one(self, req, output_dir, python_tag=None):
"""Build one wheel.
:return: The filename of the built wheel, or None if the build failed.
"""
# Install build deps into temporary directory (PEP 518)
with req.build_env:
return self._build_one_inside_env(req, o... | [
"def",
"_build_one",
"(",
"self",
",",
"req",
",",
"output_dir",
",",
"python_tag",
"=",
"None",
")",
":",
"# Install build deps into temporary directory (PEP 518)",
"with",
"req",
".",
"build_env",
":",
"return",
"self",
".",
"_build_one_inside_env",
"(",
"req",
... | Build one wheel.
:return: The filename of the built wheel, or None if the build failed. | [
"Build",
"one",
"wheel",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L870-L878 |
24,964 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | WheelBuilder._build_one_pep517 | def _build_one_pep517(self, req, tempd, python_tag=None):
"""Build one InstallRequirement using the PEP 517 build process.
Returns path to wheel if successfully built. Otherwise, returns None.
"""
assert req.metadata_directory is not None
try:
req.spin_message = 'Bui... | python | def _build_one_pep517(self, req, tempd, python_tag=None):
"""Build one InstallRequirement using the PEP 517 build process.
Returns path to wheel if successfully built. Otherwise, returns None.
"""
assert req.metadata_directory is not None
try:
req.spin_message = 'Bui... | [
"def",
"_build_one_pep517",
"(",
"self",
",",
"req",
",",
"tempd",
",",
"python_tag",
"=",
"None",
")",
":",
"assert",
"req",
".",
"metadata_directory",
"is",
"not",
"None",
"try",
":",
"req",
".",
"spin_message",
"=",
"'Building wheel for %s (PEP 517)'",
"%",... | Build one InstallRequirement using the PEP 517 build process.
Returns path to wheel if successfully built. Otherwise, returns None. | [
"Build",
"one",
"InstallRequirement",
"using",
"the",
"PEP",
"517",
"build",
"process",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L911-L938 |
24,965 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | WheelBuilder._build_one_legacy | def _build_one_legacy(self, req, tempd, python_tag=None):
"""Build one InstallRequirement using the "legacy" build process.
Returns path to wheel if successfully built. Otherwise, returns None.
"""
base_args = self._base_setup_args(req)
spin_message = 'Building wheel for %s (se... | python | def _build_one_legacy(self, req, tempd, python_tag=None):
"""Build one InstallRequirement using the "legacy" build process.
Returns path to wheel if successfully built. Otherwise, returns None.
"""
base_args = self._base_setup_args(req)
spin_message = 'Building wheel for %s (se... | [
"def",
"_build_one_legacy",
"(",
"self",
",",
"req",
",",
"tempd",
",",
"python_tag",
"=",
"None",
")",
":",
"base_args",
"=",
"self",
".",
"_base_setup_args",
"(",
"req",
")",
"spin_message",
"=",
"'Building wheel for %s (setup.py)'",
"%",
"(",
"req",
".",
... | Build one InstallRequirement using the "legacy" build process.
Returns path to wheel if successfully built. Otherwise, returns None. | [
"Build",
"one",
"InstallRequirement",
"using",
"the",
"legacy",
"build",
"process",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L940-L971 |
24,966 | pypa/pipenv | pipenv/patched/notpip/_internal/wheel.py | WheelBuilder.build | def build(
self,
requirements, # type: Iterable[InstallRequirement]
session, # type: PipSession
autobuilding=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Build wheels.
:param unpack: If True, replace the sdist we built from with the
... | python | def build(
self,
requirements, # type: Iterable[InstallRequirement]
session, # type: PipSession
autobuilding=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Build wheels.
:param unpack: If True, replace the sdist we built from with the
... | [
"def",
"build",
"(",
"self",
",",
"requirements",
",",
"# type: Iterable[InstallRequirement]",
"session",
",",
"# type: PipSession",
"autobuilding",
"=",
"False",
"# type: bool",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"buildset",
"=",
"[",
"]",
"format_con... | Build wheels.
:param unpack: If True, replace the sdist we built from with the
newly built wheel, in preparation for installation.
:return: True if all the wheels built correctly. | [
"Build",
"wheels",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L985-L1097 |
24,967 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.read_configuration | def read_configuration(self):
"""
Read the PyPI access configuration as supported by distutils, getting
PyPI to do the actual work. This populates ``username``, ``password``,
``realm`` and ``url`` attributes from the configuration.
"""
# get distutils to do the work
... | python | def read_configuration(self):
"""
Read the PyPI access configuration as supported by distutils, getting
PyPI to do the actual work. This populates ``username``, ``password``,
``realm`` and ``url`` attributes from the configuration.
"""
# get distutils to do the work
... | [
"def",
"read_configuration",
"(",
"self",
")",
":",
"# get distutils to do the work",
"c",
"=",
"self",
".",
"_get_pypirc_command",
"(",
")",
"c",
".",
"repository",
"=",
"self",
".",
"url",
"cfg",
"=",
"c",
".",
"_read_pypirc",
"(",
")",
"self",
".",
"use... | Read the PyPI access configuration as supported by distutils, getting
PyPI to do the actual work. This populates ``username``, ``password``,
``realm`` and ``url`` attributes from the configuration. | [
"Read",
"the",
"PyPI",
"access",
"configuration",
"as",
"supported",
"by",
"distutils",
"getting",
"PyPI",
"to",
"do",
"the",
"actual",
"work",
".",
"This",
"populates",
"username",
"password",
"realm",
"and",
"url",
"attributes",
"from",
"the",
"configuration",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L75-L88 |
24,968 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.save_configuration | def save_configuration(self):
"""
Save the PyPI access configuration. You must have set ``username`` and
``password`` attributes before calling this method.
Again, distutils is used to do the actual work.
"""
self.check_credentials()
# get distutils to do the wor... | python | def save_configuration(self):
"""
Save the PyPI access configuration. You must have set ``username`` and
``password`` attributes before calling this method.
Again, distutils is used to do the actual work.
"""
self.check_credentials()
# get distutils to do the wor... | [
"def",
"save_configuration",
"(",
"self",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"# get distutils to do the work",
"c",
"=",
"self",
".",
"_get_pypirc_command",
"(",
")",
"c",
".",
"_store_pypirc",
"(",
"self",
".",
"username",
",",
"self",
".",... | Save the PyPI access configuration. You must have set ``username`` and
``password`` attributes before calling this method.
Again, distutils is used to do the actual work. | [
"Save",
"the",
"PyPI",
"access",
"configuration",
".",
"You",
"must",
"have",
"set",
"username",
"and",
"password",
"attributes",
"before",
"calling",
"this",
"method",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L90-L100 |
24,969 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.check_credentials | def check_credentials(self):
"""
Check that ``username`` and ``password`` have been set, and raise an
exception if not.
"""
if self.username is None or self.password is None:
raise DistlibException('username and password must be set')
pm = HTTPPasswordMgr()
... | python | def check_credentials(self):
"""
Check that ``username`` and ``password`` have been set, and raise an
exception if not.
"""
if self.username is None or self.password is None:
raise DistlibException('username and password must be set')
pm = HTTPPasswordMgr()
... | [
"def",
"check_credentials",
"(",
"self",
")",
":",
"if",
"self",
".",
"username",
"is",
"None",
"or",
"self",
".",
"password",
"is",
"None",
":",
"raise",
"DistlibException",
"(",
"'username and password must be set'",
")",
"pm",
"=",
"HTTPPasswordMgr",
"(",
"... | Check that ``username`` and ``password`` have been set, and raise an
exception if not. | [
"Check",
"that",
"username",
"and",
"password",
"have",
"been",
"set",
"and",
"raise",
"an",
"exception",
"if",
"not",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L102-L112 |
24,970 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.register | def register(self, metadata):
"""
Register a distribution on PyPI, using the provided metadata.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the distribution to be
registered.
:return: The... | python | def register(self, metadata):
"""
Register a distribution on PyPI, using the provided metadata.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the distribution to be
registered.
:return: The... | [
"def",
"register",
"(",
"self",
",",
"metadata",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"metadata",
".",
"validate",
"(",
")",
"d",
"=",
"metadata",
".",
"todict",
"(",
")",
"d",
"[",
"':action'",
"]",
"=",
"'verify'",
"request",
"=",
... | Register a distribution on PyPI, using the provided metadata.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the distribution to be
registered.
:return: The HTTP response received from PyPI upon submission ... | [
"Register",
"a",
"distribution",
"on",
"PyPI",
"using",
"the",
"provided",
"metadata",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L114-L132 |
24,971 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex._reader | def _reader(self, name, stream, outbuf):
"""
Thread runner for reading lines of from a subprocess into a buffer.
:param name: The logical name of the stream (used for logging only).
:param stream: The stream to read from. This will typically a pipe
connected to th... | python | def _reader(self, name, stream, outbuf):
"""
Thread runner for reading lines of from a subprocess into a buffer.
:param name: The logical name of the stream (used for logging only).
:param stream: The stream to read from. This will typically a pipe
connected to th... | [
"def",
"_reader",
"(",
"self",
",",
"name",
",",
"stream",
",",
"outbuf",
")",
":",
"while",
"True",
":",
"s",
"=",
"stream",
".",
"readline",
"(",
")",
"if",
"not",
"s",
":",
"break",
"s",
"=",
"s",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"rs... | Thread runner for reading lines of from a subprocess into a buffer.
:param name: The logical name of the stream (used for logging only).
:param stream: The stream to read from. This will typically a pipe
connected to the output stream of a subprocess.
:param outbuf: The l... | [
"Thread",
"runner",
"for",
"reading",
"lines",
"of",
"from",
"a",
"subprocess",
"into",
"a",
"buffer",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L134-L150 |
24,972 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.get_sign_command | def get_sign_command(self, filename, signer, sign_password,
keystore=None):
"""
Return a suitable command for signing a file.
:param filename: The pathname to the file to be signed.
:param signer: The identifier of the signer of the file.
:param sign_pas... | python | def get_sign_command(self, filename, signer, sign_password,
keystore=None):
"""
Return a suitable command for signing a file.
:param filename: The pathname to the file to be signed.
:param signer: The identifier of the signer of the file.
:param sign_pas... | [
"def",
"get_sign_command",
"(",
"self",
",",
"filename",
",",
"signer",
",",
"sign_password",
",",
"keystore",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"self",
".",
"gpg",
",",
"'--status-fd'",
",",
"'2'",
",",
"'--no-tty'",
"]",
"if",
"keystore",
"is",
... | Return a suitable command for signing a file.
:param filename: The pathname to the file to be signed.
:param signer: The identifier of the signer of the file.
:param sign_password: The passphrase for the signer's
private key used for signing.
:param keystor... | [
"Return",
"a",
"suitable",
"command",
"for",
"signing",
"a",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L152-L179 |
24,973 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.run_command | def run_command(self, cmd, input_data=None):
"""
Run a command in a child process , passing it any input data specified.
:param cmd: The command to run.
:param input_data: If specified, this must be a byte string containing
data to be sent to the child process... | python | def run_command(self, cmd, input_data=None):
"""
Run a command in a child process , passing it any input data specified.
:param cmd: The command to run.
:param input_data: If specified, this must be a byte string containing
data to be sent to the child process... | [
"def",
"run_command",
"(",
"self",
",",
"cmd",
",",
"input_data",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'stdout'",
":",
"subprocess",
".",
"PIPE",
",",
"'stderr'",
":",
"subprocess",
".",
"PIPE",
",",
"}",
"if",
"input_data",
"is",
"not",
"None",... | Run a command in a child process , passing it any input data specified.
:param cmd: The command to run.
:param input_data: If specified, this must be a byte string containing
data to be sent to the child process.
:return: A tuple consisting of the subprocess' exit cod... | [
"Run",
"a",
"command",
"in",
"a",
"child",
"process",
"passing",
"it",
"any",
"input",
"data",
"specified",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L181-L214 |
24,974 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.sign_file | def sign_file(self, filename, signer, sign_password, keystore=None):
"""
Sign a file.
:param filename: The pathname to the file to be signed.
:param signer: The identifier of the signer of the file.
:param sign_password: The passphrase for the signer's
... | python | def sign_file(self, filename, signer, sign_password, keystore=None):
"""
Sign a file.
:param filename: The pathname to the file to be signed.
:param signer: The identifier of the signer of the file.
:param sign_password: The passphrase for the signer's
... | [
"def",
"sign_file",
"(",
"self",
",",
"filename",
",",
"signer",
",",
"sign_password",
",",
"keystore",
"=",
"None",
")",
":",
"cmd",
",",
"sig_file",
"=",
"self",
".",
"get_sign_command",
"(",
"filename",
",",
"signer",
",",
"sign_password",
",",
"keystor... | Sign a file.
:param filename: The pathname to the file to be signed.
:param signer: The identifier of the signer of the file.
:param sign_password: The passphrase for the signer's
private key used for signing.
:param keystore: The path to a directory which ... | [
"Sign",
"a",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L216-L237 |
24,975 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.upload_documentation | def upload_documentation(self, metadata, doc_dir):
"""
Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_dir: The... | python | def upload_documentation(self, metadata, doc_dir):
"""
Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_dir: The... | [
"def",
"upload_documentation",
"(",
"self",
",",
"metadata",
",",
"doc_dir",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"doc_dir",
")",
":",
"raise",
"DistlibException",
"(",
"'not a directory: %r... | Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_dir: The pathname of the directory which contains the
d... | [
"Upload",
"documentation",
"to",
"the",
"index",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L296-L322 |
24,976 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.get_verify_command | def get_verify_command(self, signature_filename, data_filename,
keystore=None):
"""
Return a suitable command for verifying a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_fil... | python | def get_verify_command(self, signature_filename, data_filename,
keystore=None):
"""
Return a suitable command for verifying a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_fil... | [
"def",
"get_verify_command",
"(",
"self",
",",
"signature_filename",
",",
"data_filename",
",",
"keystore",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"self",
".",
"gpg",
",",
"'--status-fd'",
",",
"'2'",
",",
"'--no-tty'",
"]",
"if",
"keystore",
"is",
"None"... | Return a suitable command for verifying a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_filename: The pathname to the file containing the
signed data.
:param keystore: The path to ... | [
"Return",
"a",
"suitable",
"command",
"for",
"verifying",
"a",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L324-L346 |
24,977 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.verify_signature | def verify_signature(self, signature_filename, data_filename,
keystore=None):
"""
Verify a signature for a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_filename: The pathname t... | python | def verify_signature(self, signature_filename, data_filename,
keystore=None):
"""
Verify a signature for a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_filename: The pathname t... | [
"def",
"verify_signature",
"(",
"self",
",",
"signature_filename",
",",
"data_filename",
",",
"keystore",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"gpg",
":",
"raise",
"DistlibException",
"(",
"'verification unavailable because gpg '",
"'unavailable'",
")",
... | Verify a signature for a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_filename: The pathname to the file containing the
signed data.
:param keystore: The path to a directory which... | [
"Verify",
"a",
"signature",
"for",
"a",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L348-L371 |
24,978 | pypa/pipenv | pipenv/vendor/distlib/index.py | PackageIndex.encode_request | def encode_request(self, fields, files):
"""
Encode fields and files for posting to an HTTP server.
:param fields: The fields to send as a list of (fieldname, value)
tuples.
:param files: The files to send as a list of (fieldname, filename,
f... | python | def encode_request(self, fields, files):
"""
Encode fields and files for posting to an HTTP server.
:param fields: The fields to send as a list of (fieldname, value)
tuples.
:param files: The files to send as a list of (fieldname, filename,
f... | [
"def",
"encode_request",
"(",
"self",
",",
"fields",
",",
"files",
")",
":",
"# Adapted from packaging, which in turn was adapted from",
"# http://code.activestate.com/recipes/146306",
"parts",
"=",
"[",
"]",
"boundary",
"=",
"self",
".",
"boundary",
"for",
"k",
",",
... | Encode fields and files for posting to an HTTP server.
:param fields: The fields to send as a list of (fieldname, value)
tuples.
:param files: The files to send as a list of (fieldname, filename,
file_bytes) tuple. | [
"Encode",
"fields",
"and",
"files",
"for",
"posting",
"to",
"an",
"HTTP",
"server",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L466-L507 |
24,979 | pypa/pipenv | pipenv/vendor/click_completion/core.py | do_bash_complete | def do_bash_complete(cli, prog_name):
"""Do the completion for bash
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, F... | python | def do_bash_complete(cli, prog_name):
"""Do the completion for bash
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, F... | [
"def",
"do_bash_complete",
"(",
"cli",
",",
"prog_name",
")",
":",
"comp_words",
"=",
"os",
".",
"environ",
"[",
"'COMP_WORDS'",
"]",
"try",
":",
"cwords",
"=",
"shlex",
".",
"split",
"(",
"comp_words",
")",
"quoted",
"=",
"False",
"except",
"ValueError",
... | Do the completion for bash
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, False otherwise | [
"Do",
"the",
"completion",
"for",
"bash"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L141-L176 |
24,980 | pypa/pipenv | pipenv/vendor/click_completion/core.py | do_fish_complete | def do_fish_complete(cli, prog_name):
"""Do the fish completion
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, False... | python | def do_fish_complete(cli, prog_name):
"""Do the fish completion
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, False... | [
"def",
"do_fish_complete",
"(",
"cli",
",",
"prog_name",
")",
":",
"commandline",
"=",
"os",
".",
"environ",
"[",
"'COMMANDLINE'",
"]",
"args",
"=",
"split_args",
"(",
"commandline",
")",
"[",
"1",
":",
"]",
"if",
"args",
"and",
"not",
"commandline",
"."... | Do the fish completion
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, False otherwise | [
"Do",
"the",
"fish",
"completion"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L179-L208 |
24,981 | pypa/pipenv | pipenv/vendor/click_completion/core.py | do_powershell_complete | def do_powershell_complete(cli, prog_name):
"""Do the powershell completion
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was succe... | python | def do_powershell_complete(cli, prog_name):
"""Do the powershell completion
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was succe... | [
"def",
"do_powershell_complete",
"(",
"cli",
",",
"prog_name",
")",
":",
"commandline",
"=",
"os",
".",
"environ",
"[",
"'COMMANDLINE'",
"]",
"args",
"=",
"split_args",
"(",
"commandline",
")",
"[",
"1",
":",
"]",
"quote",
"=",
"single_quote",
"incomplete",
... | Do the powershell completion
Parameters
----------
cli : click.Command
The main click Command of the program
prog_name : str
The program name on the command line
Returns
-------
bool
True if the completion was successful, False otherwise | [
"Do",
"the",
"powershell",
"completion"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L250-L279 |
24,982 | pypa/pipenv | pipenv/vendor/click_completion/core.py | get_code | def get_code(shell=None, prog_name=None, env_name=None, extra_env=None):
"""Returns the completion code to be evaluated by the shell
Parameters
----------
shell : Shell
The shell type (Default value = None)
prog_name : str
The program name on the command line (Default value = None)
... | python | def get_code(shell=None, prog_name=None, env_name=None, extra_env=None):
"""Returns the completion code to be evaluated by the shell
Parameters
----------
shell : Shell
The shell type (Default value = None)
prog_name : str
The program name on the command line (Default value = None)
... | [
"def",
"get_code",
"(",
"shell",
"=",
"None",
",",
"prog_name",
"=",
"None",
",",
"env_name",
"=",
"None",
",",
"extra_env",
"=",
"None",
")",
":",
"from",
"jinja2",
"import",
"Environment",
",",
"FileSystemLoader",
"if",
"shell",
"in",
"[",
"None",
",",... | Returns the completion code to be evaluated by the shell
Parameters
----------
shell : Shell
The shell type (Default value = None)
prog_name : str
The program name on the command line (Default value = None)
env_name : str
The environment variable used to control the completi... | [
"Returns",
"the",
"completion",
"code",
"to",
"be",
"evaluated",
"by",
"the",
"shell"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L282-L311 |
24,983 | pypa/pipenv | pipenv/vendor/click_completion/core.py | install | def install(shell=None, prog_name=None, env_name=None, path=None, append=None, extra_env=None):
"""Install the completion
Parameters
----------
shell : Shell
The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None)
prog_name : str
... | python | def install(shell=None, prog_name=None, env_name=None, path=None, append=None, extra_env=None):
"""Install the completion
Parameters
----------
shell : Shell
The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None)
prog_name : str
... | [
"def",
"install",
"(",
"shell",
"=",
"None",
",",
"prog_name",
"=",
"None",
",",
"env_name",
"=",
"None",
",",
"path",
"=",
"None",
",",
"append",
"=",
"None",
",",
"extra_env",
"=",
"None",
")",
":",
"prog_name",
"=",
"prog_name",
"or",
"click",
"."... | Install the completion
Parameters
----------
shell : Shell
The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None)
prog_name : str
The program name on the command line. It will be automatically computed if the value is None
(... | [
"Install",
"the",
"completion"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L314-L377 |
24,984 | pypa/pipenv | pipenv/vendor/urllib3/filepost.py | choose_boundary | def choose_boundary():
"""
Our embarrassingly-simple replacement for mimetools.choose_boundary.
"""
boundary = binascii.hexlify(os.urandom(16))
if six.PY3:
boundary = boundary.decode('ascii')
return boundary | python | def choose_boundary():
"""
Our embarrassingly-simple replacement for mimetools.choose_boundary.
"""
boundary = binascii.hexlify(os.urandom(16))
if six.PY3:
boundary = boundary.decode('ascii')
return boundary | [
"def",
"choose_boundary",
"(",
")",
":",
"boundary",
"=",
"binascii",
".",
"hexlify",
"(",
"os",
".",
"urandom",
"(",
"16",
")",
")",
"if",
"six",
".",
"PY3",
":",
"boundary",
"=",
"boundary",
".",
"decode",
"(",
"'ascii'",
")",
"return",
"boundary"
] | Our embarrassingly-simple replacement for mimetools.choose_boundary. | [
"Our",
"embarrassingly",
"-",
"simple",
"replacement",
"for",
"mimetools",
".",
"choose_boundary",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L15-L22 |
24,985 | pypa/pipenv | pipenv/vendor/urllib3/filepost.py | iter_field_objects | def iter_field_objects(fields):
"""
Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
:class:`~urllib3.fields.RequestField`.
"""
if isinstance(fields, dict):
i = six.iteritems(fields)
else:
i = iter(fields)
for field in i:
if isinstanc... | python | def iter_field_objects(fields):
"""
Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
:class:`~urllib3.fields.RequestField`.
"""
if isinstance(fields, dict):
i = six.iteritems(fields)
else:
i = iter(fields)
for field in i:
if isinstanc... | [
"def",
"iter_field_objects",
"(",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"dict",
")",
":",
"i",
"=",
"six",
".",
"iteritems",
"(",
"fields",
")",
"else",
":",
"i",
"=",
"iter",
"(",
"fields",
")",
"for",
"field",
"in",
"i",
":"... | Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
:class:`~urllib3.fields.RequestField`. | [
"Iterate",
"over",
"fields",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L25-L42 |
24,986 | pypa/pipenv | pipenv/vendor/distlib/resources.py | finder_for_path | def finder_for_path(path):
"""
Return a resource finder for a path, which should represent a container.
:param path: The path.
:return: A :class:`ResourceFinder` instance for the path.
"""
result = None
# calls any path hooks, gets importer into cache
pkgutil.get_importer(path)
load... | python | def finder_for_path(path):
"""
Return a resource finder for a path, which should represent a container.
:param path: The path.
:return: A :class:`ResourceFinder` instance for the path.
"""
result = None
# calls any path hooks, gets importer into cache
pkgutil.get_importer(path)
load... | [
"def",
"finder_for_path",
"(",
"path",
")",
":",
"result",
"=",
"None",
"# calls any path hooks, gets importer into cache",
"pkgutil",
".",
"get_importer",
"(",
"path",
")",
"loader",
"=",
"sys",
".",
"path_importer_cache",
".",
"get",
"(",
"path",
")",
"finder",
... | Return a resource finder for a path, which should represent a container.
:param path: The path.
:return: A :class:`ResourceFinder` instance for the path. | [
"Return",
"a",
"resource",
"finder",
"for",
"a",
"path",
"which",
"should",
"represent",
"a",
"container",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L338-L355 |
24,987 | pypa/pipenv | pipenv/vendor/distlib/resources.py | ResourceCache.get | def get(self, resource):
"""
Get a resource into the cache,
:param resource: A :class:`Resource` instance.
:return: The pathname of the resource in the cache.
"""
prefix, path = resource.finder.get_cache_info(resource)
if prefix is None:
result = path... | python | def get(self, resource):
"""
Get a resource into the cache,
:param resource: A :class:`Resource` instance.
:return: The pathname of the resource in the cache.
"""
prefix, path = resource.finder.get_cache_info(resource)
if prefix is None:
result = path... | [
"def",
"get",
"(",
"self",
",",
"resource",
")",
":",
"prefix",
",",
"path",
"=",
"resource",
".",
"finder",
".",
"get_cache_info",
"(",
"resource",
")",
"if",
"prefix",
"is",
"None",
":",
"result",
"=",
"path",
"else",
":",
"result",
"=",
"os",
".",... | Get a resource into the cache,
:param resource: A :class:`Resource` instance.
:return: The pathname of the resource in the cache. | [
"Get",
"a",
"resource",
"into",
"the",
"cache"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L46-L69 |
24,988 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py | to_sax | def to_sax(walker, handler):
"""Call SAX-like content handler based on treewalker walker
:arg walker: the treewalker to use to walk the tree to convert it
:arg handler: SAX handler to use
"""
handler.startDocument()
for prefix, namespace in prefix_mapping.items():
handler.startPrefixM... | python | def to_sax(walker, handler):
"""Call SAX-like content handler based on treewalker walker
:arg walker: the treewalker to use to walk the tree to convert it
:arg handler: SAX handler to use
"""
handler.startDocument()
for prefix, namespace in prefix_mapping.items():
handler.startPrefixM... | [
"def",
"to_sax",
"(",
"walker",
",",
"handler",
")",
":",
"handler",
".",
"startDocument",
"(",
")",
"for",
"prefix",
",",
"namespace",
"in",
"prefix_mapping",
".",
"items",
"(",
")",
":",
"handler",
".",
"startPrefixMapping",
"(",
"prefix",
",",
"namespac... | Call SAX-like content handler based on treewalker walker
:arg walker: the treewalker to use to walk the tree to convert it
:arg handler: SAX handler to use | [
"Call",
"SAX",
"-",
"like",
"content",
"handler",
"based",
"on",
"treewalker",
"walker"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py#L13-L50 |
24,989 | pypa/pipenv | pipenv/patched/notpip/_vendor/retrying.py | retry | def retry(*dargs, **dkw):
"""
Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object
"""
# support both @retry and @retry() as valid syntax
if len(dargs) == 1 and cal... | python | def retry(*dargs, **dkw):
"""
Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object
"""
# support both @retry and @retry() as valid syntax
if len(dargs) == 1 and cal... | [
"def",
"retry",
"(",
"*",
"dargs",
",",
"*",
"*",
"dkw",
")",
":",
"# support both @retry and @retry() as valid syntax",
"if",
"len",
"(",
"dargs",
")",
"==",
"1",
"and",
"callable",
"(",
"dargs",
"[",
"0",
"]",
")",
":",
"def",
"wrap_simple",
"(",
"f",
... | Decorator function that instantiates the Retrying object
@param *dargs: positional arguments passed to Retrying object
@param **dkw: keyword arguments passed to the Retrying object | [
"Decorator",
"function",
"that",
"instantiates",
"the",
"Retrying",
"object"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L26-L53 |
24,990 | pypa/pipenv | pipenv/patched/notpip/_vendor/retrying.py | Retrying.random_sleep | def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms):
"""Sleep a random amount of time between wait_random_min and wait_random_max"""
return random.randint(self._wait_random_min, self._wait_random_max) | python | def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms):
"""Sleep a random amount of time between wait_random_min and wait_random_max"""
return random.randint(self._wait_random_min, self._wait_random_max) | [
"def",
"random_sleep",
"(",
"self",
",",
"previous_attempt_number",
",",
"delay_since_first_attempt_ms",
")",
":",
"return",
"random",
".",
"randint",
"(",
"self",
".",
"_wait_random_min",
",",
"self",
".",
"_wait_random_max",
")"
] | Sleep a random amount of time between wait_random_min and wait_random_max | [
"Sleep",
"a",
"random",
"amount",
"of",
"time",
"between",
"wait_random_min",
"and",
"wait_random_max"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L157-L159 |
24,991 | pypa/pipenv | pipenv/patched/notpip/_vendor/retrying.py | Attempt.get | def get(self, wrap_exception=False):
"""
Return the return value of this Attempt instance or raise an Exception.
If wrap_exception is true, this Attempt is wrapped inside of a
RetryError before being raised.
"""
if self.has_exception:
if wrap_exception:
... | python | def get(self, wrap_exception=False):
"""
Return the return value of this Attempt instance or raise an Exception.
If wrap_exception is true, this Attempt is wrapped inside of a
RetryError before being raised.
"""
if self.has_exception:
if wrap_exception:
... | [
"def",
"get",
"(",
"self",
",",
"wrap_exception",
"=",
"False",
")",
":",
"if",
"self",
".",
"has_exception",
":",
"if",
"wrap_exception",
":",
"raise",
"RetryError",
"(",
"self",
")",
"else",
":",
"six",
".",
"reraise",
"(",
"self",
".",
"value",
"[",... | Return the return value of this Attempt instance or raise an Exception.
If wrap_exception is true, this Attempt is wrapped inside of a
RetryError before being raised. | [
"Return",
"the",
"return",
"value",
"of",
"this",
"Attempt",
"instance",
"or",
"raise",
"an",
"Exception",
".",
"If",
"wrap_exception",
"is",
"true",
"this",
"Attempt",
"is",
"wrapped",
"inside",
"of",
"a",
"RetryError",
"before",
"being",
"raised",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L237-L249 |
24,992 | pypa/pipenv | pipenv/vendor/jinja2/sandbox.py | SandboxedEnvironment.unsafe_undefined | def unsafe_undefined(self, obj, attribute):
"""Return an undefined object for unsafe attributes."""
return self.undefined('access to attribute %r of %r '
'object is unsafe.' % (
attribute,
obj.__class__.__name__
), name=attribute, obj=obj, ex... | python | def unsafe_undefined(self, obj, attribute):
"""Return an undefined object for unsafe attributes."""
return self.undefined('access to attribute %r of %r '
'object is unsafe.' % (
attribute,
obj.__class__.__name__
), name=attribute, obj=obj, ex... | [
"def",
"unsafe_undefined",
"(",
"self",
",",
"obj",
",",
"attribute",
")",
":",
"return",
"self",
".",
"undefined",
"(",
"'access to attribute %r of %r '",
"'object is unsafe.'",
"%",
"(",
"attribute",
",",
"obj",
".",
"__class__",
".",
"__name__",
")",
",",
"... | Return an undefined object for unsafe attributes. | [
"Return",
"an",
"undefined",
"object",
"for",
"unsafe",
"attributes",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L397-L403 |
24,993 | pypa/pipenv | pipenv/vendor/jinja2/sandbox.py | SandboxedEnvironment.format_string | def format_string(self, s, args, kwargs):
"""If a format call is detected, then this is routed through this
method so that our safety sandbox can be used for it.
"""
if isinstance(s, Markup):
formatter = SandboxedEscapeFormatter(self, s.escape)
else:
forma... | python | def format_string(self, s, args, kwargs):
"""If a format call is detected, then this is routed through this
method so that our safety sandbox can be used for it.
"""
if isinstance(s, Markup):
formatter = SandboxedEscapeFormatter(self, s.escape)
else:
forma... | [
"def",
"format_string",
"(",
"self",
",",
"s",
",",
"args",
",",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"Markup",
")",
":",
"formatter",
"=",
"SandboxedEscapeFormatter",
"(",
"self",
",",
"s",
".",
"escape",
")",
"else",
":",
"formatter... | If a format call is detected, then this is routed through this
method so that our safety sandbox can be used for it. | [
"If",
"a",
"format",
"call",
"is",
"detected",
"then",
"this",
"is",
"routed",
"through",
"this",
"method",
"so",
"that",
"our",
"safety",
"sandbox",
"can",
"be",
"used",
"for",
"it",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L405-L415 |
24,994 | pypa/pipenv | pipenv/vendor/attr/_make.py | attrib | def attrib(
default=NOTHING,
validator=None,
repr=True,
cmp=True,
hash=None,
init=True,
convert=None,
metadata=None,
type=None,
converter=None,
factory=None,
kw_only=False,
):
"""
Create a new attribute on a class.
.. warning::
Does *not* do anythin... | python | def attrib(
default=NOTHING,
validator=None,
repr=True,
cmp=True,
hash=None,
init=True,
convert=None,
metadata=None,
type=None,
converter=None,
factory=None,
kw_only=False,
):
"""
Create a new attribute on a class.
.. warning::
Does *not* do anythin... | [
"def",
"attrib",
"(",
"default",
"=",
"NOTHING",
",",
"validator",
"=",
"None",
",",
"repr",
"=",
"True",
",",
"cmp",
"=",
"True",
",",
"hash",
"=",
"None",
",",
"init",
"=",
"True",
",",
"convert",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
... | Create a new attribute on a class.
.. warning::
Does *not* do anything unless the class is also decorated with
:func:`attr.s`!
:param default: A value that is used if an ``attrs``-generated ``__init__``
is used and no value is passed while instantiating or the attribute is
ex... | [
"Create",
"a",
"new",
"attribute",
"on",
"a",
"class",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L70-L219 |
24,995 | pypa/pipenv | pipenv/vendor/attr/_make.py | _make_attr_tuple_class | def _make_attr_tuple_class(cls_name, attr_names):
"""
Create a tuple subclass to hold `Attribute`s for an `attrs` class.
The subclass is a bare tuple with properties for names.
class MyClassAttributes(tuple):
__slots__ = ()
x = property(itemgetter(0))
"""
attr_class_name = "{}A... | python | def _make_attr_tuple_class(cls_name, attr_names):
"""
Create a tuple subclass to hold `Attribute`s for an `attrs` class.
The subclass is a bare tuple with properties for names.
class MyClassAttributes(tuple):
__slots__ = ()
x = property(itemgetter(0))
"""
attr_class_name = "{}A... | [
"def",
"_make_attr_tuple_class",
"(",
"cls_name",
",",
"attr_names",
")",
":",
"attr_class_name",
"=",
"\"{}Attributes\"",
".",
"format",
"(",
"cls_name",
")",
"attr_class_template",
"=",
"[",
"\"class {}(tuple):\"",
".",
"format",
"(",
"attr_class_name",
")",
",",
... | Create a tuple subclass to hold `Attribute`s for an `attrs` class.
The subclass is a bare tuple with properties for names.
class MyClassAttributes(tuple):
__slots__ = ()
x = property(itemgetter(0)) | [
"Create",
"a",
"tuple",
"subclass",
"to",
"hold",
"Attribute",
"s",
"for",
"an",
"attrs",
"class",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L222-L247 |
24,996 | pypa/pipenv | pipenv/vendor/attr/_make.py | fields | def fields(cls):
"""
Return the tuple of ``attrs`` attributes for a class.
The tuple also allows accessing the fields by their names (see below for
examples).
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:raise attr.exceptions.NotAnAttrsClassError: If *... | python | def fields(cls):
"""
Return the tuple of ``attrs`` attributes for a class.
The tuple also allows accessing the fields by their names (see below for
examples).
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:raise attr.exceptions.NotAnAttrsClassError: If *... | [
"def",
"fields",
"(",
"cls",
")",
":",
"if",
"not",
"isclass",
"(",
"cls",
")",
":",
"raise",
"TypeError",
"(",
"\"Passed object must be a class.\"",
")",
"attrs",
"=",
"getattr",
"(",
"cls",
",",
"\"__attrs_attrs__\"",
",",
"None",
")",
"if",
"attrs",
"is... | Return the tuple of ``attrs`` attributes for a class.
The tuple also allows accessing the fields by their names (see below for
examples).
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
... | [
"Return",
"the",
"tuple",
"of",
"attrs",
"attributes",
"for",
"a",
"class",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1311-L1336 |
24,997 | pypa/pipenv | pipenv/vendor/attr/_make.py | fields_dict | def fields_dict(cls):
"""
Return an ordered dictionary of ``attrs`` attributes for a class, whose
keys are the attribute names.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
cla... | python | def fields_dict(cls):
"""
Return an ordered dictionary of ``attrs`` attributes for a class, whose
keys are the attribute names.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
cla... | [
"def",
"fields_dict",
"(",
"cls",
")",
":",
"if",
"not",
"isclass",
"(",
"cls",
")",
":",
"raise",
"TypeError",
"(",
"\"Passed object must be a class.\"",
")",
"attrs",
"=",
"getattr",
"(",
"cls",
",",
"\"__attrs_attrs__\"",
",",
"None",
")",
"if",
"attrs",
... | Return an ordered dictionary of ``attrs`` attributes for a class, whose
keys are the attribute names.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
class.
:rtype: an ordered dict w... | [
"Return",
"an",
"ordered",
"dictionary",
"of",
"attrs",
"attributes",
"for",
"a",
"class",
"whose",
"keys",
"are",
"the",
"attribute",
"names",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1339-L1364 |
24,998 | pypa/pipenv | pipenv/vendor/attr/_make.py | and_ | def and_(*validators):
"""
A validator that composes multiple validators into one.
When called on a value, it runs all wrapped validators.
:param validators: Arbitrary number of validators.
:type validators: callables
.. versionadded:: 17.1.0
"""
vals = []
for validator in validat... | python | def and_(*validators):
"""
A validator that composes multiple validators into one.
When called on a value, it runs all wrapped validators.
:param validators: Arbitrary number of validators.
:type validators: callables
.. versionadded:: 17.1.0
"""
vals = []
for validator in validat... | [
"def",
"and_",
"(",
"*",
"validators",
")",
":",
"vals",
"=",
"[",
"]",
"for",
"validator",
"in",
"validators",
":",
"vals",
".",
"extend",
"(",
"validator",
".",
"_validators",
"if",
"isinstance",
"(",
"validator",
",",
"_AndValidator",
")",
"else",
"["... | A validator that composes multiple validators into one.
When called on a value, it runs all wrapped validators.
:param validators: Arbitrary number of validators.
:type validators: callables
.. versionadded:: 17.1.0 | [
"A",
"validator",
"that",
"composes",
"multiple",
"validators",
"into",
"one",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L2067-L2086 |
24,999 | pypa/pipenv | pipenv/vendor/attr/_make.py | _ClassBuilder._patch_original_class | def _patch_original_class(self):
"""
Apply accumulated methods and return the class.
"""
cls = self._cls
base_names = self._base_names
# Clean class of attribute definitions (`attr.ib()`s).
if self._delete_attribs:
for name in self._attr_names:
... | python | def _patch_original_class(self):
"""
Apply accumulated methods and return the class.
"""
cls = self._cls
base_names = self._base_names
# Clean class of attribute definitions (`attr.ib()`s).
if self._delete_attribs:
for name in self._attr_names:
... | [
"def",
"_patch_original_class",
"(",
"self",
")",
":",
"cls",
"=",
"self",
".",
"_cls",
"base_names",
"=",
"self",
".",
"_base_names",
"# Clean class of attribute definitions (`attr.ib()`s).",
"if",
"self",
".",
"_delete_attribs",
":",
"for",
"name",
"in",
"self",
... | Apply accumulated methods and return the class. | [
"Apply",
"accumulated",
"methods",
"and",
"return",
"the",
"class",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L509-L555 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.