partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | translate_markers | 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... | pipenv/utils.py | 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):
"""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... | [
"Take",
"a",
"pipfile",
"entry",
"and",
"normalize",
"its",
"markers"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1597-L1633 | [
"def",
"translate_markers",
"(",
"pipfile_entry",
")",
":",
"if",
"not",
"isinstance",
"(",
"pipfile_entry",
",",
"Mapping",
")",
":",
"raise",
"TypeError",
"(",
"\"Entry is not a pipfile formatted mapping.\"",
")",
"from",
".",
"vendor",
".",
"distlib",
".",
"mar... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_virtual_environment | 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. | pipenv/utils.py | 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):
"""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... | [
"Check",
"if",
"a",
"given",
"path",
"is",
"a",
"virtual",
"environment",
"s",
"root",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1707-L1724 | [
"def",
"is_virtual_environment",
"(",
"path",
")",
":",
"if",
"not",
"path",
".",
"is_dir",
"(",
")",
":",
"return",
"False",
"for",
"bindir_name",
"in",
"(",
"'bin'",
",",
"'Scripts'",
")",
":",
"for",
"python",
"in",
"path",
".",
"joinpath",
"(",
"bi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | sys_version | Set a temporary sys.version_info tuple
:param version_tuple: a fake sys.version_info tuple | pipenv/utils.py | 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):
"""
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 | [
"Set",
"a",
"temporary",
"sys",
".",
"version_info",
"tuple"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1785-L1795 | [
"def",
"sys_version",
"(",
"version_tuple",
")",
":",
"old_version",
"=",
"sys",
".",
"version_info",
"sys",
".",
"version_info",
"=",
"version_tuple",
"yield",
"sys",
".",
"version_info",
"=",
"old_version"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | add_to_set | Given a set and some arbitrary element, add the element(s) to the set | pipenv/utils.py | def add_to_set(original_set, element):
"""Given a set and some arbitrary element, add the element(s) to the set"""
if not element:
return original_set
if isinstance(element, Set):
original_set |= element
elif isinstance(element, (list, tuple)):
original_set |= set(element)
el... | def add_to_set(original_set, element):
"""Given a set and some arbitrary element, add the element(s) to the set"""
if not element:
return original_set
if isinstance(element, Set):
original_set |= element
elif isinstance(element, (list, tuple)):
original_set |= set(element)
el... | [
"Given",
"a",
"set",
"and",
"some",
"arbitrary",
"element",
"add",
"the",
"element",
"(",
"s",
")",
"to",
"the",
"set"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1798-L1808 | [
"def",
"add_to_set",
"(",
"original_set",
",",
"element",
")",
":",
"if",
"not",
"element",
":",
"return",
"original_set",
"if",
"isinstance",
"(",
"element",
",",
"Set",
")",
":",
"original_set",
"|=",
"element",
"elif",
"isinstance",
"(",
"element",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_url_equal | 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... | pipenv/utils.py | 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
"""
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... | [
"Compare",
"two",
"urls",
"by",
"scheme",
"host",
"and",
"path",
"ignoring",
"auth"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1811-L1837 | [
"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",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | make_posix | Convert a path with possible windows-style separators to a posix-style path
(with **/** separators instead of **\\** separators).
:param Text path: A path to convert.
:return: A converted posix-style path
:rtype: Text
>>> make_posix("c:/users/user/venvs/some_venv\\Lib\\site-packages")
"c:/user... | pipenv/utils.py | def make_posix(path):
# type: (str) -> str
"""
Convert a path with possible windows-style separators to a posix-style path
(with **/** separators instead of **\\** separators).
:param Text path: A path to convert.
:return: A converted posix-style path
:rtype: Text
>>> make_posix("c:/us... | def make_posix(path):
# type: (str) -> str
"""
Convert a path with possible windows-style separators to a posix-style path
(with **/** separators instead of **\\** separators).
:param Text path: A path to convert.
:return: A converted posix-style path
:rtype: Text
>>> make_posix("c:/us... | [
"Convert",
"a",
"path",
"with",
"possible",
"windows",
"-",
"style",
"separators",
"to",
"a",
"posix",
"-",
"style",
"path",
"(",
"with",
"**",
"/",
"**",
"separators",
"instead",
"of",
"**",
"\\\\",
"**",
"separators",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1841-L1865 | [
"def",
"make_posix",
"(",
"path",
")",
":",
"# type: (str) -> str",
"if",
"not",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected a string for path, received {0!r}...\"",
".",
"format",
"(",
"path",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | find_python | 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
... | pipenv/utils.py | 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):
"""
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, ... | [
"Given",
"a",
"pythonfinder",
".",
"Finder",
"instance",
"and",
"an",
"optional",
"line",
"find",
"a",
"corresponding",
"python"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1877-L1916 | [
"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}\"",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_python_command | 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 | pipenv/utils.py | 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):
"""
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... | [
"Given",
"an",
"input",
"checks",
"whether",
"the",
"input",
"is",
"a",
"request",
"for",
"python",
"or",
"notself",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1919-L1941 | [
"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",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver.get_hash | 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 | pipenv/utils.py | 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):
"""
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",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L682-L714 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _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. | pipenv/vendor/shellingham/posix/__init__.py | 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():
"""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... | [
"Select",
"a",
"way",
"to",
"obtain",
"process",
"information",
"from",
"the",
"system",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/__init__.py#L7-L19 | [
"def",
"_get_process_mapping",
"(",
")",
":",
"for",
"impl",
"in",
"(",
"proc",
",",
"ps",
")",
":",
"try",
":",
"mapping",
"=",
"impl",
".",
"get_process_mapping",
"(",
")",
"except",
"EnvironmentError",
":",
"continue",
"return",
"mapping",
"raise",
"She... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _iter_process_command | Iterator to traverse up the tree, yielding `argv[0]` of each process. | pipenv/vendor/shellingham/posix/__init__.py | def _iter_process_command(mapping, pid, max_depth):
"""Iterator to traverse up the tree, yielding `argv[0]` of each process.
"""
for _ in range(max_depth):
try:
proc = mapping[pid]
except KeyError: # We've reached the root process. Give up.
break
try:
... | def _iter_process_command(mapping, pid, max_depth):
"""Iterator to traverse up the tree, yielding `argv[0]` of each process.
"""
for _ in range(max_depth):
try:
proc = mapping[pid]
except KeyError: # We've reached the root process. Give up.
break
try:
... | [
"Iterator",
"to",
"traverse",
"up",
"the",
"tree",
"yielding",
"argv",
"[",
"0",
"]",
"of",
"each",
"process",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/__init__.py#L22-L36 | [
"def",
"_iter_process_command",
"(",
"mapping",
",",
"pid",
",",
"max_depth",
")",
":",
"for",
"_",
"in",
"range",
"(",
"max_depth",
")",
":",
"try",
":",
"proc",
"=",
"mapping",
"[",
"pid",
"]",
"except",
"KeyError",
":",
"# We've reached the root process. ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _get_login_shell | Form shell information from the SHELL environment variable if possible. | pipenv/vendor/shellingham/posix/__init__.py | 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):
"""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) | [
"Form",
"shell",
"information",
"from",
"the",
"SHELL",
"environment",
"variable",
"if",
"possible",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/__init__.py#L39-L47 | [
"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",
":",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_shell | Get the shell that the supplied pid or os.getpid() is running in. | pipenv/vendor/shellingham/posix/__init__.py | def get_shell(pid=None, max_depth=6):
"""Get the shell that the supplied pid or os.getpid() is running in.
"""
pid = str(pid or os.getpid())
mapping = _get_process_mapping()
for proc_cmd in _iter_process_command(mapping, pid, max_depth):
if proc_cmd.startswith('-'): # Login shell! Let's u... | def get_shell(pid=None, max_depth=6):
"""Get the shell that the supplied pid or os.getpid() is running in.
"""
pid = str(pid or os.getpid())
mapping = _get_process_mapping()
for proc_cmd in _iter_process_command(mapping, pid, max_depth):
if proc_cmd.startswith('-'): # Login shell! Let's u... | [
"Get",
"the",
"shell",
"that",
"the",
"supplied",
"pid",
"or",
"os",
".",
"getpid",
"()",
"is",
"running",
"in",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/__init__.py#L50-L61 | [
"def",
"get_shell",
"(",
"pid",
"=",
"None",
",",
"max_depth",
"=",
"6",
")",
":",
"pid",
"=",
"str",
"(",
"pid",
"or",
"os",
".",
"getpid",
"(",
")",
")",
"mapping",
"=",
"_get_process_mapping",
"(",
")",
"for",
"proc_cmd",
"in",
"_iter_process_comman... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | BaseAdapter.send | Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
:param timeout: (optional) How long to wait for the server to send
data before giving up... | pipenv/vendor/requests/adapters.py | def send(self, request, stream=False, timeout=None, verify=True,
cert=None, proxies=None):
"""Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request co... | def send(self, request, stream=False, timeout=None, verify=True,
cert=None, proxies=None):
"""Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request co... | [
"Sends",
"PreparedRequest",
"object",
".",
"Returns",
"Response",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L61-L77 | [
"def",
"send",
"(",
"self",
",",
"request",
",",
"stream",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"verify",
"=",
"True",
",",
"cert",
"=",
"None",
",",
"proxies",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPAdapter.init_poolmanager | 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... | pipenv/vendor/requests/adapters.py | 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):
"""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>`.
... | [
"Initializes",
"a",
"urllib3",
"PoolManager",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L146-L164 | [
"def",
"init_poolmanager",
"(",
"self",
",",
"connections",
",",
"maxsize",
",",
"block",
"=",
"DEFAULT_POOLBLOCK",
",",
"*",
"*",
"pool_kwargs",
")",
":",
"# save these values for pickling",
"self",
".",
"_pool_connections",
"=",
"connections",
"self",
".",
"_poo... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPAdapter.proxy_manager_for | Return urllib3 ProxyManager for the given proxy.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param proxy: The proxy to return a urllib3 ProxyManager for.
:param proxy_kw... | pipenv/vendor/requests/adapters.py | def proxy_manager_for(self, proxy, **proxy_kwargs):
"""Return urllib3 ProxyManager for the given proxy.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param proxy: The prox... | def proxy_manager_for(self, proxy, **proxy_kwargs):
"""Return urllib3 ProxyManager for the given proxy.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param proxy: The prox... | [
"Return",
"urllib3",
"ProxyManager",
"for",
"the",
"given",
"proxy",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L166-L201 | [
"def",
"proxy_manager_for",
"(",
"self",
",",
"proxy",
",",
"*",
"*",
"proxy_kwargs",
")",
":",
"if",
"proxy",
"in",
"self",
".",
"proxy_manager",
":",
"manager",
"=",
"self",
".",
"proxy_manager",
"[",
"proxy",
"]",
"elif",
"proxy",
".",
"lower",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPAdapter.build_response | Builds a :class:`Response <requests.Response>` object from a urllib3
response. This should not be called from user code, and is only exposed
for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
:param req: The :class:`PreparedRequest <PreparedRequest>` used ... | pipenv/vendor/requests/adapters.py | def build_response(self, req, resp):
"""Builds a :class:`Response <requests.Response>` object from a urllib3
response. This should not be called from user code, and is only exposed
for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
:param req: The ... | def build_response(self, req, resp):
"""Builds a :class:`Response <requests.Response>` object from a urllib3
response. This should not be called from user code, and is only exposed
for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
:param req: The ... | [
"Builds",
"a",
":",
"class",
":",
"Response",
"<requests",
".",
"Response",
">",
"object",
"from",
"a",
"urllib3",
"response",
".",
"This",
"should",
"not",
"be",
"called",
"from",
"user",
"code",
"and",
"is",
"only",
"exposed",
"for",
"use",
"when",
"su... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L255-L290 | [
"def",
"build_response",
"(",
"self",
",",
"req",
",",
"resp",
")",
":",
"response",
"=",
"Response",
"(",
")",
"# Fallback to None if there's no status_code, for whatever reason.",
"response",
".",
"status_code",
"=",
"getattr",
"(",
"resp",
",",
"'status'",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPAdapter.get_connection | Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param url: The URL to connect to.
:param proxies: (optional) A Requests-style dictionary of p... | pipenv/vendor/requests/adapters.py | def get_connection(self, url, proxies=None):
"""Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param url: The URL to connect to.
:pa... | def get_connection(self, url, proxies=None):
"""Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param url: The URL to connect to.
:pa... | [
"Returns",
"a",
"urllib3",
"connection",
"for",
"the",
"given",
"URL",
".",
"This",
"should",
"not",
"be",
"called",
"from",
"user",
"code",
"and",
"is",
"only",
"exposed",
"for",
"use",
"when",
"subclassing",
"the",
":",
"class",
":",
"HTTPAdapter",
"<req... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L292-L317 | [
"def",
"get_connection",
"(",
"self",
",",
"url",
",",
"proxies",
"=",
"None",
")",
":",
"proxy",
"=",
"select_proxy",
"(",
"url",
",",
"proxies",
")",
"if",
"proxy",
":",
"proxy",
"=",
"prepend_scheme_if_needed",
"(",
"proxy",
",",
"'http'",
")",
"proxy... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPAdapter.close | Disposes of any internal state.
Currently, this closes the PoolManager and any active ProxyManager,
which closes any pooled connections. | pipenv/vendor/requests/adapters.py | 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):
"""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() | [
"Disposes",
"of",
"any",
"internal",
"state",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L319-L327 | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"poolmanager",
".",
"clear",
"(",
")",
"for",
"proxy",
"in",
"self",
".",
"proxy_manager",
".",
"values",
"(",
")",
":",
"proxy",
".",
"clear",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPAdapter.request_url | Obtain the url to use when making the final request.
If the message is being sent through a HTTP proxy, the full URL has to
be used. Otherwise, we should only use the path portion of the URL.
This should not be called from user code, and is only exposed for use
when subclassing the
... | pipenv/vendor/requests/adapters.py | def request_url(self, request, proxies):
"""Obtain the url to use when making the final request.
If the message is being sent through a HTTP proxy, the full URL has to
be used. Otherwise, we should only use the path portion of the URL.
This should not be called from user code, and is o... | def request_url(self, request, proxies):
"""Obtain the url to use when making the final request.
If the message is being sent through a HTTP proxy, the full URL has to
be used. Otherwise, we should only use the path portion of the URL.
This should not be called from user code, and is o... | [
"Obtain",
"the",
"url",
"to",
"use",
"when",
"making",
"the",
"final",
"request",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/adapters.py#L329-L356 | [
"def",
"request_url",
"(",
"self",
",",
"request",
",",
"proxies",
")",
":",
"proxy",
"=",
"select_proxy",
"(",
"request",
".",
"url",
",",
"proxies",
")",
"scheme",
"=",
"urlparse",
"(",
"request",
".",
"url",
")",
".",
"scheme",
"is_proxied_http_request"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | strip_ssh_from_git_uri | Return git+ssh:// formatted URI to git+git@ format | pipenv/vendor/requirementslib/utils.py | def strip_ssh_from_git_uri(uri):
# type: (S) -> S
"""Return git+ssh:// formatted URI to git+git@ format"""
if isinstance(uri, six.string_types):
if "git+ssh://" in uri:
parsed = urlparse(uri)
# split the path on the first separating / so we can put the first segment
... | def strip_ssh_from_git_uri(uri):
# type: (S) -> S
"""Return git+ssh:// formatted URI to git+git@ format"""
if isinstance(uri, six.string_types):
if "git+ssh://" in uri:
parsed = urlparse(uri)
# split the path on the first separating / so we can put the first segment
... | [
"Return",
"git",
"+",
"ssh",
":",
"//",
"formatted",
"URI",
"to",
"git",
"+",
"git"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L116-L130 | [
"def",
"strip_ssh_from_git_uri",
"(",
"uri",
")",
":",
"# type: (S) -> S",
"if",
"isinstance",
"(",
"uri",
",",
"six",
".",
"string_types",
")",
":",
"if",
"\"git+ssh://\"",
"in",
"uri",
":",
"parsed",
"=",
"urlparse",
"(",
"uri",
")",
"# split the path on the... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | add_ssh_scheme_to_git_uri | Cleans VCS uris from pipenv.patched.notpip format | pipenv/vendor/requirementslib/utils.py | 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
"""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+... | [
"Cleans",
"VCS",
"uris",
"from",
"pipenv",
".",
"patched",
".",
"notpip",
"format"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L133-L145 | [
"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+\"",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_vcs | Determine if dictionary entry from Pipfile is for a vcs dependency. | pipenv/vendor/requirementslib/utils.py | 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
"""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):
... | [
"Determine",
"if",
"dictionary",
"entry",
"from",
"Pipfile",
"is",
"for",
"a",
"vcs",
"dependency",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L148-L160 | [
"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",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | multi_split | Splits on multiple given separators. | pipenv/vendor/requirementslib/utils.py | 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]
"""Splits on multiple given separators."""
for r in split:
s = s.replace(r, "|")
return [i for i in s.split("|") if len(i) > 0] | [
"Splits",
"on",
"multiple",
"given",
"separators",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L172-L177 | [
"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",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | convert_entry_to_path | Convert a pipfile entry to a string | pipenv/vendor/requirementslib/utils.py | 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
"""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"]):
... | [
"Convert",
"a",
"pipfile",
"entry",
"to",
"a",
"string"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L187-L202 | [
"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",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_installable_file | Determine if a path can potentially be installed | pipenv/vendor/requirementslib/utils.py | def is_installable_file(path):
# type: (PipfileType) -> bool
"""Determine if a path can potentially be installed"""
from packaging import specifiers
if isinstance(path, Mapping):
path = convert_entry_to_path(path)
# If the string starts with a valid specifier operator, test if it is a vali... | def is_installable_file(path):
# type: (PipfileType) -> bool
"""Determine if a path can potentially be installed"""
from packaging import specifiers
if isinstance(path, Mapping):
path = convert_entry_to_path(path)
# If the string starts with a valid specifier operator, test if it is a vali... | [
"Determine",
"if",
"a",
"path",
"can",
"potentially",
"be",
"installed"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L205-L246 | [
"def",
"is_installable_file",
"(",
"path",
")",
":",
"# type: (PipfileType) -> bool",
"from",
"packaging",
"import",
"specifiers",
"if",
"isinstance",
"(",
"path",
",",
"Mapping",
")",
":",
"path",
"=",
"convert_entry_to_path",
"(",
"path",
")",
"# If the string sta... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_path | Retrieve a value from a nested object via a tuple representing the
lookup path.
>>> root = {'a': {'b': {'c': [[1], [2], [3]]}}}
>>> get_path(root, ('a', 'b', 'c', 2, 0))
3
The path format is intentionally consistent with that of
:func:`remap`.
One of get_path's chief aims is improved error m... | pipenv/vendor/requirementslib/utils.py | def get_path(root, path, default=_UNSET):
"""Retrieve a value from a nested object via a tuple representing the
lookup path.
>>> root = {'a': {'b': {'c': [[1], [2], [3]]}}}
>>> get_path(root, ('a', 'b', 'c', 2, 0))
3
The path format is intentionally consistent with that of
:func:`remap`.
... | def get_path(root, path, default=_UNSET):
"""Retrieve a value from a nested object via a tuple representing the
lookup path.
>>> root = {'a': {'b': {'c': [[1], [2], [3]]}}}
>>> get_path(root, ('a', 'b', 'c', 2, 0))
3
The path format is intentionally consistent with that of
:func:`remap`.
... | [
"Retrieve",
"a",
"value",
"from",
"a",
"nested",
"object",
"via",
"a",
"tuple",
"representing",
"the",
"lookup",
"path",
".",
">>>",
"root",
"=",
"{",
"a",
":",
"{",
"b",
":",
"{",
"c",
":",
"[[",
"1",
"]",
"[",
"2",
"]",
"[",
"3",
"]]",
"}}}",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/utils.py#L409-L458 | [
"def",
"get_path",
"(",
"root",
",",
"path",
",",
"default",
"=",
"_UNSET",
")",
":",
"if",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"path",
"=",
"path",
".",
"split",
"(",
"\".\"",
")",
"cur",
"=",
"root",
"try",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HashMismatch._hash_comparison | Return a comparison of actual and expected hash values.
Example::
Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
or 123451234512345123451234512345123451234512345
Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef | pipenv/patched/notpip/_internal/exceptions.py | 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):
"""
Return a comparison of actual and expected hash values.
Example::
Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
or 123451234512345123451234512345123451234512345
Got bcdefbcdefb... | [
"Return",
"a",
"comparison",
"of",
"actual",
"and",
"expected",
"hash",
"values",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/exceptions.py#L226-L250 | [
"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",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | UniversalDetector.reset | Reset the UniversalDetector and all of its probers back to their
initial states. This is called by ``__init__``, so you only need to
call this directly in between analyses of different documents. | pipenv/vendor/chardet/universaldetector.py | def reset(self):
"""
Reset the UniversalDetector and all of its probers back to their
initial states. This is called by ``__init__``, so you only need to
call this directly in between analyses of different documents.
"""
self.result = {'encoding': None, 'confidence': 0.0... | def reset(self):
"""
Reset the UniversalDetector and all of its probers back to their
initial states. This is called by ``__init__``, so you only need to
call this directly in between analyses of different documents.
"""
self.result = {'encoding': None, 'confidence': 0.0... | [
"Reset",
"the",
"UniversalDetector",
"and",
"all",
"of",
"its",
"probers",
"back",
"to",
"their",
"initial",
"states",
".",
"This",
"is",
"called",
"by",
"__init__",
"so",
"you",
"only",
"need",
"to",
"call",
"this",
"directly",
"in",
"between",
"analyses",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/universaldetector.py#L94-L109 | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"result",
"=",
"{",
"'encoding'",
":",
"None",
",",
"'confidence'",
":",
"0.0",
",",
"'language'",
":",
"None",
"}",
"self",
".",
"done",
"=",
"False",
"self",
".",
"_got_data",
"=",
"False",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | UniversalDetector.feed | 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... | pipenv/vendor/chardet/universaldetector.py | 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):
"""
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... | [
"Takes",
"a",
"chunk",
"of",
"a",
"document",
"and",
"feeds",
"it",
"through",
"all",
"of",
"the",
"relevant",
"charset",
"probers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/universaldetector.py#L111-L218 | [
"def",
"feed",
"(",
"self",
",",
"byte_str",
")",
":",
"if",
"self",
".",
"done",
":",
"return",
"if",
"not",
"len",
"(",
"byte_str",
")",
":",
"return",
"if",
"not",
"isinstance",
"(",
"byte_str",
",",
"bytearray",
")",
":",
"byte_str",
"=",
"bytear... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | UniversalDetector.close | 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`. | pipenv/vendor/chardet/universaldetector.py | 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):
"""
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
... | [
"Stop",
"analyzing",
"the",
"current",
"document",
"and",
"come",
"up",
"with",
"a",
"final",
"prediction",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/universaldetector.py#L220-L286 | [
"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",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | bash | Start a bash shell and return a :class:`REPLWrapper` object. | pipenv/vendor/pexpect/replwrap.py | def bash(command="bash"):
"""Start a bash shell and return a :class:`REPLWrapper` object."""
bashrc = os.path.join(os.path.dirname(__file__), 'bashrc.sh')
child = pexpect.spawn(command, ['--rcfile', bashrc], echo=False,
encoding='utf-8')
# If the user runs 'env', the value of ... | def bash(command="bash"):
"""Start a bash shell and return a :class:`REPLWrapper` object."""
bashrc = os.path.join(os.path.dirname(__file__), 'bashrc.sh')
child = pexpect.spawn(command, ['--rcfile', bashrc], echo=False,
encoding='utf-8')
# If the user runs 'env', the value of ... | [
"Start",
"a",
"bash",
"shell",
"and",
"return",
"a",
":",
"class",
":",
"REPLWrapper",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/replwrap.py#L107-L122 | [
"def",
"bash",
"(",
"command",
"=",
"\"bash\"",
")",
":",
"bashrc",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'bashrc.sh'",
")",
"child",
"=",
"pexpect",
".",
"spawn",
"(",
"command",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | REPLWrapper.run_command | 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... | pipenv/vendor/pexpect/replwrap.py | 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):
"""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... | [
"Send",
"a",
"command",
"to",
"the",
"REPL",
"wait",
"for",
"and",
"return",
"output",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/replwrap.py#L68-L101 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Line.parse_hashes | Parse hashes from *self.line* and set them on the current object.
:returns: Nothing
:rtype: None | pipenv/vendor/requirementslib/models/requirements.py | def parse_hashes(self):
# type: () -> None
"""
Parse hashes from *self.line* and set them on the current object.
:returns: Nothing
:rtype: None
"""
line, hashes = self.split_hashes(self.line)
self.hashes = hashes
self.line = line | def parse_hashes(self):
# type: () -> None
"""
Parse hashes from *self.line* and set them on the current object.
:returns: Nothing
:rtype: None
"""
line, hashes = self.split_hashes(self.line)
self.hashes = hashes
self.line = line | [
"Parse",
"hashes",
"from",
"*",
"self",
".",
"line",
"*",
"and",
"set",
"them",
"on",
"the",
"current",
"object",
".",
":",
"returns",
":",
"Nothing",
":",
"rtype",
":",
"None"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/requirements.py#L483-L493 | [
"def",
"parse_hashes",
"(",
"self",
")",
":",
"# type: () -> None",
"line",
",",
"hashes",
"=",
"self",
".",
"split_hashes",
"(",
"self",
".",
"line",
")",
"self",
".",
"hashes",
"=",
"hashes",
"self",
".",
"line",
"=",
"line"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Line.parse_extras | Parse extras from *self.line* and set them on the current object
:returns: Nothing
:rtype: None | pipenv/vendor/requirementslib/models/requirements.py | def parse_extras(self):
# type: () -> None
"""
Parse extras from *self.line* and set them on the current object
:returns: Nothing
:rtype: None
"""
extras = None
if "@" in self.line or self.is_vcs or self.is_url:
line = "{0}".format(self.line)
... | def parse_extras(self):
# type: () -> None
"""
Parse extras from *self.line* and set them on the current object
:returns: Nothing
:rtype: None
"""
extras = None
if "@" in self.line or self.is_vcs or self.is_url:
line = "{0}".format(self.line)
... | [
"Parse",
"extras",
"from",
"*",
"self",
".",
"line",
"*",
"and",
"set",
"them",
"on",
"the",
"current",
"object",
":",
"returns",
":",
"Nothing",
":",
"rtype",
":",
"None"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/requirements.py#L495-L527 | [
"def",
"parse_extras",
"(",
"self",
")",
":",
"# type: () -> None",
"extras",
"=",
"None",
"if",
"\"@\"",
"in",
"self",
".",
"line",
"or",
"self",
".",
"is_vcs",
"or",
"self",
".",
"is_url",
":",
"line",
"=",
"\"{0}\"",
".",
"format",
"(",
"self",
".",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Line.get_url | Sets ``self.name`` if given a **PEP-508** style URL | pipenv/vendor/requirementslib/models/requirements.py | def get_url(self):
# type: () -> STRING_TYPE
"""Sets ``self.name`` if given a **PEP-508** style URL"""
line = self.line
try:
parsed = URI.parse(line)
line = parsed.to_string(escape_password=False, direct=False, strip_ref=True)
except ValueError:
... | def get_url(self):
# type: () -> STRING_TYPE
"""Sets ``self.name`` if given a **PEP-508** style URL"""
line = self.line
try:
parsed = URI.parse(line)
line = parsed.to_string(escape_password=False, direct=False, strip_ref=True)
except ValueError:
... | [
"Sets",
"self",
".",
"name",
"if",
"given",
"a",
"**",
"PEP",
"-",
"508",
"**",
"style",
"URL"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/requirements.py#L529-L562 | [
"def",
"get_url",
"(",
"self",
")",
":",
"# type: () -> STRING_TYPE",
"line",
"=",
"self",
".",
"line",
"try",
":",
"parsed",
"=",
"URI",
".",
"parse",
"(",
"line",
")",
"line",
"=",
"parsed",
".",
"to_string",
"(",
"escape_password",
"=",
"False",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Line.requirement_info | Generates a 3-tuple of the requisite *name*, *extras* and *url* to generate a
:class:`~packaging.requirements.Requirement` out of.
:return: A Tuple of an optional name, a Tuple of extras, and an optional URL.
:rtype: Tuple[Optional[S], Tuple[Optional[S], ...], Optional[S]] | pipenv/vendor/requirementslib/models/requirements.py | def requirement_info(self):
# type: () -> Tuple[Optional[S], Tuple[Optional[S], ...], Optional[S]]
"""
Generates a 3-tuple of the requisite *name*, *extras* and *url* to generate a
:class:`~packaging.requirements.Requirement` out of.
:return: A Tuple of an optional name, a Tuple... | def requirement_info(self):
# type: () -> Tuple[Optional[S], Tuple[Optional[S], ...], Optional[S]]
"""
Generates a 3-tuple of the requisite *name*, *extras* and *url* to generate a
:class:`~packaging.requirements.Requirement` out of.
:return: A Tuple of an optional name, a Tuple... | [
"Generates",
"a",
"3",
"-",
"tuple",
"of",
"the",
"requisite",
"*",
"name",
"*",
"*",
"extras",
"*",
"and",
"*",
"url",
"*",
"to",
"generate",
"a",
":",
"class",
":",
"~packaging",
".",
"requirements",
".",
"Requirement",
"out",
"of",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/requirements.py#L1044-L1081 | [
"def",
"requirement_info",
"(",
"self",
")",
":",
"# type: () -> Tuple[Optional[S], Tuple[Optional[S], ...], Optional[S]]",
"# Direct URLs can be converted to packaging requirements directly, but",
"# only if they are `file://` (with only two slashes)",
"name",
"=",
"None",
"# type: Optional... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Line.line_is_installable | This is a safeguard against decoy requirements when a user installs a package
whose name coincides with the name of a folder in the cwd, e.g. install *alembic*
when there is a folder called *alembic* in the working directory.
In this case we first need to check that the given requirement is a v... | pipenv/vendor/requirementslib/models/requirements.py | def line_is_installable(self):
# type: () -> bool
"""
This is a safeguard against decoy requirements when a user installs a package
whose name coincides with the name of a folder in the cwd, e.g. install *alembic*
when there is a folder called *alembic* in the working directory.
... | def line_is_installable(self):
# type: () -> bool
"""
This is a safeguard against decoy requirements when a user installs a package
whose name coincides with the name of a folder in the cwd, e.g. install *alembic*
when there is a folder called *alembic* in the working directory.
... | [
"This",
"is",
"a",
"safeguard",
"against",
"decoy",
"requirements",
"when",
"a",
"user",
"installs",
"a",
"package",
"whose",
"name",
"coincides",
"with",
"the",
"name",
"of",
"a",
"folder",
"in",
"the",
"cwd",
"e",
".",
"g",
".",
"install",
"*",
"alembi... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/requirements.py#L1084-L1109 | [
"def",
"line_is_installable",
"(",
"self",
")",
":",
"# type: () -> bool",
"line",
"=",
"self",
".",
"line",
"if",
"is_file_url",
"(",
"line",
")",
":",
"link",
"=",
"create_link",
"(",
"line",
")",
"line",
"=",
"link",
".",
"url_without_fragment",
"line",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fork_pty | This implements a substitute for the forkpty system call. This
should be more portable than the pty.fork() function. Specifically,
this should work on Solaris.
Modified 10.06.05 by Geoff Marshall: Implemented __fork_pty() method to
resolve the issue with Python's pty.fork() not supporting Solaris,
... | pipenv/vendor/ptyprocess/_fork_pty.py | def fork_pty():
'''This implements a substitute for the forkpty system call. This
should be more portable than the pty.fork() function. Specifically,
this should work on Solaris.
Modified 10.06.05 by Geoff Marshall: Implemented __fork_pty() method to
resolve the issue with Python's pty.fork() not s... | def fork_pty():
'''This implements a substitute for the forkpty system call. This
should be more portable than the pty.fork() function. Specifically,
this should work on Solaris.
Modified 10.06.05 by Geoff Marshall: Implemented __fork_pty() method to
resolve the issue with Python's pty.fork() not s... | [
"This",
"implements",
"a",
"substitute",
"for",
"the",
"forkpty",
"system",
"call",
".",
"This",
"should",
"be",
"more",
"portable",
"than",
"the",
"pty",
".",
"fork",
"()",
"function",
".",
"Specifically",
"this",
"should",
"work",
"on",
"Solaris",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/_fork_pty.py#L9-L41 | [
"def",
"fork_pty",
"(",
")",
":",
"parent_fd",
",",
"child_fd",
"=",
"os",
".",
"openpty",
"(",
")",
"if",
"parent_fd",
"<",
"0",
"or",
"child_fd",
"<",
"0",
":",
"raise",
"OSError",
"(",
"\"os.openpty() failed\"",
")",
"pid",
"=",
"os",
".",
"fork",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pty_make_controlling_tty | This makes the pseudo-terminal the controlling tty. This should be
more portable than the pty.fork() function. Specifically, this should
work on Solaris. | pipenv/vendor/ptyprocess/_fork_pty.py | def pty_make_controlling_tty(tty_fd):
'''This makes the pseudo-terminal the controlling tty. This should be
more portable than the pty.fork() function. Specifically, this should
work on Solaris. '''
child_name = os.ttyname(tty_fd)
# Disconnect from controlling tty, if any. Raises OSError of ENXIO... | def pty_make_controlling_tty(tty_fd):
'''This makes the pseudo-terminal the controlling tty. This should be
more portable than the pty.fork() function. Specifically, this should
work on Solaris. '''
child_name = os.ttyname(tty_fd)
# Disconnect from controlling tty, if any. Raises OSError of ENXIO... | [
"This",
"makes",
"the",
"pseudo",
"-",
"terminal",
"the",
"controlling",
"tty",
".",
"This",
"should",
"be",
"more",
"portable",
"than",
"the",
"pty",
".",
"fork",
"()",
"function",
".",
"Specifically",
"this",
"should",
"work",
"on",
"Solaris",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/_fork_pty.py#L43-L78 | [
"def",
"pty_make_controlling_tty",
"(",
"tty_fd",
")",
":",
"child_name",
"=",
"os",
".",
"ttyname",
"(",
"tty_fd",
")",
"# Disconnect from controlling tty, if any. Raises OSError of ENXIO",
"# if there was no controlling tty to begin with, such as when",
"# executed by a cron(1) jo... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | safecall | Wraps a function so that it swallows exceptions. | pipenv/vendor/click/utils.py | 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):
"""Wraps a function so that it swallows exceptions."""
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception:
pass
return wrapper | [
"Wraps",
"a",
"function",
"so",
"that",
"it",
"swallows",
"exceptions",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L25-L32 | [
"def",
"safecall",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"Exception",
":",
"pass",
"return",
"wrapper"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | make_str | Converts a value into a valid string. | pipenv/vendor/click/utils.py | def make_str(value):
"""Converts a value into a valid string."""
if isinstance(value, bytes):
try:
return value.decode(get_filesystem_encoding())
except UnicodeError:
return value.decode('utf-8', 'replace')
return text_type(value) | def make_str(value):
"""Converts a value into a valid string."""
if isinstance(value, bytes):
try:
return value.decode(get_filesystem_encoding())
except UnicodeError:
return value.decode('utf-8', 'replace')
return text_type(value) | [
"Converts",
"a",
"value",
"into",
"a",
"valid",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L35-L42 | [
"def",
"make_str",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"bytes",
")",
":",
"try",
":",
"return",
"value",
".",
"decode",
"(",
"get_filesystem_encoding",
"(",
")",
")",
"except",
"UnicodeError",
":",
"return",
"value",
".",
"deco... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | make_default_short_help | Return a condensed version of help string. | pipenv/vendor/click/utils.py | 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):
"""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)
... | [
"Return",
"a",
"condensed",
"version",
"of",
"help",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L45-L67 | [
"def",
"make_default_short_help",
"(",
"help",
",",
"max_length",
"=",
"45",
")",
":",
"words",
"=",
"help",
".",
"split",
"(",
")",
"total_length",
"=",
"0",
"result",
"=",
"[",
"]",
"done",
"=",
"False",
"for",
"word",
"in",
"words",
":",
"if",
"wo... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_binary_stream | 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 ... | pipenv/vendor/click/utils.py | 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):
"""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... | [
"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... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L264-L277 | [
"def",
"get_binary_stream",
"(",
"name",
")",
":",
"opener",
"=",
"binary_streams",
".",
"get",
"(",
"name",
")",
"if",
"opener",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'Unknown standard stream %r'",
"%",
"name",
")",
"return",
"opener",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_text_stream | Returns a system stream for text processing. This usually returns
a wrapped stream around a binary stream returned from
:func:`get_binary_stream` but it also can take shortcuts on Python 3
for already correctly configured streams.
:param name: the name of the stream to open. Valid names are ``'stdin'... | pipenv/vendor/click/utils.py | def get_text_stream(name, encoding=None, errors='strict'):
"""Returns a system stream for text processing. This usually returns
a wrapped stream around a binary stream returned from
:func:`get_binary_stream` but it also can take shortcuts on Python 3
for already correctly configured streams.
:para... | def get_text_stream(name, encoding=None, errors='strict'):
"""Returns a system stream for text processing. This usually returns
a wrapped stream around a binary stream returned from
:func:`get_binary_stream` but it also can take shortcuts on Python 3
for already correctly configured streams.
:para... | [
"Returns",
"a",
"system",
"stream",
"for",
"text",
"processing",
".",
"This",
"usually",
"returns",
"a",
"wrapped",
"stream",
"around",
"a",
"binary",
"stream",
"returned",
"from",
":",
"func",
":",
"get_binary_stream",
"but",
"it",
"also",
"can",
"take",
"s... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L280-L294 | [
"def",
"get_text_stream",
"(",
"name",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"opener",
"=",
"text_streams",
".",
"get",
"(",
"name",
")",
"if",
"opener",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'Unknown standard str... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | open_file | This is similar to how the :class:`File` works but for manual
usage. Files are opened non lazy by default. This can open regular
files as well as stdin/stdout if ``'-'`` is passed.
If stdin/stdout is returned the stream is wrapped so that the context
manager will not close the stream accidentally. T... | pipenv/vendor/click/utils.py | def open_file(filename, mode='r', encoding=None, errors='strict',
lazy=False, atomic=False):
"""This is similar to how the :class:`File` works but for manual
usage. Files are opened non lazy by default. This can open regular
files as well as stdin/stdout if ``'-'`` is passed.
If stdin/s... | def open_file(filename, mode='r', encoding=None, errors='strict',
lazy=False, atomic=False):
"""This is similar to how the :class:`File` works but for manual
usage. Files are opened non lazy by default. This can open regular
files as well as stdin/stdout if ``'-'`` is passed.
If stdin/s... | [
"This",
"is",
"similar",
"to",
"how",
"the",
":",
"class",
":",
"File",
"works",
"but",
"for",
"manual",
"usage",
".",
"Files",
"are",
"opened",
"non",
"lazy",
"by",
"default",
".",
"This",
"can",
"open",
"regular",
"files",
"as",
"well",
"as",
"stdin"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L297-L327 | [
"def",
"open_file",
"(",
"filename",
",",
"mode",
"=",
"'r'",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
",",
"lazy",
"=",
"False",
",",
"atomic",
"=",
"False",
")",
":",
"if",
"lazy",
":",
"return",
"LazyFile",
"(",
"filename",
",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | format_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.
... | pipenv/vendor/click/utils.py | 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):
"""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... | [
"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",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L351-L365 | [
"def",
"format_filename",
"(",
"filename",
",",
"shorten",
"=",
"False",
")",
":",
"if",
"shorten",
":",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"return",
"filename_to_ui",
"(",
"filename",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_app_dir | 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... | pipenv/vendor/click/utils.py | 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):
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... | [
"r",
"Returns",
"the",
"config",
"folder",
"for",
"the",
"application",
".",
"The",
"default",
"behavior",
"is",
"to",
"return",
"whatever",
"is",
"most",
"appropriate",
"for",
"the",
"operating",
"system",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L368-L416 | [
"def",
"get_app_dir",
"(",
"app_name",
",",
"roaming",
"=",
"True",
",",
"force_posix",
"=",
"False",
")",
":",
"if",
"WIN",
":",
"key",
"=",
"roaming",
"and",
"'APPDATA'",
"or",
"'LOCALAPPDATA'",
"folder",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LazyFile.open | Opens the file if it's not yet open. This call might fail with
a :exc:`FileError`. Not handling this error will produce an error
that Click shows. | pipenv/vendor/click/utils.py | def open(self):
"""Opens the file if it's not yet open. This call might fail with
a :exc:`FileError`. Not handling this error will produce an error
that Click shows.
"""
if self._f is not None:
return self._f
try:
rv, self.should_close = open_str... | def open(self):
"""Opens the file if it's not yet open. This call might fail with
a :exc:`FileError`. Not handling this error will produce an error
that Click shows.
"""
if self._f is not None:
return self._f
try:
rv, self.should_close = open_str... | [
"Opens",
"the",
"file",
"if",
"it",
"s",
"not",
"yet",
"open",
".",
"This",
"call",
"might",
"fail",
"with",
"a",
":",
"exc",
":",
"FileError",
".",
"Not",
"handling",
"this",
"error",
"will",
"produce",
"an",
"error",
"that",
"Click",
"shows",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/utils.py#L105-L121 | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"self",
".",
"_f",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_f",
"try",
":",
"rv",
",",
"self",
".",
"should_close",
"=",
"open_stream",
"(",
"self",
".",
"name",
",",
"self",
".",
"mode",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | split_args | Version of shlex.split that silently accept incomplete strings.
Parameters
----------
line : str
The string to split
Returns
-------
[str]
The line split in separated arguments | pipenv/vendor/click_completion/lib.py | 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):
"""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... | [
"Version",
"of",
"shlex",
".",
"split",
"that",
"silently",
"accept",
"incomplete",
"strings",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/lib.py#L94-L120 | [
"def",
"split_args",
"(",
"line",
")",
":",
"lex",
"=",
"shlex",
".",
"shlex",
"(",
"line",
",",
"posix",
"=",
"True",
")",
"lex",
".",
"whitespace_split",
"=",
"True",
"lex",
".",
"commenters",
"=",
"''",
"res",
"=",
"[",
"]",
"try",
":",
"while",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | confirm | Prompts for confirmation (yes/no question).
If the user aborts the input by sending a interrupt signal this
function will catch it and raise a :exc:`Abort` exception.
.. versionadded:: 4.0
Added the `err` parameter.
:param text: the question to ask.
:param default: the default for the prom... | pipenv/vendor/click/termui.py | def confirm(text, default=False, abort=False, prompt_suffix=': ',
show_default=True, err=False):
"""Prompts for confirmation (yes/no question).
If the user aborts the input by sending a interrupt signal this
function will catch it and raise a :exc:`Abort` exception.
.. versionadded:: 4.0
... | def confirm(text, default=False, abort=False, prompt_suffix=': ',
show_default=True, err=False):
"""Prompts for confirmation (yes/no question).
If the user aborts the input by sending a interrupt signal this
function will catch it and raise a :exc:`Abort` exception.
.. versionadded:: 4.0
... | [
"Prompts",
"for",
"confirmation",
"(",
"yes",
"/",
"no",
"question",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L141-L182 | [
"def",
"confirm",
"(",
"text",
",",
"default",
"=",
"False",
",",
"abort",
"=",
"False",
",",
"prompt_suffix",
"=",
"': '",
",",
"show_default",
"=",
"True",
",",
"err",
"=",
"False",
")",
":",
"prompt",
"=",
"_build_prompt",
"(",
"text",
",",
"prompt_... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | echo_via_pager | 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... | pipenv/vendor/click/termui.py | 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):
"""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... | [
"This",
"function",
"takes",
"a",
"text",
"and",
"shows",
"it",
"via",
"an",
"environment",
"specific",
"pager",
"on",
"stdout",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L232-L258 | [
"def",
"echo_via_pager",
"(",
"text_or_generator",
",",
"color",
"=",
"None",
")",
":",
"color",
"=",
"resolve_color_default",
"(",
"color",
")",
"if",
"inspect",
".",
"isgeneratorfunction",
"(",
"text_or_generator",
")",
":",
"i",
"=",
"text_or_generator",
"(",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | progressbar | This function creates an iterable context manager that can be used
to iterate over something while showing a progress bar. It will
either iterate over the `iterable` or `length` items (that are counted
up). While iteration happens, this function will print a rendered
progress bar to the given `file` (... | pipenv/vendor/click/termui.py | def progressbar(iterable=None, length=None, label=None, show_eta=True,
show_percent=None, show_pos=False,
item_show_func=None, fill_char='#', empty_char='-',
bar_template='%(label)s [%(bar)s] %(info)s',
info_sep=' ', width=36, file=None, color=None):
... | def progressbar(iterable=None, length=None, label=None, show_eta=True,
show_percent=None, show_pos=False,
item_show_func=None, fill_char='#', empty_char='-',
bar_template='%(label)s [%(bar)s] %(info)s',
info_sep=' ', width=36, file=None, color=None):
... | [
"This",
"function",
"creates",
"an",
"iterable",
"context",
"manager",
"that",
"can",
"be",
"used",
"to",
"iterate",
"over",
"something",
"while",
"showing",
"a",
"progress",
"bar",
".",
"It",
"will",
"either",
"iterate",
"over",
"the",
"iterable",
"or",
"le... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L261-L351 | [
"def",
"progressbar",
"(",
"iterable",
"=",
"None",
",",
"length",
"=",
"None",
",",
"label",
"=",
"None",
",",
"show_eta",
"=",
"True",
",",
"show_percent",
"=",
"None",
",",
"show_pos",
"=",
"False",
",",
"item_show_func",
"=",
"None",
",",
"fill_char"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | 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 | pipenv/vendor/click/termui.py | 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():
"""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
# ... | [
"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",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L354-L369 | [
"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",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | edit | r"""Edits the given text in the defined editor. If an editor is given
(should be the full path to the executable but the regular operating
system search path is used for finding the executable) it overrides
the detected editor. Optionally, some environment variables can be
used. If the editor is clos... | pipenv/vendor/click/termui.py | def edit(text=None, editor=None, env=None, require_save=True,
extension='.txt', filename=None):
r"""Edits the given text in the defined editor. If an editor is given
(should be the full path to the executable but the regular operating
system search path is used for finding the executable) it overr... | def edit(text=None, editor=None, env=None, require_save=True,
extension='.txt', filename=None):
r"""Edits the given text in the defined editor. If an editor is given
(should be the full path to the executable but the regular operating
system search path is used for finding the executable) it overr... | [
"r",
"Edits",
"the",
"given",
"text",
"in",
"the",
"defined",
"editor",
".",
"If",
"an",
"editor",
"is",
"given",
"(",
"should",
"be",
"the",
"full",
"path",
"to",
"the",
"executable",
"but",
"the",
"regular",
"operating",
"system",
"search",
"path",
"is... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L481-L515 | [
"def",
"edit",
"(",
"text",
"=",
"None",
",",
"editor",
"=",
"None",
",",
"env",
"=",
"None",
",",
"require_save",
"=",
"True",
",",
"extension",
"=",
"'.txt'",
",",
"filename",
"=",
"None",
")",
":",
"from",
".",
"_termui_impl",
"import",
"Editor",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | launch | This function launches the given URL (or filename) in the default
viewer application for this file type. If this is an executable, it
might launch the executable in a new session. The return value is
the exit code of the launched application. Usually, ``0`` indicates
success.
Examples::
... | pipenv/vendor/click/termui.py | def launch(url, wait=False, locate=False):
"""This function launches the given URL (or filename) in the default
viewer application for this file type. If this is an executable, it
might launch the executable in a new session. The return value is
the exit code of the launched application. Usually, ``0... | def launch(url, wait=False, locate=False):
"""This function launches the given URL (or filename) in the default
viewer application for this file type. If this is an executable, it
might launch the executable in a new session. The return value is
the exit code of the launched application. Usually, ``0... | [
"This",
"function",
"launches",
"the",
"given",
"URL",
"(",
"or",
"filename",
")",
"in",
"the",
"default",
"viewer",
"application",
"for",
"this",
"file",
"type",
".",
"If",
"this",
"is",
"an",
"executable",
"it",
"might",
"launch",
"the",
"executable",
"i... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L518-L541 | [
"def",
"launch",
"(",
"url",
",",
"wait",
"=",
"False",
",",
"locate",
"=",
"False",
")",
":",
"from",
".",
"_termui_impl",
"import",
"open_url",
"return",
"open_url",
"(",
"url",
",",
"wait",
"=",
"wait",
",",
"locate",
"=",
"locate",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | getchar | 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... | pipenv/vendor/click/termui.py | 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):
"""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 ... | [
"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"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L549-L572 | [
"def",
"getchar",
"(",
"echo",
"=",
"False",
")",
":",
"f",
"=",
"_getchar",
"if",
"f",
"is",
"None",
":",
"from",
".",
"_termui_impl",
"import",
"getchar",
"as",
"f",
"return",
"f",
"(",
"echo",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pause | 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... | pipenv/vendor/click/termui.py | 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):
"""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... | [
"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... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/termui.py#L580-L606 | [
"def",
"pause",
"(",
"info",
"=",
"'Press any key to continue ...'",
",",
"err",
"=",
"False",
")",
":",
"if",
"not",
"isatty",
"(",
"sys",
".",
"stdin",
")",
"or",
"not",
"isatty",
"(",
"sys",
".",
"stdout",
")",
":",
"return",
"try",
":",
"if",
"in... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | optional | 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... | pipenv/vendor/attr/validators.py | 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):
"""
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... | [
"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",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/validators.py#L114-L129 | [
"def",
"optional",
"(",
"validator",
")",
":",
"if",
"isinstance",
"(",
"validator",
",",
"list",
")",
":",
"return",
"_OptionalValidator",
"(",
"_AndValidator",
"(",
"validator",
")",
")",
"return",
"_OptionalValidator",
"(",
"validator",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DirectedGraph.copy | Return a shallow copy of this graph. | pipenv/vendor/resolvelib/structs.py | 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):
"""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... | [
"Return",
"a",
"shallow",
"copy",
"of",
"this",
"graph",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L18-L25 | [
"def",
"copy",
"(",
"self",
")",
":",
"other",
"=",
"DirectedGraph",
"(",
")",
"other",
".",
"_vertices",
"=",
"set",
"(",
"self",
".",
"_vertices",
")",
"other",
".",
"_forwards",
"=",
"{",
"k",
":",
"set",
"(",
"v",
")",
"for",
"k",
",",
"v",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DirectedGraph.add | Add a new vertex to the graph. | pipenv/vendor/resolvelib/structs.py | 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):
"""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() | [
"Add",
"a",
"new",
"vertex",
"to",
"the",
"graph",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L27-L34 | [
"def",
"add",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"_vertices",
":",
"raise",
"ValueError",
"(",
"'vertex exists'",
")",
"self",
".",
"_vertices",
".",
"add",
"(",
"key",
")",
"self",
".",
"_forwards",
"[",
"key",
"]",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DirectedGraph.remove | Remove a vertex from the graph, disconnecting all edges from/to it. | pipenv/vendor/resolvelib/structs.py | def remove(self, key):
"""Remove a vertex from the graph, disconnecting all edges from/to it.
"""
self._vertices.remove(key)
for f in self._forwards.pop(key):
self._backwards[f].remove(key)
for t in self._backwards.pop(key):
self._forwards[t].remove(key) | def remove(self, key):
"""Remove a vertex from the graph, disconnecting all edges from/to it.
"""
self._vertices.remove(key)
for f in self._forwards.pop(key):
self._backwards[f].remove(key)
for t in self._backwards.pop(key):
self._forwards[t].remove(key) | [
"Remove",
"a",
"vertex",
"from",
"the",
"graph",
"disconnecting",
"all",
"edges",
"from",
"/",
"to",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L36-L43 | [
"def",
"remove",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_vertices",
".",
"remove",
"(",
"key",
")",
"for",
"f",
"in",
"self",
".",
"_forwards",
".",
"pop",
"(",
"key",
")",
":",
"self",
".",
"_backwards",
"[",
"f",
"]",
".",
"remove",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DirectedGraph.connect | Connect two existing vertices.
Nothing happens if the vertices are already connected. | pipenv/vendor/resolvelib/structs.py | 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):
"""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) | [
"Connect",
"two",
"existing",
"vertices",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/structs.py#L48-L56 | [
"def",
"connect",
"(",
"self",
",",
"f",
",",
"t",
")",
":",
"if",
"t",
"not",
"in",
"self",
".",
"_vertices",
":",
"raise",
"KeyError",
"(",
"t",
")",
"self",
".",
"_forwards",
"[",
"f",
"]",
".",
"add",
"(",
"t",
")",
"self",
".",
"_backwards... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _const_compare_digest_backport | 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. | pipenv/vendor/urllib3/util/ssl_.py | 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):
"""
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 |=... | [
"Compare",
"two",
"digests",
"of",
"equal",
"length",
"in",
"constant",
"time",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L27-L37 | [
"def",
"_const_compare_digest_backport",
"(",
"a",
",",
"b",
")",
":",
"result",
"=",
"abs",
"(",
"len",
"(",
"a",
")",
"-",
"len",
"(",
"b",
")",
")",
"for",
"l",
",",
"r",
"in",
"zip",
"(",
"bytearray",
"(",
"a",
")",
",",
"bytearray",
"(",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | assert_fingerprint | Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons. | pipenv/vendor/urllib3/util/ssl_.py | def assert_fingerprint(cert, fingerprint):
"""
Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons.
"""
fingerprint = fingerprint.replace(':... | def assert_fingerprint(cert, fingerprint):
"""
Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons.
"""
fingerprint = fingerprint.replace(':... | [
"Checks",
"if",
"given",
"fingerprint",
"matches",
"the",
"supplied",
"certificate",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L163-L187 | [
"def",
"assert_fingerprint",
"(",
"cert",
",",
"fingerprint",
")",
":",
"fingerprint",
"=",
"fingerprint",
".",
"replace",
"(",
"':'",
",",
"''",
")",
".",
"lower",
"(",
")",
"digest_length",
"=",
"len",
"(",
"fingerprint",
")",
"hashfunc",
"=",
"HASHFUNC_... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | resolve_cert_reqs | Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_NONE`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abbreviation.
(So you can specify `REQUIRED` inst... | pipenv/vendor/urllib3/util/ssl_.py | def resolve_cert_reqs(candidate):
"""
Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_NONE`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abbrevi... | def resolve_cert_reqs(candidate):
"""
Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_NONE`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abbrevi... | [
"Resolves",
"the",
"argument",
"to",
"a",
"numeric",
"constant",
"which",
"can",
"be",
"passed",
"to",
"the",
"wrap_socket",
"function",
"/",
"method",
"from",
"the",
"ssl",
"module",
".",
"Defaults",
"to",
":",
"data",
":",
"ssl",
".",
"CERT_NONE",
".",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L190-L210 | [
"def",
"resolve_cert_reqs",
"(",
"candidate",
")",
":",
"if",
"candidate",
"is",
"None",
":",
"return",
"CERT_NONE",
"if",
"isinstance",
"(",
"candidate",
",",
"str",
")",
":",
"res",
"=",
"getattr",
"(",
"ssl",
",",
"candidate",
",",
"None",
")",
"if",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | resolve_ssl_version | like resolve_cert_reqs | pipenv/vendor/urllib3/util/ssl_.py | def resolve_ssl_version(candidate):
"""
like resolve_cert_reqs
"""
if candidate is None:
return PROTOCOL_SSLv23
if isinstance(candidate, str):
res = getattr(ssl, candidate, None)
if res is None:
res = getattr(ssl, 'PROTOCOL_' + candidate)
return res
... | def resolve_ssl_version(candidate):
"""
like resolve_cert_reqs
"""
if candidate is None:
return PROTOCOL_SSLv23
if isinstance(candidate, str):
res = getattr(ssl, candidate, None)
if res is None:
res = getattr(ssl, 'PROTOCOL_' + candidate)
return res
... | [
"like",
"resolve_cert_reqs"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L213-L226 | [
"def",
"resolve_ssl_version",
"(",
"candidate",
")",
":",
"if",
"candidate",
"is",
"None",
":",
"return",
"PROTOCOL_SSLv23",
"if",
"isinstance",
"(",
"candidate",
",",
"str",
")",
":",
"res",
"=",
"getattr",
"(",
"ssl",
",",
"candidate",
",",
"None",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ssl_wrap_socket | All arguments except for server_hostname, ssl_context, and ca_cert_dir have
the same meaning as they do when using :func:`ssl.wrap_socket`.
:param server_hostname:
When SNI is supported, the expected hostname of the certificate
:param ssl_context:
A pre-made :class:`SSLContext` object. If n... | pipenv/vendor/urllib3/util/ssl_.py | def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
ca_certs=None, server_hostname=None,
ssl_version=None, ciphers=None, ssl_context=None,
ca_cert_dir=None):
"""
All arguments except for server_hostname, ssl_context, and ca_cert_dir ... | def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
ca_certs=None, server_hostname=None,
ssl_version=None, ciphers=None, ssl_context=None,
ca_cert_dir=None):
"""
All arguments except for server_hostname, ssl_context, and ca_cert_dir ... | [
"All",
"arguments",
"except",
"for",
"server_hostname",
"ssl_context",
"and",
"ca_cert_dir",
"have",
"the",
"same",
"meaning",
"as",
"they",
"do",
"when",
"using",
":",
"func",
":",
"ssl",
".",
"wrap_socket",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L291-L357 | [
"def",
"ssl_wrap_socket",
"(",
"sock",
",",
"keyfile",
"=",
"None",
",",
"certfile",
"=",
"None",
",",
"cert_reqs",
"=",
"None",
",",
"ca_certs",
"=",
"None",
",",
"server_hostname",
"=",
"None",
",",
"ssl_version",
"=",
"None",
",",
"ciphers",
"=",
"Non... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_ipaddress | 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. | pipenv/vendor/urllib3/util/ssl_.py | 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):
"""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... | [
"Detects",
"whether",
"the",
"hostname",
"given",
"is",
"an",
"IP",
"address",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L360-L381 | [
"def",
"is_ipaddress",
"(",
"hostname",
")",
":",
"if",
"six",
".",
"PY3",
"and",
"isinstance",
"(",
"hostname",
",",
"bytes",
")",
":",
"# IDN A-label bytes are ASCII compatible.",
"hostname",
"=",
"hostname",
".",
"decode",
"(",
"'ascii'",
")",
"families",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry.get_backoff_time | Formula for computing the current backoff
:rtype: float | pipenv/vendor/urllib3/util/retry.py | def get_backoff_time(self):
""" Formula for computing the current backoff
:rtype: float
"""
# We want to consider only the last consecutive errors sequence (Ignore redirects).
consecutive_errors_len = len(list(takewhile(lambda x: x.redirect_location is None,
... | def get_backoff_time(self):
""" Formula for computing the current backoff
:rtype: float
"""
# We want to consider only the last consecutive errors sequence (Ignore redirects).
consecutive_errors_len = len(list(takewhile(lambda x: x.redirect_location is None,
... | [
"Formula",
"for",
"computing",
"the",
"current",
"backoff"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L213-L225 | [
"def",
"get_backoff_time",
"(",
"self",
")",
":",
"# We want to consider only the last consecutive errors sequence (Ignore redirects).",
"consecutive_errors_len",
"=",
"len",
"(",
"list",
"(",
"takewhile",
"(",
"lambda",
"x",
":",
"x",
".",
"redirect_location",
"is",
"Non... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry.get_retry_after | Get the value of Retry-After in seconds. | pipenv/vendor/urllib3/util/retry.py | 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):
""" 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) | [
"Get",
"the",
"value",
"of",
"Retry",
"-",
"After",
"in",
"seconds",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L243-L251 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry.sleep | 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. | pipenv/vendor/urllib3/util/retry.py | 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):
""" 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
... | [
"Sleep",
"between",
"retry",
"attempts",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L267-L281 | [
"def",
"sleep",
"(",
"self",
",",
"response",
"=",
"None",
")",
":",
"if",
"response",
":",
"slept",
"=",
"self",
".",
"sleep_for_retry",
"(",
"response",
")",
"if",
"slept",
":",
"return",
"self",
".",
"_sleep_backoff",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry._is_method_retryable | Checks if a given HTTP method should be retried upon, depending if
it is included on the method whitelist. | pipenv/vendor/urllib3/util/retry.py | 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):
""" 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 | [
"Checks",
"if",
"a",
"given",
"HTTP",
"method",
"should",
"be",
"retried",
"upon",
"depending",
"if",
"it",
"is",
"included",
"on",
"the",
"method",
"whitelist",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L295-L302 | [
"def",
"_is_method_retryable",
"(",
"self",
",",
"method",
")",
":",
"if",
"self",
".",
"method_whitelist",
"and",
"method",
".",
"upper",
"(",
")",
"not",
"in",
"self",
".",
"method_whitelist",
":",
"return",
"False",
"return",
"True"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry.is_retry | Is this method/status code retryable? (Based on whitelists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
be retried upon... | pipenv/vendor/urllib3/util/retry.py | def is_retry(self, method, status_code, has_retry_after=False):
""" Is this method/status code retryable? (Based on whitelists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the re... | def is_retry(self, method, status_code, has_retry_after=False):
""" Is this method/status code retryable? (Based on whitelists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the re... | [
"Is",
"this",
"method",
"/",
"status",
"code",
"retryable?",
"(",
"Based",
"on",
"whitelists",
"and",
"control",
"variables",
"such",
"as",
"the",
"number",
"of",
"total",
"retries",
"to",
"allow",
"whether",
"to",
"respect",
"the",
"Retry",
"-",
"After",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L304-L318 | [
"def",
"is_retry",
"(",
"self",
",",
"method",
",",
"status_code",
",",
"has_retry_after",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_is_method_retryable",
"(",
"method",
")",
":",
"return",
"False",
"if",
"self",
".",
"status_forcelist",
"and",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry.is_exhausted | Are we out of retries? | pipenv/vendor/urllib3/util/retry.py | 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):
""" 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 | [
"Are",
"we",
"out",
"of",
"retries?"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L320-L327 | [
"def",
"is_exhausted",
"(",
"self",
")",
":",
"retry_counts",
"=",
"(",
"self",
".",
"total",
",",
"self",
".",
"connect",
",",
"self",
".",
"read",
",",
"self",
".",
"redirect",
",",
"self",
".",
"status",
")",
"retry_counts",
"=",
"list",
"(",
"fil... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Retry.increment | Return a new Retry object with incremented retry counters.
:param response: A response object, or None, if the server did not
return a response.
:type response: :class:`~urllib3.response.HTTPResponse`
:param Exception error: An error encountered during the request, or
No... | pipenv/vendor/urllib3/util/retry.py | def increment(self, method=None, url=None, response=None, error=None,
_pool=None, _stacktrace=None):
""" Return a new Retry object with incremented retry counters.
:param response: A response object, or None, if the server did not
return a response.
:type response:... | def increment(self, method=None, url=None, response=None, error=None,
_pool=None, _stacktrace=None):
""" Return a new Retry object with incremented retry counters.
:param response: A response object, or None, if the server did not
return a response.
:type response:... | [
"Return",
"a",
"new",
"Retry",
"object",
"with",
"incremented",
"retry",
"counters",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/retry.py#L329-L402 | [
"def",
"increment",
"(",
"self",
",",
"method",
"=",
"None",
",",
"url",
"=",
"None",
",",
"response",
"=",
"None",
",",
"error",
"=",
"None",
",",
"_pool",
"=",
"None",
",",
"_stacktrace",
"=",
"None",
")",
":",
"if",
"self",
".",
"total",
"is",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CacheControlAdapter.build_response | Build a response by making a request or using the cache.
This will end up calling send and returning a potentially
cached response | pipenv/patched/notpip/_vendor/cachecontrol/adapter.py | 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
):
"""
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... | [
"Build",
"a",
"response",
"by",
"making",
"a",
"request",
"or",
"using",
"the",
"cache",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/adapter.py#L57-L129 | [
"def",
"build_response",
"(",
"self",
",",
"request",
",",
"response",
",",
"from_cache",
"=",
"False",
",",
"cacheable_methods",
"=",
"None",
")",
":",
"cacheable",
"=",
"cacheable_methods",
"or",
"self",
".",
"cacheable_methods",
"if",
"not",
"from_cache",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_process_mapping | Try to look up the process tree via Linux's /proc | pipenv/vendor/shellingham/posix/linux.py | def get_process_mapping():
"""Try to look up the process tree via Linux's /proc
"""
with open('/proc/{0}/stat'.format(os.getpid())) as f:
self_tty = f.read().split()[STAT_TTY]
processes = {}
for pid in os.listdir('/proc'):
if not pid.isdigit():
continue
try:
... | def get_process_mapping():
"""Try to look up the process tree via Linux's /proc
"""
with open('/proc/{0}/stat'.format(os.getpid())) as f:
self_tty = f.read().split()[STAT_TTY]
processes = {}
for pid in os.listdir('/proc'):
if not pid.isdigit():
continue
try:
... | [
"Try",
"to",
"look",
"up",
"the",
"process",
"tree",
"via",
"Linux",
"s",
"/",
"proc"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/linux.py#L11-L35 | [
"def",
"get_process_mapping",
"(",
")",
":",
"with",
"open",
"(",
"'/proc/{0}/stat'",
".",
"format",
"(",
"os",
".",
"getpid",
"(",
")",
")",
")",
"as",
"f",
":",
"self_tty",
"=",
"f",
".",
"read",
"(",
")",
".",
"split",
"(",
")",
"[",
"STAT_TTY",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | rehash | Return (hash, length) for path using hashlib.sha256() | pipenv/patched/notpip/_internal/wheel.py | def rehash(path, blocksize=1 << 20):
# type: (str, int) -> Tuple[str, str]
"""Return (hash, length) for path using hashlib.sha256()"""
h = hashlib.sha256()
length = 0
with open(path, 'rb') as f:
for block in read_chunks(f, size=blocksize):
length += len(block)
h.updat... | def rehash(path, blocksize=1 << 20):
# type: (str, int) -> Tuple[str, str]
"""Return (hash, length) for path using hashlib.sha256()"""
h = hashlib.sha256()
length = 0
with open(path, 'rb') as f:
for block in read_chunks(f, size=blocksize):
length += len(block)
h.updat... | [
"Return",
"(",
"hash",
"length",
")",
"for",
"path",
"using",
"hashlib",
".",
"sha256",
"()"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L71-L84 | [
"def",
"rehash",
"(",
"path",
",",
"blocksize",
"=",
"1",
"<<",
"20",
")",
":",
"# type: (str, int) -> Tuple[str, str]",
"h",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"length",
"=",
"0",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | replace_python_tag | Replace the Python tag in a wheel file name with a new value. | pipenv/patched/notpip/_internal/wheel.py | 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
"""Replace the Python tag in a wheel file name with a new value.
"""
parts = wheelname.split('-')
parts[-3] = new_tag
return '-'.join(parts) | [
"Replace",
"the",
"Python",
"tag",
"in",
"a",
"wheel",
"file",
"name",
"with",
"a",
"new",
"value",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L98-L104 | [
"def",
"replace_python_tag",
"(",
"wheelname",
",",
"new_tag",
")",
":",
"# type: (str, str) -> str",
"parts",
"=",
"wheelname",
".",
"split",
"(",
"'-'",
")",
"parts",
"[",
"-",
"3",
"]",
"=",
"new_tag",
"return",
"'-'",
".",
"join",
"(",
"parts",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | message_about_scripts_not_on_PATH | 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. | pipenv/patched/notpip/_internal/wheel.py | 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]
"""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... | [
"Determine",
"if",
"any",
"scripts",
"are",
"not",
"on",
"PATH",
"and",
"format",
"a",
"warning",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L180-L239 | [
"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",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | sorted_outrows | 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. | pipenv/patched/notpip/_internal/wheel.py | 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]
"""
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... | [
"Return",
"the",
"given",
"rows",
"of",
"a",
"RECORD",
"file",
"in",
"sorted",
"order",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L242-L260 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_csv_rows_for_installed | :param installed: A map from archive RECORD path to installation RECORD
path. | pipenv/patched/notpip/_internal/wheel.py | def get_csv_rows_for_installed(
old_csv_rows, # type: Iterable[List[str]]
installed, # type: Dict[str, str]
changed, # type: set
generated, # type: List[str]
lib_dir, # type: str
):
# type: (...) -> List[InstalledCSVRow]
"""
:param installed: A map from archive RECORD path to instal... | def get_csv_rows_for_installed(
old_csv_rows, # type: Iterable[List[str]]
installed, # type: Dict[str, str]
changed, # type: set
generated, # type: List[str]
lib_dir, # type: str
):
# type: (...) -> List[InstalledCSVRow]
"""
:param installed: A map from archive RECORD path to instal... | [
":",
"param",
"installed",
":",
"A",
"map",
"from",
"archive",
"RECORD",
"path",
"to",
"installation",
"RECORD",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L263-L296 | [
"def",
"get_csv_rows_for_installed",
"(",
"old_csv_rows",
",",
"# type: Iterable[List[str]]",
"installed",
",",
"# type: Dict[str, str]",
"changed",
",",
"# type: set",
"generated",
",",
"# type: List[str]",
"lib_dir",
",",
"# type: str",
")",
":",
"# type: (...) -> List[Inst... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | move_wheel_files | Install a wheel | pipenv/patched/notpip/_internal/wheel.py | def move_wheel_files(
name, # type: str
req, # type: Requirement
wheeldir, # type: str
user=False, # type: bool
home=None, # type: Optional[str]
root=None, # type: Optional[str]
pycompile=True, # type: bool
scheme=None, # type: Optional[Mapping[str, str]]
isolated=False, # t... | def move_wheel_files(
name, # type: str
req, # type: Requirement
wheeldir, # type: str
user=False, # type: bool
home=None, # type: Optional[str]
root=None, # type: Optional[str]
pycompile=True, # type: bool
scheme=None, # type: Optional[Mapping[str, str]]
isolated=False, # t... | [
"Install",
"a",
"wheel"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L299-L614 | [
"def",
"move_wheel_files",
"(",
"name",
",",
"# type: str",
"req",
",",
"# type: Requirement",
"wheeldir",
",",
"# type: str",
"user",
"=",
"False",
",",
"# type: bool",
"home",
"=",
"None",
",",
"# type: Optional[str]",
"root",
"=",
"None",
",",
"# type: Optional... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | wheel_version | Return the Wheel-Version of an extracted wheel, if possible.
Otherwise, return None if we couldn't parse / extract it. | pipenv/patched/notpip/_internal/wheel.py | 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, ...]]
"""
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]
... | [
"Return",
"the",
"Wheel",
"-",
"Version",
"of",
"an",
"extracted",
"wheel",
"if",
"possible",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L617-L634 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _contains_egg_info | Determine whether the string looks like an egg_info.
:param s: The string to parse. E.g. foo-2.1 | pipenv/patched/notpip/_internal/wheel.py | 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)):
"""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)) | [
"Determine",
"whether",
"the",
"string",
"looks",
"like",
"an",
"egg_info",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L727-L733 | [
"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",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | should_use_ephemeral_cache | 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 ... | pipenv/patched/notpip/_internal/wheel.py | 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]
"""
Return whether to build an InstallRequirement object using the
ephemeral cache.
:p... | [
"Return",
"whether",
"to",
"build",
"an",
"InstallRequirement",
"object",
"using",
"the",
"ephemeral",
"cache",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L736-L787 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | format_command | Format command information for logging. | pipenv/patched/notpip/_internal/wheel.py | 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
"""
Format command information for logging.
"""
text = 'Command arguments: {}\n'.format(command_args)
if not command_output:
text += 'Command output: None'
elif logger.g... | [
"Format",
"command",
"information",
"for",
"logging",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L790-L812 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_legacy_build_wheel_path | Return the path to the wheel in the temporary build directory. | pipenv/patched/notpip/_internal/wheel.py | 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",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L815-L844 | [
"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]",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Wheel.support_index_min | Return the lowest index that one of the wheel's file_tag combinations
achieves in the supported_tags list e.g. if there are 8 supported tags,
and one of the file tags is first in the list, then return 0. Returns
None is the wheel is not supported. | pipenv/patched/notpip/_internal/wheel.py | def support_index_min(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> Optional[int]
"""
Return the lowest index that one of the wheel's file_tag combinations
achieves in the supported_tags list e.g. if there are 8 supported tags,
and one of the file tags is first in the ... | def support_index_min(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> Optional[int]
"""
Return the lowest index that one of the wheel's file_tag combinations
achieves in the supported_tags list e.g. if there are 8 supported tags,
and one of the file tags is first in the ... | [
"Return",
"the",
"lowest",
"index",
"that",
"one",
"of",
"the",
"wheel",
"s",
"file_tag",
"combinations",
"achieves",
"in",
"the",
"supported_tags",
"list",
"e",
".",
"g",
".",
"if",
"there",
"are",
"8",
"supported",
"tags",
"and",
"one",
"of",
"the",
"f... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L706-L717 | [
"def",
"support_index_min",
"(",
"self",
",",
"tags",
"=",
"None",
")",
":",
"# type: (Optional[List[Pep425Tag]]) -> Optional[int]",
"if",
"tags",
"is",
"None",
":",
"# for mock",
"tags",
"=",
"pep425tags",
".",
"get_supported",
"(",
")",
"indexes",
"=",
"[",
"t... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Wheel.supported | Is this wheel supported on this system? | pipenv/patched/notpip/_internal/wheel.py | 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
"""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)) | [
"Is",
"this",
"wheel",
"supported",
"on",
"this",
"system?"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L719-L724 | [
"def",
"supported",
"(",
"self",
",",
"tags",
"=",
"None",
")",
":",
"# type: (Optional[List[Pep425Tag]]) -> bool",
"if",
"tags",
"is",
"None",
":",
"# for mock",
"tags",
"=",
"pep425tags",
".",
"get_supported",
"(",
")",
"return",
"bool",
"(",
"set",
"(",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WheelBuilder._build_one | Build one wheel.
:return: The filename of the built wheel, or None if the build failed. | pipenv/patched/notpip/_internal/wheel.py | 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):
"""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... | [
"Build",
"one",
"wheel",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L870-L878 | [
"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",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WheelBuilder._build_one_pep517 | Build one InstallRequirement using the PEP 517 build process.
Returns path to wheel if successfully built. Otherwise, returns None. | pipenv/patched/notpip/_internal/wheel.py | 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):
"""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... | [
"Build",
"one",
"InstallRequirement",
"using",
"the",
"PEP",
"517",
"build",
"process",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L911-L938 | [
"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)'",
"%",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WheelBuilder._build_one_legacy | Build one InstallRequirement using the "legacy" build process.
Returns path to wheel if successfully built. Otherwise, returns None. | pipenv/patched/notpip/_internal/wheel.py | 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):
"""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... | [
"Build",
"one",
"InstallRequirement",
"using",
"the",
"legacy",
"build",
"process",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L940-L971 | [
"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",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WheelBuilder.build | 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. | pipenv/patched/notpip/_internal/wheel.py | 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]
"""Build wheels.
:param unpack: If True, replace the sdist we built from with the
... | [
"Build",
"wheels",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L985-L1097 | [
"def",
"build",
"(",
"self",
",",
"requirements",
",",
"# type: Iterable[InstallRequirement]",
"session",
",",
"# type: PipSession",
"autobuilding",
"=",
"False",
"# type: bool",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"buildset",
"=",
"[",
"]",
"format_con... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageIndex._get_pypirc_command | Get the distutils command for interacting with PyPI configurations.
:return: the command. | pipenv/vendor/distlib/index.py | def _get_pypirc_command(self):
"""
Get the distutils command for interacting with PyPI configurations.
:return: the command.
"""
from distutils.core import Distribution
from distutils.config import PyPIRCCommand
d = Distribution()
return PyPIRCCommand(d) | def _get_pypirc_command(self):
"""
Get the distutils command for interacting with PyPI configurations.
:return: the command.
"""
from distutils.core import Distribution
from distutils.config import PyPIRCCommand
d = Distribution()
return PyPIRCCommand(d) | [
"Get",
"the",
"distutils",
"command",
"for",
"interacting",
"with",
"PyPI",
"configurations",
".",
":",
"return",
":",
"the",
"command",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L65-L73 | [
"def",
"_get_pypirc_command",
"(",
"self",
")",
":",
"from",
"distutils",
".",
"core",
"import",
"Distribution",
"from",
"distutils",
".",
"config",
"import",
"PyPIRCCommand",
"d",
"=",
"Distribution",
"(",
")",
"return",
"PyPIRCCommand",
"(",
"d",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageIndex.read_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. | pipenv/vendor/distlib/index.py | 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):
"""
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
... | [
"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",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L75-L88 | [
"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... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageIndex.save_configuration | 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. | pipenv/vendor/distlib/index.py | 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):
"""
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... | [
"Save",
"the",
"PyPI",
"access",
"configuration",
".",
"You",
"must",
"have",
"set",
"username",
"and",
"password",
"attributes",
"before",
"calling",
"this",
"method",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L90-L100 | [
"def",
"save_configuration",
"(",
"self",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"# get distutils to do the work",
"c",
"=",
"self",
".",
"_get_pypirc_command",
"(",
")",
"c",
".",
"_store_pypirc",
"(",
"self",
".",
"username",
",",
"self",
".",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageIndex.check_credentials | Check that ``username`` and ``password`` have been set, and raise an
exception if not. | pipenv/vendor/distlib/index.py | 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):
"""
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()
... | [
"Check",
"that",
"username",
"and",
"password",
"have",
"been",
"set",
"and",
"raise",
"an",
"exception",
"if",
"not",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L102-L112 | [
"def",
"check_credentials",
"(",
"self",
")",
":",
"if",
"self",
".",
"username",
"is",
"None",
"or",
"self",
".",
"password",
"is",
"None",
":",
"raise",
"DistlibException",
"(",
"'username and password must be set'",
")",
"pm",
"=",
"HTTPPasswordMgr",
"(",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageIndex.register | 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 ... | pipenv/vendor/distlib/index.py | 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):
"""
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... | [
"Register",
"a",
"distribution",
"on",
"PyPI",
"using",
"the",
"provided",
"metadata",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L114-L132 | [
"def",
"register",
"(",
"self",
",",
"metadata",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"metadata",
".",
"validate",
"(",
")",
"d",
"=",
"metadata",
".",
"todict",
"(",
")",
"d",
"[",
"':action'",
"]",
"=",
"'verify'",
"request",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.