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 | Project.register_proper_name | Registers a proper name to the database. | pipenv/project.py | def register_proper_name(self, name):
"""Registers a proper name to the database."""
with self.proper_names_db_path.open("a") as f:
f.write(u"{0}\n".format(name)) | def register_proper_name(self, name):
"""Registers a proper name to the database."""
with self.proper_names_db_path.open("a") as f:
f.write(u"{0}\n".format(name)) | [
"Registers",
"a",
"proper",
"name",
"to",
"the",
"database",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L462-L465 | [
"def",
"register_proper_name",
"(",
"self",
",",
"name",
")",
":",
"with",
"self",
".",
"proper_names_db_path",
".",
"open",
"(",
"\"a\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"u\"{0}\\n\"",
".",
"format",
"(",
"name",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.parsed_pipfile | Parse Pipfile into a TOMLFile and cache it
(call clear_pipfile_cache() afterwards if mutating) | pipenv/project.py | def parsed_pipfile(self):
"""Parse Pipfile into a TOMLFile and cache it
(call clear_pipfile_cache() afterwards if mutating)"""
contents = self.read_pipfile()
# use full contents to get around str/bytes 2/3 issues
cache_key = (self.pipfile_location, contents)
if cache_key... | def parsed_pipfile(self):
"""Parse Pipfile into a TOMLFile and cache it
(call clear_pipfile_cache() afterwards if mutating)"""
contents = self.read_pipfile()
# use full contents to get around str/bytes 2/3 issues
cache_key = (self.pipfile_location, contents)
if cache_key... | [
"Parse",
"Pipfile",
"into",
"a",
"TOMLFile",
"and",
"cache",
"it"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L491-L501 | [
"def",
"parsed_pipfile",
"(",
"self",
")",
":",
"contents",
"=",
"self",
".",
"read_pipfile",
"(",
")",
"# use full contents to get around str/bytes 2/3 issues",
"cache_key",
"=",
"(",
"self",
".",
"pipfile_location",
",",
"contents",
")",
"if",
"cache_key",
"not",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project._lockfile | Pipfile.lock divided by PyPI and external dependencies. | pipenv/project.py | def _lockfile(self):
"""Pipfile.lock divided by PyPI and external dependencies."""
pfile = pipfile.load(self.pipfile_location, inject_env=False)
lockfile = json.loads(pfile.lock())
for section in ("default", "develop"):
lock_section = lockfile.get(section, {})
for... | def _lockfile(self):
"""Pipfile.lock divided by PyPI and external dependencies."""
pfile = pipfile.load(self.pipfile_location, inject_env=False)
lockfile = json.loads(pfile.lock())
for section in ("default", "develop"):
lock_section = lockfile.get(section, {})
for... | [
"Pipfile",
".",
"lock",
"divided",
"by",
"PyPI",
"and",
"external",
"dependencies",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L581-L590 | [
"def",
"_lockfile",
"(",
"self",
")",
":",
"pfile",
"=",
"pipfile",
".",
"load",
"(",
"self",
".",
"pipfile_location",
",",
"inject_env",
"=",
"False",
")",
"lockfile",
"=",
"json",
".",
"loads",
"(",
"pfile",
".",
"lock",
"(",
")",
")",
"for",
"sect... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.all_packages | Returns a list of all packages. | pipenv/project.py | def all_packages(self):
"""Returns a list of all packages."""
p = dict(self.parsed_pipfile.get("dev-packages", {}))
p.update(self.parsed_pipfile.get("packages", {}))
return p | def all_packages(self):
"""Returns a list of all packages."""
p = dict(self.parsed_pipfile.get("dev-packages", {}))
p.update(self.parsed_pipfile.get("packages", {}))
return p | [
"Returns",
"a",
"list",
"of",
"all",
"packages",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L648-L652 | [
"def",
"all_packages",
"(",
"self",
")",
":",
"p",
"=",
"dict",
"(",
"self",
".",
"parsed_pipfile",
".",
"get",
"(",
"\"dev-packages\"",
",",
"{",
"}",
")",
")",
"p",
".",
"update",
"(",
"self",
".",
"parsed_pipfile",
".",
"get",
"(",
"\"packages\"",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.create_pipfile | Creates the Pipfile, filled with juicy defaults. | pipenv/project.py | def create_pipfile(self, python=None):
"""Creates the Pipfile, filled with juicy defaults."""
from .vendor.pip_shims.shims import (
ConfigOptionParser, make_option_group, index_group
)
config_parser = ConfigOptionParser(name=self.name)
config_parser.add_option_group(... | def create_pipfile(self, python=None):
"""Creates the Pipfile, filled with juicy defaults."""
from .vendor.pip_shims.shims import (
ConfigOptionParser, make_option_group, index_group
)
config_parser = ConfigOptionParser(name=self.name)
config_parser.add_option_group(... | [
"Creates",
"the",
"Pipfile",
"filled",
"with",
"juicy",
"defaults",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L674-L715 | [
"def",
"create_pipfile",
"(",
"self",
",",
"python",
"=",
"None",
")",
":",
"from",
".",
"vendor",
".",
"pip_shims",
".",
"shims",
"import",
"(",
"ConfigOptionParser",
",",
"make_option_group",
",",
"index_group",
")",
"config_parser",
"=",
"ConfigOptionParser",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.write_toml | Writes the given data structure out as TOML. | pipenv/project.py | def write_toml(self, data, path=None):
"""Writes the given data structure out as TOML."""
if path is None:
path = self.pipfile_location
data = convert_toml_outline_tables(data)
try:
formatted_data = tomlkit.dumps(data).rstrip()
except Exception:
... | def write_toml(self, data, path=None):
"""Writes the given data structure out as TOML."""
if path is None:
path = self.pipfile_location
data = convert_toml_outline_tables(data)
try:
formatted_data = tomlkit.dumps(data).rstrip()
except Exception:
... | [
"Writes",
"the",
"given",
"data",
"structure",
"out",
"as",
"TOML",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L783-L815 | [
"def",
"write_toml",
"(",
"self",
",",
"data",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"self",
".",
"pipfile_location",
"data",
"=",
"convert_toml_outline_tables",
"(",
"data",
")",
"try",
":",
"formatted_data",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.write_lockfile | Write out the lockfile. | pipenv/project.py | def write_lockfile(self, content):
"""Write out the lockfile.
"""
s = self._lockfile_encoder.encode(content)
open_kwargs = {"newline": self._lockfile_newlines, "encoding": "utf-8"}
with vistir.contextmanagers.atomic_open_for_write(
self.lockfile_location, **open_kwarg... | def write_lockfile(self, content):
"""Write out the lockfile.
"""
s = self._lockfile_encoder.encode(content)
open_kwargs = {"newline": self._lockfile_newlines, "encoding": "utf-8"}
with vistir.contextmanagers.atomic_open_for_write(
self.lockfile_location, **open_kwarg... | [
"Write",
"out",
"the",
"lockfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L817-L829 | [
"def",
"write_lockfile",
"(",
"self",
",",
"content",
")",
":",
"s",
"=",
"self",
".",
"_lockfile_encoder",
".",
"encode",
"(",
"content",
")",
"open_kwargs",
"=",
"{",
"\"newline\"",
":",
"self",
".",
"_lockfile_newlines",
",",
"\"encoding\"",
":",
"\"utf-8... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.find_source | Given a source, find it.
source can be a url or an index name. | pipenv/project.py | def find_source(self, source):
"""
Given a source, find it.
source can be a url or an index name.
"""
if not is_valid_url(source):
try:
source = self.get_source(name=source)
except SourceNotFound:
source = self.get_source(u... | def find_source(self, source):
"""
Given a source, find it.
source can be a url or an index name.
"""
if not is_valid_url(source):
try:
source = self.get_source(name=source)
except SourceNotFound:
source = self.get_source(u... | [
"Given",
"a",
"source",
"find",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L854-L867 | [
"def",
"find_source",
"(",
"self",
",",
"source",
")",
":",
"if",
"not",
"is_valid_url",
"(",
"source",
")",
":",
"try",
":",
"source",
"=",
"self",
".",
"get_source",
"(",
"name",
"=",
"source",
")",
"except",
"SourceNotFound",
":",
"source",
"=",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.get_package_name_in_pipfile | Get the equivalent package name in pipfile | pipenv/project.py | def get_package_name_in_pipfile(self, package_name, dev=False):
"""Get the equivalent package name in pipfile"""
key = "dev-packages" if dev else "packages"
section = self.parsed_pipfile.get(key, {})
package_name = pep423_name(package_name)
for name in section.keys():
... | def get_package_name_in_pipfile(self, package_name, dev=False):
"""Get the equivalent package name in pipfile"""
key = "dev-packages" if dev else "packages"
section = self.parsed_pipfile.get(key, {})
package_name = pep423_name(package_name)
for name in section.keys():
... | [
"Get",
"the",
"equivalent",
"package",
"name",
"in",
"pipfile"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L898-L906 | [
"def",
"get_package_name_in_pipfile",
"(",
"self",
",",
"package_name",
",",
"dev",
"=",
"False",
")",
":",
"key",
"=",
"\"dev-packages\"",
"if",
"dev",
"else",
"\"packages\"",
"section",
"=",
"self",
".",
"parsed_pipfile",
".",
"get",
"(",
"key",
",",
"{",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.add_index_to_pipfile | Adds a given index to the Pipfile. | pipenv/project.py | def add_index_to_pipfile(self, index, verify_ssl=True):
"""Adds a given index to the Pipfile."""
# Read and append Pipfile.
p = self.parsed_pipfile
try:
self.get_source(url=index)
except SourceNotFound:
source = {"url": index, "verify_ssl": verify_ssl}
... | def add_index_to_pipfile(self, index, verify_ssl=True):
"""Adds a given index to the Pipfile."""
# Read and append Pipfile.
p = self.parsed_pipfile
try:
self.get_source(url=index)
except SourceNotFound:
source = {"url": index, "verify_ssl": verify_ssl}
... | [
"Adds",
"a",
"given",
"index",
"to",
"the",
"Pipfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L969-L986 | [
"def",
"add_index_to_pipfile",
"(",
"self",
",",
"index",
",",
"verify_ssl",
"=",
"True",
")",
":",
"# Read and append Pipfile.",
"p",
"=",
"self",
".",
"parsed_pipfile",
"try",
":",
"self",
".",
"get_source",
"(",
"url",
"=",
"index",
")",
"except",
"Source... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.ensure_proper_casing | Ensures proper casing of Pipfile packages | pipenv/project.py | def ensure_proper_casing(self):
"""Ensures proper casing of Pipfile packages"""
pfile = self.parsed_pipfile
casing_changed = self.proper_case_section(pfile.get("packages", {}))
casing_changed |= self.proper_case_section(pfile.get("dev-packages", {}))
return casing_changed | def ensure_proper_casing(self):
"""Ensures proper casing of Pipfile packages"""
pfile = self.parsed_pipfile
casing_changed = self.proper_case_section(pfile.get("packages", {}))
casing_changed |= self.proper_case_section(pfile.get("dev-packages", {}))
return casing_changed | [
"Ensures",
"proper",
"casing",
"of",
"Pipfile",
"packages"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L1028-L1033 | [
"def",
"ensure_proper_casing",
"(",
"self",
")",
":",
"pfile",
"=",
"self",
".",
"parsed_pipfile",
"casing_changed",
"=",
"self",
".",
"proper_case_section",
"(",
"pfile",
".",
"get",
"(",
"\"packages\"",
",",
"{",
"}",
")",
")",
"casing_changed",
"|=",
"sel... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.proper_case_section | Verify proper casing is retrieved, when available, for each
dependency in the section. | pipenv/project.py | def proper_case_section(self, section):
"""Verify proper casing is retrieved, when available, for each
dependency in the section.
"""
# Casing for section.
changed_values = False
unknown_names = [k for k in section.keys() if k not in set(self.proper_names)]
# Repl... | def proper_case_section(self, section):
"""Verify proper casing is retrieved, when available, for each
dependency in the section.
"""
# Casing for section.
changed_values = False
unknown_names = [k for k in section.keys() if k not in set(self.proper_names)]
# Repl... | [
"Verify",
"proper",
"casing",
"is",
"retrieved",
"when",
"available",
"for",
"each",
"dependency",
"in",
"the",
"section",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L1035-L1059 | [
"def",
"proper_case_section",
"(",
"self",
",",
"section",
")",
":",
"# Casing for section.",
"changed_values",
"=",
"False",
"unknown_names",
"=",
"[",
"k",
"for",
"k",
"in",
"section",
".",
"keys",
"(",
")",
"if",
"k",
"not",
"in",
"set",
"(",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | native_concat | Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
string is returned. | pipenv/vendor/jinja2/nativetypes.py | def native_concat(nodes):
"""Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
s... | def native_concat(nodes):
"""Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
s... | [
"Return",
"a",
"native",
"Python",
"type",
"from",
"the",
"list",
"of",
"compiled",
"nodes",
".",
"If",
"the",
"result",
"is",
"a",
"single",
"node",
"its",
"value",
"is",
"returned",
".",
"Otherwise",
"the",
"nodes",
"are",
"concatenated",
"as",
"strings"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nativetypes.py#L11-L31 | [
"def",
"native_concat",
"(",
"nodes",
")",
":",
"head",
"=",
"list",
"(",
"islice",
"(",
"nodes",
",",
"2",
")",
")",
"if",
"not",
"head",
":",
"return",
"None",
"if",
"len",
"(",
"head",
")",
"==",
"1",
":",
"out",
"=",
"head",
"[",
"0",
"]",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | NativeCodeGenerator.visit_Output | Same as :meth:`CodeGenerator.visit_Output`, but do not call
``to_string`` on output nodes in generated code. | pipenv/vendor/jinja2/nativetypes.py | def visit_Output(self, node, frame):
"""Same as :meth:`CodeGenerator.visit_Output`, but do not call
``to_string`` on output nodes in generated code.
"""
if self.has_known_extends and frame.require_output_check:
return
finalize = self.environment.finalize
fina... | def visit_Output(self, node, frame):
"""Same as :meth:`CodeGenerator.visit_Output`, but do not call
``to_string`` on output nodes in generated code.
"""
if self.has_known_extends and frame.require_output_check:
return
finalize = self.environment.finalize
fina... | [
"Same",
"as",
":",
"meth",
":",
"CodeGenerator",
".",
"visit_Output",
"but",
"do",
"not",
"call",
"to_string",
"on",
"output",
"nodes",
"in",
"generated",
"code",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/nativetypes.py#L39-L195 | [
"def",
"visit_Output",
"(",
"self",
",",
"node",
",",
"frame",
")",
":",
"if",
"self",
".",
"has_known_extends",
"and",
"frame",
".",
"require_output_check",
":",
"return",
"finalize",
"=",
"self",
".",
"environment",
".",
"finalize",
"finalize_context",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.load | Clear all existing key:value items and import all key:value items from
<mapping>. If multiple values exist for the same key in <mapping>, they
are all be imported.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.load([(4,4), (4,44), (5,5)])
omd.al... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def load(self, *args, **kwargs):
"""
Clear all existing key:value items and import all key:value items from
<mapping>. If multiple values exist for the same key in <mapping>, they
are all be imported.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
... | def load(self, *args, **kwargs):
"""
Clear all existing key:value items and import all key:value items from
<mapping>. If multiple values exist for the same key in <mapping>, they
are all be imported.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
... | [
"Clear",
"all",
"existing",
"key",
":",
"value",
"items",
"and",
"import",
"all",
"key",
":",
"value",
"items",
"from",
"<mapping",
">",
".",
"If",
"multiple",
"values",
"exist",
"for",
"the",
"same",
"key",
"in",
"<mapping",
">",
"they",
"are",
"all",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L156-L171 | [
"def",
"load",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"clear",
"(",
")",
"self",
".",
"updateall",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.updateall | Update this dictionary with the items from <mapping>, replacing
existing key:value items with shared keys before adding new key:value
items.
Example:
omd = omdict([(1,1), (2,2)])
omd.updateall([(2,'two'), (1,'one'), (2,222), (1,111)])
omd.allitems() == [(1, 'one'),... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def updateall(self, *args, **kwargs):
"""
Update this dictionary with the items from <mapping>, replacing
existing key:value items with shared keys before adding new key:value
items.
Example:
omd = omdict([(1,1), (2,2)])
omd.updateall([(2,'two'), (1,'one'), (... | def updateall(self, *args, **kwargs):
"""
Update this dictionary with the items from <mapping>, replacing
existing key:value items with shared keys before adding new key:value
items.
Example:
omd = omdict([(1,1), (2,2)])
omd.updateall([(2,'two'), (1,'one'), (... | [
"Update",
"this",
"dictionary",
"with",
"the",
"items",
"from",
"<mapping",
">",
"replacing",
"existing",
"key",
":",
"value",
"items",
"with",
"shared",
"keys",
"before",
"adding",
"new",
"key",
":",
"value",
"items",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L201-L215 | [
"def",
"updateall",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_update_updateall",
"(",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict._bin_update_items | <replacements and <leftovers> are modified directly, ala pass by
reference. | pipenv/vendor/orderedmultidict/orderedmultidict.py | def _bin_update_items(self, items, replace_at_most_one,
replacements, leftovers):
"""
<replacements and <leftovers> are modified directly, ala pass by
reference.
"""
for key, value in items:
# If there are existing items with key <key> that h... | def _bin_update_items(self, items, replace_at_most_one,
replacements, leftovers):
"""
<replacements and <leftovers> are modified directly, ala pass by
reference.
"""
for key, value in items:
# If there are existing items with key <key> that h... | [
"<replacements",
"and",
"<leftovers",
">",
"are",
"modified",
"directly",
"ala",
"pass",
"by",
"reference",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L235-L254 | [
"def",
"_bin_update_items",
"(",
"self",
",",
"items",
",",
"replace_at_most_one",
",",
"replacements",
",",
"leftovers",
")",
":",
"for",
"key",
",",
"value",
"in",
"items",
":",
"# If there are existing items with key <key> that have yet to be",
"# marked for replacemen... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.getlist | Returns: The list of values for <key> if <key> is in the dictionary,
else <default>. If <default> is not provided, an empty list is
returned. | pipenv/vendor/orderedmultidict/orderedmultidict.py | def getlist(self, key, default=[]):
"""
Returns: The list of values for <key> if <key> is in the dictionary,
else <default>. If <default> is not provided, an empty list is
returned.
"""
if key in self:
return [node.value for node in self._map[key]]
ret... | def getlist(self, key, default=[]):
"""
Returns: The list of values for <key> if <key> is in the dictionary,
else <default>. If <default> is not provided, an empty list is
returned.
"""
if key in self:
return [node.value for node in self._map[key]]
ret... | [
"Returns",
":",
"The",
"list",
"of",
"values",
"for",
"<key",
">",
"if",
"<key",
">",
"is",
"in",
"the",
"dictionary",
"else",
"<default",
">",
".",
"If",
"<default",
">",
"is",
"not",
"provided",
"an",
"empty",
"list",
"is",
"returned",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L274-L282 | [
"def",
"getlist",
"(",
"self",
",",
"key",
",",
"default",
"=",
"[",
"]",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"[",
"node",
".",
"value",
"for",
"node",
"in",
"self",
".",
"_map",
"[",
"key",
"]",
"]",
"return",
"default"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.setdefaultlist | Similar to setdefault() except <defaultlist> is a list of values to set
for <key>. If <key> already exists, its existing list of values is
returned.
If <key> isn't a key and <defaultlist> is an empty list, [], no values
are added for <key> and <key> will not be added as a key.
... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def setdefaultlist(self, key, defaultlist=[None]):
"""
Similar to setdefault() except <defaultlist> is a list of values to set
for <key>. If <key> already exists, its existing list of values is
returned.
If <key> isn't a key and <defaultlist> is an empty list, [], no values
... | def setdefaultlist(self, key, defaultlist=[None]):
"""
Similar to setdefault() except <defaultlist> is a list of values to set
for <key>. If <key> already exists, its existing list of values is
returned.
If <key> isn't a key and <defaultlist> is an empty list, [], no values
... | [
"Similar",
"to",
"setdefault",
"()",
"except",
"<defaultlist",
">",
"is",
"a",
"list",
"of",
"values",
"to",
"set",
"for",
"<key",
">",
".",
"If",
"<key",
">",
"already",
"exists",
"its",
"existing",
"list",
"of",
"values",
"is",
"returned",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L290-L305 | [
"def",
"setdefaultlist",
"(",
"self",
",",
"key",
",",
"defaultlist",
"=",
"[",
"None",
"]",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
".",
"getlist",
"(",
"key",
")",
"self",
".",
"addlist",
"(",
"key",
",",
"defaultlist",
")",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.addlist | Add the values in <valuelist> to the list of values for <key>. If <key>
is not in the dictionary, the values in <valuelist> become the values
for <key>.
Example:
omd = omdict([(1,1)])
omd.addlist(1, [11, 111])
omd.allitems() == [(1, 1), (1, 11), (1, 111)]
... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def addlist(self, key, valuelist=[]):
"""
Add the values in <valuelist> to the list of values for <key>. If <key>
is not in the dictionary, the values in <valuelist> become the values
for <key>.
Example:
omd = omdict([(1,1)])
omd.addlist(1, [11, 111])
... | def addlist(self, key, valuelist=[]):
"""
Add the values in <valuelist> to the list of values for <key>. If <key>
is not in the dictionary, the values in <valuelist> become the values
for <key>.
Example:
omd = omdict([(1,1)])
omd.addlist(1, [11, 111])
... | [
"Add",
"the",
"values",
"in",
"<valuelist",
">",
"to",
"the",
"list",
"of",
"values",
"for",
"<key",
">",
".",
"If",
"<key",
">",
"is",
"not",
"in",
"the",
"dictionary",
"the",
"values",
"in",
"<valuelist",
">",
"become",
"the",
"values",
"for",
"<key"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L325-L342 | [
"def",
"addlist",
"(",
"self",
",",
"key",
",",
"valuelist",
"=",
"[",
"]",
")",
":",
"for",
"value",
"in",
"valuelist",
":",
"self",
".",
"add",
"(",
"key",
",",
"value",
")",
"return",
"self"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.setlist | Sets <key>'s list of values to <values>. Existing items with key <key>
are first replaced with new values from <values>. Any remaining old
items that haven't been replaced with new values are deleted, and any
new values from <values> that don't have corresponding items with <key>
to repl... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def setlist(self, key, values):
"""
Sets <key>'s list of values to <values>. Existing items with key <key>
are first replaced with new values from <values>. Any remaining old
items that haven't been replaced with new values are deleted, and any
new values from <values> that don't... | def setlist(self, key, values):
"""
Sets <key>'s list of values to <values>. Existing items with key <key>
are first replaced with new values from <values>. Any remaining old
items that haven't been replaced with new values are deleted, and any
new values from <values> that don't... | [
"Sets",
"<key",
">",
"s",
"list",
"of",
"values",
"to",
"<values",
">",
".",
"Existing",
"items",
"with",
"key",
"<key",
">",
"are",
"first",
"replaced",
"with",
"new",
"values",
"from",
"<values",
">",
".",
"Any",
"remaining",
"old",
"items",
"that",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L353-L392 | [
"def",
"setlist",
"(",
"self",
",",
"key",
",",
"values",
")",
":",
"if",
"not",
"values",
"and",
"key",
"in",
"self",
":",
"self",
".",
"pop",
"(",
"key",
")",
"else",
":",
"it",
"=",
"zip_longest",
"(",
"list",
"(",
"self",
".",
"_map",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.removevalues | Removes all <values> from the values of <key>. If <key> has no
remaining values after removevalues(), the key is popped.
Example:
omd = omdict([(1, 1), (1, 11), (1, 1), (1, 111)])
omd.removevalues(1, [1, 111])
omd.allitems() == [(1, 11)]
Returns: <self>. | pipenv/vendor/orderedmultidict/orderedmultidict.py | def removevalues(self, key, values):
"""
Removes all <values> from the values of <key>. If <key> has no
remaining values after removevalues(), the key is popped.
Example:
omd = omdict([(1, 1), (1, 11), (1, 1), (1, 111)])
omd.removevalues(1, [1, 111])
omd.al... | def removevalues(self, key, values):
"""
Removes all <values> from the values of <key>. If <key> has no
remaining values after removevalues(), the key is popped.
Example:
omd = omdict([(1, 1), (1, 11), (1, 1), (1, 111)])
omd.removevalues(1, [1, 111])
omd.al... | [
"Removes",
"all",
"<values",
">",
"from",
"the",
"values",
"of",
"<key",
">",
".",
"If",
"<key",
">",
"has",
"no",
"remaining",
"values",
"after",
"removevalues",
"()",
"the",
"key",
"is",
"popped",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L394-L407 | [
"def",
"removevalues",
"(",
"self",
",",
"key",
",",
"values",
")",
":",
"self",
".",
"setlist",
"(",
"key",
",",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"getlist",
"(",
"key",
")",
"if",
"v",
"not",
"in",
"values",
"]",
")",
"return",
"self"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.poplist | If <key> is in the dictionary, pop it and return its list of values. If
<key> is not in the dictionary, return <default>. KeyError is raised if
<default> is not provided and <key> is not in the dictionary.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.pop... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def poplist(self, key, default=_absent):
"""
If <key> is in the dictionary, pop it and return its list of values. If
<key> is not in the dictionary, return <default>. KeyError is raised if
<default> is not provided and <key> is not in the dictionary.
Example:
omd = omd... | def poplist(self, key, default=_absent):
"""
If <key> is in the dictionary, pop it and return its list of values. If
<key> is not in the dictionary, return <default>. KeyError is raised if
<default> is not provided and <key> is not in the dictionary.
Example:
omd = omd... | [
"If",
"<key",
">",
"is",
"in",
"the",
"dictionary",
"pop",
"it",
"and",
"return",
"its",
"list",
"of",
"values",
".",
"If",
"<key",
">",
"is",
"not",
"in",
"the",
"dictionary",
"return",
"<default",
">",
".",
"KeyError",
"is",
"raised",
"if",
"<default... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L416-L442 | [
"def",
"poplist",
"(",
"self",
",",
"key",
",",
"default",
"=",
"_absent",
")",
":",
"if",
"key",
"in",
"self",
":",
"values",
"=",
"self",
".",
"getlist",
"(",
"key",
")",
"del",
"self",
".",
"_map",
"[",
"key",
"]",
"for",
"node",
",",
"nodekey... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.popvalue | If <value> is provided, pops the first or last (key,value) item in the
dictionary if <key> is in the dictionary.
If <value> is not provided, pops the first or last value for <key> if
<key> is in the dictionary.
If <key> no longer has any values after a popvalue() call, <key> is
... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def popvalue(self, key, value=_absent, default=_absent, last=True):
"""
If <value> is provided, pops the first or last (key,value) item in the
dictionary if <key> is in the dictionary.
If <value> is not provided, pops the first or last value for <key> if
<key> is in the dictiona... | def popvalue(self, key, value=_absent, default=_absent, last=True):
"""
If <value> is provided, pops the first or last (key,value) item in the
dictionary if <key> is in the dictionary.
If <value> is not provided, pops the first or last value for <key> if
<key> is in the dictiona... | [
"If",
"<value",
">",
"is",
"provided",
"pops",
"the",
"first",
"or",
"last",
"(",
"key",
"value",
")",
"item",
"in",
"the",
"dictionary",
"if",
"<key",
">",
"is",
"in",
"the",
"dictionary",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L444-L501 | [
"def",
"popvalue",
"(",
"self",
",",
"key",
",",
"value",
"=",
"_absent",
",",
"default",
"=",
"_absent",
",",
"last",
"=",
"True",
")",
":",
"def",
"pop_node_with_index",
"(",
"key",
",",
"index",
")",
":",
"node",
"=",
"self",
".",
"_map",
"[",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.popitem | Pop and return a key:value item.
If <fromall> is False, items()[0] is popped if <last> is False or
items()[-1] is popped if <last> is True. All remaining items with the
same key are removed.
If <fromall> is True, allitems()[0] is popped if <last> is False or
allitems()[-1] is p... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def popitem(self, fromall=False, last=True):
"""
Pop and return a key:value item.
If <fromall> is False, items()[0] is popped if <last> is False or
items()[-1] is popped if <last> is True. All remaining items with the
same key are removed.
If <fromall> is True, allitems... | def popitem(self, fromall=False, last=True):
"""
Pop and return a key:value item.
If <fromall> is False, items()[0] is popped if <last> is False or
items()[-1] is popped if <last> is True. All remaining items with the
same key are removed.
If <fromall> is True, allitems... | [
"Pop",
"and",
"return",
"a",
"key",
":",
"value",
"item",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L503-L544 | [
"def",
"popitem",
"(",
"self",
",",
"fromall",
"=",
"False",
",",
"last",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"_items",
":",
"raise",
"KeyError",
"(",
"'popitem(): %s is empty'",
"%",
"self",
".",
"__class__",
".",
"__name__",
")",
"if",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.poplistitem | Pop and return a key:valuelist item comprised of a key and that key's
list of values. If <last> is False, a key:valuelist item comprised of
keys()[0] and its list of values is popped and returned. If <last> is
True, a key:valuelist item comprised of keys()[-1] and its list of
values is p... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def poplistitem(self, last=True):
"""
Pop and return a key:valuelist item comprised of a key and that key's
list of values. If <last> is False, a key:valuelist item comprised of
keys()[0] and its list of values is popped and returned. If <last> is
True, a key:valuelist item compr... | def poplistitem(self, last=True):
"""
Pop and return a key:valuelist item comprised of a key and that key's
list of values. If <last> is False, a key:valuelist item comprised of
keys()[0] and its list of values is popped and returned. If <last> is
True, a key:valuelist item compr... | [
"Pop",
"and",
"return",
"a",
"key",
":",
"valuelist",
"item",
"comprised",
"of",
"a",
"key",
"and",
"that",
"key",
"s",
"list",
"of",
"values",
".",
"If",
"<last",
">",
"is",
"False",
"a",
"key",
":",
"valuelist",
"item",
"comprised",
"of",
"keys",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L546-L571 | [
"def",
"poplistitem",
"(",
"self",
",",
"last",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"_items",
":",
"s",
"=",
"'poplistitem(): %s is empty'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"raise",
"KeyError",
"(",
"s",
")",
"key",
"=",
"s... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.values | Raises: KeyError if <key> is provided and not in the dictionary.
Returns: List created from itervalues(<key>).If <key> is provided and
is a dictionary key, only values of items with key <key> are
returned. | pipenv/vendor/orderedmultidict/orderedmultidict.py | def values(self, key=_absent):
"""
Raises: KeyError if <key> is provided and not in the dictionary.
Returns: List created from itervalues(<key>).If <key> is provided and
is a dictionary key, only values of items with key <key> are
returned.
"""
if key is not _... | def values(self, key=_absent):
"""
Raises: KeyError if <key> is provided and not in the dictionary.
Returns: List created from itervalues(<key>).If <key> is provided and
is a dictionary key, only values of items with key <key> are
returned.
"""
if key is not _... | [
"Raises",
":",
"KeyError",
"if",
"<key",
">",
"is",
"provided",
"and",
"not",
"in",
"the",
"dictionary",
".",
"Returns",
":",
"List",
"created",
"from",
"itervalues",
"(",
"<key",
">",
")",
".",
"If",
"<key",
">",
"is",
"provided",
"and",
"is",
"a",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L584-L593 | [
"def",
"values",
"(",
"self",
",",
"key",
"=",
"_absent",
")",
":",
"if",
"key",
"is",
"not",
"_absent",
"and",
"key",
"in",
"self",
".",
"_map",
":",
"return",
"self",
".",
"getlist",
"(",
"key",
")",
"return",
"list",
"(",
"self",
".",
"itervalue... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.iteritems | Parity with dict.iteritems() except the optional <key> parameter has
been added. If <key> is provided, only items with the provided key are
iterated over. KeyError is raised if <key> is provided and not in the
dictionary.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def iteritems(self, key=_absent):
"""
Parity with dict.iteritems() except the optional <key> parameter has
been added. If <key> is provided, only items with the provided key are
iterated over. KeyError is raised if <key> is provided and not in the
dictionary.
Example:
... | def iteritems(self, key=_absent):
"""
Parity with dict.iteritems() except the optional <key> parameter has
been added. If <key> is provided, only items with the provided key are
iterated over. KeyError is raised if <key> is provided and not in the
dictionary.
Example:
... | [
"Parity",
"with",
"dict",
".",
"iteritems",
"()",
"except",
"the",
"optional",
"<key",
">",
"parameter",
"has",
"been",
"added",
".",
"If",
"<key",
">",
"is",
"provided",
"only",
"items",
"with",
"the",
"provided",
"key",
"are",
"iterated",
"over",
".",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L607-L629 | [
"def",
"iteritems",
"(",
"self",
",",
"key",
"=",
"_absent",
")",
":",
"if",
"key",
"is",
"not",
"_absent",
":",
"if",
"key",
"in",
"self",
":",
"items",
"=",
"[",
"(",
"node",
".",
"key",
",",
"node",
".",
"value",
")",
"for",
"node",
"in",
"s... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.itervalues | Parity with dict.itervalues() except the optional <key> parameter has
been added. If <key> is provided, only values from items with the
provided key are iterated over. KeyError is raised if <key> is provided
and not in the dictionary.
Example:
omd = omdict([(1,1), (1,11), (1,1... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def itervalues(self, key=_absent):
"""
Parity with dict.itervalues() except the optional <key> parameter has
been added. If <key> is provided, only values from items with the
provided key are iterated over. KeyError is raised if <key> is provided
and not in the dictionary.
... | def itervalues(self, key=_absent):
"""
Parity with dict.itervalues() except the optional <key> parameter has
been added. If <key> is provided, only values from items with the
provided key are iterated over. KeyError is raised if <key> is provided
and not in the dictionary.
... | [
"Parity",
"with",
"dict",
".",
"itervalues",
"()",
"except",
"the",
"optional",
"<key",
">",
"parameter",
"has",
"been",
"added",
".",
"If",
"<key",
">",
"is",
"provided",
"only",
"values",
"from",
"items",
"with",
"the",
"provided",
"key",
"are",
"iterate... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L634-L654 | [
"def",
"itervalues",
"(",
"self",
",",
"key",
"=",
"_absent",
")",
":",
"if",
"key",
"is",
"not",
"_absent",
":",
"if",
"key",
"in",
"self",
":",
"return",
"iter",
"(",
"[",
"node",
".",
"value",
"for",
"node",
"in",
"self",
".",
"_map",
"[",
"ke... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.iterallitems | Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.iterallitems() == (1,1) -> (1,11) -> (1,111) -> (2,2) -> (3,3)
omd.iterallitems(1) == (1,1) -> (1,11) -> (1,111)
Raises: KeyError if <key> is provided and not in the dictionary.
Returns: An iterator over eve... | pipenv/vendor/orderedmultidict/orderedmultidict.py | def iterallitems(self, key=_absent):
'''
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.iterallitems() == (1,1) -> (1,11) -> (1,111) -> (2,2) -> (3,3)
omd.iterallitems(1) == (1,1) -> (1,11) -> (1,111)
Raises: KeyError if <key> is provided and not... | def iterallitems(self, key=_absent):
'''
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.iterallitems() == (1,1) -> (1,11) -> (1,111) -> (2,2) -> (3,3)
omd.iterallitems(1) == (1,1) -> (1,11) -> (1,111)
Raises: KeyError if <key> is provided and not... | [
"Example",
":",
"omd",
"=",
"omdict",
"(",
"[",
"(",
"1",
"1",
")",
"(",
"1",
"11",
")",
"(",
"1",
"111",
")",
"(",
"2",
"2",
")",
"(",
"3",
"3",
")",
"]",
")",
"omd",
".",
"iterallitems",
"()",
"==",
"(",
"1",
"1",
")",
"-",
">",
"(",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L685-L699 | [
"def",
"iterallitems",
"(",
"self",
",",
"key",
"=",
"_absent",
")",
":",
"if",
"key",
"is",
"not",
"_absent",
":",
"# Raises KeyError if <key> is not in self._map.",
"return",
"self",
".",
"iteritems",
"(",
"key",
")",
"return",
"self",
".",
"_items",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.iterallvalues | Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.iterallvalues() == 1 -> 11 -> 111 -> 2 -> 3
Returns: An iterator over the values of every item in the dictionary. | pipenv/vendor/orderedmultidict/orderedmultidict.py | def iterallvalues(self, key=_absent):
'''
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.iterallvalues() == 1 -> 11 -> 111 -> 2 -> 3
Returns: An iterator over the values of every item in the dictionary.
'''
if key is not _absent:
... | def iterallvalues(self, key=_absent):
'''
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.iterallvalues() == 1 -> 11 -> 111 -> 2 -> 3
Returns: An iterator over the values of every item in the dictionary.
'''
if key is not _absent:
... | [
"Example",
":",
"omd",
"=",
"omdict",
"(",
"[",
"(",
"1",
"1",
")",
"(",
"1",
"11",
")",
"(",
"1",
"111",
")",
"(",
"2",
"2",
")",
"(",
"3",
"3",
")",
"]",
")",
"omd",
".",
"iterallvalues",
"()",
"==",
"1",
"-",
">",
"11",
"-",
">",
"11... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L711-L723 | [
"def",
"iterallvalues",
"(",
"self",
",",
"key",
"=",
"_absent",
")",
":",
"if",
"key",
"is",
"not",
"_absent",
":",
"if",
"key",
"in",
"self",
":",
"return",
"iter",
"(",
"self",
".",
"getlist",
"(",
"key",
")",
")",
"raise",
"KeyError",
"(",
"key... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | omdict.reverse | Reverse the order of all items in the dictionary.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.reverse()
omd.allitems() == [(3,3), (2,2), (1,111), (1,11), (1,1)]
Returns: <self>. | pipenv/vendor/orderedmultidict/orderedmultidict.py | def reverse(self):
"""
Reverse the order of all items in the dictionary.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.reverse()
omd.allitems() == [(3,3), (2,2), (1,111), (1,11), (1,1)]
Returns: <self>.
"""
for key in si... | def reverse(self):
"""
Reverse the order of all items in the dictionary.
Example:
omd = omdict([(1,1), (1,11), (1,111), (2,2), (3,3)])
omd.reverse()
omd.allitems() == [(3,3), (2,2), (1,111), (1,11), (1,1)]
Returns: <self>.
"""
for key in si... | [
"Reverse",
"the",
"order",
"of",
"all",
"items",
"in",
"the",
"dictionary",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L746-L760 | [
"def",
"reverse",
"(",
"self",
")",
":",
"for",
"key",
"in",
"six",
".",
"iterkeys",
"(",
"self",
".",
"_map",
")",
":",
"self",
".",
"_map",
"[",
"key",
"]",
".",
"reverse",
"(",
")",
"self",
".",
"_items",
".",
"reverse",
"(",
")",
"return",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | BuildEnvironment.check_requirements | Return 2 sets:
- conflicting requirements: set of (installed, wanted) reqs tuples
- missing requirements: set of reqs | pipenv/patched/notpip/_internal/build_env.py | def check_requirements(self, reqs):
# type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]
"""Return 2 sets:
- conflicting requirements: set of (installed, wanted) reqs tuples
- missing requirements: set of reqs
"""
missing = set()
conflicting = ... | def check_requirements(self, reqs):
# type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]
"""Return 2 sets:
- conflicting requirements: set of (installed, wanted) reqs tuples
- missing requirements: set of reqs
"""
missing = set()
conflicting = ... | [
"Return",
"2",
"sets",
":",
"-",
"conflicting",
"requirements",
":",
"set",
"of",
"(",
"installed",
"wanted",
")",
"reqs",
"tuples",
"-",
"missing",
"requirements",
":",
"set",
"of",
"reqs"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/build_env.py#L137-L154 | [
"def",
"check_requirements",
"(",
"self",
",",
"reqs",
")",
":",
"# type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]",
"missing",
"=",
"set",
"(",
")",
"conflicting",
"=",
"set",
"(",
")",
"if",
"reqs",
":",
"ws",
"=",
"WorkingSet",
"(",
"self",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _unpack_args | Given an iterable of arguments and an iterable of nargs specifications,
it returns a tuple with all the unpacked arguments at the first index
and all remaining arguments as the second.
The nargs specification is the number of arguments that should be consumed
or `-1` to indicate that this position shou... | pipenv/vendor/click/parser.py | def _unpack_args(args, nargs_spec):
"""Given an iterable of arguments and an iterable of nargs specifications,
it returns a tuple with all the unpacked arguments at the first index
and all remaining arguments as the second.
The nargs specification is the number of arguments that should be consumed
... | def _unpack_args(args, nargs_spec):
"""Given an iterable of arguments and an iterable of nargs specifications,
it returns a tuple with all the unpacked arguments at the first index
and all remaining arguments as the second.
The nargs specification is the number of arguments that should be consumed
... | [
"Given",
"an",
"iterable",
"of",
"arguments",
"and",
"an",
"iterable",
"of",
"nargs",
"specifications",
"it",
"returns",
"a",
"tuple",
"with",
"all",
"the",
"unpacked",
"arguments",
"at",
"the",
"first",
"index",
"and",
"all",
"remaining",
"arguments",
"as",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L25-L73 | [
"def",
"_unpack_args",
"(",
"args",
",",
"nargs_spec",
")",
":",
"args",
"=",
"deque",
"(",
"args",
")",
"nargs_spec",
"=",
"deque",
"(",
"nargs_spec",
")",
"rv",
"=",
"[",
"]",
"spos",
"=",
"None",
"def",
"_fetch",
"(",
"c",
")",
":",
"try",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | split_arg_string | Given an argument string this attempts to split it into small parts. | pipenv/vendor/click/parser.py | def split_arg_string(string):
"""Given an argument string this attempts to split it into small parts."""
rv = []
for match in re.finditer(r"('([^'\\]*(?:\\.[^'\\]*)*)'"
r'|"([^"\\]*(?:\\.[^"\\]*)*)"'
r'|\S+)\s*', string, re.S):
arg = match.gr... | def split_arg_string(string):
"""Given an argument string this attempts to split it into small parts."""
rv = []
for match in re.finditer(r"('([^'\\]*(?:\\.[^'\\]*)*)'"
r'|"([^"\\]*(?:\\.[^"\\]*)*)"'
r'|\S+)\s*', string, re.S):
arg = match.gr... | [
"Given",
"an",
"argument",
"string",
"this",
"attempts",
"to",
"split",
"it",
"into",
"small",
"parts",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L98-L113 | [
"def",
"split_arg_string",
"(",
"string",
")",
":",
"rv",
"=",
"[",
"]",
"for",
"match",
"in",
"re",
".",
"finditer",
"(",
"r\"('([^'\\\\]*(?:\\\\.[^'\\\\]*)*)'\"",
"r'|\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"'",
"r'|\\S+)\\s*'",
",",
"string",
",",
"re",
".",
"S",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | OptionParser.add_option | Adds a new option named `dest` to the parser. The destination
is not inferred (unlike with optparse) and needs to be explicitly
provided. Action can be any of ``store``, ``store_const``,
``append``, ``appnd_const`` or ``count``.
The `obj` can be used to identify the option in the orde... | pipenv/vendor/click/parser.py | def add_option(self, opts, dest, action=None, nargs=1, const=None,
obj=None):
"""Adds a new option named `dest` to the parser. The destination
is not inferred (unlike with optparse) and needs to be explicitly
provided. Action can be any of ``store``, ``store_const``,
... | def add_option(self, opts, dest, action=None, nargs=1, const=None,
obj=None):
"""Adds a new option named `dest` to the parser. The destination
is not inferred (unlike with optparse) and needs to be explicitly
provided. Action can be any of ``store``, ``store_const``,
... | [
"Adds",
"a",
"new",
"option",
"named",
"dest",
"to",
"the",
"parser",
".",
"The",
"destination",
"is",
"not",
"inferred",
"(",
"unlike",
"with",
"optparse",
")",
"and",
"needs",
"to",
"be",
"explicitly",
"provided",
".",
"Action",
"can",
"be",
"any",
"of... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L228-L247 | [
"def",
"add_option",
"(",
"self",
",",
"opts",
",",
"dest",
",",
"action",
"=",
"None",
",",
"nargs",
"=",
"1",
",",
"const",
"=",
"None",
",",
"obj",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
":",
"obj",
"=",
"dest",
"opts",
"=",
"[",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | OptionParser.add_argument | Adds a positional argument named `dest` to the parser.
The `obj` can be used to identify the option in the order list
that is returned from the parser. | pipenv/vendor/click/parser.py | def add_argument(self, dest, nargs=1, obj=None):
"""Adds a positional argument named `dest` to the parser.
The `obj` can be used to identify the option in the order list
that is returned from the parser.
"""
if obj is None:
obj = dest
self._args.append(Argume... | def add_argument(self, dest, nargs=1, obj=None):
"""Adds a positional argument named `dest` to the parser.
The `obj` can be used to identify the option in the order list
that is returned from the parser.
"""
if obj is None:
obj = dest
self._args.append(Argume... | [
"Adds",
"a",
"positional",
"argument",
"named",
"dest",
"to",
"the",
"parser",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L249-L257 | [
"def",
"add_argument",
"(",
"self",
",",
"dest",
",",
"nargs",
"=",
"1",
",",
"obj",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
":",
"obj",
"=",
"dest",
"self",
".",
"_args",
".",
"append",
"(",
"Argument",
"(",
"dest",
"=",
"dest",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | OptionParser.parse_args | Parses positional arguments and returns ``(values, args, order)``
for the parsed options and arguments as well as the leftover
arguments if there are any. The order is a list of objects as they
appear on the command line. If arguments appear multiple times they
will be memorized multip... | pipenv/vendor/click/parser.py | def parse_args(self, args):
"""Parses positional arguments and returns ``(values, args, order)``
for the parsed options and arguments as well as the leftover
arguments if there are any. The order is a list of objects as they
appear on the command line. If arguments appear multiple time... | def parse_args(self, args):
"""Parses positional arguments and returns ``(values, args, order)``
for the parsed options and arguments as well as the leftover
arguments if there are any. The order is a list of objects as they
appear on the command line. If arguments appear multiple time... | [
"Parses",
"positional",
"arguments",
"and",
"returns",
"(",
"values",
"args",
"order",
")",
"for",
"the",
"parsed",
"options",
"and",
"arguments",
"as",
"well",
"as",
"the",
"leftover",
"arguments",
"if",
"there",
"are",
"any",
".",
"The",
"order",
"is",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/parser.py#L259-L273 | [
"def",
"parse_args",
"(",
"self",
",",
"args",
")",
":",
"state",
"=",
"ParsingState",
"(",
"args",
")",
"try",
":",
"self",
".",
"_process_args_for_options",
"(",
"state",
")",
"self",
".",
"_process_args_for_args",
"(",
"state",
")",
"except",
"UsageError"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | make_graph | Makes a dependency graph from the given distributions.
:parameter dists: a list of distributions
:type dists: list of :class:`distutils2.database.InstalledDistribution` and
:class:`distutils2.database.EggInfoDistribution` instances
:rtype: a :class:`DependencyGraph` instance | pipenv/vendor/distlib/database.py | def make_graph(dists, scheme='default'):
"""Makes a dependency graph from the given distributions.
:parameter dists: a list of distributions
:type dists: list of :class:`distutils2.database.InstalledDistribution` and
:class:`distutils2.database.EggInfoDistribution` instances
:rtype: a ... | def make_graph(dists, scheme='default'):
"""Makes a dependency graph from the given distributions.
:parameter dists: a list of distributions
:type dists: list of :class:`distutils2.database.InstalledDistribution` and
:class:`distutils2.database.EggInfoDistribution` instances
:rtype: a ... | [
"Makes",
"a",
"dependency",
"graph",
"from",
"the",
"given",
"distributions",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1225-L1276 | [
"def",
"make_graph",
"(",
"dists",
",",
"scheme",
"=",
"'default'",
")",
":",
"scheme",
"=",
"get_scheme",
"(",
"scheme",
")",
"graph",
"=",
"DependencyGraph",
"(",
")",
"provided",
"=",
"{",
"}",
"# maps names to lists of (version, dist) tuples",
"# first, build ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dependent_dists | Recursively generate a list of distributions from *dists* that are
dependent on *dist*.
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested | pipenv/vendor/distlib/database.py | def get_dependent_dists(dists, dist):
"""Recursively generate a list of distributions from *dists* that are
dependent on *dist*.
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
"""
if dist not in dists:
raise DistlibExcept... | def get_dependent_dists(dists, dist):
"""Recursively generate a list of distributions from *dists* that are
dependent on *dist*.
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
"""
if dist not in dists:
raise DistlibExcept... | [
"Recursively",
"generate",
"a",
"list",
"of",
"distributions",
"from",
"*",
"dists",
"*",
"that",
"are",
"dependent",
"on",
"*",
"dist",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1279-L1302 | [
"def",
"get_dependent_dists",
"(",
"dists",
",",
"dist",
")",
":",
"if",
"dist",
"not",
"in",
"dists",
":",
"raise",
"DistlibException",
"(",
"'given distribution %r is not a member '",
"'of the list'",
"%",
"dist",
".",
"name",
")",
"graph",
"=",
"make_graph",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_required_dists | Recursively generate a list of distributions from *dists* that are
required by *dist*.
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested | pipenv/vendor/distlib/database.py | def get_required_dists(dists, dist):
"""Recursively generate a list of distributions from *dists* that are
required by *dist*.
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
"""
if dist not in dists:
raise DistlibExceptio... | def get_required_dists(dists, dist):
"""Recursively generate a list of distributions from *dists* that are
required by *dist*.
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
"""
if dist not in dists:
raise DistlibExceptio... | [
"Recursively",
"generate",
"a",
"list",
"of",
"distributions",
"from",
"*",
"dists",
"*",
"that",
"are",
"required",
"by",
"*",
"dist",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1305-L1327 | [
"def",
"get_required_dists",
"(",
"dists",
",",
"dist",
")",
":",
"if",
"dist",
"not",
"in",
"dists",
":",
"raise",
"DistlibException",
"(",
"'given distribution %r is not a member '",
"'of the list'",
"%",
"dist",
".",
"name",
")",
"graph",
"=",
"make_graph",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | make_dist | A convenience method for making a dist given just a name and version. | pipenv/vendor/distlib/database.py | def make_dist(name, version, **kwargs):
"""
A convenience method for making a dist given just a name and version.
"""
summary = kwargs.pop('summary', 'Placeholder for summary')
md = Metadata(**kwargs)
md.name = name
md.version = version
md.summary = summary or 'Placeholder for summary'
... | def make_dist(name, version, **kwargs):
"""
A convenience method for making a dist given just a name and version.
"""
summary = kwargs.pop('summary', 'Placeholder for summary')
md = Metadata(**kwargs)
md.name = name
md.version = version
md.summary = summary or 'Placeholder for summary'
... | [
"A",
"convenience",
"method",
"for",
"making",
"a",
"dist",
"given",
"just",
"a",
"name",
"and",
"version",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1330-L1339 | [
"def",
"make_dist",
"(",
"name",
",",
"version",
",",
"*",
"*",
"kwargs",
")",
":",
"summary",
"=",
"kwargs",
".",
"pop",
"(",
"'summary'",
",",
"'Placeholder for summary'",
")",
"md",
"=",
"Metadata",
"(",
"*",
"*",
"kwargs",
")",
"md",
".",
"name",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Cache.clear | Clear the cache, setting it to its initial state. | pipenv/vendor/distlib/database.py | def clear(self):
"""
Clear the cache, setting it to its initial state.
"""
self.name.clear()
self.path.clear()
self.generated = False | def clear(self):
"""
Clear the cache, setting it to its initial state.
"""
self.name.clear()
self.path.clear()
self.generated = False | [
"Clear",
"the",
"cache",
"setting",
"it",
"to",
"its",
"initial",
"state",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L57-L63 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"name",
".",
"clear",
"(",
")",
"self",
".",
"path",
".",
"clear",
"(",
")",
"self",
".",
"generated",
"=",
"False"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Cache.add | Add a distribution to the cache.
:param dist: The distribution to add. | pipenv/vendor/distlib/database.py | def add(self, dist):
"""
Add a distribution to the cache.
:param dist: The distribution to add.
"""
if dist.path not in self.path:
self.path[dist.path] = dist
self.name.setdefault(dist.key, []).append(dist) | def add(self, dist):
"""
Add a distribution to the cache.
:param dist: The distribution to add.
"""
if dist.path not in self.path:
self.path[dist.path] = dist
self.name.setdefault(dist.key, []).append(dist) | [
"Add",
"a",
"distribution",
"to",
"the",
"cache",
".",
":",
"param",
"dist",
":",
"The",
"distribution",
"to",
"add",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L65-L72 | [
"def",
"add",
"(",
"self",
",",
"dist",
")",
":",
"if",
"dist",
".",
"path",
"not",
"in",
"self",
".",
"path",
":",
"self",
".",
"path",
"[",
"dist",
".",
"path",
"]",
"=",
"dist",
"self",
".",
"name",
".",
"setdefault",
"(",
"dist",
".",
"key"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath._generate_cache | Scan the path for distributions and populate the cache with
those that are found. | pipenv/vendor/distlib/database.py | def _generate_cache(self):
"""
Scan the path for distributions and populate the cache with
those that are found.
"""
gen_dist = not self._cache.generated
gen_egg = self._include_egg and not self._cache_egg.generated
if gen_dist or gen_egg:
for dist in ... | def _generate_cache(self):
"""
Scan the path for distributions and populate the cache with
those that are found.
"""
gen_dist = not self._cache.generated
gen_egg = self._include_egg and not self._cache_egg.generated
if gen_dist or gen_egg:
for dist in ... | [
"Scan",
"the",
"path",
"for",
"distributions",
"and",
"populate",
"the",
"cache",
"with",
"those",
"that",
"are",
"found",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L159-L176 | [
"def",
"_generate_cache",
"(",
"self",
")",
":",
"gen_dist",
"=",
"not",
"self",
".",
"_cache",
".",
"generated",
"gen_egg",
"=",
"self",
".",
"_include_egg",
"and",
"not",
"self",
".",
"_cache_egg",
".",
"generated",
"if",
"gen_dist",
"or",
"gen_egg",
":"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath.distinfo_dirname | The *name* and *version* parameters are converted into their
filename-escaped form, i.e. any ``'-'`` characters are replaced
with ``'_'`` other than the one in ``'dist-info'`` and the one
separating the name from the version number.
:parameter name: is converted to a standard distributi... | pipenv/vendor/distlib/database.py | def distinfo_dirname(cls, name, version):
"""
The *name* and *version* parameters are converted into their
filename-escaped form, i.e. any ``'-'`` characters are replaced
with ``'_'`` other than the one in ``'dist-info'`` and the one
separating the name from the version number.
... | def distinfo_dirname(cls, name, version):
"""
The *name* and *version* parameters are converted into their
filename-escaped form, i.e. any ``'-'`` characters are replaced
with ``'_'`` other than the one in ``'dist-info'`` and the one
separating the name from the version number.
... | [
"The",
"*",
"name",
"*",
"and",
"*",
"version",
"*",
"parameters",
"are",
"converted",
"into",
"their",
"filename",
"-",
"escaped",
"form",
"i",
".",
"e",
".",
"any",
"-",
"characters",
"are",
"replaced",
"with",
"_",
"other",
"than",
"the",
"one",
"in... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L179-L198 | [
"def",
"distinfo_dirname",
"(",
"cls",
",",
"name",
",",
"version",
")",
":",
"name",
"=",
"name",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
"return",
"'-'",
".",
"join",
"(",
"[",
"name",
",",
"version",
"]",
")",
"+",
"DISTINFO_EXT"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath.get_distributions | Provides an iterator that looks for distributions and returns
:class:`InstalledDistribution` or
:class:`EggInfoDistribution` instances for each one of them.
:rtype: iterator of :class:`InstalledDistribution` and
:class:`EggInfoDistribution` instances | pipenv/vendor/distlib/database.py | def get_distributions(self):
"""
Provides an iterator that looks for distributions and returns
:class:`InstalledDistribution` or
:class:`EggInfoDistribution` instances for each one of them.
:rtype: iterator of :class:`InstalledDistribution` and
:class:`EggInfoDis... | def get_distributions(self):
"""
Provides an iterator that looks for distributions and returns
:class:`InstalledDistribution` or
:class:`EggInfoDistribution` instances for each one of them.
:rtype: iterator of :class:`InstalledDistribution` and
:class:`EggInfoDis... | [
"Provides",
"an",
"iterator",
"that",
"looks",
"for",
"distributions",
"and",
"returns",
":",
"class",
":",
"InstalledDistribution",
"or",
":",
"class",
":",
"EggInfoDistribution",
"instances",
"for",
"each",
"one",
"of",
"them",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L200-L220 | [
"def",
"get_distributions",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_cache_enabled",
":",
"for",
"dist",
"in",
"self",
".",
"_yield_distributions",
"(",
")",
":",
"yield",
"dist",
"else",
":",
"self",
".",
"_generate_cache",
"(",
")",
"for",
"d... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath.get_distribution | Looks for a named distribution on the path.
This function only returns the first result found, as no more than one
value is expected. If nothing is found, ``None`` is returned.
:rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution`
or ``None`` | pipenv/vendor/distlib/database.py | def get_distribution(self, name):
"""
Looks for a named distribution on the path.
This function only returns the first result found, as no more than one
value is expected. If nothing is found, ``None`` is returned.
:rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribu... | def get_distribution(self, name):
"""
Looks for a named distribution on the path.
This function only returns the first result found, as no more than one
value is expected. If nothing is found, ``None`` is returned.
:rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribu... | [
"Looks",
"for",
"a",
"named",
"distribution",
"on",
"the",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L222-L246 | [
"def",
"get_distribution",
"(",
"self",
",",
"name",
")",
":",
"result",
"=",
"None",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"not",
"self",
".",
"_cache_enabled",
":",
"for",
"dist",
"in",
"self",
".",
"_yield_distributions",
"(",
")",
":",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath.provides_distribution | Iterates over all distributions to find which distributions provide *name*.
If a *version* is provided, it will be used to filter the results.
This function only returns the first result found, since no more than
one values are expected. If the directory is not found, returns ``None``.
... | pipenv/vendor/distlib/database.py | def provides_distribution(self, name, version=None):
"""
Iterates over all distributions to find which distributions provide *name*.
If a *version* is provided, it will be used to filter the results.
This function only returns the first result found, since no more than
one value... | def provides_distribution(self, name, version=None):
"""
Iterates over all distributions to find which distributions provide *name*.
If a *version* is provided, it will be used to filter the results.
This function only returns the first result found, since no more than
one value... | [
"Iterates",
"over",
"all",
"distributions",
"to",
"find",
"which",
"distributions",
"provide",
"*",
"name",
"*",
".",
"If",
"a",
"*",
"version",
"*",
"is",
"provided",
"it",
"will",
"be",
"used",
"to",
"filter",
"the",
"results",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L248-L287 | [
"def",
"provides_distribution",
"(",
"self",
",",
"name",
",",
"version",
"=",
"None",
")",
":",
"matcher",
"=",
"None",
"if",
"version",
"is",
"not",
"None",
":",
"try",
":",
"matcher",
"=",
"self",
".",
"_scheme",
".",
"matcher",
"(",
"'%s (%s)'",
"%... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath.get_file_path | Return the path to a resource file. | pipenv/vendor/distlib/database.py | def get_file_path(self, name, relative_path):
"""
Return the path to a resource file.
"""
dist = self.get_distribution(name)
if dist is None:
raise LookupError('no distribution named %r found' % name)
return dist.get_resource_path(relative_path) | def get_file_path(self, name, relative_path):
"""
Return the path to a resource file.
"""
dist = self.get_distribution(name)
if dist is None:
raise LookupError('no distribution named %r found' % name)
return dist.get_resource_path(relative_path) | [
"Return",
"the",
"path",
"to",
"a",
"resource",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L289-L296 | [
"def",
"get_file_path",
"(",
"self",
",",
"name",
",",
"relative_path",
")",
":",
"dist",
"=",
"self",
".",
"get_distribution",
"(",
"name",
")",
"if",
"dist",
"is",
"None",
":",
"raise",
"LookupError",
"(",
"'no distribution named %r found'",
"%",
"name",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistributionPath.get_exported_entries | Return all of the exported entries in a particular category.
:param category: The category to search for entries.
:param name: If specified, only entries with that name are returned. | pipenv/vendor/distlib/database.py | def get_exported_entries(self, category, name=None):
"""
Return all of the exported entries in a particular category.
:param category: The category to search for entries.
:param name: If specified, only entries with that name are returned.
"""
for dist in self.get_distri... | def get_exported_entries(self, category, name=None):
"""
Return all of the exported entries in a particular category.
:param category: The category to search for entries.
:param name: If specified, only entries with that name are returned.
"""
for dist in self.get_distri... | [
"Return",
"all",
"of",
"the",
"exported",
"entries",
"in",
"a",
"particular",
"category",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L298-L314 | [
"def",
"get_exported_entries",
"(",
"self",
",",
"category",
",",
"name",
"=",
"None",
")",
":",
"for",
"dist",
"in",
"self",
".",
"get_distributions",
"(",
")",
":",
"r",
"=",
"dist",
".",
"exports",
"if",
"category",
"in",
"r",
":",
"d",
"=",
"r",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.provides | A set of distribution names and versions provided by this distribution.
:return: A set of "name (version)" strings. | pipenv/vendor/distlib/database.py | def provides(self):
"""
A set of distribution names and versions provided by this distribution.
:return: A set of "name (version)" strings.
"""
plist = self.metadata.provides
s = '%s (%s)' % (self.name, self.version)
if s not in plist:
plist.append(s)
... | def provides(self):
"""
A set of distribution names and versions provided by this distribution.
:return: A set of "name (version)" strings.
"""
plist = self.metadata.provides
s = '%s (%s)' % (self.name, self.version)
if s not in plist:
plist.append(s)
... | [
"A",
"set",
"of",
"distribution",
"names",
"and",
"versions",
"provided",
"by",
"this",
"distribution",
".",
":",
"return",
":",
"A",
"set",
"of",
"name",
"(",
"version",
")",
"strings",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L369-L378 | [
"def",
"provides",
"(",
"self",
")",
":",
"plist",
"=",
"self",
".",
"metadata",
".",
"provides",
"s",
"=",
"'%s (%s)'",
"%",
"(",
"self",
".",
"name",
",",
"self",
".",
"version",
")",
"if",
"s",
"not",
"in",
"plist",
":",
"plist",
".",
"append",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.matches_requirement | Say if this instance matches (fulfills) a requirement.
:param req: The requirement to match.
:rtype req: str
:return: True if it matches, else False. | pipenv/vendor/distlib/database.py | def matches_requirement(self, req):
"""
Say if this instance matches (fulfills) a requirement.
:param req: The requirement to match.
:rtype req: str
:return: True if it matches, else False.
"""
# Requirement may contain extras - parse to lose those
# from ... | def matches_requirement(self, req):
"""
Say if this instance matches (fulfills) a requirement.
:param req: The requirement to match.
:rtype req: str
:return: True if it matches, else False.
"""
# Requirement may contain extras - parse to lose those
# from ... | [
"Say",
"if",
"this",
"instance",
"matches",
"(",
"fulfills",
")",
"a",
"requirement",
".",
":",
"param",
"req",
":",
"The",
"requirement",
"to",
"match",
".",
":",
"rtype",
"req",
":",
"str",
":",
"return",
":",
"True",
"if",
"it",
"matches",
"else",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L407-L439 | [
"def",
"matches_requirement",
"(",
"self",
",",
"req",
")",
":",
"# Requirement may contain extras - parse to lose those",
"# from what's passed to the matcher",
"r",
"=",
"parse_requirement",
"(",
"req",
")",
"scheme",
"=",
"get_scheme",
"(",
"self",
".",
"metadata",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | BaseInstalledDistribution.get_hash | Get the hash of some data, using a particular hash algorithm, if
specified.
:param data: The data to be hashed.
:type data: bytes
:param hasher: The name of a hash implementation, supported by hashlib,
or ``None``. Examples of valid values are ``'sha1'``,
... | pipenv/vendor/distlib/database.py | def get_hash(self, data, hasher=None):
"""
Get the hash of some data, using a particular hash algorithm, if
specified.
:param data: The data to be hashed.
:type data: bytes
:param hasher: The name of a hash implementation, supported by hashlib,
or ... | def get_hash(self, data, hasher=None):
"""
Get the hash of some data, using a particular hash algorithm, if
specified.
:param data: The data to be hashed.
:type data: bytes
:param hasher: The name of a hash implementation, supported by hashlib,
or ... | [
"Get",
"the",
"hash",
"of",
"some",
"data",
"using",
"a",
"particular",
"hash",
"algorithm",
"if",
"specified",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L497-L526 | [
"def",
"get_hash",
"(",
"self",
",",
"data",
",",
"hasher",
"=",
"None",
")",
":",
"if",
"hasher",
"is",
"None",
":",
"hasher",
"=",
"self",
".",
"hasher",
"if",
"hasher",
"is",
"None",
":",
"hasher",
"=",
"hashlib",
".",
"md5",
"prefix",
"=",
"''"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution._get_records | Get the list of installed files for the distribution
:return: A list of tuples of path, hash and size. Note that hash and
size might be ``None`` for some entries. The path is exactly
as stored in the file (which is as in PEP 376). | pipenv/vendor/distlib/database.py | def _get_records(self):
"""
Get the list of installed files for the distribution
:return: A list of tuples of path, hash and size. Note that hash and
size might be ``None`` for some entries. The path is exactly
as stored in the file (which is as in PEP 376).
... | def _get_records(self):
"""
Get the list of installed files for the distribution
:return: A list of tuples of path, hash and size. Note that hash and
size might be ``None`` for some entries. The path is exactly
as stored in the file (which is as in PEP 376).
... | [
"Get",
"the",
"list",
"of",
"installed",
"files",
"for",
"the",
"distribution",
":",
"return",
":",
"A",
"list",
"of",
"tuples",
"of",
"path",
"hash",
"and",
"size",
".",
"Note",
"that",
"hash",
"and",
"size",
"might",
"be",
"None",
"for",
"some",
"ent... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L580-L601 | [
"def",
"_get_records",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"r",
"=",
"self",
".",
"get_distinfo_resource",
"(",
"'RECORD'",
")",
"with",
"contextlib",
".",
"closing",
"(",
"r",
".",
"as_stream",
"(",
")",
")",
"as",
"stream",
":",
"with",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.exports | Return the information exported by this distribution.
:return: A dictionary of exports, mapping an export category to a dict
of :class:`ExportEntry` instances describing the individual
export entries, and keyed by name. | pipenv/vendor/distlib/database.py | def exports(self):
"""
Return the information exported by this distribution.
:return: A dictionary of exports, mapping an export category to a dict
of :class:`ExportEntry` instances describing the individual
export entries, and keyed by name.
"""
... | def exports(self):
"""
Return the information exported by this distribution.
:return: A dictionary of exports, mapping an export category to a dict
of :class:`ExportEntry` instances describing the individual
export entries, and keyed by name.
"""
... | [
"Return",
"the",
"information",
"exported",
"by",
"this",
"distribution",
".",
":",
"return",
":",
"A",
"dictionary",
"of",
"exports",
"mapping",
"an",
"export",
"category",
"to",
"a",
"dict",
"of",
":",
"class",
":",
"ExportEntry",
"instances",
"describing",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L604-L615 | [
"def",
"exports",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"r",
"=",
"self",
".",
"get_distinfo_resource",
"(",
"EXPORTS_FILENAME",
")",
"if",
"r",
":",
"result",
"=",
"self",
".",
"read_exports",
"(",
")",
"return",
"result"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.read_exports | Read exports data from a file in .ini format.
:return: A dictionary of exports, mapping an export category to a list
of :class:`ExportEntry` instances describing the individual
export entries. | pipenv/vendor/distlib/database.py | def read_exports(self):
"""
Read exports data from a file in .ini format.
:return: A dictionary of exports, mapping an export category to a list
of :class:`ExportEntry` instances describing the individual
export entries.
"""
result = {}
... | def read_exports(self):
"""
Read exports data from a file in .ini format.
:return: A dictionary of exports, mapping an export category to a list
of :class:`ExportEntry` instances describing the individual
export entries.
"""
result = {}
... | [
"Read",
"exports",
"data",
"from",
"a",
"file",
"in",
".",
"ini",
"format",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L617-L630 | [
"def",
"read_exports",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"r",
"=",
"self",
".",
"get_distinfo_resource",
"(",
"EXPORTS_FILENAME",
")",
"if",
"r",
":",
"with",
"contextlib",
".",
"closing",
"(",
"r",
".",
"as_stream",
"(",
")",
")",
"as",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.write_exports | Write a dictionary of exports to a file in .ini format.
:param exports: A dictionary of exports, mapping an export category to
a list of :class:`ExportEntry` instances describing the
individual export entries. | pipenv/vendor/distlib/database.py | def write_exports(self, exports):
"""
Write a dictionary of exports to a file in .ini format.
:param exports: A dictionary of exports, mapping an export category to
a list of :class:`ExportEntry` instances describing the
individual export entries.
... | def write_exports(self, exports):
"""
Write a dictionary of exports to a file in .ini format.
:param exports: A dictionary of exports, mapping an export category to
a list of :class:`ExportEntry` instances describing the
individual export entries.
... | [
"Write",
"a",
"dictionary",
"of",
"exports",
"to",
"a",
"file",
"in",
".",
"ini",
"format",
".",
":",
"param",
"exports",
":",
"A",
"dictionary",
"of",
"exports",
"mapping",
"an",
"export",
"category",
"to",
"a",
"list",
"of",
":",
"class",
":",
"Expor... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L632-L641 | [
"def",
"write_exports",
"(",
"self",
",",
"exports",
")",
":",
"rf",
"=",
"self",
".",
"get_distinfo_file",
"(",
"EXPORTS_FILENAME",
")",
"with",
"open",
"(",
"rf",
",",
"'w'",
")",
"as",
"f",
":",
"write_exports",
"(",
"exports",
",",
"f",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.get_resource_path | NOTE: This API may change in the future.
Return the absolute path to a resource file with the given relative
path.
:param relative_path: The path, relative to .dist-info, of the resource
of interest.
:return: The absolute path where the resource is to be f... | pipenv/vendor/distlib/database.py | def get_resource_path(self, relative_path):
"""
NOTE: This API may change in the future.
Return the absolute path to a resource file with the given relative
path.
:param relative_path: The path, relative to .dist-info, of the resource
of interest.
... | def get_resource_path(self, relative_path):
"""
NOTE: This API may change in the future.
Return the absolute path to a resource file with the given relative
path.
:param relative_path: The path, relative to .dist-info, of the resource
of interest.
... | [
"NOTE",
":",
"This",
"API",
"may",
"change",
"in",
"the",
"future",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L643-L661 | [
"def",
"get_resource_path",
"(",
"self",
",",
"relative_path",
")",
":",
"r",
"=",
"self",
".",
"get_distinfo_resource",
"(",
"'RESOURCES'",
")",
"with",
"contextlib",
".",
"closing",
"(",
"r",
".",
"as_stream",
"(",
")",
")",
"as",
"stream",
":",
"with",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.write_installed_files | Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any
existing ``RECORD`` file is silently overwritten.
prefix is used to determine when to write absolute paths. | pipenv/vendor/distlib/database.py | def write_installed_files(self, paths, prefix, dry_run=False):
"""
Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any
existing ``RECORD`` file is silently overwritten.
prefix is used to determine when to write absolute paths.
"""
prefix = os.path.joi... | def write_installed_files(self, paths, prefix, dry_run=False):
"""
Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any
existing ``RECORD`` file is silently overwritten.
prefix is used to determine when to write absolute paths.
"""
prefix = os.path.joi... | [
"Writes",
"the",
"RECORD",
"file",
"using",
"the",
"paths",
"iterable",
"passed",
"in",
".",
"Any",
"existing",
"RECORD",
"file",
"is",
"silently",
"overwritten",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L673-L706 | [
"def",
"write_installed_files",
"(",
"self",
",",
"paths",
",",
"prefix",
",",
"dry_run",
"=",
"False",
")",
":",
"prefix",
"=",
"os",
".",
"path",
".",
"join",
"(",
"prefix",
",",
"''",
")",
"base",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.check_installed_files | Checks that the hashes and sizes of the files in ``RECORD`` are
matched by the files themselves. Returns a (possibly empty) list of
mismatches. Each entry in the mismatch list will be a tuple consisting
of the path, 'exists', 'size' or 'hash' according to what didn't match
(existence is ... | pipenv/vendor/distlib/database.py | def check_installed_files(self):
"""
Checks that the hashes and sizes of the files in ``RECORD`` are
matched by the files themselves. Returns a (possibly empty) list of
mismatches. Each entry in the mismatch list will be a tuple consisting
of the path, 'exists', 'size' or 'hash' ... | def check_installed_files(self):
"""
Checks that the hashes and sizes of the files in ``RECORD`` are
matched by the files themselves. Returns a (possibly empty) list of
mismatches. Each entry in the mismatch list will be a tuple consisting
of the path, 'exists', 'size' or 'hash' ... | [
"Checks",
"that",
"the",
"hashes",
"and",
"sizes",
"of",
"the",
"files",
"in",
"RECORD",
"are",
"matched",
"by",
"the",
"files",
"themselves",
".",
"Returns",
"a",
"(",
"possibly",
"empty",
")",
"list",
"of",
"mismatches",
".",
"Each",
"entry",
"in",
"th... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L708-L741 | [
"def",
"check_installed_files",
"(",
"self",
")",
":",
"mismatches",
"=",
"[",
"]",
"base",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"path",
")",
"record_path",
"=",
"self",
".",
"get_distinfo_file",
"(",
"'RECORD'",
")",
"for",
"path",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.shared_locations | A dictionary of shared locations whose keys are in the set 'prefix',
'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'.
The corresponding value is the absolute path of that category for
this distribution, and takes into account any paths selected by the
user at installat... | pipenv/vendor/distlib/database.py | def shared_locations(self):
"""
A dictionary of shared locations whose keys are in the set 'prefix',
'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'.
The corresponding value is the absolute path of that category for
this distribution, and takes into account any... | def shared_locations(self):
"""
A dictionary of shared locations whose keys are in the set 'prefix',
'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'.
The corresponding value is the absolute path of that category for
this distribution, and takes into account any... | [
"A",
"dictionary",
"of",
"shared",
"locations",
"whose",
"keys",
"are",
"in",
"the",
"set",
"prefix",
"purelib",
"platlib",
"scripts",
"headers",
"data",
"and",
"namespace",
".",
"The",
"corresponding",
"value",
"is",
"the",
"absolute",
"path",
"of",
"that",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L744-L768 | [
"def",
"shared_locations",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"shared_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"'SHARED'",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"shared_path",
")",
":",
"wi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.write_shared_locations | Write shared location information to the SHARED file in .dist-info.
:param paths: A dictionary as described in the documentation for
:meth:`shared_locations`.
:param dry_run: If True, the action is logged but no file is actually
written.
:return: The path of the f... | pipenv/vendor/distlib/database.py | def write_shared_locations(self, paths, dry_run=False):
"""
Write shared location information to the SHARED file in .dist-info.
:param paths: A dictionary as described in the documentation for
:meth:`shared_locations`.
:param dry_run: If True, the action is logged but no file is ... | def write_shared_locations(self, paths, dry_run=False):
"""
Write shared location information to the SHARED file in .dist-info.
:param paths: A dictionary as described in the documentation for
:meth:`shared_locations`.
:param dry_run: If True, the action is logged but no file is ... | [
"Write",
"shared",
"location",
"information",
"to",
"the",
"SHARED",
"file",
"in",
".",
"dist",
"-",
"info",
".",
":",
"param",
"paths",
":",
"A",
"dictionary",
"as",
"described",
"in",
"the",
"documentation",
"for",
":",
"meth",
":",
"shared_locations",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L770-L793 | [
"def",
"write_shared_locations",
"(",
"self",
",",
"paths",
",",
"dry_run",
"=",
"False",
")",
":",
"shared_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"'SHARED'",
")",
"logger",
".",
"info",
"(",
"'creating %s'",
",",
"s... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.get_distinfo_file | Returns a path located under the ``.dist-info`` directory. Returns a
string representing the path.
:parameter path: a ``'/'``-separated path relative to the
``.dist-info`` directory or an absolute path;
If *path* is an absolute path and doesn't start
... | pipenv/vendor/distlib/database.py | def get_distinfo_file(self, path):
"""
Returns a path located under the ``.dist-info`` directory. Returns a
string representing the path.
:parameter path: a ``'/'``-separated path relative to the
``.dist-info`` directory or an absolute path;
... | def get_distinfo_file(self, path):
"""
Returns a path located under the ``.dist-info`` directory. Returns a
string representing the path.
:parameter path: a ``'/'``-separated path relative to the
``.dist-info`` directory or an absolute path;
... | [
"Returns",
"a",
"path",
"located",
"under",
"the",
".",
"dist",
"-",
"info",
"directory",
".",
"Returns",
"a",
"string",
"representing",
"the",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L804-L831 | [
"def",
"get_distinfo_file",
"(",
"self",
",",
"path",
")",
":",
"# Check if it is an absolute path # XXX use relpath, add tests",
"if",
"path",
".",
"find",
"(",
"os",
".",
"sep",
")",
">=",
"0",
":",
"# it's an absolute path?",
"distinfo_dirname",
",",
"path",
"="... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstalledDistribution.list_distinfo_files | Iterates over the ``RECORD`` entries and returns paths for each line if
the path is pointing to a file located in the ``.dist-info`` directory
or one of its subdirectories.
:returns: iterator of paths | pipenv/vendor/distlib/database.py | def list_distinfo_files(self):
"""
Iterates over the ``RECORD`` entries and returns paths for each line if
the path is pointing to a file located in the ``.dist-info`` directory
or one of its subdirectories.
:returns: iterator of paths
"""
base = os.path.dirname(... | def list_distinfo_files(self):
"""
Iterates over the ``RECORD`` entries and returns paths for each line if
the path is pointing to a file located in the ``.dist-info`` directory
or one of its subdirectories.
:returns: iterator of paths
"""
base = os.path.dirname(... | [
"Iterates",
"over",
"the",
"RECORD",
"entries",
"and",
"returns",
"paths",
"for",
"each",
"line",
"if",
"the",
"path",
"is",
"pointing",
"to",
"a",
"file",
"located",
"in",
"the",
".",
"dist",
"-",
"info",
"directory",
"or",
"one",
"of",
"its",
"subdirec... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L833-L847 | [
"def",
"list_distinfo_files",
"(",
"self",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"path",
")",
"for",
"path",
",",
"checksum",
",",
"size",
"in",
"self",
".",
"_get_records",
"(",
")",
":",
"# XXX add separator or use... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EggInfoDistribution.check_installed_files | Checks that the hashes and sizes of the files in ``RECORD`` are
matched by the files themselves. Returns a (possibly empty) list of
mismatches. Each entry in the mismatch list will be a tuple consisting
of the path, 'exists', 'size' or 'hash' according to what didn't match
(existence is ... | pipenv/vendor/distlib/database.py | def check_installed_files(self):
"""
Checks that the hashes and sizes of the files in ``RECORD`` are
matched by the files themselves. Returns a (possibly empty) list of
mismatches. Each entry in the mismatch list will be a tuple consisting
of the path, 'exists', 'size' or 'hash' ... | def check_installed_files(self):
"""
Checks that the hashes and sizes of the files in ``RECORD`` are
matched by the files themselves. Returns a (possibly empty) list of
mismatches. Each entry in the mismatch list will be a tuple consisting
of the path, 'exists', 'size' or 'hash' ... | [
"Checks",
"that",
"the",
"hashes",
"and",
"sizes",
"of",
"the",
"files",
"in",
"RECORD",
"are",
"matched",
"by",
"the",
"files",
"themselves",
".",
"Returns",
"a",
"(",
"possibly",
"empty",
")",
"list",
"of",
"mismatches",
".",
"Each",
"entry",
"in",
"th... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L984-L1001 | [
"def",
"check_installed_files",
"(",
"self",
")",
":",
"mismatches",
"=",
"[",
"]",
"record_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"'installed-files.txt'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"record_path... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EggInfoDistribution.list_installed_files | Iterates over the ``installed-files.txt`` entries and returns a tuple
``(path, hash, size)`` for each line.
:returns: a list of (path, hash, size) | pipenv/vendor/distlib/database.py | def list_installed_files(self):
"""
Iterates over the ``installed-files.txt`` entries and returns a tuple
``(path, hash, size)`` for each line.
:returns: a list of (path, hash, size)
"""
def _md5(path):
f = open(path, 'rb')
try:
c... | def list_installed_files(self):
"""
Iterates over the ``installed-files.txt`` entries and returns a tuple
``(path, hash, size)`` for each line.
:returns: a list of (path, hash, size)
"""
def _md5(path):
f = open(path, 'rb')
try:
c... | [
"Iterates",
"over",
"the",
"installed",
"-",
"files",
".",
"txt",
"entries",
"and",
"returns",
"a",
"tuple",
"(",
"path",
"hash",
"size",
")",
"for",
"each",
"line",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1003-L1039 | [
"def",
"list_installed_files",
"(",
"self",
")",
":",
"def",
"_md5",
"(",
"path",
")",
":",
"f",
"=",
"open",
"(",
"path",
",",
"'rb'",
")",
"try",
":",
"content",
"=",
"f",
".",
"read",
"(",
")",
"finally",
":",
"f",
".",
"close",
"(",
")",
"r... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EggInfoDistribution.list_distinfo_files | Iterates over the ``installed-files.txt`` entries and returns paths for
each line if the path is pointing to a file located in the
``.egg-info`` directory or one of its subdirectories.
:parameter absolute: If *absolute* is ``True``, each returned path is
transformed in... | pipenv/vendor/distlib/database.py | def list_distinfo_files(self, absolute=False):
"""
Iterates over the ``installed-files.txt`` entries and returns paths for
each line if the path is pointing to a file located in the
``.egg-info`` directory or one of its subdirectories.
:parameter absolute: If *absolute* is ``Tru... | def list_distinfo_files(self, absolute=False):
"""
Iterates over the ``installed-files.txt`` entries and returns paths for
each line if the path is pointing to a file located in the
``.egg-info`` directory or one of its subdirectories.
:parameter absolute: If *absolute* is ``Tru... | [
"Iterates",
"over",
"the",
"installed",
"-",
"files",
".",
"txt",
"entries",
"and",
"returns",
"paths",
"for",
"each",
"line",
"if",
"the",
"path",
"is",
"pointing",
"to",
"a",
"file",
"located",
"in",
"the",
".",
"egg",
"-",
"info",
"directory",
"or",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1041-L1068 | [
"def",
"list_distinfo_files",
"(",
"self",
",",
"absolute",
"=",
"False",
")",
":",
"record_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"'installed-files.txt'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"record_path... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyGraph.add_edge | Add an edge from distribution *x* to distribution *y* with the given
*label*.
:type x: :class:`distutils2.database.InstalledDistribution` or
:class:`distutils2.database.EggInfoDistribution`
:type y: :class:`distutils2.database.InstalledDistribution` or
:class:`... | pipenv/vendor/distlib/database.py | def add_edge(self, x, y, label=None):
"""Add an edge from distribution *x* to distribution *y* with the given
*label*.
:type x: :class:`distutils2.database.InstalledDistribution` or
:class:`distutils2.database.EggInfoDistribution`
:type y: :class:`distutils2.database.In... | def add_edge(self, x, y, label=None):
"""Add an edge from distribution *x* to distribution *y* with the given
*label*.
:type x: :class:`distutils2.database.InstalledDistribution` or
:class:`distutils2.database.EggInfoDistribution`
:type y: :class:`distutils2.database.In... | [
"Add",
"an",
"edge",
"from",
"distribution",
"*",
"x",
"*",
"to",
"distribution",
"*",
"y",
"*",
"with",
"the",
"given",
"*",
"label",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1112-L1125 | [
"def",
"add_edge",
"(",
"self",
",",
"x",
",",
"y",
",",
"label",
"=",
"None",
")",
":",
"self",
".",
"adjacency_list",
"[",
"x",
"]",
".",
"append",
"(",
"(",
"y",
",",
"label",
")",
")",
"# multiple edges are allowed, so be careful",
"if",
"x",
"not"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyGraph.add_missing | Add a missing *requirement* for the given *distribution*.
:type distribution: :class:`distutils2.database.InstalledDistribution`
or :class:`distutils2.database.EggInfoDistribution`
:type requirement: ``str`` | pipenv/vendor/distlib/database.py | def add_missing(self, distribution, requirement):
"""
Add a missing *requirement* for the given *distribution*.
:type distribution: :class:`distutils2.database.InstalledDistribution`
or :class:`distutils2.database.EggInfoDistribution`
:type requirement: ``str... | def add_missing(self, distribution, requirement):
"""
Add a missing *requirement* for the given *distribution*.
:type distribution: :class:`distutils2.database.InstalledDistribution`
or :class:`distutils2.database.EggInfoDistribution`
:type requirement: ``str... | [
"Add",
"a",
"missing",
"*",
"requirement",
"*",
"for",
"the",
"given",
"*",
"distribution",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1127-L1136 | [
"def",
"add_missing",
"(",
"self",
",",
"distribution",
",",
"requirement",
")",
":",
"logger",
".",
"debug",
"(",
"'%s missing %r'",
",",
"distribution",
",",
"requirement",
")",
"self",
".",
"missing",
".",
"setdefault",
"(",
"distribution",
",",
"[",
"]",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyGraph.repr_node | Prints only a subgraph | pipenv/vendor/distlib/database.py | def repr_node(self, dist, level=1):
"""Prints only a subgraph"""
output = [self._repr_dist(dist)]
for other, label in self.adjacency_list[dist]:
dist = self._repr_dist(other)
if label is not None:
dist = '%s [%s]' % (dist, label)
output.append(... | def repr_node(self, dist, level=1):
"""Prints only a subgraph"""
output = [self._repr_dist(dist)]
for other, label in self.adjacency_list[dist]:
dist = self._repr_dist(other)
if label is not None:
dist = '%s [%s]' % (dist, label)
output.append(... | [
"Prints",
"only",
"a",
"subgraph"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1141-L1152 | [
"def",
"repr_node",
"(",
"self",
",",
"dist",
",",
"level",
"=",
"1",
")",
":",
"output",
"=",
"[",
"self",
".",
"_repr_dist",
"(",
"dist",
")",
"]",
"for",
"other",
",",
"label",
"in",
"self",
".",
"adjacency_list",
"[",
"dist",
"]",
":",
"dist",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyGraph.to_dot | Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
:type skip_disconnected: ``bool`` | pipenv/vendor/distlib/database.py | def to_dot(self, f, skip_disconnected=True):
"""Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
... | def to_dot(self, f, skip_disconnected=True):
"""Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
... | [
"Writes",
"a",
"DOT",
"output",
"for",
"the",
"graph",
"to",
"the",
"provided",
"file",
"*",
"f",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1154-L1184 | [
"def",
"to_dot",
"(",
"self",
",",
"f",
",",
"skip_disconnected",
"=",
"True",
")",
":",
"disconnected",
"=",
"[",
"]",
"f",
".",
"write",
"(",
"\"digraph dependencies {\\n\"",
")",
"for",
"dist",
",",
"adjs",
"in",
"self",
".",
"adjacency_list",
".",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyGraph.topological_sort | Perform a topological sort of the graph.
:return: A tuple, the first element of which is a topologically sorted
list of distributions, and the second element of which is a
list of distributions that cannot be sorted because they have
circular dependencies and s... | pipenv/vendor/distlib/database.py | def topological_sort(self):
"""
Perform a topological sort of the graph.
:return: A tuple, the first element of which is a topologically sorted
list of distributions, and the second element of which is a
list of distributions that cannot be sorted because they h... | def topological_sort(self):
"""
Perform a topological sort of the graph.
:return: A tuple, the first element of which is a topologically sorted
list of distributions, and the second element of which is a
list of distributions that cannot be sorted because they h... | [
"Perform",
"a",
"topological",
"sort",
"of",
"the",
"graph",
".",
":",
"return",
":",
"A",
"tuple",
"the",
"first",
"element",
"of",
"which",
"is",
"a",
"topologically",
"sorted",
"list",
"of",
"distributions",
"and",
"the",
"second",
"element",
"of",
"whi... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1186-L1215 | [
"def",
"topological_sort",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"# Make a shallow copy of the adjacency list",
"alist",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"adjacency_list",
".",
"items",
"(",
")",
":",
"alist",
"[",
"k",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | encode_unicode | Cerberus error messages expect regular binary strings.
If unicode is used in a ValidationError message can't be printed.
This decorator ensures that if legacy Python is used unicode
strings are encoded before passing to a function. | pipenv/vendor/cerberus/errors.py | def encode_unicode(f):
"""Cerberus error messages expect regular binary strings.
If unicode is used in a ValidationError message can't be printed.
This decorator ensures that if legacy Python is used unicode
strings are encoded before passing to a function.
"""
@wraps(f)
def wrapped(obj, er... | def encode_unicode(f):
"""Cerberus error messages expect regular binary strings.
If unicode is used in a ValidationError message can't be printed.
This decorator ensures that if legacy Python is used unicode
strings are encoded before passing to a function.
"""
@wraps(f)
def wrapped(obj, er... | [
"Cerberus",
"error",
"messages",
"expect",
"regular",
"binary",
"strings",
".",
"If",
"unicode",
"is",
"used",
"in",
"a",
"ValidationError",
"message",
"can",
"t",
"be",
"printed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L407-L431 | [
"def",
"encode_unicode",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapped",
"(",
"obj",
",",
"error",
")",
":",
"def",
"_encode",
"(",
"value",
")",
":",
"\"\"\"Helper encoding unicode strings into binary utf-8\"\"\"",
"if",
"isinstance",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ValidationError.definitions_errors | Dictionary with errors of an *of-rule mapped to the index of the
definition it occurred in. Returns :obj:`None` if not applicable. | pipenv/vendor/cerberus/errors.py | def definitions_errors(self):
""" Dictionary with errors of an *of-rule mapped to the index of the
definition it occurred in. Returns :obj:`None` if not applicable.
"""
if not self.is_logic_error:
return None
result = defaultdict(list)
for error in se... | def definitions_errors(self):
""" Dictionary with errors of an *of-rule mapped to the index of the
definition it occurred in. Returns :obj:`None` if not applicable.
"""
if not self.is_logic_error:
return None
result = defaultdict(list)
for error in se... | [
"Dictionary",
"with",
"errors",
"of",
"an",
"*",
"of",
"-",
"rule",
"mapped",
"to",
"the",
"index",
"of",
"the",
"definition",
"it",
"occurred",
"in",
".",
"Returns",
":",
"obj",
":",
"None",
"if",
"not",
"applicable",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L151-L162 | [
"def",
"definitions_errors",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_logic_error",
":",
"return",
"None",
"result",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"error",
"in",
"self",
".",
"child_errors",
":",
"i",
"=",
"error",
".",
"schema... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ErrorTree.add | Add an error to the tree.
:param error: :class:`~cerberus.errors.ValidationError` | pipenv/vendor/cerberus/errors.py | def add(self, error):
""" Add an error to the tree.
:param error: :class:`~cerberus.errors.ValidationError`
"""
if not self._path_of_(error):
self.errors.append(error)
self.errors.sort()
else:
super(ErrorTree, self).add(error) | def add(self, error):
""" Add an error to the tree.
:param error: :class:`~cerberus.errors.ValidationError`
"""
if not self._path_of_(error):
self.errors.append(error)
self.errors.sort()
else:
super(ErrorTree, self).add(error) | [
"Add",
"an",
"error",
"to",
"the",
"tree",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L286-L295 | [
"def",
"add",
"(",
"self",
",",
"error",
")",
":",
"if",
"not",
"self",
".",
"_path_of_",
"(",
"error",
")",
":",
"self",
".",
"errors",
".",
"append",
"(",
"error",
")",
"self",
".",
"errors",
".",
"sort",
"(",
")",
"else",
":",
"super",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ErrorTree.fetch_errors_from | Returns all errors for a particular path.
:param path: :class:`tuple` of :term:`hashable` s.
:rtype: :class:`~cerberus.errors.ErrorList` | pipenv/vendor/cerberus/errors.py | def fetch_errors_from(self, path):
""" Returns all errors for a particular path.
:param path: :class:`tuple` of :term:`hashable` s.
:rtype: :class:`~cerberus.errors.ErrorList`
"""
node = self.fetch_node_from(path)
if node is not None:
return node.errors
... | def fetch_errors_from(self, path):
""" Returns all errors for a particular path.
:param path: :class:`tuple` of :term:`hashable` s.
:rtype: :class:`~cerberus.errors.ErrorList`
"""
node = self.fetch_node_from(path)
if node is not None:
return node.errors
... | [
"Returns",
"all",
"errors",
"for",
"a",
"particular",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L297-L307 | [
"def",
"fetch_errors_from",
"(",
"self",
",",
"path",
")",
":",
"node",
"=",
"self",
".",
"fetch_node_from",
"(",
"path",
")",
"if",
"node",
"is",
"not",
"None",
":",
"return",
"node",
".",
"errors",
"else",
":",
"return",
"ErrorList",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ErrorTree.fetch_node_from | Returns a node for a path.
:param path: Tuple of :term:`hashable` s.
:rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None` | pipenv/vendor/cerberus/errors.py | def fetch_node_from(self, path):
""" Returns a node for a path.
:param path: Tuple of :term:`hashable` s.
:rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None`
"""
context = self
for key in path:
context = context[key]
if context is None:... | def fetch_node_from(self, path):
""" Returns a node for a path.
:param path: Tuple of :term:`hashable` s.
:rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None`
"""
context = self
for key in path:
context = context[key]
if context is None:... | [
"Returns",
"a",
"node",
"for",
"a",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L309-L320 | [
"def",
"fetch_node_from",
"(",
"self",
",",
"path",
")",
":",
"context",
"=",
"self",
"for",
"key",
"in",
"path",
":",
"context",
"=",
"context",
"[",
"key",
"]",
"if",
"context",
"is",
"None",
":",
"break",
"return",
"context"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | BasicErrorHandler._insert_error | Adds an error or sub-tree to :attr:tree.
:param path: Path to the error.
:type path: Tuple of strings and integers.
:param node: An error message or a sub-tree.
:type node: String or dictionary. | pipenv/vendor/cerberus/errors.py | def _insert_error(self, path, node):
""" Adds an error or sub-tree to :attr:tree.
:param path: Path to the error.
:type path: Tuple of strings and integers.
:param node: An error message or a sub-tree.
:type node: String or dictionary.
"""
field = path[0]
... | def _insert_error(self, path, node):
""" Adds an error or sub-tree to :attr:tree.
:param path: Path to the error.
:type path: Tuple of strings and integers.
:param node: An error message or a sub-tree.
:type node: String or dictionary.
"""
field = path[0]
... | [
"Adds",
"an",
"error",
"or",
"sub",
"-",
"tree",
"to",
":",
"attr",
":",
"tree",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L528-L553 | [
"def",
"_insert_error",
"(",
"self",
",",
"path",
",",
"node",
")",
":",
"field",
"=",
"path",
"[",
"0",
"]",
"if",
"len",
"(",
"path",
")",
"==",
"1",
":",
"if",
"field",
"in",
"self",
".",
"tree",
":",
"subtree",
"=",
"self",
".",
"tree",
"["... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | BasicErrorHandler._rewrite_error_path | Recursively rewrites the error path to correctly represent logic errors | pipenv/vendor/cerberus/errors.py | def _rewrite_error_path(self, error, offset=0):
"""
Recursively rewrites the error path to correctly represent logic errors
"""
if error.is_logic_error:
self._rewrite_logic_error_path(error, offset)
elif error.is_group_error:
self._rewrite_group_error_path... | def _rewrite_error_path(self, error, offset=0):
"""
Recursively rewrites the error path to correctly represent logic errors
"""
if error.is_logic_error:
self._rewrite_logic_error_path(error, offset)
elif error.is_group_error:
self._rewrite_group_error_path... | [
"Recursively",
"rewrites",
"the",
"error",
"path",
"to",
"correctly",
"represent",
"logic",
"errors"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/errors.py#L589-L596 | [
"def",
"_rewrite_error_path",
"(",
"self",
",",
"error",
",",
"offset",
"=",
"0",
")",
":",
"if",
"error",
".",
"is_logic_error",
":",
"self",
".",
"_rewrite_logic_error_path",
"(",
"error",
",",
"offset",
")",
"elif",
"error",
".",
"is_group_error",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | dispatch_hook | Dispatches a hook dictionary on a given piece of data. | pipenv/vendor/requests/hooks.py | def dispatch_hook(key, hooks, hook_data, **kwargs):
"""Dispatches a hook dictionary on a given piece of data."""
hooks = hooks or {}
hooks = hooks.get(key)
if hooks:
if hasattr(hooks, '__call__'):
hooks = [hooks]
for hook in hooks:
_hook_data = hook(hook_data, **k... | def dispatch_hook(key, hooks, hook_data, **kwargs):
"""Dispatches a hook dictionary on a given piece of data."""
hooks = hooks or {}
hooks = hooks.get(key)
if hooks:
if hasattr(hooks, '__call__'):
hooks = [hooks]
for hook in hooks:
_hook_data = hook(hook_data, **k... | [
"Dispatches",
"a",
"hook",
"dictionary",
"on",
"a",
"given",
"piece",
"of",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/hooks.py#L23-L34 | [
"def",
"dispatch_hook",
"(",
"key",
",",
"hooks",
",",
"hook_data",
",",
"*",
"*",
"kwargs",
")",
":",
"hooks",
"=",
"hooks",
"or",
"{",
"}",
"hooks",
"=",
"hooks",
".",
"get",
"(",
"key",
")",
"if",
"hooks",
":",
"if",
"hasattr",
"(",
"hooks",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | cli | This script is used to set, get or unset values from a .env file. | pipenv/vendor/dotenv/cli.py | def cli(ctx, file, quote):
'''This script is used to set, get or unset values from a .env file.'''
ctx.obj = {}
ctx.obj['FILE'] = file
ctx.obj['QUOTE'] = quote | def cli(ctx, file, quote):
'''This script is used to set, get or unset values from a .env file.'''
ctx.obj = {}
ctx.obj['FILE'] = file
ctx.obj['QUOTE'] = quote | [
"This",
"script",
"is",
"used",
"to",
"set",
"get",
"or",
"unset",
"values",
"from",
"a",
".",
"env",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L24-L28 | [
"def",
"cli",
"(",
"ctx",
",",
"file",
",",
"quote",
")",
":",
"ctx",
".",
"obj",
"=",
"{",
"}",
"ctx",
".",
"obj",
"[",
"'FILE'",
"]",
"=",
"file",
"ctx",
".",
"obj",
"[",
"'QUOTE'",
"]",
"=",
"quote"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | list | Display all the stored key/value. | pipenv/vendor/dotenv/cli.py | def list(ctx):
'''Display all the stored key/value.'''
file = ctx.obj['FILE']
dotenv_as_dict = dotenv_values(file)
for k, v in dotenv_as_dict.items():
click.echo('%s=%s' % (k, v)) | def list(ctx):
'''Display all the stored key/value.'''
file = ctx.obj['FILE']
dotenv_as_dict = dotenv_values(file)
for k, v in dotenv_as_dict.items():
click.echo('%s=%s' % (k, v)) | [
"Display",
"all",
"the",
"stored",
"key",
"/",
"value",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L33-L38 | [
"def",
"list",
"(",
"ctx",
")",
":",
"file",
"=",
"ctx",
".",
"obj",
"[",
"'FILE'",
"]",
"dotenv_as_dict",
"=",
"dotenv_values",
"(",
"file",
")",
"for",
"k",
",",
"v",
"in",
"dotenv_as_dict",
".",
"items",
"(",
")",
":",
"click",
".",
"echo",
"(",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | set | Store the given key/value. | pipenv/vendor/dotenv/cli.py | def set(ctx, key, value):
'''Store the given key/value.'''
file = ctx.obj['FILE']
quote = ctx.obj['QUOTE']
success, key, value = set_key(file, key, value, quote)
if success:
click.echo('%s=%s' % (key, value))
else:
exit(1) | def set(ctx, key, value):
'''Store the given key/value.'''
file = ctx.obj['FILE']
quote = ctx.obj['QUOTE']
success, key, value = set_key(file, key, value, quote)
if success:
click.echo('%s=%s' % (key, value))
else:
exit(1) | [
"Store",
"the",
"given",
"key",
"/",
"value",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L45-L53 | [
"def",
"set",
"(",
"ctx",
",",
"key",
",",
"value",
")",
":",
"file",
"=",
"ctx",
".",
"obj",
"[",
"'FILE'",
"]",
"quote",
"=",
"ctx",
".",
"obj",
"[",
"'QUOTE'",
"]",
"success",
",",
"key",
",",
"value",
"=",
"set_key",
"(",
"file",
",",
"key"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get | Retrieve the value for the given key. | pipenv/vendor/dotenv/cli.py | def get(ctx, key):
'''Retrieve the value for the given key.'''
file = ctx.obj['FILE']
stored_value = get_key(file, key)
if stored_value:
click.echo('%s=%s' % (key, stored_value))
else:
exit(1) | def get(ctx, key):
'''Retrieve the value for the given key.'''
file = ctx.obj['FILE']
stored_value = get_key(file, key)
if stored_value:
click.echo('%s=%s' % (key, stored_value))
else:
exit(1) | [
"Retrieve",
"the",
"value",
"for",
"the",
"given",
"key",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L59-L66 | [
"def",
"get",
"(",
"ctx",
",",
"key",
")",
":",
"file",
"=",
"ctx",
".",
"obj",
"[",
"'FILE'",
"]",
"stored_value",
"=",
"get_key",
"(",
"file",
",",
"key",
")",
"if",
"stored_value",
":",
"click",
".",
"echo",
"(",
"'%s=%s'",
"%",
"(",
"key",
",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | unset | Removes the given key. | pipenv/vendor/dotenv/cli.py | def unset(ctx, key):
'''Removes the given key.'''
file = ctx.obj['FILE']
quote = ctx.obj['QUOTE']
success, key = unset_key(file, key, quote)
if success:
click.echo("Successfully removed %s" % key)
else:
exit(1) | def unset(ctx, key):
'''Removes the given key.'''
file = ctx.obj['FILE']
quote = ctx.obj['QUOTE']
success, key = unset_key(file, key, quote)
if success:
click.echo("Successfully removed %s" % key)
else:
exit(1) | [
"Removes",
"the",
"given",
"key",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L72-L80 | [
"def",
"unset",
"(",
"ctx",
",",
"key",
")",
":",
"file",
"=",
"ctx",
".",
"obj",
"[",
"'FILE'",
"]",
"quote",
"=",
"ctx",
".",
"obj",
"[",
"'QUOTE'",
"]",
"success",
",",
"key",
"=",
"unset_key",
"(",
"file",
",",
"key",
",",
"quote",
")",
"if... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | run | Run command with environment variables present. | pipenv/vendor/dotenv/cli.py | def run(ctx, commandline):
"""Run command with environment variables present."""
file = ctx.obj['FILE']
dotenv_as_dict = dotenv_values(file)
if not commandline:
click.echo('No command given.')
exit(1)
ret = run_command(commandline, dotenv_as_dict)
exit(ret) | def run(ctx, commandline):
"""Run command with environment variables present."""
file = ctx.obj['FILE']
dotenv_as_dict = dotenv_values(file)
if not commandline:
click.echo('No command given.')
exit(1)
ret = run_command(commandline, dotenv_as_dict)
exit(ret) | [
"Run",
"command",
"with",
"environment",
"variables",
"present",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/cli.py#L86-L94 | [
"def",
"run",
"(",
"ctx",
",",
"commandline",
")",
":",
"file",
"=",
"ctx",
".",
"obj",
"[",
"'FILE'",
"]",
"dotenv_as_dict",
"=",
"dotenv_values",
"(",
"file",
")",
"if",
"not",
"commandline",
":",
"click",
".",
"echo",
"(",
"'No command given.'",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _is_installation_local | Check whether the distribution is in the current Python installation.
This is used to distinguish packages seen by a virtual environment. A venv
may be able to see global packages, but we don't want to mess with them. | pipenv/vendor/passa/models/synchronizers.py | def _is_installation_local(name):
"""Check whether the distribution is in the current Python installation.
This is used to distinguish packages seen by a virtual environment. A venv
may be able to see global packages, but we don't want to mess with them.
"""
loc = os.path.normcase(pkg_resources.wor... | def _is_installation_local(name):
"""Check whether the distribution is in the current Python installation.
This is used to distinguish packages seen by a virtual environment. A venv
may be able to see global packages, but we don't want to mess with them.
"""
loc = os.path.normcase(pkg_resources.wor... | [
"Check",
"whether",
"the",
"distribution",
"is",
"in",
"the",
"current",
"Python",
"installation",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/synchronizers.py#L20-L28 | [
"def",
"_is_installation_local",
"(",
"name",
")",
":",
"loc",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"pkg_resources",
".",
"working_set",
".",
"by_key",
"[",
"name",
"]",
".",
"location",
")",
"pre",
"=",
"os",
".",
"path",
".",
"normcase",
"("... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _group_installed_names | Group locally installed packages based on given specifications.
`packages` is a name-package mapping that are used as baseline to
determine how the installed package should be grouped.
Returns a 3-tuple of disjoint sets, all containing names of installed
packages:
* `uptodate`: These match the sp... | pipenv/vendor/passa/models/synchronizers.py | def _group_installed_names(packages):
"""Group locally installed packages based on given specifications.
`packages` is a name-package mapping that are used as baseline to
determine how the installed package should be grouped.
Returns a 3-tuple of disjoint sets, all containing names of installed
pa... | def _group_installed_names(packages):
"""Group locally installed packages based on given specifications.
`packages` is a name-package mapping that are used as baseline to
determine how the installed package should be grouped.
Returns a 3-tuple of disjoint sets, all containing names of installed
pa... | [
"Group",
"locally",
"installed",
"packages",
"based",
"on",
"given",
"specifications",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/synchronizers.py#L41-L74 | [
"def",
"_group_installed_names",
"(",
"packages",
")",
":",
"groupcoll",
"=",
"GroupCollection",
"(",
"set",
"(",
")",
",",
"set",
"(",
")",
",",
"set",
"(",
")",
",",
"set",
"(",
")",
")",
"for",
"distro",
"in",
"pkg_resources",
".",
"working_set",
":... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _build_paths | Prepare paths for distlib.wheel.Wheel to install into. | pipenv/vendor/passa/models/synchronizers.py | def _build_paths():
"""Prepare paths for distlib.wheel.Wheel to install into.
"""
paths = sysconfig.get_paths()
return {
"prefix": sys.prefix,
"data": paths["data"],
"scripts": paths["scripts"],
"headers": paths["include"],
"purelib": paths["purelib"],
"pl... | def _build_paths():
"""Prepare paths for distlib.wheel.Wheel to install into.
"""
paths = sysconfig.get_paths()
return {
"prefix": sys.prefix,
"data": paths["data"],
"scripts": paths["scripts"],
"headers": paths["include"],
"purelib": paths["purelib"],
"pl... | [
"Prepare",
"paths",
"for",
"distlib",
".",
"wheel",
".",
"Wheel",
"to",
"install",
"into",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/synchronizers.py#L98-L109 | [
"def",
"_build_paths",
"(",
")",
":",
"paths",
"=",
"sysconfig",
".",
"get_paths",
"(",
")",
"return",
"{",
"\"prefix\"",
":",
"sys",
".",
"prefix",
",",
"\"data\"",
":",
"paths",
"[",
"\"data\"",
"]",
",",
"\"scripts\"",
":",
"paths",
"[",
"\"scripts\""... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | dumps | Dumps a TOMLDocument into a string. | pipenv/vendor/tomlkit/api.py | def dumps(data): # type: (_TOMLDocument) -> str
"""
Dumps a TOMLDocument into a string.
"""
if not isinstance(data, _TOMLDocument) and isinstance(data, dict):
data = item(data)
return data.as_string() | def dumps(data): # type: (_TOMLDocument) -> str
"""
Dumps a TOMLDocument into a string.
"""
if not isinstance(data, _TOMLDocument) and isinstance(data, dict):
data = item(data)
return data.as_string() | [
"Dumps",
"a",
"TOMLDocument",
"into",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/api.py#L35-L42 | [
"def",
"dumps",
"(",
"data",
")",
":",
"# type: (_TOMLDocument) -> str",
"if",
"not",
"isinstance",
"(",
"data",
",",
"_TOMLDocument",
")",
"and",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"data",
"=",
"item",
"(",
"data",
")",
"return",
"data",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest.findall | Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found. | pipenv/vendor/distlib/manifest.py | def findall(self):
"""Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
"""
from stat import S_ISREG, S_ISDIR, S_ISLNK
self.allfiles = allfiles = []
root = self.base
stack = [root]
pop = stack.pop
push = ... | def findall(self):
"""Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
"""
from stat import S_ISREG, S_ISDIR, S_ISLNK
self.allfiles = allfiles = []
root = self.base
stack = [root]
pop = stack.pop
push = ... | [
"Find",
"all",
"files",
"under",
"the",
"base",
"and",
"set",
"allfiles",
"to",
"the",
"absolute",
"pathnames",
"of",
"files",
"found",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L57-L82 | [
"def",
"findall",
"(",
"self",
")",
":",
"from",
"stat",
"import",
"S_ISREG",
",",
"S_ISDIR",
",",
"S_ISLNK",
"self",
".",
"allfiles",
"=",
"allfiles",
"=",
"[",
"]",
"root",
"=",
"self",
".",
"base",
"stack",
"=",
"[",
"root",
"]",
"pop",
"=",
"st... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest.add | Add a file to the manifest.
:param item: The pathname to add. This can be relative to the base. | pipenv/vendor/distlib/manifest.py | def add(self, item):
"""
Add a file to the manifest.
:param item: The pathname to add. This can be relative to the base.
"""
if not item.startswith(self.prefix):
item = os.path.join(self.base, item)
self.files.add(os.path.normpath(item)) | def add(self, item):
"""
Add a file to the manifest.
:param item: The pathname to add. This can be relative to the base.
"""
if not item.startswith(self.prefix):
item = os.path.join(self.base, item)
self.files.add(os.path.normpath(item)) | [
"Add",
"a",
"file",
"to",
"the",
"manifest",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L84-L92 | [
"def",
"add",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"item",
".",
"startswith",
"(",
"self",
".",
"prefix",
")",
":",
"item",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"base",
",",
"item",
")",
"self",
".",
"files",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest.sorted | Return sorted files in directory order | pipenv/vendor/distlib/manifest.py | def sorted(self, wantdirs=False):
"""
Return sorted files in directory order
"""
def add_dir(dirs, d):
dirs.add(d)
logger.debug('add_dir added %s', d)
if d != self.base:
parent, _ = os.path.split(d)
assert parent not in... | def sorted(self, wantdirs=False):
"""
Return sorted files in directory order
"""
def add_dir(dirs, d):
dirs.add(d)
logger.debug('add_dir added %s', d)
if d != self.base:
parent, _ = os.path.split(d)
assert parent not in... | [
"Return",
"sorted",
"files",
"in",
"directory",
"order"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L103-L123 | [
"def",
"sorted",
"(",
"self",
",",
"wantdirs",
"=",
"False",
")",
":",
"def",
"add_dir",
"(",
"dirs",
",",
"d",
")",
":",
"dirs",
".",
"add",
"(",
"d",
")",
"logger",
".",
"debug",
"(",
"'add_dir added %s'",
",",
"d",
")",
"if",
"d",
"!=",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest.process_directive | Process a directive which either adds some files from ``allfiles`` to
``files``, or removes some files from ``files``.
:param directive: The directive to process. This should be in a format
compatible with distutils ``MANIFEST.in`` files:
http://docs.python.or... | pipenv/vendor/distlib/manifest.py | def process_directive(self, directive):
"""
Process a directive which either adds some files from ``allfiles`` to
``files``, or removes some files from ``files``.
:param directive: The directive to process. This should be in a format
compatible with distutils ``MANI... | def process_directive(self, directive):
"""
Process a directive which either adds some files from ``allfiles`` to
``files``, or removes some files from ``files``.
:param directive: The directive to process. This should be in a format
compatible with distutils ``MANI... | [
"Process",
"a",
"directive",
"which",
"either",
"adds",
"some",
"files",
"from",
"allfiles",
"to",
"files",
"or",
"removes",
"some",
"files",
"from",
"files",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L130-L203 | [
"def",
"process_directive",
"(",
"self",
",",
"directive",
")",
":",
"# Parse the line: split it up, make sure the right number of words",
"# is there, and return the relevant words. 'action' is always",
"# defined: it's the first word of the line. Which of the other",
"# three are defined d... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest._parse_directive | Validate a directive.
:param directive: The directive to validate.
:return: A tuple of action, patterns, thedir, dir_patterns | pipenv/vendor/distlib/manifest.py | def _parse_directive(self, directive):
"""
Validate a directive.
:param directive: The directive to validate.
:return: A tuple of action, patterns, thedir, dir_patterns
"""
words = directive.split()
if len(words) == 1 and words[0] not in ('include', 'exclude',
... | def _parse_directive(self, directive):
"""
Validate a directive.
:param directive: The directive to validate.
:return: A tuple of action, patterns, thedir, dir_patterns
"""
words = directive.split()
if len(words) == 1 and words[0] not in ('include', 'exclude',
... | [
"Validate",
"a",
"directive",
".",
":",
"param",
"directive",
":",
"The",
"directive",
"to",
"validate",
".",
":",
"return",
":",
"A",
"tuple",
"of",
"action",
"patterns",
"thedir",
"dir_patterns"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L209-L254 | [
"def",
"_parse_directive",
"(",
"self",
",",
"directive",
")",
":",
"words",
"=",
"directive",
".",
"split",
"(",
")",
"if",
"len",
"(",
"words",
")",
"==",
"1",
"and",
"words",
"[",
"0",
"]",
"not",
"in",
"(",
"'include'",
",",
"'exclude'",
",",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest._include_pattern | Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
module: '*' and '?' match non-special characters, where "special"
is platform-dependent: slash on Unix; co... | pipenv/vendor/distlib/manifest.py | def _include_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
... | def _include_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
... | [
"Select",
"strings",
"(",
"presumably",
"filenames",
")",
"from",
"self",
".",
"files",
"that",
"match",
"pattern",
"a",
"Unix",
"-",
"style",
"wildcard",
"(",
"glob",
")",
"pattern",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L256-L295 | [
"def",
"_include_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"# XXX docstring lying about what the special chars are?",
"found",
"=",
"False",
"pattern_re",
"=",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest._exclude_pattern | Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place. Return True if files are
found.
This API is public to allow e.g. exclusion of SCM subdirs, e.g. ... | pipenv/vendor/distlib/manifest.py | def _exclude_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place... | def _exclude_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place... | [
"Remove",
"strings",
"(",
"presumably",
"filenames",
")",
"from",
"files",
"that",
"match",
"pattern",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L297-L315 | [
"def",
"_exclude_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"found",
"=",
"False",
"pattern_re",
"=",
"self",
".",
"_translate_pattern",
"(",
"pattern",
",",
"an... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest._translate_pattern | Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a regex object). | pipenv/vendor/distlib/manifest.py | def _translate_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it'... | def _translate_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it'... | [
"Translate",
"a",
"shell",
"-",
"like",
"wildcard",
"pattern",
"to",
"a",
"compiled",
"regular",
"expression",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L317-L370 | [
"def",
"_translate_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"if",
"is_regex",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"str",
")",
":",
"return",
"re",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Manifest._glob_to_re | Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific). | pipenv/vendor/distlib/manifest.py | def _glob_to_re(self, pattern):
"""Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific).
"""
pattern_re = fnmat... | def _glob_to_re(self, pattern):
"""Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific).
"""
pattern_re = fnmat... | [
"Translate",
"a",
"shell",
"-",
"like",
"glob",
"pattern",
"to",
"a",
"regular",
"expression",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L372-L393 | [
"def",
"_glob_to_re",
"(",
"self",
",",
"pattern",
")",
":",
"pattern_re",
"=",
"fnmatch",
".",
"translate",
"(",
"pattern",
")",
"# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which",
"# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,",
"#... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.