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 | Markup.escape | Escape a string. Calls :func:`escape` and ensures that for
subclasses the correct type is returned. | pipenv/vendor/markupsafe/__init__.py | def escape(cls, s):
"""Escape a string. Calls :func:`escape` and ensures that for
subclasses the correct type is returned.
"""
rv = escape(s)
if rv.__class__ is not cls:
return cls(rv)
return rv | def escape(cls, s):
"""Escape a string. Calls :func:`escape` and ensures that for
subclasses the correct type is returned.
"""
rv = escape(s)
if rv.__class__ is not cls:
return cls(rv)
return rv | [
"Escape",
"a",
"string",
".",
"Calls",
":",
"func",
":",
"escape",
"and",
"ensures",
"that",
"for",
"subclasses",
"the",
"correct",
"type",
"is",
"returned",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/markupsafe/__init__.py#L163-L170 | [
"def",
"escape",
"(",
"cls",
",",
"s",
")",
":",
"rv",
"=",
"escape",
"(",
"s",
")",
"if",
"rv",
".",
"__class__",
"is",
"not",
"cls",
":",
"return",
"cls",
"(",
"rv",
")",
"return",
"rv"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.populate_link | Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If require_hashes is True, don't use the wheel cache, because cached
wheels, always built locally, have different hashes ... | pipenv/patched/notpip/_internal/req/req_install.py | def populate_link(self, finder, upgrade, require_hashes):
# type: (PackageFinder, bool, bool) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If requi... | def populate_link(self, finder, upgrade, require_hashes):
# type: (PackageFinder, bool, bool) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If requi... | [
"Ensure",
"that",
"if",
"a",
"link",
"can",
"be",
"found",
"for",
"this",
"that",
"it",
"is",
"found",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L182-L201 | [
"def",
"populate_link",
"(",
"self",
",",
"finder",
",",
"upgrade",
",",
"require_hashes",
")",
":",
"# type: (PackageFinder, bool, bool) -> None",
"if",
"self",
".",
"link",
"is",
"None",
":",
"self",
".",
"link",
"=",
"finder",
".",
"find_requirement",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.is_pinned | Return whether I am pinned to an exact version.
For example, some-package==1.2 is pinned; some-package>1.2 is not. | pipenv/patched/notpip/_internal/req/req_install.py | def is_pinned(self):
# type: () -> bool
"""Return whether I am pinned to an exact version.
For example, some-package==1.2 is pinned; some-package>1.2 is not.
"""
specifiers = self.specifier
return (len(specifiers) == 1 and
next(iter(specifiers)).operator ... | def is_pinned(self):
# type: () -> bool
"""Return whether I am pinned to an exact version.
For example, some-package==1.2 is pinned; some-package>1.2 is not.
"""
specifiers = self.specifier
return (len(specifiers) == 1 and
next(iter(specifiers)).operator ... | [
"Return",
"whether",
"I",
"am",
"pinned",
"to",
"an",
"exact",
"version",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L217-L225 | [
"def",
"is_pinned",
"(",
"self",
")",
":",
"# type: () -> bool",
"specifiers",
"=",
"self",
".",
"specifier",
"return",
"(",
"len",
"(",
"specifiers",
")",
"==",
"1",
"and",
"next",
"(",
"iter",
"(",
"specifiers",
")",
")",
".",
"operator",
"in",
"{",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.hashes | Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.
Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones from
flags. They satisfy --require-hashes (whether it was implicitly or
... | pipenv/patched/notpip/_internal/req/req_install.py | def hashes(self, trust_internet=True):
# type: (bool) -> Hashes
"""Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.
Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones... | def hashes(self, trust_internet=True):
# type: (bool) -> Hashes
"""Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.
Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones... | [
"Return",
"a",
"hash",
"-",
"comparer",
"that",
"considers",
"my",
"option",
"-",
"and",
"URL",
"-",
"based",
"hashes",
"to",
"be",
"known",
"-",
"good",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L255-L275 | [
"def",
"hashes",
"(",
"self",
",",
"trust_internet",
"=",
"True",
")",
":",
"# type: (bool) -> Hashes",
"good_hashes",
"=",
"self",
".",
"options",
".",
"get",
"(",
"'hashes'",
",",
"{",
"}",
")",
".",
"copy",
"(",
")",
"link",
"=",
"self",
".",
"link"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement._correct_build_location | Move self._temp_build_dir to self._ideal_build_dir/self.req.name
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a temporary directory and store the _ideal_build_dir.
This is only call... | pipenv/patched/notpip/_internal/req/req_install.py | def _correct_build_location(self):
# type: () -> None
"""Move self._temp_build_dir to self._ideal_build_dir/self.req.name
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a tempo... | def _correct_build_location(self):
# type: () -> None
"""Move self._temp_build_dir to self._ideal_build_dir/self.req.name
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a tempo... | [
"Move",
"self",
".",
"_temp_build_dir",
"to",
"self",
".",
"_ideal_build_dir",
"/",
"self",
".",
"req",
".",
"name"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L321-L362 | [
"def",
"_correct_build_location",
"(",
"self",
")",
":",
"# type: () -> None",
"if",
"self",
".",
"source_dir",
"is",
"not",
"None",
":",
"return",
"assert",
"self",
".",
"req",
"is",
"not",
"None",
"assert",
"self",
".",
"_temp_build_dir",
".",
"path",
"ass... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.remove_temporary_source | Remove the source files from this requirement, if they are marked
for deletion | pipenv/patched/notpip/_internal/req/req_install.py | def remove_temporary_source(self):
# type: () -> None
"""Remove the source files from this requirement, if they are marked
for deletion"""
if self.source_dir and os.path.exists(
os.path.join(self.source_dir, PIP_DELETE_MARKER_FILENAME)):
logger.debug('Removing... | def remove_temporary_source(self):
# type: () -> None
"""Remove the source files from this requirement, if they are marked
for deletion"""
if self.source_dir and os.path.exists(
os.path.join(self.source_dir, PIP_DELETE_MARKER_FILENAME)):
logger.debug('Removing... | [
"Remove",
"the",
"source",
"files",
"from",
"this",
"requirement",
"if",
"they",
"are",
"marked",
"for",
"deletion"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L364-L374 | [
"def",
"remove_temporary_source",
"(",
"self",
")",
":",
"# type: () -> None",
"if",
"self",
".",
"source_dir",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"source_dir",
",",
"PIP_DELETE_MARKER_FILENAME",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.check_if_exists | Find an installed distribution that satisfies or conflicts
with this requirement, and set self.satisfied_by or
self.conflicts_with appropriately. | pipenv/patched/notpip/_internal/req/req_install.py | def check_if_exists(self, use_user_site):
# type: (bool) -> bool
"""Find an installed distribution that satisfies or conflicts
with this requirement, and set self.satisfied_by or
self.conflicts_with appropriately.
"""
if self.req is None:
return False
... | def check_if_exists(self, use_user_site):
# type: (bool) -> bool
"""Find an installed distribution that satisfies or conflicts
with this requirement, and set self.satisfied_by or
self.conflicts_with appropriately.
"""
if self.req is None:
return False
... | [
"Find",
"an",
"installed",
"distribution",
"that",
"satisfies",
"or",
"conflicts",
"with",
"this",
"requirement",
"and",
"set",
"self",
".",
"satisfied_by",
"or",
"self",
".",
"conflicts_with",
"appropriately",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L376-L416 | [
"def",
"check_if_exists",
"(",
"self",
",",
"use_user_site",
")",
":",
"# type: (bool) -> bool",
"if",
"self",
".",
"req",
"is",
"None",
":",
"return",
"False",
"try",
":",
"# get_distribution() will resolve the entire list of requirements",
"# anyway, and we've already det... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.load_pyproject_toml | Load the pyproject.toml file.
After calling this routine, all of the attributes related to PEP 517
processing for this requirement have been set. In particular, the
use_pep517 attribute can be used to determine whether we should
follow the PEP 517 or legacy (setup.py) code path. | pipenv/patched/notpip/_internal/req/req_install.py | def load_pyproject_toml(self):
# type: () -> None
"""Load the pyproject.toml file.
After calling this routine, all of the attributes related to PEP 517
processing for this requirement have been set. In particular, the
use_pep517 attribute can be used to determine whether we shou... | def load_pyproject_toml(self):
# type: () -> None
"""Load the pyproject.toml file.
After calling this routine, all of the attributes related to PEP 517
processing for this requirement have been set. In particular, the
use_pep517 attribute can be used to determine whether we shou... | [
"Load",
"the",
"pyproject",
".",
"toml",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L476-L515 | [
"def",
"load_pyproject_toml",
"(",
"self",
")",
":",
"# type: () -> None",
"pep517_data",
"=",
"load_pyproject_toml",
"(",
"self",
".",
"use_pep517",
",",
"self",
".",
"pyproject_toml",
",",
"self",
".",
"setup_py",
",",
"str",
"(",
"self",
")",
")",
"if",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.prepare_metadata | Ensure that project metadata is available.
Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info. | pipenv/patched/notpip/_internal/req/req_install.py | def prepare_metadata(self):
# type: () -> None
"""Ensure that project metadata is available.
Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info.
"""
assert self.source_dir
with indent_log():
... | def prepare_metadata(self):
# type: () -> None
"""Ensure that project metadata is available.
Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info.
"""
assert self.source_dir
with indent_log():
... | [
"Ensure",
"that",
"project",
"metadata",
"is",
"available",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L517-L554 | [
"def",
"prepare_metadata",
"(",
"self",
")",
":",
"# type: () -> None",
"assert",
"self",
".",
"source_dir",
"with",
"indent_log",
"(",
")",
":",
"if",
"self",
".",
"use_pep517",
":",
"self",
".",
"prepare_pep517_metadata",
"(",
")",
"else",
":",
"self",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.get_dist | Return a pkg_resources.Distribution for this requirement | pipenv/patched/notpip/_internal/req/req_install.py | def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
if self.metadata_directory:
base_dir, distinfo = os.path.split(self.metadata_directory)
metadata = pkg_resources.PathMetadata(
base_dir, self.meta... | def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
if self.metadata_directory:
base_dir, distinfo = os.path.split(self.metadata_directory)
metadata = pkg_resources.PathMetadata(
base_dir, self.meta... | [
"Return",
"a",
"pkg_resources",
".",
"Distribution",
"for",
"this",
"requirement"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L672-L694 | [
"def",
"get_dist",
"(",
"self",
")",
":",
"# type: () -> Distribution",
"if",
"self",
".",
"metadata_directory",
":",
"base_dir",
",",
"distinfo",
"=",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"metadata_directory",
")",
"metadata",
"=",
"pkg_resource... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | InstallRequirement.uninstall | Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_confirm`` is True.
Refuses to delete or modify files outside of ``sys.prefix`` -
thus uninstallation within a virtual environment can only
modify that virt... | pipenv/patched/notpip/_internal/req/req_install.py | def uninstall(self, auto_confirm=False, verbose=False,
use_user_site=False):
# type: (bool, bool, bool) -> Optional[UninstallPathSet]
"""
Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_... | def uninstall(self, auto_confirm=False, verbose=False,
use_user_site=False):
# type: (bool, bool, bool) -> Optional[UninstallPathSet]
"""
Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_... | [
"Uninstall",
"the",
"distribution",
"currently",
"satisfying",
"this",
"requirement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L798-L820 | [
"def",
"uninstall",
"(",
"self",
",",
"auto_confirm",
"=",
"False",
",",
"verbose",
"=",
"False",
",",
"use_user_site",
"=",
"False",
")",
":",
"# type: (bool, bool, bool) -> Optional[UninstallPathSet]",
"if",
"not",
"self",
".",
"check_if_exists",
"(",
"use_user_si... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequirementCommand.populate_requirement_set | Marshal cmd line args into a requirement set. | pipenv/patched/notpip/_internal/cli/base_command.py | def populate_requirement_set(requirement_set, # type: RequirementSet
args, # type: List[str]
options, # type: Values
finder, # type: PackageFinder
session, ... | def populate_requirement_set(requirement_set, # type: RequirementSet
args, # type: List[str]
options, # type: Values
finder, # type: PackageFinder
session, ... | [
"Marshal",
"cmd",
"line",
"args",
"into",
"a",
"requirement",
"set",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/base_command.py#L242-L306 | [
"def",
"populate_requirement_set",
"(",
"requirement_set",
",",
"# type: RequirementSet",
"args",
",",
"# type: List[str]",
"options",
",",
"# type: Values",
"finder",
",",
"# type: PackageFinder",
"session",
",",
"# type: PipSession",
"name",
",",
"# type: str",
"wheel_cac... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequirementCommand._build_package_finder | Create a package finder appropriate to this requirement command. | pipenv/patched/notpip/_internal/cli/base_command.py | def _build_package_finder(
self,
options, # type: Values
session, # type: PipSession
platform=None, # type: Optional[str]
python_versions=None, # type: Optional[List[str]]
abi=None, # type: Optional[str]
implementa... | def _build_package_finder(
self,
options, # type: Values
session, # type: PipSession
platform=None, # type: Optional[str]
python_versions=None, # type: Optional[List[str]]
abi=None, # type: Optional[str]
implementa... | [
"Create",
"a",
"package",
"finder",
"appropriate",
"to",
"this",
"requirement",
"command",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/base_command.py#L308-L341 | [
"def",
"_build_package_finder",
"(",
"self",
",",
"options",
",",
"# type: Values",
"session",
",",
"# type: PipSession",
"platform",
"=",
"None",
",",
"# type: Optional[str]",
"python_versions",
"=",
"None",
",",
"# type: Optional[List[str]]",
"abi",
"=",
"None",
","... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | intranges_from_list | Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i.
Ranges are encoded as single integers (start << 32 | end), not as tuples. | pipenv/vendor/idna/intranges.py | def intranges_from_list(list_):
"""Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i.
Ranges are encoded as single integers (start << 32 | end), not as tuples.
... | def intranges_from_list(list_):
"""Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i.
Ranges are encoded as single integers (start << 32 | end), not as tuples.
... | [
"Represent",
"a",
"list",
"of",
"integers",
"as",
"a",
"sequence",
"of",
"ranges",
":",
"((",
"start_0",
"end_0",
")",
"(",
"start_1",
"end_1",
")",
"...",
")",
"such",
"that",
"the",
"original",
"integers",
"are",
"exactly",
"those",
"x",
"such",
"that"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/idna/intranges.py#L10-L29 | [
"def",
"intranges_from_list",
"(",
"list_",
")",
":",
"sorted_list",
"=",
"sorted",
"(",
"list_",
")",
"ranges",
"=",
"[",
"]",
"last_write",
"=",
"-",
"1",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"sorted_list",
")",
")",
":",
"if",
"i",
"+",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | intranges_contain | Determine if `int_` falls into one of the ranges in `ranges`. | pipenv/vendor/idna/intranges.py | def intranges_contain(int_, ranges):
"""Determine if `int_` falls into one of the ranges in `ranges`."""
tuple_ = _encode_range(int_, 0)
pos = bisect.bisect_left(ranges, tuple_)
# we could be immediately ahead of a tuple (start, end)
# with start < int_ <= end
if pos > 0:
left, right = _... | def intranges_contain(int_, ranges):
"""Determine if `int_` falls into one of the ranges in `ranges`."""
tuple_ = _encode_range(int_, 0)
pos = bisect.bisect_left(ranges, tuple_)
# we could be immediately ahead of a tuple (start, end)
# with start < int_ <= end
if pos > 0:
left, right = _... | [
"Determine",
"if",
"int_",
"falls",
"into",
"one",
"of",
"the",
"ranges",
"in",
"ranges",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/idna/intranges.py#L38-L53 | [
"def",
"intranges_contain",
"(",
"int_",
",",
"ranges",
")",
":",
"tuple_",
"=",
"_encode_range",
"(",
"int_",
",",
"0",
")",
"pos",
"=",
"bisect",
".",
"bisect_left",
"(",
"ranges",
",",
"tuple_",
")",
"# we could be immediately ahead of a tuple (start, end)",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _hash_of_file | Return the hash digest of a file. | pipenv/patched/notpip/_internal/commands/hash.py | def _hash_of_file(path, algorithm):
"""Return the hash digest of a file."""
with open(path, 'rb') as archive:
hash = hashlib.new(algorithm)
for chunk in read_chunks(archive):
hash.update(chunk)
return hash.hexdigest() | def _hash_of_file(path, algorithm):
"""Return the hash digest of a file."""
with open(path, 'rb') as archive:
hash = hashlib.new(algorithm)
for chunk in read_chunks(archive):
hash.update(chunk)
return hash.hexdigest() | [
"Return",
"the",
"hash",
"digest",
"of",
"a",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/hash.py#L51-L57 | [
"def",
"_hash_of_file",
"(",
"path",
",",
"algorithm",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"archive",
":",
"hash",
"=",
"hashlib",
".",
"new",
"(",
"algorithm",
")",
"for",
"chunk",
"in",
"read_chunks",
"(",
"archive",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution.linux_distribution | Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters.
For details, see :func:`distro.linux_distribution`. | pipenv/patched/notpip/_vendor/distro.py | def linux_distribution(self, full_distribution_name=True):
"""
Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters.
For details, see :func:`distro.linux_distribution`.
""... | def linux_distribution(self, full_distribution_name=True):
"""
Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters.
For details, see :func:`distro.linux_distribution`.
""... | [
"Return",
"information",
"about",
"the",
"OS",
"distribution",
"that",
"is",
"compatible",
"with",
"Python",
"s",
":",
"func",
":",
"platform",
".",
"linux_distribution",
"supporting",
"a",
"subset",
"of",
"its",
"parameters",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L665-L677 | [
"def",
"linux_distribution",
"(",
"self",
",",
"full_distribution_name",
"=",
"True",
")",
":",
"return",
"(",
"self",
".",
"name",
"(",
")",
"if",
"full_distribution_name",
"else",
"self",
".",
"id",
"(",
")",
",",
"self",
".",
"version",
"(",
")",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution.id | Return the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`. | pipenv/patched/notpip/_vendor/distro.py | def id(self):
"""Return the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`.
"""
def normalize(distro_id, table):
distro_id = distro_id.lower().replace(' ', '_')
return table.get(distro_id, distro_id)
distro_id = self.os... | def id(self):
"""Return the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`.
"""
def normalize(distro_id, table):
distro_id = distro_id.lower().replace(' ', '_')
return table.get(distro_id, distro_id)
distro_id = self.os... | [
"Return",
"the",
"distro",
"ID",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L679-L704 | [
"def",
"id",
"(",
"self",
")",
":",
"def",
"normalize",
"(",
"distro_id",
",",
"table",
")",
":",
"distro_id",
"=",
"distro_id",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"' '",
",",
"'_'",
")",
"return",
"table",
".",
"get",
"(",
"distro_id",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution.name | Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`. | pipenv/patched/notpip/_vendor/distro.py | def name(self, pretty=False):
"""
Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`.
"""
name = self.os_release_attr('name') \
or self.lsb_release_attr('distributor_id') \
or self.distro_release_attr('name') \
... | def name(self, pretty=False):
"""
Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`.
"""
name = self.os_release_attr('name') \
or self.lsb_release_attr('distributor_id') \
or self.distro_release_attr('name') \
... | [
"Return",
"the",
"name",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L706-L725 | [
"def",
"name",
"(",
"self",
",",
"pretty",
"=",
"False",
")",
":",
"name",
"=",
"self",
".",
"os_release_attr",
"(",
"'name'",
")",
"or",
"self",
".",
"lsb_release_attr",
"(",
"'distributor_id'",
")",
"or",
"self",
".",
"distro_release_attr",
"(",
"'name'"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution.version | Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`. | pipenv/patched/notpip/_vendor/distro.py | def version(self, pretty=False, best=False):
"""
Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`.
"""
versions = [
self.os_release_attr('version_id'),
self.lsb_release_attr('release'),
self.distr... | def version(self, pretty=False, best=False):
"""
Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`.
"""
versions = [
self.os_release_attr('version_id'),
self.lsb_release_attr('release'),
self.distr... | [
"Return",
"the",
"version",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L727-L759 | [
"def",
"version",
"(",
"self",
",",
"pretty",
"=",
"False",
",",
"best",
"=",
"False",
")",
":",
"versions",
"=",
"[",
"self",
".",
"os_release_attr",
"(",
"'version_id'",
")",
",",
"self",
".",
"lsb_release_attr",
"(",
"'release'",
")",
",",
"self",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution.version_parts | Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`. | pipenv/patched/notpip/_vendor/distro.py | def version_parts(self, best=False):
"""
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
"""
version_str = self.version(best=best)
if version_str:
version_regex = re.compile(r'(\... | def version_parts(self, best=False):
"""
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
"""
version_str = self.version(best=best)
if version_str:
version_regex = re.compile(r'(\... | [
"Return",
"the",
"version",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"tuple",
"of",
"version",
"numbers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L761-L775 | [
"def",
"version_parts",
"(",
"self",
",",
"best",
"=",
"False",
")",
":",
"version_str",
"=",
"self",
".",
"version",
"(",
"best",
"=",
"best",
")",
"if",
"version_str",
":",
"version_regex",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\.?(\\d+)?\\.?(\\d+)?'",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution.info | Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`. | pipenv/patched/notpip/_vendor/distro.py | def info(self, pretty=False, best=False):
"""
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
"""
return dict(
id=self.id(),
version=self.version(pretty, best),
version_parts... | def info(self, pretty=False, best=False):
"""
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
"""
return dict(
id=self.id(),
version=self.version(pretty, best),
version_parts... | [
"Return",
"certain",
"machine",
"-",
"readable",
"information",
"about",
"the",
"OS",
"distribution",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L820-L837 | [
"def",
"info",
"(",
"self",
",",
"pretty",
"=",
"False",
",",
"best",
"=",
"False",
")",
":",
"return",
"dict",
"(",
"id",
"=",
"self",
".",
"id",
"(",
")",
",",
"version",
"=",
"self",
".",
"version",
"(",
"pretty",
",",
"best",
")",
",",
"ver... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution._os_release_info | Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items. | pipenv/patched/notpip/_vendor/distro.py | def _os_release_info(self):
"""
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
"""
if os.path.isfile(self.os_release_file):
with open(self.os_release_file) as release_file:
... | def _os_release_info(self):
"""
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
"""
if os.path.isfile(self.os_release_file):
with open(self.os_release_file) as release_file:
... | [
"Get",
"the",
"information",
"items",
"from",
"the",
"specified",
"os",
"-",
"release",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L913-L923 | [
"def",
"_os_release_info",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"os_release_file",
")",
":",
"with",
"open",
"(",
"self",
".",
"os_release_file",
")",
"as",
"release_file",
":",
"return",
"self",
".",
"_parse_o... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution._lsb_release_info | Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items. | pipenv/patched/notpip/_vendor/distro.py | def _lsb_release_info(self):
"""
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
"""
if not self.include_lsb:
return {}
with open(os.devnull, 'w') as devnull:
try:
... | def _lsb_release_info(self):
"""
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
"""
if not self.include_lsb:
return {}
with open(os.devnull, 'w') as devnull:
try:
... | [
"Get",
"the",
"information",
"items",
"from",
"the",
"lsb_release",
"command",
"output",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L986-L1002 | [
"def",
"_lsb_release_info",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"include_lsb",
":",
"return",
"{",
"}",
"with",
"open",
"(",
"os",
".",
"devnull",
",",
"'w'",
")",
"as",
"devnull",
":",
"try",
":",
"cmd",
"=",
"(",
"'lsb_release'",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution._parse_lsb_release_content | Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items. | pipenv/patched/notpip/_vendor/distro.py | def _parse_lsb_release_content(lines):
"""
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
... | def _parse_lsb_release_content(lines):
"""
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
... | [
"Parse",
"the",
"output",
"of",
"the",
"lsb_release",
"command",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1005-L1026 | [
"def",
"_parse_lsb_release_content",
"(",
"lines",
")",
":",
"props",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"kv",
"=",
"line",
".",
"strip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"':'",
",",
"1",
")",
"if",
"len",
"(",
"kv",
")",
"!="... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution._distro_release_info | Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items. | pipenv/patched/notpip/_vendor/distro.py | def _distro_release_info(self):
"""
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
"""
if self.distro_release_file:
# If it was specified, we use it and parse what we can, even if
... | def _distro_release_info(self):
"""
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
"""
if self.distro_release_file:
# If it was specified, we use it and parse what we can, even if
... | [
"Get",
"the",
"information",
"items",
"from",
"the",
"specified",
"distro",
"release",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1057-L1117 | [
"def",
"_distro_release_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"distro_release_file",
":",
"# If it was specified, we use it and parse what we can, even if",
"# its file name or content does not match the expected pattern.",
"distro_info",
"=",
"self",
".",
"_parse_distro... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution._parse_distro_release_file | Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items. | pipenv/patched/notpip/_vendor/distro.py | def _parse_distro_release_file(self, filepath):
"""
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
"""
try:
with open(filepath) as fp:
... | def _parse_distro_release_file(self, filepath):
"""
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
"""
try:
with open(filepath) as fp:
... | [
"Parse",
"a",
"distro",
"release",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1119-L1139 | [
"def",
"_parse_distro_release_file",
"(",
"self",
",",
"filepath",
")",
":",
"try",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"fp",
":",
"# Only parse the first line. For instance, on SLES there",
"# are multiple lines. We don't want them...",
"return",
"self",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LinuxDistribution._parse_distro_release_content | Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information items. | pipenv/patched/notpip/_vendor/distro.py | def _parse_distro_release_content(line):
"""
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information ite... | def _parse_distro_release_content(line):
"""
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information ite... | [
"Parse",
"a",
"line",
"from",
"a",
"distro",
"release",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1142-L1167 | [
"def",
"_parse_distro_release_content",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"bytes",
")",
":",
"line",
"=",
"line",
".",
"decode",
"(",
"'utf-8'",
")",
"matches",
"=",
"_DISTRO_RELEASE_CONTENT_REVERSED_PATTERN",
".",
"match",
"(",
"lin... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | dependency_tree | Calculate the dependency tree for the package `root_key` and return
a collection of all its dependencies. Uses a DFS traversal algorithm.
`installed_keys` should be a {key: requirement} mapping, e.g.
{'django': from_line('django==1.8')}
`root_key` should be the key to return the dependency tree fo... | pipenv/patched/piptools/sync.py | def dependency_tree(installed_keys, root_key):
"""
Calculate the dependency tree for the package `root_key` and return
a collection of all its dependencies. Uses a DFS traversal algorithm.
`installed_keys` should be a {key: requirement} mapping, e.g.
{'django': from_line('django==1.8')}
`r... | def dependency_tree(installed_keys, root_key):
"""
Calculate the dependency tree for the package `root_key` and return
a collection of all its dependencies. Uses a DFS traversal algorithm.
`installed_keys` should be a {key: requirement} mapping, e.g.
{'django': from_line('django==1.8')}
`r... | [
"Calculate",
"the",
"dependency",
"tree",
"for",
"the",
"package",
"root_key",
"and",
"return",
"a",
"collection",
"of",
"all",
"its",
"dependencies",
".",
"Uses",
"a",
"DFS",
"traversal",
"algorithm",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L21-L53 | [
"def",
"dependency_tree",
"(",
"installed_keys",
",",
"root_key",
")",
":",
"dependencies",
"=",
"set",
"(",
")",
"queue",
"=",
"collections",
".",
"deque",
"(",
")",
"if",
"root_key",
"in",
"installed_keys",
":",
"dep",
"=",
"installed_keys",
"[",
"root_key... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dists_to_ignore | Returns a collection of package names to ignore when performing pip-sync,
based on the currently installed environment. For example, when pip-tools
is installed in the local environment, it should be ignored, including all
of its dependencies (e.g. click). When pip-tools is not installed
locally, clic... | pipenv/patched/piptools/sync.py | def get_dists_to_ignore(installed):
"""
Returns a collection of package names to ignore when performing pip-sync,
based on the currently installed environment. For example, when pip-tools
is installed in the local environment, it should be ignored, including all
of its dependencies (e.g. click). W... | def get_dists_to_ignore(installed):
"""
Returns a collection of package names to ignore when performing pip-sync,
based on the currently installed environment. For example, when pip-tools
is installed in the local environment, it should be ignored, including all
of its dependencies (e.g. click). W... | [
"Returns",
"a",
"collection",
"of",
"package",
"names",
"to",
"ignore",
"when",
"performing",
"pip",
"-",
"sync",
"based",
"on",
"the",
"currently",
"installed",
"environment",
".",
"For",
"example",
"when",
"pip",
"-",
"tools",
"is",
"installed",
"in",
"the... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L56-L66 | [
"def",
"get_dists_to_ignore",
"(",
"installed",
")",
":",
"installed_keys",
"=",
"{",
"key_from_req",
"(",
"r",
")",
":",
"r",
"for",
"r",
"in",
"installed",
"}",
"return",
"list",
"(",
"flat_map",
"(",
"lambda",
"req",
":",
"dependency_tree",
"(",
"instal... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | diff | Calculate which packages should be installed or uninstalled, given a set
of compiled requirements and a list of currently installed modules. | pipenv/patched/piptools/sync.py | def diff(compiled_requirements, installed_dists):
"""
Calculate which packages should be installed or uninstalled, given a set
of compiled requirements and a list of currently installed modules.
"""
requirements_lut = {r.link or key_from_req(r.req): r for r in compiled_requirements}
satisfied =... | def diff(compiled_requirements, installed_dists):
"""
Calculate which packages should be installed or uninstalled, given a set
of compiled requirements and a list of currently installed modules.
"""
requirements_lut = {r.link or key_from_req(r.req): r for r in compiled_requirements}
satisfied =... | [
"Calculate",
"which",
"packages",
"should",
"be",
"installed",
"or",
"uninstalled",
"given",
"a",
"set",
"of",
"compiled",
"requirements",
"and",
"a",
"list",
"of",
"currently",
"installed",
"modules",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L94-L120 | [
"def",
"diff",
"(",
"compiled_requirements",
",",
"installed_dists",
")",
":",
"requirements_lut",
"=",
"{",
"r",
".",
"link",
"or",
"key_from_req",
"(",
"r",
".",
"req",
")",
":",
"r",
"for",
"r",
"in",
"compiled_requirements",
"}",
"satisfied",
"=",
"set... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | sync | Install and uninstalls the given sets of modules. | pipenv/patched/piptools/sync.py | def sync(to_install, to_uninstall, verbose=False, dry_run=False, install_flags=None):
"""
Install and uninstalls the given sets of modules.
"""
if not to_uninstall and not to_install:
click.echo("Everything up-to-date")
pip_flags = []
if not verbose:
pip_flags += ['-q']
if ... | def sync(to_install, to_uninstall, verbose=False, dry_run=False, install_flags=None):
"""
Install and uninstalls the given sets of modules.
"""
if not to_uninstall and not to_install:
click.echo("Everything up-to-date")
pip_flags = []
if not verbose:
pip_flags += ['-q']
if ... | [
"Install",
"and",
"uninstalls",
"the",
"given",
"sets",
"of",
"modules",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L123-L168 | [
"def",
"sync",
"(",
"to_install",
",",
"to_uninstall",
",",
"verbose",
"=",
"False",
",",
"dry_run",
"=",
"False",
",",
"install_flags",
"=",
"None",
")",
":",
"if",
"not",
"to_uninstall",
"and",
"not",
"to_install",
":",
"click",
".",
"echo",
"(",
"\"Ev... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_spontaneous_environment | Return a new spontaneous environment. A spontaneous environment is an
unnamed and unaccessible (in theory) environment that is used for
templates generated from a string and not from the file system. | pipenv/vendor/jinja2/environment.py | def get_spontaneous_environment(*args):
"""Return a new spontaneous environment. A spontaneous environment is an
unnamed and unaccessible (in theory) environment that is used for
templates generated from a string and not from the file system.
"""
try:
env = _spontaneous_environments.get(arg... | def get_spontaneous_environment(*args):
"""Return a new spontaneous environment. A spontaneous environment is an
unnamed and unaccessible (in theory) environment that is used for
templates generated from a string and not from the file system.
"""
try:
env = _spontaneous_environments.get(arg... | [
"Return",
"a",
"new",
"spontaneous",
"environment",
".",
"A",
"spontaneous",
"environment",
"is",
"an",
"unnamed",
"and",
"unaccessible",
"(",
"in",
"theory",
")",
"environment",
"that",
"is",
"used",
"for",
"templates",
"generated",
"from",
"a",
"string",
"an... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L44-L57 | [
"def",
"get_spontaneous_environment",
"(",
"*",
"args",
")",
":",
"try",
":",
"env",
"=",
"_spontaneous_environments",
".",
"get",
"(",
"args",
")",
"except",
"TypeError",
":",
"return",
"Environment",
"(",
"*",
"args",
")",
"if",
"env",
"is",
"not",
"None... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _environment_sanity_check | Perform a sanity check on the environment. | pipenv/vendor/jinja2/environment.py | def _environment_sanity_check(environment):
"""Perform a sanity check on the environment."""
assert issubclass(environment.undefined, Undefined), 'undefined must ' \
'be a subclass of undefined because filters depend on it.'
assert environment.block_start_string != \
environment.variable_sta... | def _environment_sanity_check(environment):
"""Perform a sanity check on the environment."""
assert issubclass(environment.undefined, Undefined), 'undefined must ' \
'be a subclass of undefined because filters depend on it.'
assert environment.block_start_string != \
environment.variable_sta... | [
"Perform",
"a",
"sanity",
"check",
"on",
"the",
"environment",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L100-L110 | [
"def",
"_environment_sanity_check",
"(",
"environment",
")",
":",
"assert",
"issubclass",
"(",
"environment",
".",
"undefined",
",",
"Undefined",
")",
",",
"'undefined must '",
"'be a subclass of undefined because filters depend on it.'",
"assert",
"environment",
".",
"bloc... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.overlay | Create a new overlay environment that shares all the data with the
current environment except for cache and the overridden attributes.
Extensions cannot be removed for an overlayed environment. An overlayed
environment automatically gets all the extensions of the environment it
is linke... | pipenv/vendor/jinja2/environment.py | def overlay(self, block_start_string=missing, block_end_string=missing,
variable_start_string=missing, variable_end_string=missing,
comment_start_string=missing, comment_end_string=missing,
line_statement_prefix=missing, line_comment_prefix=missing,
trim_b... | def overlay(self, block_start_string=missing, block_end_string=missing,
variable_start_string=missing, variable_end_string=missing,
comment_start_string=missing, comment_end_string=missing,
line_statement_prefix=missing, line_comment_prefix=missing,
trim_b... | [
"Create",
"a",
"new",
"overlay",
"environment",
"that",
"shares",
"all",
"the",
"data",
"with",
"the",
"current",
"environment",
"except",
"for",
"cache",
"and",
"the",
"overridden",
"attributes",
".",
"Extensions",
"cannot",
"be",
"removed",
"for",
"an",
"ove... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L356-L399 | [
"def",
"overlay",
"(",
"self",
",",
"block_start_string",
"=",
"missing",
",",
"block_end_string",
"=",
"missing",
",",
"variable_start_string",
"=",
"missing",
",",
"variable_end_string",
"=",
"missing",
",",
"comment_start_string",
"=",
"missing",
",",
"comment_en... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.iter_extensions | Iterates over the extensions by priority. | pipenv/vendor/jinja2/environment.py | def iter_extensions(self):
"""Iterates over the extensions by priority."""
return iter(sorted(self.extensions.values(),
key=lambda x: x.priority)) | def iter_extensions(self):
"""Iterates over the extensions by priority."""
return iter(sorted(self.extensions.values(),
key=lambda x: x.priority)) | [
"Iterates",
"over",
"the",
"extensions",
"by",
"priority",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L403-L406 | [
"def",
"iter_extensions",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"sorted",
"(",
"self",
".",
"extensions",
".",
"values",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
".",
"priority",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.getattr | Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a bytestring. | pipenv/vendor/jinja2/environment.py | def getattr(self, obj, attribute):
"""Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a bytestring.
"""
try:
return getattr(obj, attribute)
except AttributeError:
pass
try:
... | def getattr(self, obj, attribute):
"""Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a bytestring.
"""
try:
return getattr(obj, attribute)
except AttributeError:
pass
try:
... | [
"Get",
"an",
"item",
"or",
"attribute",
"of",
"an",
"object",
"but",
"prefer",
"the",
"attribute",
".",
"Unlike",
":",
"meth",
":",
"getitem",
"the",
"attribute",
"*",
"must",
"*",
"be",
"a",
"bytestring",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L425-L436 | [
"def",
"getattr",
"(",
"self",
",",
"obj",
",",
"attribute",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"obj",
",",
"attribute",
")",
"except",
"AttributeError",
":",
"pass",
"try",
":",
"return",
"obj",
"[",
"attribute",
"]",
"except",
"(",
"Type... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.call_filter | Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and the filter
supports async execution. It's your responsibility to await this
if needed.
.. vers... | pipenv/vendor/jinja2/environment.py | def call_filter(self, name, value, args=None, kwargs=None,
context=None, eval_ctx=None):
"""Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and ... | def call_filter(self, name, value, args=None, kwargs=None,
context=None, eval_ctx=None):
"""Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and ... | [
"Invokes",
"a",
"filter",
"on",
"a",
"value",
"the",
"same",
"way",
"the",
"compiler",
"does",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L438-L467 | [
"def",
"call_filter",
"(",
"self",
",",
"name",
",",
"value",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"context",
"=",
"None",
",",
"eval_ctx",
"=",
"None",
")",
":",
"func",
"=",
"self",
".",
"filters",
".",
"get",
"(",
"name",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.parse | Parse the sourcecode and return the abstract syntax tree. This
tree of nodes is used by the compiler to convert the template into
executable source- or bytecode. This is useful for debugging or to
extract information from templates.
If you are :ref:`developing Jinja2 extensions <writi... | pipenv/vendor/jinja2/environment.py | def parse(self, source, name=None, filename=None):
"""Parse the sourcecode and return the abstract syntax tree. This
tree of nodes is used by the compiler to convert the template into
executable source- or bytecode. This is useful for debugging or to
extract information from templates.... | def parse(self, source, name=None, filename=None):
"""Parse the sourcecode and return the abstract syntax tree. This
tree of nodes is used by the compiler to convert the template into
executable source- or bytecode. This is useful for debugging or to
extract information from templates.... | [
"Parse",
"the",
"sourcecode",
"and",
"return",
"the",
"abstract",
"syntax",
"tree",
".",
"This",
"tree",
"of",
"nodes",
"is",
"used",
"by",
"the",
"compiler",
"to",
"convert",
"the",
"template",
"into",
"executable",
"source",
"-",
"or",
"bytecode",
".",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L480-L493 | [
"def",
"parse",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"_parse",
"(",
"source",
",",
"name",
",",
"filename",
")",
"except",
"TemplateSyntaxError",
":",
"exc_info... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment._parse | Internal parsing function used by `parse` and `compile`. | pipenv/vendor/jinja2/environment.py | def _parse(self, source, name, filename):
"""Internal parsing function used by `parse` and `compile`."""
return Parser(self, source, name, encode_filename(filename)).parse() | def _parse(self, source, name, filename):
"""Internal parsing function used by `parse` and `compile`."""
return Parser(self, source, name, encode_filename(filename)).parse() | [
"Internal",
"parsing",
"function",
"used",
"by",
"parse",
"and",
"compile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L495-L497 | [
"def",
"_parse",
"(",
"self",
",",
"source",
",",
"name",
",",
"filename",
")",
":",
"return",
"Parser",
"(",
"self",
",",
"source",
",",
"name",
",",
"encode_filename",
"(",
"filename",
")",
")",
".",
"parse",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.lex | Lex the given sourcecode and return a generator that yields
tokens as tuples in the form ``(lineno, token_type, value)``.
This can be useful for :ref:`extension development <writing-extensions>`
and debugging templates.
This does not perform preprocessing. If you want the preprocessing... | pipenv/vendor/jinja2/environment.py | def lex(self, source, name=None, filename=None):
"""Lex the given sourcecode and return a generator that yields
tokens as tuples in the form ``(lineno, token_type, value)``.
This can be useful for :ref:`extension development <writing-extensions>`
and debugging templates.
This do... | def lex(self, source, name=None, filename=None):
"""Lex the given sourcecode and return a generator that yields
tokens as tuples in the form ``(lineno, token_type, value)``.
This can be useful for :ref:`extension development <writing-extensions>`
and debugging templates.
This do... | [
"Lex",
"the",
"given",
"sourcecode",
"and",
"return",
"a",
"generator",
"that",
"yields",
"tokens",
"as",
"tuples",
"in",
"the",
"form",
"(",
"lineno",
"token_type",
"value",
")",
".",
"This",
"can",
"be",
"useful",
"for",
":",
"ref",
":",
"extension",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L499-L514 | [
"def",
"lex",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"source",
"=",
"text_type",
"(",
"source",
")",
"try",
":",
"return",
"self",
".",
"lexer",
".",
"tokeniter",
"(",
"source",
",",
"name",
",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment._tokenize | Called by the parser to do the preprocessing and filtering
for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`. | pipenv/vendor/jinja2/environment.py | def _tokenize(self, source, name, filename=None, state=None):
"""Called by the parser to do the preprocessing and filtering
for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.
"""
source = self.preprocess(source, name, filename)
stream = self.lexer.tokenize(sou... | def _tokenize(self, source, name, filename=None, state=None):
"""Called by the parser to do the preprocessing and filtering
for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.
"""
source = self.preprocess(source, name, filename)
stream = self.lexer.tokenize(sou... | [
"Called",
"by",
"the",
"parser",
"to",
"do",
"the",
"preprocessing",
"and",
"filtering",
"for",
"all",
"the",
"extensions",
".",
"Returns",
"a",
":",
"class",
":",
"~jinja2",
".",
"lexer",
".",
"TokenStream",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L524-L534 | [
"def",
"_tokenize",
"(",
"self",
",",
"source",
",",
"name",
",",
"filename",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"source",
"=",
"self",
".",
"preprocess",
"(",
"source",
",",
"name",
",",
"filename",
")",
"stream",
"=",
"self",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.compile | Compile a node or template source code. The `name` parameter is
the load name of the template after it was joined using
:meth:`join_path` if necessary, not the filename on the file system.
the `filename` parameter is the estimated filename of the template on
the file system. If the tem... | pipenv/vendor/jinja2/environment.py | def compile(self, source, name=None, filename=None, raw=False,
defer_init=False):
"""Compile a node or template source code. The `name` parameter is
the load name of the template after it was joined using
:meth:`join_path` if necessary, not the filename on the file system.
... | def compile(self, source, name=None, filename=None, raw=False,
defer_init=False):
"""Compile a node or template source code. The `name` parameter is
the load name of the template after it was joined using
:meth:`join_path` if necessary, not the filename on the file system.
... | [
"Compile",
"a",
"node",
"or",
"template",
"source",
"code",
".",
"The",
"name",
"parameter",
"is",
"the",
"load",
"name",
"of",
"the",
"template",
"after",
"it",
"was",
"joined",
"using",
":",
"meth",
":",
"join_path",
"if",
"necessary",
"not",
"the",
"f... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L554-L591 | [
"def",
"compile",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"raw",
"=",
"False",
",",
"defer_init",
"=",
"False",
")",
":",
"source_hint",
"=",
"None",
"try",
":",
"if",
"isinstance",
"(",
"source",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.compile_expression | A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the same rules as Jinja
in template "configuration files" or similar si... | pipenv/vendor/jinja2/environment.py | def compile_expression(self, source, undefined_to_none=True):
"""A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the sa... | def compile_expression(self, source, undefined_to_none=True):
"""A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the sa... | [
"A",
"handy",
"helper",
"method",
"that",
"returns",
"a",
"callable",
"that",
"accepts",
"keyword",
"arguments",
"that",
"appear",
"as",
"variables",
"in",
"the",
"expression",
".",
"If",
"called",
"it",
"returns",
"the",
"result",
"of",
"the",
"expression",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L593-L636 | [
"def",
"compile_expression",
"(",
"self",
",",
"source",
",",
"undefined_to_none",
"=",
"True",
")",
":",
"parser",
"=",
"Parser",
"(",
"self",
",",
"source",
",",
"state",
"=",
"'variable'",
")",
"exc_info",
"=",
"None",
"try",
":",
"expr",
"=",
"parser... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.get_template | Load a template from the loader. If a loader is configured this
method asks the loader for the template and returns a :class:`Template`.
If the `parent` parameter is not `None`, :meth:`join_path` is called
to get the real template name before loading.
The `globals` parameter can be use... | pipenv/vendor/jinja2/environment.py | def get_template(self, name, parent=None, globals=None):
"""Load a template from the loader. If a loader is configured this
method asks the loader for the template and returns a :class:`Template`.
If the `parent` parameter is not `None`, :meth:`join_path` is called
to get the real templ... | def get_template(self, name, parent=None, globals=None):
"""Load a template from the loader. If a loader is configured this
method asks the loader for the template and returns a :class:`Template`.
If the `parent` parameter is not `None`, :meth:`join_path` is called
to get the real templ... | [
"Load",
"a",
"template",
"from",
"the",
"loader",
".",
"If",
"a",
"loader",
"is",
"configured",
"this",
"method",
"asks",
"the",
"loader",
"for",
"the",
"template",
"and",
"returns",
"a",
":",
"class",
":",
"Template",
".",
"If",
"the",
"parent",
"parame... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L810-L830 | [
"def",
"get_template",
"(",
"self",
",",
"name",
",",
"parent",
"=",
"None",
",",
"globals",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"Template",
")",
":",
"return",
"name",
"if",
"parent",
"is",
"not",
"None",
":",
"name",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.select_template | Works like :meth:`get_template` but tries a number of templates
before it fails. If it cannot find any of the templates, it will
raise a :exc:`TemplatesNotFound` exception.
.. versionadded:: 2.3
.. versionchanged:: 2.4
If `names` contains a :class:`Template` object it is re... | pipenv/vendor/jinja2/environment.py | def select_template(self, names, parent=None, globals=None):
"""Works like :meth:`get_template` but tries a number of templates
before it fails. If it cannot find any of the templates, it will
raise a :exc:`TemplatesNotFound` exception.
.. versionadded:: 2.3
.. versionchanged:... | def select_template(self, names, parent=None, globals=None):
"""Works like :meth:`get_template` but tries a number of templates
before it fails. If it cannot find any of the templates, it will
raise a :exc:`TemplatesNotFound` exception.
.. versionadded:: 2.3
.. versionchanged:... | [
"Works",
"like",
":",
"meth",
":",
"get_template",
"but",
"tries",
"a",
"number",
"of",
"templates",
"before",
"it",
"fails",
".",
"If",
"it",
"cannot",
"find",
"any",
"of",
"the",
"templates",
"it",
"will",
"raise",
"a",
":",
"exc",
":",
"TemplatesNotFo... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L833-L857 | [
"def",
"select_template",
"(",
"self",
",",
"names",
",",
"parent",
"=",
"None",
",",
"globals",
"=",
"None",
")",
":",
"if",
"not",
"names",
":",
"raise",
"TemplatesNotFound",
"(",
"message",
"=",
"u'Tried to select from an empty list '",
"u'of templates.'",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.get_or_select_template | Does a typecheck and dispatches to :meth:`select_template`
if an iterable of template names is given, otherwise to
:meth:`get_template`.
.. versionadded:: 2.3 | pipenv/vendor/jinja2/environment.py | def get_or_select_template(self, template_name_or_list,
parent=None, globals=None):
"""Does a typecheck and dispatches to :meth:`select_template`
if an iterable of template names is given, otherwise to
:meth:`get_template`.
.. versionadded:: 2.3
""... | def get_or_select_template(self, template_name_or_list,
parent=None, globals=None):
"""Does a typecheck and dispatches to :meth:`select_template`
if an iterable of template names is given, otherwise to
:meth:`get_template`.
.. versionadded:: 2.3
""... | [
"Does",
"a",
"typecheck",
"and",
"dispatches",
"to",
":",
"meth",
":",
"select_template",
"if",
"an",
"iterable",
"of",
"template",
"names",
"is",
"given",
"otherwise",
"to",
":",
"meth",
":",
"get_template",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L860-L872 | [
"def",
"get_or_select_template",
"(",
"self",
",",
"template_name_or_list",
",",
"parent",
"=",
"None",
",",
"globals",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"template_name_or_list",
",",
"string_types",
")",
":",
"return",
"self",
".",
"get_template",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.from_string | Load a template from a string. This parses the source given and
returns a :class:`Template` object. | pipenv/vendor/jinja2/environment.py | def from_string(self, source, globals=None, template_class=None):
"""Load a template from a string. This parses the source given and
returns a :class:`Template` object.
"""
globals = self.make_globals(globals)
cls = template_class or self.template_class
return cls.from_c... | def from_string(self, source, globals=None, template_class=None):
"""Load a template from a string. This parses the source given and
returns a :class:`Template` object.
"""
globals = self.make_globals(globals)
cls = template_class or self.template_class
return cls.from_c... | [
"Load",
"a",
"template",
"from",
"a",
"string",
".",
"This",
"parses",
"the",
"source",
"given",
"and",
"returns",
"a",
":",
"class",
":",
"Template",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L874-L880 | [
"def",
"from_string",
"(",
"self",
",",
"source",
",",
"globals",
"=",
"None",
",",
"template_class",
"=",
"None",
")",
":",
"globals",
"=",
"self",
".",
"make_globals",
"(",
"globals",
")",
"cls",
"=",
"template_class",
"or",
"self",
".",
"template_class"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.make_globals | Return a dict for the globals. | pipenv/vendor/jinja2/environment.py | def make_globals(self, d):
"""Return a dict for the globals."""
if not d:
return self.globals
return dict(self.globals, **d) | def make_globals(self, d):
"""Return a dict for the globals."""
if not d:
return self.globals
return dict(self.globals, **d) | [
"Return",
"a",
"dict",
"for",
"the",
"globals",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L882-L886 | [
"def",
"make_globals",
"(",
"self",
",",
"d",
")",
":",
"if",
"not",
"d",
":",
"return",
"self",
".",
"globals",
"return",
"dict",
"(",
"self",
".",
"globals",
",",
"*",
"*",
"d",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Template.from_module_dict | Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4 | pipenv/vendor/jinja2/environment.py | def from_module_dict(cls, environment, module_dict, globals):
"""Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
"""
return cls._from_namespace(environment, module_dict, globals) | def from_module_dict(cls, environment, module_dict, globals):
"""Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
"""
return cls._from_namespace(environment, module_dict, globals) | [
"Creates",
"a",
"template",
"object",
"from",
"a",
"module",
".",
"This",
"is",
"used",
"by",
"the",
"module",
"loader",
"to",
"create",
"a",
"template",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L962-L968 | [
"def",
"from_module_dict",
"(",
"cls",
",",
"environment",
",",
"module_dict",
",",
"globals",
")",
":",
"return",
"cls",
".",
"_from_namespace",
"(",
"environment",
",",
"module_dict",
",",
"globals",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Template.new_context | Create a new :class:`Context` for this template. The vars
provided will be passed to the template. Per default the globals
are added to the context. If shared is set to `True` the data
is passed as it to the context without adding the globals.
`locals` can be a dict of local variable... | pipenv/vendor/jinja2/environment.py | def new_context(self, vars=None, shared=False, locals=None):
"""Create a new :class:`Context` for this template. The vars
provided will be passed to the template. Per default the globals
are added to the context. If shared is set to `True` the data
is passed as it to the context witho... | def new_context(self, vars=None, shared=False, locals=None):
"""Create a new :class:`Context` for this template. The vars
provided will be passed to the template. Per default the globals
are added to the context. If shared is set to `True` the data
is passed as it to the context witho... | [
"Create",
"a",
"new",
":",
"class",
":",
"Context",
"for",
"this",
"template",
".",
"The",
"vars",
"provided",
"will",
"be",
"passed",
"to",
"the",
"template",
".",
"Per",
"default",
"the",
"globals",
"are",
"added",
"to",
"the",
"context",
".",
"If",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L1055-L1064 | [
"def",
"new_context",
"(",
"self",
",",
"vars",
"=",
"None",
",",
"shared",
"=",
"False",
",",
"locals",
"=",
"None",
")",
":",
"return",
"new_context",
"(",
"self",
".",
"environment",
",",
"self",
".",
"name",
",",
"self",
".",
"blocks",
",",
"vars... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Template.make_module | This method works like the :attr:`module` attribute when called
without arguments but it will evaluate the template on every call
rather than caching it. It's also possible to provide
a dict which is then used as context. The arguments are the same
as for the :meth:`new_context` method... | pipenv/vendor/jinja2/environment.py | def make_module(self, vars=None, shared=False, locals=None):
"""This method works like the :attr:`module` attribute when called
without arguments but it will evaluate the template on every call
rather than caching it. It's also possible to provide
a dict which is then used as context. ... | def make_module(self, vars=None, shared=False, locals=None):
"""This method works like the :attr:`module` attribute when called
without arguments but it will evaluate the template on every call
rather than caching it. It's also possible to provide
a dict which is then used as context. ... | [
"This",
"method",
"works",
"like",
"the",
":",
"attr",
":",
"module",
"attribute",
"when",
"called",
"without",
"arguments",
"but",
"it",
"will",
"evaluate",
"the",
"template",
"on",
"every",
"call",
"rather",
"than",
"caching",
"it",
".",
"It",
"s",
"also... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L1066-L1073 | [
"def",
"make_module",
"(",
"self",
",",
"vars",
"=",
"None",
",",
"shared",
"=",
"False",
",",
"locals",
"=",
"None",
")",
":",
"return",
"TemplateModule",
"(",
"self",
",",
"self",
".",
"new_context",
"(",
"vars",
",",
"shared",
",",
"locals",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Template.get_corresponding_lineno | Return the source line number of a line number in the
generated bytecode as they are not in sync. | pipenv/vendor/jinja2/environment.py | def get_corresponding_lineno(self, lineno):
"""Return the source line number of a line number in the
generated bytecode as they are not in sync.
"""
for template_line, code_line in reversed(self.debug_info):
if code_line <= lineno:
return template_line
... | def get_corresponding_lineno(self, lineno):
"""Return the source line number of a line number in the
generated bytecode as they are not in sync.
"""
for template_line, code_line in reversed(self.debug_info):
if code_line <= lineno:
return template_line
... | [
"Return",
"the",
"source",
"line",
"number",
"of",
"a",
"line",
"number",
"in",
"the",
"generated",
"bytecode",
"as",
"they",
"are",
"not",
"in",
"sync",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L1108-L1115 | [
"def",
"get_corresponding_lineno",
"(",
"self",
",",
"lineno",
")",
":",
"for",
"template_line",
",",
"code_line",
"in",
"reversed",
"(",
"self",
".",
"debug_info",
")",
":",
"if",
"code_line",
"<=",
"lineno",
":",
"return",
"template_line",
"return",
"1"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Template.debug_info | The debug info mapping. | pipenv/vendor/jinja2/environment.py | def debug_info(self):
"""The debug info mapping."""
return [tuple(imap(int, x.split('='))) for x in
self._debug_info.split('&')] | def debug_info(self):
"""The debug info mapping."""
return [tuple(imap(int, x.split('='))) for x in
self._debug_info.split('&')] | [
"The",
"debug",
"info",
"mapping",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L1125-L1128 | [
"def",
"debug_info",
"(",
"self",
")",
":",
"return",
"[",
"tuple",
"(",
"imap",
"(",
"int",
",",
"x",
".",
"split",
"(",
"'='",
")",
")",
")",
"for",
"x",
"in",
"self",
".",
"_debug_info",
".",
"split",
"(",
"'&'",
")",
"]"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _get_parsed_url | This is a stand-in function for `urllib3.util.parse_url`
The orignal function doesn't handle special characters very well, this simply splits
out the authentication section, creates the parsed url, then puts the authentication
section back in, bypassing validation.
:return: The new, parsed URL object
... | pipenv/vendor/requirementslib/models/url.py | def _get_parsed_url(url):
# type: (S) -> Url
"""
This is a stand-in function for `urllib3.util.parse_url`
The orignal function doesn't handle special characters very well, this simply splits
out the authentication section, creates the parsed url, then puts the authentication
section back in, by... | def _get_parsed_url(url):
# type: (S) -> Url
"""
This is a stand-in function for `urllib3.util.parse_url`
The orignal function doesn't handle special characters very well, this simply splits
out the authentication section, creates the parsed url, then puts the authentication
section back in, by... | [
"This",
"is",
"a",
"stand",
"-",
"in",
"function",
"for",
"urllib3",
".",
"util",
".",
"parse_url"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/url.py#L24-L44 | [
"def",
"_get_parsed_url",
"(",
"url",
")",
":",
"# type: (S) -> Url",
"try",
":",
"parsed",
"=",
"urllib3_parse",
"(",
"url",
")",
"except",
"ValueError",
":",
"scheme",
",",
"_",
",",
"url",
"=",
"url",
".",
"partition",
"(",
"\"://\"",
")",
"auth",
","... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | remove_password_from_url | Given a url, remove the password and insert 4 dashes
:param url: The url to replace the authentication in
:type url: S
:return: The new URL without authentication
:rtype: S | pipenv/vendor/requirementslib/models/url.py | def remove_password_from_url(url):
# type: (S) -> S
"""
Given a url, remove the password and insert 4 dashes
:param url: The url to replace the authentication in
:type url: S
:return: The new URL without authentication
:rtype: S
"""
parsed = _get_parsed_url(url)
if parsed.auth:... | def remove_password_from_url(url):
# type: (S) -> S
"""
Given a url, remove the password and insert 4 dashes
:param url: The url to replace the authentication in
:type url: S
:return: The new URL without authentication
:rtype: S
"""
parsed = _get_parsed_url(url)
if parsed.auth:... | [
"Given",
"a",
"url",
"remove",
"the",
"password",
"and",
"insert",
"4",
"dashes"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/url.py#L47-L62 | [
"def",
"remove_password_from_url",
"(",
"url",
")",
":",
"# type: (S) -> S",
"parsed",
"=",
"_get_parsed_url",
"(",
"url",
")",
"if",
"parsed",
".",
"auth",
":",
"auth",
",",
"_",
",",
"_",
"=",
"parsed",
".",
"auth",
".",
"partition",
"(",
"\":\"",
")",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _verify_python3_env | Ensures that the environment is good for unicode on Python 3. | pipenv/vendor/click/_unicodefun.py | def _verify_python3_env():
"""Ensures that the environment is good for unicode on Python 3."""
if PY2:
return
try:
import locale
fs_enc = codecs.lookup(locale.getpreferredencoding()).name
except Exception:
fs_enc = 'ascii'
if fs_enc != 'ascii':
return
ext... | def _verify_python3_env():
"""Ensures that the environment is good for unicode on Python 3."""
if PY2:
return
try:
import locale
fs_enc = codecs.lookup(locale.getpreferredencoding()).name
except Exception:
fs_enc = 'ascii'
if fs_enc != 'ascii':
return
ext... | [
"Ensures",
"that",
"the",
"environment",
"is",
"good",
"for",
"unicode",
"on",
"Python",
"3",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_unicodefun.py#L50-L125 | [
"def",
"_verify_python3_env",
"(",
")",
":",
"if",
"PY2",
":",
"return",
"try",
":",
"import",
"locale",
"fs_enc",
"=",
"codecs",
".",
"lookup",
"(",
"locale",
".",
"getpreferredencoding",
"(",
")",
")",
".",
"name",
"except",
"Exception",
":",
"fs_enc",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | rmtree_errorhandler | On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems. | pipenv/patched/notpip/_internal/utils/misc.py | def rmtree_errorhandler(func, path, exc_info):
"""On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems."""
# if file type currently read only
if os.stat... | def rmtree_errorhandler(func, path, exc_info):
"""On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems."""
# if file type currently read only
if os.stat... | [
"On",
"Windows",
"the",
"files",
"in",
".",
"svn",
"are",
"read",
"-",
"only",
"so",
"when",
"rmtree",
"()",
"tries",
"to",
"remove",
"them",
"an",
"exception",
"is",
"thrown",
".",
"We",
"catch",
"that",
"here",
"remove",
"the",
"read",
"-",
"only",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L124-L136 | [
"def",
"rmtree_errorhandler",
"(",
"func",
",",
"path",
",",
"exc_info",
")",
":",
"# if file type currently read only",
"if",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mode",
"&",
"stat",
".",
"S_IREAD",
":",
"# convert to read/write",
"os",
".",
"chmod",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | display_path | Gives the display value for a given path, making it relative to cwd
if possible. | pipenv/patched/notpip/_internal/utils/misc.py | def display_path(path):
# type: (Union[str, Text]) -> str
"""Gives the display value for a given path, making it relative to cwd
if possible."""
path = os.path.normcase(os.path.abspath(path))
if sys.version_info[0] == 2:
path = path.decode(sys.getfilesystemencoding(), 'replace')
path... | def display_path(path):
# type: (Union[str, Text]) -> str
"""Gives the display value for a given path, making it relative to cwd
if possible."""
path = os.path.normcase(os.path.abspath(path))
if sys.version_info[0] == 2:
path = path.decode(sys.getfilesystemencoding(), 'replace')
path... | [
"Gives",
"the",
"display",
"value",
"for",
"a",
"given",
"path",
"making",
"it",
"relative",
"to",
"cwd",
"if",
"possible",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L139-L149 | [
"def",
"display_path",
"(",
"path",
")",
":",
"# type: (Union[str, Text]) -> str",
"path",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"==",
"2... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_installable_dir | Is path is a directory containing setup.py or pyproject.toml? | pipenv/patched/notpip/_internal/utils/misc.py | def is_installable_dir(path):
# type: (str) -> bool
"""Is path is a directory containing setup.py or pyproject.toml?
"""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
pyproject_toml = os.path.join(p... | def is_installable_dir(path):
# type: (str) -> bool
"""Is path is a directory containing setup.py or pyproject.toml?
"""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
pyproject_toml = os.path.join(p... | [
"Is",
"path",
"is",
"a",
"directory",
"containing",
"setup",
".",
"py",
"or",
"pyproject",
".",
"toml?"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L204-L216 | [
"def",
"is_installable_dir",
"(",
"path",
")",
":",
"# type: (str) -> bool",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"return",
"False",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'setup.py'",
")",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_svn_page | Returns true if the page appears to be the index page of an svn repository | pipenv/patched/notpip/_internal/utils/misc.py | def is_svn_page(html):
# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]
"""
Returns true if the page appears to be the index page of an svn repository
"""
return (re.search(r'<title>[^<]*Revision \d+:', html) and
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I... | def is_svn_page(html):
# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]
"""
Returns true if the page appears to be the index page of an svn repository
"""
return (re.search(r'<title>[^<]*Revision \d+:', html) and
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I... | [
"Returns",
"true",
"if",
"the",
"page",
"appears",
"to",
"be",
"the",
"index",
"page",
"of",
"an",
"svn",
"repository"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L219-L225 | [
"def",
"is_svn_page",
"(",
"html",
")",
":",
"# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]",
"return",
"(",
"re",
".",
"search",
"(",
"r'<title>[^<]*Revision \\d+:'",
",",
"html",
")",
"and",
"re",
".",
"search",
"(",
"r'Powered by (?:<a[^>]*?>)?Subvers... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | read_chunks | Yield pieces of data from a file-like object until EOF. | pipenv/patched/notpip/_internal/utils/misc.py | def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
"""Yield pieces of data from a file-like object until EOF."""
while True:
chunk = file.read(size)
if not chunk:
break
yield chunk | def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
"""Yield pieces of data from a file-like object until EOF."""
while True:
chunk = file.read(size)
if not chunk:
break
yield chunk | [
"Yield",
"pieces",
"of",
"data",
"from",
"a",
"file",
"-",
"like",
"object",
"until",
"EOF",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L234-L240 | [
"def",
"read_chunks",
"(",
"file",
",",
"size",
"=",
"io",
".",
"DEFAULT_BUFFER_SIZE",
")",
":",
"while",
"True",
":",
"chunk",
"=",
"file",
".",
"read",
"(",
"size",
")",
"if",
"not",
"chunk",
":",
"break",
"yield",
"chunk"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | normalize_path | Convert a path to its canonical, case-normalized, absolute version. | pipenv/patched/notpip/_internal/utils/misc.py | def normalize_path(path, resolve_symlinks=True):
# type: (str, bool) -> str
"""
Convert a path to its canonical, case-normalized, absolute version.
"""
path = expanduser(path)
if resolve_symlinks:
path = os.path.realpath(path)
else:
path = os.path.abspath(path)
return os... | def normalize_path(path, resolve_symlinks=True):
# type: (str, bool) -> str
"""
Convert a path to its canonical, case-normalized, absolute version.
"""
path = expanduser(path)
if resolve_symlinks:
path = os.path.realpath(path)
else:
path = os.path.abspath(path)
return os... | [
"Convert",
"a",
"path",
"to",
"its",
"canonical",
"case",
"-",
"normalized",
"absolute",
"version",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L271-L282 | [
"def",
"normalize_path",
"(",
"path",
",",
"resolve_symlinks",
"=",
"True",
")",
":",
"# type: (str, bool) -> str",
"path",
"=",
"expanduser",
"(",
"path",
")",
"if",
"resolve_symlinks",
":",
"path",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | splitext | Like os.path.splitext, but take off .tar too | pipenv/patched/notpip/_internal/utils/misc.py | def splitext(path):
# type: (str) -> Tuple[str, str]
"""Like os.path.splitext, but take off .tar too"""
base, ext = posixpath.splitext(path)
if base.lower().endswith('.tar'):
ext = base[-4:] + ext
base = base[:-4]
return base, ext | def splitext(path):
# type: (str) -> Tuple[str, str]
"""Like os.path.splitext, but take off .tar too"""
base, ext = posixpath.splitext(path)
if base.lower().endswith('.tar'):
ext = base[-4:] + ext
base = base[:-4]
return base, ext | [
"Like",
"os",
".",
"path",
".",
"splitext",
"but",
"take",
"off",
".",
"tar",
"too"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L285-L292 | [
"def",
"splitext",
"(",
"path",
")",
":",
"# type: (str) -> Tuple[str, str]",
"base",
",",
"ext",
"=",
"posixpath",
".",
"splitext",
"(",
"path",
")",
"if",
"base",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.tar'",
")",
":",
"ext",
"=",
"base",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | renames | Like os.renames(), but handles renaming across devices. | pipenv/patched/notpip/_internal/utils/misc.py | def renames(old, new):
# type: (str, str) -> None
"""Like os.renames(), but handles renaming across devices."""
# Implementation borrowed from os.renames().
head, tail = os.path.split(new)
if head and tail and not os.path.exists(head):
os.makedirs(head)
shutil.move(old, new)
head, ... | def renames(old, new):
# type: (str, str) -> None
"""Like os.renames(), but handles renaming across devices."""
# Implementation borrowed from os.renames().
head, tail = os.path.split(new)
if head and tail and not os.path.exists(head):
os.makedirs(head)
shutil.move(old, new)
head, ... | [
"Like",
"os",
".",
"renames",
"()",
"but",
"handles",
"renaming",
"across",
"devices",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L295-L310 | [
"def",
"renames",
"(",
"old",
",",
"new",
")",
":",
"# type: (str, str) -> None",
"# Implementation borrowed from os.renames().",
"head",
",",
"tail",
"=",
"os",
".",
"path",
".",
"split",
"(",
"new",
")",
"if",
"head",
"and",
"tail",
"and",
"not",
"os",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_local | Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local." | pipenv/patched/notpip/_internal/utils/misc.py | def is_local(path):
# type: (str) -> bool
"""
Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local."
"""
if not running_under_virtualenv():
return True
return normalize_path(path).startswith(normal... | def is_local(path):
# type: (str) -> bool
"""
Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local."
"""
if not running_under_virtualenv():
return True
return normalize_path(path).startswith(normal... | [
"Return",
"True",
"if",
"path",
"is",
"within",
"sys",
".",
"prefix",
"if",
"we",
"re",
"running",
"in",
"a",
"virtualenv",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L313-L323 | [
"def",
"is_local",
"(",
"path",
")",
":",
"# type: (str) -> bool",
"if",
"not",
"running_under_virtualenv",
"(",
")",
":",
"return",
"True",
"return",
"normalize_path",
"(",
"path",
")",
".",
"startswith",
"(",
"normalize_path",
"(",
"sys",
".",
"prefix",
")",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | dist_is_editable | Return True if given Distribution is an editable install. | pipenv/patched/notpip/_internal/utils/misc.py | def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
return ... | def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
return ... | [
"Return",
"True",
"if",
"given",
"Distribution",
"is",
"an",
"editable",
"install",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L358-L367 | [
"def",
"dist_is_editable",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"for",
"path_item",
"in",
"sys",
".",
"path",
":",
"egg_link",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_item",
",",
"dist",
".",
"project_name",
"+",
"'.egg-link'",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_installed_distributions | Return a list of installed Distribution objects.
If ``local_only`` is True (default), only return installations
local to the current virtualenv, if in a virtualenv.
``skip`` argument is an iterable of lower-case project names to
ignore; defaults to stdlib_pkgs
If ``include_editables`` is False, d... | pipenv/patched/notpip/_internal/utils/misc.py | def get_installed_distributions(local_only=True,
skip=stdlib_pkgs,
include_editables=True,
editables_only=False,
user_only=False):
# type: (bool, Container[str], bool, bool, bool) -> List[... | def get_installed_distributions(local_only=True,
skip=stdlib_pkgs,
include_editables=True,
editables_only=False,
user_only=False):
# type: (bool, Container[str], bool, bool, bool) -> List[... | [
"Return",
"a",
"list",
"of",
"installed",
"Distribution",
"objects",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L370-L426 | [
"def",
"get_installed_distributions",
"(",
"local_only",
"=",
"True",
",",
"skip",
"=",
"stdlib_pkgs",
",",
"include_editables",
"=",
"True",
",",
"editables_only",
"=",
"False",
",",
"user_only",
"=",
"False",
")",
":",
"# type: (bool, Container[str], bool, bool, boo... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | egg_link_path | Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site_packages
3) in a yes-global virtualenv
try to find in site_packages, ... | pipenv/patched/notpip/_internal/utils/misc.py | def egg_link_path(dist):
# type: (Distribution) -> Optional[str]
"""
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site... | def egg_link_path(dist):
# type: (Distribution) -> Optional[str]
"""
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site... | [
"Return",
"the",
"path",
"for",
"the",
".",
"egg",
"-",
"link",
"file",
"if",
"it",
"exists",
"otherwise",
"None",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L429-L465 | [
"def",
"egg_link_path",
"(",
"dist",
")",
":",
"# type: (Distribution) -> Optional[str]",
"sites",
"=",
"[",
"]",
"if",
"running_under_virtualenv",
"(",
")",
":",
"if",
"virtualenv_no_global",
"(",
")",
":",
"sites",
".",
"append",
"(",
"site_packages",
")",
"el... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | unzip_file | Unzip the file (with path `filename`) to the destination `location`. All
files are written based on system defaults and umask (i.e. permissions are
not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmod +x" applied after being
written. Note tha... | pipenv/patched/notpip/_internal/utils/misc.py | def unzip_file(filename, location, flatten=True):
# type: (str, str, bool) -> None
"""
Unzip the file (with path `filename`) to the destination `location`. All
files are written based on system defaults and umask (i.e. permissions are
not preserved), except that regular file members with any execut... | def unzip_file(filename, location, flatten=True):
# type: (str, str, bool) -> None
"""
Unzip the file (with path `filename`) to the destination `location`. All
files are written based on system defaults and umask (i.e. permissions are
not preserved), except that regular file members with any execut... | [
"Unzip",
"the",
"file",
"(",
"with",
"path",
"filename",
")",
"to",
"the",
"destination",
"location",
".",
"All",
"files",
"are",
"written",
"based",
"on",
"system",
"defaults",
"and",
"umask",
"(",
"i",
".",
"e",
".",
"permissions",
"are",
"not",
"prese... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L490-L533 | [
"def",
"unzip_file",
"(",
"filename",
",",
"location",
",",
"flatten",
"=",
"True",
")",
":",
"# type: (str, str, bool) -> None",
"ensure_dir",
"(",
"location",
")",
"zipfp",
"=",
"open",
"(",
"filename",
",",
"'rb'",
")",
"try",
":",
"zip",
"=",
"zipfile",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | call_subprocess | Args:
extra_ok_returncodes: an iterable of integer return codes that are
acceptable, in addition to 0. Defaults to None, which means [].
unset_environ: an iterable of environment variable names to unset
prior to calling subprocess.Popen(). | pipenv/patched/notpip/_internal/utils/misc.py | def call_subprocess(
cmd, # type: List[str]
show_stdout=True, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
extra_environ=None, # type: Optional[Mappin... | def call_subprocess(
cmd, # type: List[str]
show_stdout=True, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
extra_environ=None, # type: Optional[Mappin... | [
"Args",
":",
"extra_ok_returncodes",
":",
"an",
"iterable",
"of",
"integer",
"return",
"codes",
"that",
"are",
"acceptable",
"in",
"addition",
"to",
"0",
".",
"Defaults",
"to",
"None",
"which",
"means",
"[]",
".",
"unset_environ",
":",
"an",
"iterable",
"of"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L651-L774 | [
"def",
"call_subprocess",
"(",
"cmd",
",",
"# type: List[str]",
"show_stdout",
"=",
"True",
",",
"# type: bool",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"on_returncode",
"=",
"'raise'",
",",
"# type: str",
"extra_ok_returncodes",
"=",
"None",
",",
"# type:... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | read_text_file | Return the contents of *filename*.
Try to decode the file contents with utf-8, the preferred system encoding
(e.g., cp1252 on some Windows machines), and latin1, in that order.
Decoding a byte string with latin1 will never raise an error. In the worst
case, the returned string will contain some garbage... | pipenv/patched/notpip/_internal/utils/misc.py | def read_text_file(filename):
# type: (str) -> str
"""Return the contents of *filename*.
Try to decode the file contents with utf-8, the preferred system encoding
(e.g., cp1252 on some Windows machines), and latin1, in that order.
Decoding a byte string with latin1 will never raise an error. In the... | def read_text_file(filename):
# type: (str) -> str
"""Return the contents of *filename*.
Try to decode the file contents with utf-8, the preferred system encoding
(e.g., cp1252 on some Windows machines), and latin1, in that order.
Decoding a byte string with latin1 will never raise an error. In the... | [
"Return",
"the",
"contents",
"of",
"*",
"filename",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L777-L800 | [
"def",
"read_text_file",
"(",
"filename",
")",
":",
"# type: (str) -> str",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"fp",
":",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"encodings",
"=",
"[",
"'utf-8'",
",",
"locale",
".",
"getpreferrede... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | captured_output | Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO.
Taken from Lib/support/__init__.py in the CPython repo. | pipenv/patched/notpip/_internal/utils/misc.py | def captured_output(stream_name):
"""Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO.
Taken from Lib/support/__init__.py in the CPython repo.
"""
orig_stdout = getattr(sys, stream_name)
setattr(sys, stream_name... | def captured_output(stream_name):
"""Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO.
Taken from Lib/support/__init__.py in the CPython repo.
"""
orig_stdout = getattr(sys, stream_name)
setattr(sys, stream_name... | [
"Return",
"a",
"context",
"manager",
"used",
"by",
"captured_stdout",
"/",
"stdin",
"/",
"stderr",
"that",
"temporarily",
"replaces",
"the",
"sys",
"stream",
"*",
"stream_name",
"*",
"with",
"a",
"StringIO",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L841-L852 | [
"def",
"captured_output",
"(",
"stream_name",
")",
":",
"orig_stdout",
"=",
"getattr",
"(",
"sys",
",",
"stream_name",
")",
"setattr",
"(",
"sys",
",",
"stream_name",
",",
"StreamWrapper",
".",
"from_stream",
"(",
"orig_stdout",
")",
")",
"try",
":",
"yield"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_installed_version | Get the installed version of dist_name avoiding pkg_resources cache | pipenv/patched/notpip/_internal/utils/misc.py | def get_installed_version(dist_name, working_set=None):
"""Get the installed version of dist_name avoiding pkg_resources cache"""
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_name)
if working_set is None:
# We want to avoid having t... | def get_installed_version(dist_name, working_set=None):
"""Get the installed version of dist_name avoiding pkg_resources cache"""
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_name)
if working_set is None:
# We want to avoid having t... | [
"Get",
"the",
"installed",
"version",
"of",
"dist_name",
"avoiding",
"pkg_resources",
"cache"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L894-L909 | [
"def",
"get_installed_version",
"(",
"dist_name",
",",
"working_set",
"=",
"None",
")",
":",
"# Create a requirement that we'll look for inside of setuptools.",
"req",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",
"(",
"dist_name",
")",
"if",
"working_set",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | make_vcs_requirement_url | Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name. | pipenv/patched/notpip/_internal/utils/misc.py | def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
"""
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
"""
egg_project_name = pkg_resources.to_filename(pr... | def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
"""
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
"""
egg_project_name = pkg_resources.to_filename(pr... | [
"Return",
"the",
"URL",
"for",
"a",
"VCS",
"requirement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L925-L938 | [
"def",
"make_vcs_requirement_url",
"(",
"repo_url",
",",
"rev",
",",
"project_name",
",",
"subdir",
"=",
"None",
")",
":",
"egg_project_name",
"=",
"pkg_resources",
".",
"to_filename",
"(",
"project_name",
")",
"req",
"=",
"'{}@{}#egg={}'",
".",
"format",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | split_auth_from_netloc | Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)). | pipenv/patched/notpip/_internal/utils/misc.py | def split_auth_from_netloc(netloc):
"""
Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)).
"""
if '@' not in netloc:
return netloc, (None, None)
# Split from the right because that's how urllib.parse.urlsplit()
# behaves if more than o... | def split_auth_from_netloc(netloc):
"""
Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)).
"""
if '@' not in netloc:
return netloc, (None, None)
# Split from the right because that's how urllib.parse.urlsplit()
# behaves if more than o... | [
"Parse",
"out",
"and",
"remove",
"the",
"auth",
"information",
"from",
"a",
"netloc",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L941-L966 | [
"def",
"split_auth_from_netloc",
"(",
"netloc",
")",
":",
"if",
"'@'",
"not",
"in",
"netloc",
":",
"return",
"netloc",
",",
"(",
"None",
",",
"None",
")",
"# Split from the right because that's how urllib.parse.urlsplit()",
"# behaves if more than one @ is present (which ca... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | redact_netloc | Replace the password in a netloc with "****", if it exists.
For example, "user:pass@example.com" returns "user:****@example.com". | pipenv/patched/notpip/_internal/utils/misc.py | def redact_netloc(netloc):
# type: (str) -> str
"""
Replace the password in a netloc with "****", if it exists.
For example, "user:pass@example.com" returns "user:****@example.com".
"""
netloc, (user, password) = split_auth_from_netloc(netloc)
if user is None:
return netloc
pass... | def redact_netloc(netloc):
# type: (str) -> str
"""
Replace the password in a netloc with "****", if it exists.
For example, "user:pass@example.com" returns "user:****@example.com".
"""
netloc, (user, password) = split_auth_from_netloc(netloc)
if user is None:
return netloc
pass... | [
"Replace",
"the",
"password",
"in",
"a",
"netloc",
"with",
"****",
"if",
"it",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L969-L982 | [
"def",
"redact_netloc",
"(",
"netloc",
")",
":",
"# type: (str) -> str",
"netloc",
",",
"(",
"user",
",",
"password",
")",
"=",
"split_auth_from_netloc",
"(",
"netloc",
")",
"if",
"user",
"is",
"None",
":",
"return",
"netloc",
"password",
"=",
"''",
"if",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | protect_pip_from_modification_on_windows | Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ... | pipenv/patched/notpip/_internal/utils/misc.py | def protect_pip_from_modification_on_windows(modifying_pip):
"""Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
"""
pip_names = [
"pip.exe",
"pip{}.exe".format(sys.version_info[0]),
"pip{}.{}.... | def protect_pip_from_modification_on_windows(modifying_pip):
"""Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
"""
pip_names = [
"pip.exe",
"pip{}.exe".format(sys.version_info[0]),
"pip{}.{}.... | [
"Protection",
"of",
"pip",
".",
"exe",
"from",
"modification",
"on",
"Windows"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L1014-L1040 | [
"def",
"protect_pip_from_modification_on_windows",
"(",
"modifying_pip",
")",
":",
"pip_names",
"=",
"[",
"\"pip.exe\"",
",",
"\"pip{}.exe\"",
".",
"format",
"(",
"sys",
".",
"version_info",
"[",
"0",
"]",
")",
",",
"\"pip{}.{}.exe\"",
".",
"format",
"(",
"*",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | check_requires_python | Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
requirement.
Raises an InvalidSpecifier if `requires_python` have an invalid format. | pipenv/patched/notpip/_internal/utils/packaging.py | def check_requires_python(requires_python):
# type: (Optional[str]) -> bool
"""
Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
... | def check_requires_python(requires_python):
# type: (Optional[str]) -> bool
"""
Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
... | [
"Check",
"if",
"the",
"python",
"version",
"in",
"use",
"match",
"the",
"requires_python",
"specifier",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/packaging.py#L23-L41 | [
"def",
"check_requires_python",
"(",
"requires_python",
")",
":",
"# type: (Optional[str]) -> bool",
"if",
"requires_python",
"is",
"None",
":",
"# The package provides no information",
"return",
"True",
"requires_python_specifier",
"=",
"specifiers",
".",
"SpecifierSet",
"("... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | init | Initialize the enhanced click completion
Parameters
----------
complete_options : bool
always complete the options, even when the user hasn't typed a first dash (Default value = False)
match_incomplete : func
a function with two parameters choice and incomplete. Must return True
... | pipenv/vendor/click_completion/__init__.py | def init(complete_options=False, match_incomplete=None):
"""Initialize the enhanced click completion
Parameters
----------
complete_options : bool
always complete the options, even when the user hasn't typed a first dash (Default value = False)
match_incomplete : func
a function wit... | def init(complete_options=False, match_incomplete=None):
"""Initialize the enhanced click completion
Parameters
----------
complete_options : bool
always complete the options, even when the user hasn't typed a first dash (Default value = False)
match_incomplete : func
a function wit... | [
"Initialize",
"the",
"enhanced",
"click",
"completion"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/__init__.py#L27-L44 | [
"def",
"init",
"(",
"complete_options",
"=",
"False",
",",
"match_incomplete",
"=",
"None",
")",
":",
"global",
"_initialized",
"if",
"not",
"_initialized",
":",
"_patch",
"(",
")",
"completion_configuration",
".",
"complete_options",
"=",
"complete_options",
"if"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | transform_hits | The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use. | pipenv/patched/notpip/_internal/commands/search.py | def transform_hits(hits):
"""
The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use.
"""
packages = OrderedDict()
for hit in hits:
name = hit['name']
summary = ... | def transform_hits(hits):
"""
The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use.
"""
packages = OrderedDict()
for hit in hits:
name = hit['name']
summary = ... | [
"The",
"list",
"from",
"pypi",
"is",
"really",
"a",
"list",
"of",
"versions",
".",
"We",
"want",
"a",
"list",
"of",
"packages",
"with",
"the",
"list",
"of",
"versions",
"stored",
"inline",
".",
"This",
"converts",
"the",
"list",
"from",
"pypi",
"into",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/search.py#L69-L94 | [
"def",
"transform_hits",
"(",
"hits",
")",
":",
"packages",
"=",
"OrderedDict",
"(",
")",
"for",
"hit",
"in",
"hits",
":",
"name",
"=",
"hit",
"[",
"'name'",
"]",
"summary",
"=",
"hit",
"[",
"'summary'",
"]",
"version",
"=",
"hit",
"[",
"'version'",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequirementSet.add_requirement | Add install_req as a requirement to install.
:param parent_req_name: The name of the requirement that needed this
added. The name is used because when multiple unnamed requirements
resolve to the same name, we could otherwise end up with dependency
links that point outside t... | pipenv/patched/notpip/_internal/req/req_set.py | def add_requirement(
self,
install_req, # type: InstallRequirement
parent_req_name=None, # type: Optional[str]
extras_requested=None # type: Optional[Iterable[str]]
):
# type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501
"""A... | def add_requirement(
self,
install_req, # type: InstallRequirement
parent_req_name=None, # type: Optional[str]
extras_requested=None # type: Optional[Iterable[str]]
):
# type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501
"""A... | [
"Add",
"install_req",
"as",
"a",
"requirement",
"to",
"install",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_set.py#L52-L167 | [
"def",
"add_requirement",
"(",
"self",
",",
"install_req",
",",
"# type: InstallRequirement",
"parent_req_name",
"=",
"None",
",",
"# type: Optional[str]",
"extras_requested",
"=",
"None",
"# type: Optional[Iterable[str]]",
")",
":",
"# type: (...) -> Tuple[List[InstallRequirem... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver.resolve | Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operations.prepare``.
Once PyPI has static dependency metadata available, it would be... | pipenv/patched/notpip/_internal/resolve.py | def resolve(self, requirement_set):
# type: (RequirementSet) -> None
"""Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operat... | def resolve(self, requirement_set):
# type: (RequirementSet) -> None
"""Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operat... | [
"Resolve",
"what",
"operations",
"need",
"to",
"be",
"done"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L96-L144 | [
"def",
"resolve",
"(",
"self",
",",
"requirement_set",
")",
":",
"# type: (RequirementSet) -> None",
"# make the wheelhouse",
"if",
"self",
".",
"preparer",
".",
"wheel_download_dir",
":",
"ensure_dir",
"(",
"self",
".",
"preparer",
".",
"wheel_download_dir",
")",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver._set_req_to_reinstall | Set a requirement to be installed. | pipenv/patched/notpip/_internal/resolve.py | def _set_req_to_reinstall(self, req):
# type: (InstallRequirement) -> None
"""
Set a requirement to be installed.
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
if not self.use_user_site or dist_in_usersite(req... | def _set_req_to_reinstall(self, req):
# type: (InstallRequirement) -> None
"""
Set a requirement to be installed.
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
if not self.use_user_site or dist_in_usersite(req... | [
"Set",
"a",
"requirement",
"to",
"be",
"installed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L156-L165 | [
"def",
"_set_req_to_reinstall",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"# Don't uninstall the conflict if doing a user install and the",
"# conflict is not a user install.",
"if",
"not",
"self",
".",
"use_user_site",
"or",
"dist_in_usersite",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver._check_skip_installed | Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only have satisfied_by set to
None if the req_to_install is to be... | pipenv/patched/notpip/_internal/resolve.py | def _check_skip_installed(self, req_to_install):
# type: (InstallRequirement) -> Optional[str]
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
... | def _check_skip_installed(self, req_to_install):
# type: (InstallRequirement) -> Optional[str]
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
... | [
"Check",
"if",
"req_to_install",
"should",
"be",
"skipped",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L168-L219 | [
"def",
"_check_skip_installed",
"(",
"self",
",",
"req_to_install",
")",
":",
"# type: (InstallRequirement) -> Optional[str]",
"if",
"self",
".",
"ignore_installed",
":",
"return",
"None",
"req_to_install",
".",
"check_if_exists",
"(",
"self",
".",
"use_user_site",
")",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver._get_abstract_dist_for | Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same. | pipenv/patched/notpip/_internal/resolve.py | def _get_abstract_dist_for(self, req):
# type: (InstallRequirement) -> DistAbstraction
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
assert self.require_hashes is not None, (
"require_hashes should h... | def _get_abstract_dist_for(self, req):
# type: (InstallRequirement) -> DistAbstraction
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
assert self.require_hashes is not None, (
"require_hashes should h... | [
"Takes",
"a",
"InstallRequirement",
"and",
"returns",
"a",
"single",
"AbstractDist",
"\\",
"representing",
"a",
"prepared",
"variant",
"of",
"the",
"same",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L221-L277 | [
"def",
"_get_abstract_dist_for",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> DistAbstraction",
"assert",
"self",
".",
"require_hashes",
"is",
"not",
"None",
",",
"(",
"\"require_hashes should have been set in Resolver.resolve()\"",
")",
"if",
"req",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver._resolve_one | Prepare a single requirements file.
:return: A list of additional InstallRequirements to also install. | pipenv/patched/notpip/_internal/resolve.py | def _resolve_one(
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
ignore_requires_python=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Prepare a single requirements file.
:return: A list of addi... | def _resolve_one(
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
ignore_requires_python=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Prepare a single requirements file.
:return: A list of addi... | [
"Prepare",
"a",
"single",
"requirements",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L279-L397 | [
"def",
"_resolve_one",
"(",
"self",
",",
"requirement_set",
",",
"# type: RequirementSet",
"req_to_install",
",",
"# type: InstallRequirement",
"ignore_requires_python",
"=",
"False",
"# type: bool",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"# Tell user what we are ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver.get_installation_order | Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees. | pipenv/patched/notpip/_internal/resolve.py | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no oth... | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no oth... | [
"Create",
"the",
"installation",
"order",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L399-L425 | [
"def",
"get_installation_order",
"(",
"self",
",",
"req_set",
")",
":",
"# type: (RequirementSet) -> List[InstallRequirement]",
"# The current implementation, which we may change at any point",
"# installs the user specified things in the order given, except when",
"# dependencies must come ea... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _xml_escape | Escape &, <, >, ", ', etc. in a string of data. | pipenv/vendor/pyparsing.py | def _xml_escape(data):
"""Escape &, <, >, ", ', etc. in a string of data."""
# ampersand must be replaced first
from_symbols = '&><"\''
to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
for from_,to_ in zip(from_symbols, to_symbols):
data = data.replace(from_, to_)
return ... | def _xml_escape(data):
"""Escape &, <, >, ", ', etc. in a string of data."""
# ampersand must be replaced first
from_symbols = '&><"\''
to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
for from_,to_ in zip(from_symbols, to_symbols):
data = data.replace(from_, to_)
return ... | [
"Escape",
"&",
"<",
">",
"etc",
".",
"in",
"a",
"string",
"of",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L219-L227 | [
"def",
"_xml_escape",
"(",
"data",
")",
":",
"# ampersand must be replaced first",
"from_symbols",
"=",
"'&><\"\\''",
"to_symbols",
"=",
"(",
"'&'",
"+",
"s",
"+",
"';'",
"for",
"s",
"in",
"\"amp gt lt quot apos\"",
".",
"split",
"(",
")",
")",
"for",
"from_",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | line | Returns the line of text containing loc within a string, counting newlines as line separators. | pipenv/vendor/pyparsing.py | def line( loc, strg ):
"""Returns the line of text containing loc within a string, counting newlines as line separators.
"""
lastCR = strg.rfind("\n", 0, loc)
nextCR = strg.find("\n", loc)
if nextCR >= 0:
return strg[lastCR+1:nextCR]
else:
return strg[lastCR+1:] | def line( loc, strg ):
"""Returns the line of text containing loc within a string, counting newlines as line separators.
"""
lastCR = strg.rfind("\n", 0, loc)
nextCR = strg.find("\n", loc)
if nextCR >= 0:
return strg[lastCR+1:nextCR]
else:
return strg[lastCR+1:] | [
"Returns",
"the",
"line",
"of",
"text",
"containing",
"loc",
"within",
"a",
"string",
"counting",
"newlines",
"as",
"line",
"separators",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1124-L1132 | [
"def",
"line",
"(",
"loc",
",",
"strg",
")",
":",
"lastCR",
"=",
"strg",
".",
"rfind",
"(",
"\"\\n\"",
",",
"0",
",",
"loc",
")",
"nextCR",
"=",
"strg",
".",
"find",
"(",
"\"\\n\"",
",",
"loc",
")",
"if",
"nextCR",
">=",
"0",
":",
"return",
"st... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | traceParseAction | Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by the returned value, or any exce... | pipenv/vendor/pyparsing.py | def traceParseAction(f):
"""Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by... | def traceParseAction(f):
"""Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by... | [
"Decorator",
"for",
"debugging",
"parse",
"actions",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L4846-L4889 | [
"def",
"traceParseAction",
"(",
"f",
")",
":",
"f",
"=",
"_trim_arity",
"(",
"f",
")",
"def",
"z",
"(",
"*",
"paArgs",
")",
":",
"thisFunc",
"=",
"f",
".",
"__name__",
"s",
",",
"l",
",",
"t",
"=",
"paArgs",
"[",
"-",
"3",
":",
"]",
"if",
"le... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | delimitedList | Helper to define a delimited list of expressions - the delimiter
defaults to ','. By default, the list elements and delimiters can
have intervening whitespace, and comments, but this can be
overridden by passing ``combine=True`` in the constructor. If
``combine`` is set to ``True``, the matching tokens ... | pipenv/vendor/pyparsing.py | def delimitedList( expr, delim=",", combine=False ):
"""Helper to define a delimited list of expressions - the delimiter
defaults to ','. By default, the list elements and delimiters can
have intervening whitespace, and comments, but this can be
overridden by passing ``combine=True`` in the constructor.... | def delimitedList( expr, delim=",", combine=False ):
"""Helper to define a delimited list of expressions - the delimiter
defaults to ','. By default, the list elements and delimiters can
have intervening whitespace, and comments, but this can be
overridden by passing ``combine=True`` in the constructor.... | [
"Helper",
"to",
"define",
"a",
"delimited",
"list",
"of",
"expressions",
"-",
"the",
"delimiter",
"defaults",
"to",
".",
"By",
"default",
"the",
"list",
"elements",
"and",
"delimiters",
"can",
"have",
"intervening",
"whitespace",
"and",
"comments",
"but",
"thi... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L4894-L4913 | [
"def",
"delimitedList",
"(",
"expr",
",",
"delim",
"=",
"\",\"",
",",
"combine",
"=",
"False",
")",
":",
"dlName",
"=",
"_ustr",
"(",
"expr",
")",
"+",
"\" [\"",
"+",
"_ustr",
"(",
"delim",
")",
"+",
"\" \"",
"+",
"_ustr",
"(",
"expr",
")",
"+",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | originalTextFor | Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. By
default, returns astring containing the or... | pipenv/vendor/pyparsing.py | def originalTextFor(expr, asString=True):
"""Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. ... | def originalTextFor(expr, asString=True):
"""Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. ... | [
"Helper",
"to",
"return",
"the",
"original",
"untokenized",
"text",
"for",
"a",
"given",
"expression",
".",
"Useful",
"to",
"restore",
"the",
"parsed",
"fields",
"of",
"an",
"HTML",
"start",
"tag",
"into",
"the",
"raw",
"tag",
"text",
"itself",
"or",
"to",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5146-L5186 | [
"def",
"originalTextFor",
"(",
"expr",
",",
"asString",
"=",
"True",
")",
":",
"locMarker",
"=",
"Empty",
"(",
")",
".",
"setParseAction",
"(",
"lambda",
"s",
",",
"loc",
",",
"t",
":",
"loc",
")",
"endlocMarker",
"=",
"locMarker",
".",
"copy",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | locatedExpr | Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- locn_start = location where matched expression begins
- locn_end = location where matched expression ends
- value = the actual parsed results
Be c... | pipenv/vendor/pyparsing.py | def locatedExpr(expr):
"""Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- locn_start = location where matched expression begins
- locn_end = location where matched expression ends
- value = the a... | def locatedExpr(expr):
"""Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- locn_start = location where matched expression begins
- locn_end = location where matched expression ends
- value = the a... | [
"Helper",
"to",
"decorate",
"a",
"returned",
"token",
"with",
"its",
"starting",
"and",
"ending",
"locations",
"in",
"the",
"input",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5194-L5220 | [
"def",
"locatedExpr",
"(",
"expr",
")",
":",
"locator",
"=",
"Empty",
"(",
")",
".",
"setParseAction",
"(",
"lambda",
"s",
",",
"l",
",",
"t",
":",
"l",
")",
"return",
"Group",
"(",
"locator",
"(",
"\"locn_start\"",
")",
"+",
"expr",
"(",
"\"value\""... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | srange | r"""Helper to easily define string ranges for use in Word
construction. Borrows syntax from regexp '[]' string range
definitions::
srange("[0-9]") -> "0123456789"
srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz"
srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
The input strin... | pipenv/vendor/pyparsing.py | def srange(s):
r"""Helper to easily define string ranges for use in Word
construction. Borrows syntax from regexp '[]' string range
definitions::
srange("[0-9]") -> "0123456789"
srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz"
srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
... | def srange(s):
r"""Helper to easily define string ranges for use in Word
construction. Borrows syntax from regexp '[]' string range
definitions::
srange("[0-9]") -> "0123456789"
srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz"
srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
... | [
"r",
"Helper",
"to",
"easily",
"define",
"string",
"ranges",
"for",
"use",
"in",
"Word",
"construction",
".",
"Borrows",
"syntax",
"from",
"regexp",
"[]",
"string",
"range",
"definitions",
"::"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5237-L5267 | [
"def",
"srange",
"(",
"s",
")",
":",
"_expanded",
"=",
"lambda",
"p",
":",
"p",
"if",
"not",
"isinstance",
"(",
"p",
",",
"ParseResults",
")",
"else",
"''",
".",
"join",
"(",
"unichr",
"(",
"c",
")",
"for",
"c",
"in",
"range",
"(",
"ord",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | matchOnlyAtCol | Helper method for defining parse actions that require matching at
a specific column in the input text. | pipenv/vendor/pyparsing.py | def matchOnlyAtCol(n):
"""Helper method for defining parse actions that require matching at
a specific column in the input text.
"""
def verifyCol(strg,locn,toks):
if col(locn,strg) != n:
raise ParseException(strg,locn,"matched token not at column %d" % n)
return verifyCol | def matchOnlyAtCol(n):
"""Helper method for defining parse actions that require matching at
a specific column in the input text.
"""
def verifyCol(strg,locn,toks):
if col(locn,strg) != n:
raise ParseException(strg,locn,"matched token not at column %d" % n)
return verifyCol | [
"Helper",
"method",
"for",
"defining",
"parse",
"actions",
"that",
"require",
"matching",
"at",
"a",
"specific",
"column",
"in",
"the",
"input",
"text",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5269-L5276 | [
"def",
"matchOnlyAtCol",
"(",
"n",
")",
":",
"def",
"verifyCol",
"(",
"strg",
",",
"locn",
",",
"toks",
")",
":",
"if",
"col",
"(",
"locn",
",",
"strg",
")",
"!=",
"n",
":",
"raise",
"ParseException",
"(",
"strg",
",",
"locn",
",",
"\"matched token n... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | tokenMap | Helper to define a parse action by mapping a function to all
elements of a ParseResults list. If any additional args are passed,
they are forwarded to the given function as additional arguments
after the token, as in
``hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))``,
which will conve... | pipenv/vendor/pyparsing.py | def tokenMap(func, *args):
"""Helper to define a parse action by mapping a function to all
elements of a ParseResults list. If any additional args are passed,
they are forwarded to the given function as additional arguments
after the token, as in
``hex_integer = Word(hexnums).setParseAction(tokenMap... | def tokenMap(func, *args):
"""Helper to define a parse action by mapping a function to all
elements of a ParseResults list. If any additional args are passed,
they are forwarded to the given function as additional arguments
after the token, as in
``hex_integer = Word(hexnums).setParseAction(tokenMap... | [
"Helper",
"to",
"define",
"a",
"parse",
"action",
"by",
"mapping",
"a",
"function",
"to",
"all",
"elements",
"of",
"a",
"ParseResults",
"list",
".",
"If",
"any",
"additional",
"args",
"are",
"passed",
"they",
"are",
"forwarded",
"to",
"the",
"given",
"func... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5308-L5354 | [
"def",
"tokenMap",
"(",
"func",
",",
"*",
"args",
")",
":",
"def",
"pa",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"return",
"[",
"func",
"(",
"tokn",
",",
"*",
"args",
")",
"for",
"tokn",
"in",
"t",
"]",
"try",
":",
"func_name",
"=",
"getattr"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | withAttribute | Helper to create a validating parse action to be used with start
tags created with :class:`makeXMLTags` or
:class:`makeHTMLTags`. Use ``withAttribute`` to qualify
a starting tag with a required attribute value, to avoid false
matches on common tags such as ``<TD>`` or ``<DIV>``.
Call ``withAttribut... | pipenv/vendor/pyparsing.py | def withAttribute(*args,**attrDict):
"""Helper to create a validating parse action to be used with start
tags created with :class:`makeXMLTags` or
:class:`makeHTMLTags`. Use ``withAttribute`` to qualify
a starting tag with a required attribute value, to avoid false
matches on common tags such as ``<... | def withAttribute(*args,**attrDict):
"""Helper to create a validating parse action to be used with start
tags created with :class:`makeXMLTags` or
:class:`makeHTMLTags`. Use ``withAttribute`` to qualify
a starting tag with a required attribute value, to avoid false
matches on common tags such as ``<... | [
"Helper",
"to",
"create",
"a",
"validating",
"parse",
"action",
"to",
"be",
"used",
"with",
"start",
"tags",
"created",
"with",
":",
"class",
":",
"makeXMLTags",
"or",
":",
"class",
":",
"makeHTMLTags",
".",
"Use",
"withAttribute",
"to",
"qualify",
"a",
"s... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5425-L5493 | [
"def",
"withAttribute",
"(",
"*",
"args",
",",
"*",
"*",
"attrDict",
")",
":",
"if",
"args",
":",
"attrs",
"=",
"args",
"[",
":",
"]",
"else",
":",
"attrs",
"=",
"attrDict",
".",
"items",
"(",
")",
"attrs",
"=",
"[",
"(",
"k",
",",
"v",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | nestedExpr | Helper method for defining nested lists enclosed in opening and
closing delimiters ("(" and ")" are the default).
Parameters:
- opener - opening character for a nested list
(default= ``"("``); can also be a pyparsing expression
- closer - closing character for a nested list
(default= ``... | pipenv/vendor/pyparsing.py | def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()):
"""Helper method for defining nested lists enclosed in opening and
closing delimiters ("(" and ")" are the default).
Parameters:
- opener - opening character for a nested list
(default= ``"("``); can also be a... | def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()):
"""Helper method for defining nested lists enclosed in opening and
closing delimiters ("(" and ")" are the default).
Parameters:
- opener - opening character for a nested list
(default= ``"("``); can also be a... | [
"Helper",
"method",
"for",
"defining",
"nested",
"lists",
"enclosed",
"in",
"opening",
"and",
"closing",
"delimiters",
"(",
"(",
"and",
")",
"are",
"the",
"default",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5677-L5772 | [
"def",
"nestedExpr",
"(",
"opener",
"=",
"\"(\"",
",",
"closer",
"=",
"\")\"",
",",
"content",
"=",
"None",
",",
"ignoreExpr",
"=",
"quotedString",
".",
"copy",
"(",
")",
")",
":",
"if",
"opener",
"==",
"closer",
":",
"raise",
"ValueError",
"(",
"\"ope... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseBaseException._from_exception | internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses | pipenv/vendor/pyparsing.py | def _from_exception(cls, pe):
"""
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
"""
return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement) | def _from_exception(cls, pe):
"""
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
"""
return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement) | [
"internal",
"factory",
"method",
"to",
"simplify",
"creating",
"one",
"type",
"of",
"ParseException",
"from",
"another",
"-",
"avoids",
"having",
"__init__",
"signature",
"conflicts",
"among",
"subclasses"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L252-L257 | [
"def",
"_from_exception",
"(",
"cls",
",",
"pe",
")",
":",
"return",
"cls",
"(",
"pe",
".",
"pstr",
",",
"pe",
".",
"loc",
",",
"pe",
".",
"msg",
",",
"pe",
".",
"parserElement",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.