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 | Parameter.get_error_hint | Get a stringified version of the param for use in error messages to
indicate which param caused the error. | pipenv/vendor/click/core.py | def get_error_hint(self, ctx):
"""Get a stringified version of the param for use in error messages to
indicate which param caused the error.
"""
hint_list = self.opts or [self.human_readable_name]
return ' / '.join('"%s"' % x for x in hint_list) | def get_error_hint(self, ctx):
"""Get a stringified version of the param for use in error messages to
indicate which param caused the error.
"""
hint_list = self.opts or [self.human_readable_name]
return ' / '.join('"%s"' % x for x in hint_list) | [
"Get",
"a",
"stringified",
"version",
"of",
"the",
"param",
"for",
"use",
"in",
"error",
"messages",
"to",
"indicate",
"which",
"param",
"caused",
"the",
"error",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1492-L1497 | [
"def",
"get_error_hint",
"(",
"self",
",",
"ctx",
")",
":",
"hint_list",
"=",
"self",
".",
"opts",
"or",
"[",
"self",
".",
"human_readable_name",
"]",
"return",
"' / '",
".",
"join",
"(",
"'\"%s\"'",
"%",
"x",
"for",
"x",
"in",
"hint_list",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Option.prompt_for_value | This is an alternative flow that can be activated in the full
value processing if a value does not exist. It will prompt the
user until a valid value exists and then returns the processed
value as result. | pipenv/vendor/click/core.py | def prompt_for_value(self, ctx):
"""This is an alternative flow that can be activated in the full
value processing if a value does not exist. It will prompt the
user until a valid value exists and then returns the processed
value as result.
"""
# Calculate the default be... | def prompt_for_value(self, ctx):
"""This is an alternative flow that can be activated in the full
value processing if a value does not exist. It will prompt the
user until a valid value exists and then returns the processed
value as result.
"""
# Calculate the default be... | [
"This",
"is",
"an",
"alternative",
"flow",
"that",
"can",
"be",
"activated",
"in",
"the",
"full",
"value",
"processing",
"if",
"a",
"value",
"does",
"not",
"exist",
".",
"It",
"will",
"prompt",
"the",
"user",
"until",
"a",
"valid",
"value",
"exists",
"an... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1747-L1764 | [
"def",
"prompt_for_value",
"(",
"self",
",",
"ctx",
")",
":",
"# Calculate the default before prompting anything to be stable.",
"default",
"=",
"self",
".",
"get_default",
"(",
"ctx",
")",
"# If this is a prompt for a flag we need to handle this",
"# differently.",
"if",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | find_all_matches | Find all matching dependencies using the supplied finder and the
given ireq.
:param finder: A package finder for discovering matching candidates.
:type finder: :class:`~pip._internal.index.PackageFinder`
:param ireq: An install requirement.
:type ireq: :class:`~pip._internal.req.req_install.Install... | pipenv/vendor/requirementslib/models/dependencies.py | def find_all_matches(finder, ireq, pre=False):
# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]
"""Find all matching dependencies using the supplied finder and the
given ireq.
:param finder: A package finder for discovering matching candidates.
:type finder: :class:`... | def find_all_matches(finder, ireq, pre=False):
# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]
"""Find all matching dependencies using the supplied finder and the
given ireq.
:param finder: A package finder for discovering matching candidates.
:type finder: :class:`... | [
"Find",
"all",
"matching",
"dependencies",
"using",
"the",
"supplied",
"finder",
"and",
"the",
"given",
"ireq",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L57-L77 | [
"def",
"find_all_matches",
"(",
"finder",
",",
"ireq",
",",
"pre",
"=",
"False",
")",
":",
"# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]",
"candidates",
"=",
"clean_requires_python",
"(",
"finder",
".",
"find_all_candidates",
"(",
"ireq",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_abstract_dependencies | Get all abstract dependencies for a given list of requirements.
Given a set of requirements, convert each requirement to an Abstract Dependency.
:param reqs: A list of Requirements
:type reqs: list[:class:`~requirementslib.models.requirements.Requirement`]
:param sources: Pipfile-formatted sources, de... | pipenv/vendor/requirementslib/models/dependencies.py | def get_abstract_dependencies(reqs, sources=None, parent=None):
"""Get all abstract dependencies for a given list of requirements.
Given a set of requirements, convert each requirement to an Abstract Dependency.
:param reqs: A list of Requirements
:type reqs: list[:class:`~requirementslib.models.requi... | def get_abstract_dependencies(reqs, sources=None, parent=None):
"""Get all abstract dependencies for a given list of requirements.
Given a set of requirements, convert each requirement to an Abstract Dependency.
:param reqs: A list of Requirements
:type reqs: list[:class:`~requirementslib.models.requi... | [
"Get",
"all",
"abstract",
"dependencies",
"for",
"a",
"given",
"list",
"of",
"requirements",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L262-L297 | [
"def",
"get_abstract_dependencies",
"(",
"reqs",
",",
"sources",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"deps",
"=",
"[",
"]",
"from",
".",
"requirements",
"import",
"Requirement",
"for",
"req",
"in",
"reqs",
":",
"if",
"isinstance",
"(",
"re... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dependencies | Get all dependencies for a given install requirement.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfile-formatted sources, defaults to None
:type sources: list[dict], optional
:param parent: The parent of this lis... | pipenv/vendor/requirementslib/models/dependencies.py | def get_dependencies(ireq, sources=None, parent=None):
# type: (Union[InstallRequirement, InstallationCandidate], Optional[List[Dict[S, Union[S, bool]]]], Optional[AbstractDependency]) -> Set[S, ...]
"""Get all dependencies for a given install requirement.
:param ireq: A single InstallRequirement
:type... | def get_dependencies(ireq, sources=None, parent=None):
# type: (Union[InstallRequirement, InstallationCandidate], Optional[List[Dict[S, Union[S, bool]]]], Optional[AbstractDependency]) -> Set[S, ...]
"""Get all dependencies for a given install requirement.
:param ireq: A single InstallRequirement
:type... | [
"Get",
"all",
"dependencies",
"for",
"a",
"given",
"install",
"requirement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L300-L334 | [
"def",
"get_dependencies",
"(",
"ireq",
",",
"sources",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"# type: (Union[InstallRequirement, InstallationCandidate], Optional[List[Dict[S, Union[S, bool]]]], Optional[AbstractDependency]) -> Set[S, ...]",
"if",
"not",
"isinstance",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dependencies_from_wheel_cache | Retrieves dependencies for the given install requirement from the wheel cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.
:rtype: set(str) or None | pipenv/vendor/requirementslib/models/dependencies.py | def get_dependencies_from_wheel_cache(ireq):
"""Retrieves dependencies for the given install requirement from the wheel cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallReq... | def get_dependencies_from_wheel_cache(ireq):
"""Retrieves dependencies for the given install requirement from the wheel cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallReq... | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"wheel",
"cache",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L337-L354 | [
"def",
"get_dependencies_from_wheel_cache",
"(",
"ireq",
")",
":",
"if",
"ireq",
".",
"editable",
"or",
"not",
"is_pinned_requirement",
"(",
"ireq",
")",
":",
"return",
"matches",
"=",
"WHEEL_CACHE",
".",
"get",
"(",
"ireq",
".",
"link",
",",
"name_from_req",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dependencies_from_json | Retrieves dependencies for the given install requirement from the json api.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.
:rtype: set(str) or None | pipenv/vendor/requirementslib/models/dependencies.py | def get_dependencies_from_json(ireq):
"""Retrieves dependencies for the given install requirement from the json api.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.... | def get_dependencies_from_json(ireq):
"""Retrieves dependencies for the given install requirement from the json api.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.... | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"json",
"api",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L362-L408 | [
"def",
"get_dependencies_from_json",
"(",
"ireq",
")",
":",
"if",
"ireq",
".",
"editable",
"or",
"not",
"is_pinned_requirement",
"(",
"ireq",
")",
":",
"return",
"# It is technically possible to parse extras out of the JSON API's",
"# requirement format, but it is such a chore ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dependencies_from_cache | Retrieves dependencies for the given install requirement from the dependency cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.
:rtype: set(str) or None | pipenv/vendor/requirementslib/models/dependencies.py | def get_dependencies_from_cache(ireq):
"""Retrieves dependencies for the given install requirement from the dependency cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequ... | def get_dependencies_from_cache(ireq):
"""Retrieves dependencies for the given install requirement from the dependency cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequ... | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"dependency",
"cache",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L411-L445 | [
"def",
"get_dependencies_from_cache",
"(",
"ireq",
")",
":",
"if",
"ireq",
".",
"editable",
"or",
"not",
"is_pinned_requirement",
"(",
"ireq",
")",
":",
"return",
"if",
"ireq",
"not",
"in",
"DEPENDENCY_CACHE",
":",
"return",
"cached",
"=",
"set",
"(",
"DEPEN... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_dependencies_from_index | Retrieves dependencies for the given install requirement from the pip resolver.
:param dep: A single InstallRequirement
:type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfile-formatted sources, defaults to None
:type sources: list[dict], optional
:return: A se... | pipenv/vendor/requirementslib/models/dependencies.py | def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None):
"""Retrieves dependencies for the given install requirement from the pip resolver.
:param dep: A single InstallRequirement
:type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfil... | def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None):
"""Retrieves dependencies for the given install requirement from the pip resolver.
:param dep: A single InstallRequirement
:type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfil... | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"pip",
"resolver",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L452-L544 | [
"def",
"get_dependencies_from_index",
"(",
"dep",
",",
"sources",
"=",
"None",
",",
"pip_options",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"finder",
"=",
"get_finder",
"(",
"sources",
"=",
"sources",
",",
"pip_options",
"=",
"pip_options",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_pip_options | Build a pip command from a list of sources
:param args: positional arguments passed through to the pip parser
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_command: A pre-built pip command instance
:type pip_command: :class:`~p... | pipenv/vendor/requirementslib/models/dependencies.py | def get_pip_options(args=[], sources=None, pip_command=None):
"""Build a pip command from a list of sources
:param args: positional arguments passed through to the pip parser
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_comman... | def get_pip_options(args=[], sources=None, pip_command=None):
"""Build a pip command from a list of sources
:param args: positional arguments passed through to the pip parser
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_comman... | [
"Build",
"a",
"pip",
"command",
"from",
"a",
"list",
"of",
"sources"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L547-L570 | [
"def",
"get_pip_options",
"(",
"args",
"=",
"[",
"]",
",",
"sources",
"=",
"None",
",",
"pip_command",
"=",
"None",
")",
":",
"if",
"not",
"pip_command",
":",
"pip_command",
"=",
"get_pip_command",
"(",
")",
"if",
"not",
"sources",
":",
"sources",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_finder | Get a package finder for looking up candidates to install
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_command: A pip command instance, defaults to None
:type pip_command: :class:`~pip._internal.cli.base_command.Command`
:para... | pipenv/vendor/requirementslib/models/dependencies.py | def get_finder(sources=None, pip_command=None, pip_options=None):
# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder
"""Get a package finder for looking up candidates to install
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict... | def get_finder(sources=None, pip_command=None, pip_options=None):
# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder
"""Get a package finder for looking up candidates to install
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict... | [
"Get",
"a",
"package",
"finder",
"for",
"looking",
"up",
"candidates",
"to",
"install"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L573-L604 | [
"def",
"get_finder",
"(",
"sources",
"=",
"None",
",",
"pip_command",
"=",
"None",
",",
"pip_options",
"=",
"None",
")",
":",
"# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder",
"if",
"not",
"pip_command",
":",
"pip_command",
"=",
"get_pi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | start_resolver | Context manager to produce a resolver.
:param finder: A package finder to use for searching the index
:type finder: :class:`~pip._internal.index.PackageFinder`
:return: A 3-tuple of finder, preparer, resolver
:rtype: (:class:`~pip._internal.operations.prepare.RequirementPreparer`, :class:`~pip._interna... | pipenv/vendor/requirementslib/models/dependencies.py | def start_resolver(finder=None, wheel_cache=None):
"""Context manager to produce a resolver.
:param finder: A package finder to use for searching the index
:type finder: :class:`~pip._internal.index.PackageFinder`
:return: A 3-tuple of finder, preparer, resolver
:rtype: (:class:`~pip._internal.oper... | def start_resolver(finder=None, wheel_cache=None):
"""Context manager to produce a resolver.
:param finder: A package finder to use for searching the index
:type finder: :class:`~pip._internal.index.PackageFinder`
:return: A 3-tuple of finder, preparer, resolver
:rtype: (:class:`~pip._internal.oper... | [
"Context",
"manager",
"to",
"produce",
"a",
"resolver",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L608-L663 | [
"def",
"start_resolver",
"(",
"finder",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"pip_command",
"=",
"get_pip_command",
"(",
")",
"pip_options",
"=",
"get_pip_options",
"(",
"pip_command",
"=",
"pip_command",
")",
"if",
"not",
"finder",
":",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyCache.as_cache_key | Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this will return, for example:
("ipython", "2.1.0")
For a requirement with extras, the extras will be comma-separated and app... | pipenv/vendor/requirementslib/models/cache.py | def as_cache_key(self, ireq):
"""
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this will return, for example:
("ipython", "2.1.0")
For a requirement with ... | def as_cache_key(self, ireq):
"""
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this will return, for example:
("ipython", "2.1.0")
For a requirement with ... | [
"Given",
"a",
"requirement",
"return",
"its",
"cache",
"key",
".",
"This",
"behavior",
"is",
"a",
"little",
"weird",
"in",
"order",
"to",
"allow",
"backwards",
"compatibility",
"with",
"cache",
"files",
".",
"For",
"a",
"requirement",
"without",
"extras",
"t... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L86-L103 | [
"def",
"as_cache_key",
"(",
"self",
",",
"ireq",
")",
":",
"name",
",",
"version",
",",
"extras",
"=",
"as_tuple",
"(",
"ireq",
")",
"if",
"not",
"extras",
":",
"extras_string",
"=",
"\"\"",
"else",
":",
"extras_string",
"=",
"\"[{}]\"",
".",
"format",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyCache.read_cache | Reads the cached contents into memory. | pipenv/vendor/requirementslib/models/cache.py | def read_cache(self):
"""Reads the cached contents into memory."""
if os.path.exists(self._cache_file):
self._cache = read_cache_file(self._cache_file)
else:
self._cache = {} | def read_cache(self):
"""Reads the cached contents into memory."""
if os.path.exists(self._cache_file):
self._cache = read_cache_file(self._cache_file)
else:
self._cache = {} | [
"Reads",
"the",
"cached",
"contents",
"into",
"memory",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L105-L110 | [
"def",
"read_cache",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_cache_file",
")",
":",
"self",
".",
"_cache",
"=",
"read_cache_file",
"(",
"self",
".",
"_cache_file",
")",
"else",
":",
"self",
".",
"_cache",
"=... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyCache.write_cache | Writes the cache to disk as JSON. | pipenv/vendor/requirementslib/models/cache.py | def write_cache(self):
"""Writes the cache to disk as JSON."""
doc = {
'__format__': 1,
'dependencies': self._cache,
}
with open(self._cache_file, 'w') as f:
json.dump(doc, f, sort_keys=True) | def write_cache(self):
"""Writes the cache to disk as JSON."""
doc = {
'__format__': 1,
'dependencies': self._cache,
}
with open(self._cache_file, 'w') as f:
json.dump(doc, f, sort_keys=True) | [
"Writes",
"the",
"cache",
"to",
"disk",
"as",
"JSON",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L112-L119 | [
"def",
"write_cache",
"(",
"self",
")",
":",
"doc",
"=",
"{",
"'__format__'",
":",
"1",
",",
"'dependencies'",
":",
"self",
".",
"_cache",
",",
"}",
"with",
"open",
"(",
"self",
".",
"_cache_file",
",",
"'w'",
")",
"as",
"f",
":",
"json",
".",
"dum... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyCache.reverse_dependencies | Returns a lookup table of reverse dependencies for all the given ireqs.
Since this is all static, it only works if the dependency cache
contains the complete data, otherwise you end up with a partial view.
This is typically no problem if you use this function after the entire
dependency... | pipenv/vendor/requirementslib/models/cache.py | def reverse_dependencies(self, ireqs):
"""
Returns a lookup table of reverse dependencies for all the given ireqs.
Since this is all static, it only works if the dependency cache
contains the complete data, otherwise you end up with a partial view.
This is typically no problem i... | def reverse_dependencies(self, ireqs):
"""
Returns a lookup table of reverse dependencies for all the given ireqs.
Since this is all static, it only works if the dependency cache
contains the complete data, otherwise you end up with a partial view.
This is typically no problem i... | [
"Returns",
"a",
"lookup",
"table",
"of",
"reverse",
"dependencies",
"for",
"all",
"the",
"given",
"ireqs",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L151-L161 | [
"def",
"reverse_dependencies",
"(",
"self",
",",
"ireqs",
")",
":",
"ireqs_as_cache_values",
"=",
"[",
"self",
".",
"as_cache_key",
"(",
"ireq",
")",
"for",
"ireq",
"in",
"ireqs",
"]",
"return",
"self",
".",
"_reverse_dependencies",
"(",
"ireqs_as_cache_values",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyCache._reverse_dependencies | Returns a lookup table of reverse dependencies for all the given cache keys.
Example input:
[('pep8', '1.5.7'),
('flake8', '2.4.0'),
('mccabe', '0.3'),
('pyflakes', '0.8.1')]
Example output:
{'pep8': ['flake8'],
'flake8': []... | pipenv/vendor/requirementslib/models/cache.py | def _reverse_dependencies(self, cache_keys):
"""
Returns a lookup table of reverse dependencies for all the given cache keys.
Example input:
[('pep8', '1.5.7'),
('flake8', '2.4.0'),
('mccabe', '0.3'),
('pyflakes', '0.8.1')]
Example ou... | def _reverse_dependencies(self, cache_keys):
"""
Returns a lookup table of reverse dependencies for all the given cache keys.
Example input:
[('pep8', '1.5.7'),
('flake8', '2.4.0'),
('mccabe', '0.3'),
('pyflakes', '0.8.1')]
Example ou... | [
"Returns",
"a",
"lookup",
"table",
"of",
"reverse",
"dependencies",
"for",
"all",
"the",
"given",
"cache",
"keys",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L163-L186 | [
"def",
"_reverse_dependencies",
"(",
"self",
",",
"cache_keys",
")",
":",
"# First, collect all the dependencies into a sequence of (parent, child) tuples, like [('flake8', 'pep8'),",
"# ('flake8', 'mccabe'), ...]",
"return",
"lookup_table",
"(",
"(",
"key_from_req",
"(",
"Requiremen... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _JSONCache.as_cache_key | Given a requirement, return its cache key.
This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this
will return, for example::
("ipython", "2.1.0")
For a requirement with extras, the extras will be c... | pipenv/vendor/requirementslib/models/cache.py | def as_cache_key(self, ireq):
"""Given a requirement, return its cache key.
This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this
will return, for example::
("ipython", "2.1.0")
For a requ... | def as_cache_key(self, ireq):
"""Given a requirement, return its cache key.
This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this
will return, for example::
("ipython", "2.1.0")
For a requ... | [
"Given",
"a",
"requirement",
"return",
"its",
"cache",
"key",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L266-L287 | [
"def",
"as_cache_key",
"(",
"self",
",",
"ireq",
")",
":",
"extras",
"=",
"tuple",
"(",
"sorted",
"(",
"ireq",
".",
"extras",
")",
")",
"if",
"not",
"extras",
":",
"extras_string",
"=",
"\"\"",
"else",
":",
"extras_string",
"=",
"\"[{}]\"",
".",
"forma... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | locked | Decorator which enables locks for decorated function.
Arguments:
- path: path for lockfile.
- timeout (optional): Timeout for acquiring lock.
Usage:
@locked('/var/run/myname', timeout=0)
def myname(...):
... | pipenv/patched/notpip/_vendor/lockfile/__init__.py | def locked(path, timeout=None):
"""Decorator which enables locks for decorated function.
Arguments:
- path: path for lockfile.
- timeout (optional): Timeout for acquiring lock.
Usage:
@locked('/var/run/myname', timeout=0)
def myname(...):
...
"""
def decor... | def locked(path, timeout=None):
"""Decorator which enables locks for decorated function.
Arguments:
- path: path for lockfile.
- timeout (optional): Timeout for acquiring lock.
Usage:
@locked('/var/run/myname', timeout=0)
def myname(...):
...
"""
def decor... | [
"Decorator",
"which",
"enables",
"locks",
"for",
"decorated",
"function",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/__init__.py#L315-L337 | [
"def",
"locked",
"(",
"path",
",",
"timeout",
"=",
"None",
")",
":",
"def",
"decor",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"lock",
"=",
"F... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | getTreeWalker | Get a TreeWalker class for various types of tree with built-in support
:arg str treeType: the name of the tree type required (case-insensitive).
Supported values are:
* "dom": The xml.dom.minidom DOM implementation
* "etree": A generic walker for tree implementations exposing an
... | pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py | def getTreeWalker(treeType, implementation=None, **kwargs):
"""Get a TreeWalker class for various types of tree with built-in support
:arg str treeType: the name of the tree type required (case-insensitive).
Supported values are:
* "dom": The xml.dom.minidom DOM implementation
* "etree... | def getTreeWalker(treeType, implementation=None, **kwargs):
"""Get a TreeWalker class for various types of tree with built-in support
:arg str treeType: the name of the tree type required (case-insensitive).
Supported values are:
* "dom": The xml.dom.minidom DOM implementation
* "etree... | [
"Get",
"a",
"TreeWalker",
"class",
"for",
"various",
"types",
"of",
"tree",
"with",
"built",
"-",
"in",
"support"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py#L21-L62 | [
"def",
"getTreeWalker",
"(",
"treeType",
",",
"implementation",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"treeType",
"=",
"treeType",
".",
"lower",
"(",
")",
"if",
"treeType",
"not",
"in",
"treeWalkerCache",
":",
"if",
"treeType",
"==",
"\"dom\"",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pprint | Pretty printer for tree walkers
Takes a TreeWalker instance and pretty prints the output of walking the tree.
:arg walker: a TreeWalker instance | pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py | def pprint(walker):
"""Pretty printer for tree walkers
Takes a TreeWalker instance and pretty prints the output of walking the tree.
:arg walker: a TreeWalker instance
"""
output = []
indent = 0
for token in concatenateCharacterTokens(walker):
type = token["type"]
if type ... | def pprint(walker):
"""Pretty printer for tree walkers
Takes a TreeWalker instance and pretty prints the output of walking the tree.
:arg walker: a TreeWalker instance
"""
output = []
indent = 0
for token in concatenateCharacterTokens(walker):
type = token["type"]
if type ... | [
"Pretty",
"printer",
"for",
"tree",
"walkers"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py#L80-L154 | [
"def",
"pprint",
"(",
"walker",
")",
":",
"output",
"=",
"[",
"]",
"indent",
"=",
"0",
"for",
"token",
"in",
"concatenateCharacterTokens",
"(",
"walker",
")",
":",
"type",
"=",
"token",
"[",
"\"type\"",
"]",
"if",
"type",
"in",
"(",
"\"StartTag\"",
","... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Yaspin.hide | Hide the spinner to allow for custom writing to the terminal. | pipenv/vendor/yaspin/core.py | def hide(self):
"""Hide the spinner to allow for custom writing to the terminal."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and not self._hide_spin.is_set():
# set the hidden spinner flag
self._hide_spin.set()
# clea... | def hide(self):
"""Hide the spinner to allow for custom writing to the terminal."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and not self._hide_spin.is_set():
# set the hidden spinner flag
self._hide_spin.set()
# clea... | [
"Hide",
"the",
"spinner",
"to",
"allow",
"for",
"custom",
"writing",
"to",
"the",
"terminal",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L251-L264 | [
"def",
"hide",
"(",
"self",
")",
":",
"thr_is_alive",
"=",
"self",
".",
"_spin_thread",
"and",
"self",
".",
"_spin_thread",
".",
"is_alive",
"(",
")",
"if",
"thr_is_alive",
"and",
"not",
"self",
".",
"_hide_spin",
".",
"is_set",
"(",
")",
":",
"# set the... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Yaspin.show | Show the hidden spinner. | pipenv/vendor/yaspin/core.py | def show(self):
"""Show the hidden spinner."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and self._hide_spin.is_set():
# clear the hidden spinner flag
self._hide_spin.clear()
# clear the current line so the spinner is ... | def show(self):
"""Show the hidden spinner."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and self._hide_spin.is_set():
# clear the hidden spinner flag
self._hide_spin.clear()
# clear the current line so the spinner is ... | [
"Show",
"the",
"hidden",
"spinner",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L266-L276 | [
"def",
"show",
"(",
"self",
")",
":",
"thr_is_alive",
"=",
"self",
".",
"_spin_thread",
"and",
"self",
".",
"_spin_thread",
".",
"is_alive",
"(",
")",
"if",
"thr_is_alive",
"and",
"self",
".",
"_hide_spin",
".",
"is_set",
"(",
")",
":",
"# clear the hidden... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Yaspin.write | Write text in the terminal without breaking the spinner. | pipenv/vendor/yaspin/core.py | def write(self, text):
"""Write text in the terminal without breaking the spinner."""
# similar to tqdm.write()
# https://pypi.python.org/pypi/tqdm#writing-messages
sys.stdout.write("\r")
self._clear_line()
_text = to_unicode(text)
if PY2:
_text = _te... | def write(self, text):
"""Write text in the terminal without breaking the spinner."""
# similar to tqdm.write()
# https://pypi.python.org/pypi/tqdm#writing-messages
sys.stdout.write("\r")
self._clear_line()
_text = to_unicode(text)
if PY2:
_text = _te... | [
"Write",
"text",
"in",
"the",
"terminal",
"without",
"breaking",
"the",
"spinner",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L278-L292 | [
"def",
"write",
"(",
"self",
",",
"text",
")",
":",
"# similar to tqdm.write()",
"# https://pypi.python.org/pypi/tqdm#writing-messages",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"\\r\"",
")",
"self",
".",
"_clear_line",
"(",
")",
"_text",
"=",
"to_unicode",
"(",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Yaspin._freeze | Stop spinner, compose last frame and 'freeze' it. | pipenv/vendor/yaspin/core.py | def _freeze(self, final_text):
"""Stop spinner, compose last frame and 'freeze' it."""
text = to_unicode(final_text)
self._last_frame = self._compose_out(text, mode="last")
# Should be stopped here, otherwise prints after
# self._freeze call will mess up the spinner
self... | def _freeze(self, final_text):
"""Stop spinner, compose last frame and 'freeze' it."""
text = to_unicode(final_text)
self._last_frame = self._compose_out(text, mode="last")
# Should be stopped here, otherwise prints after
# self._freeze call will mess up the spinner
self... | [
"Stop",
"spinner",
"compose",
"last",
"frame",
"and",
"freeze",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L307-L315 | [
"def",
"_freeze",
"(",
"self",
",",
"final_text",
")",
":",
"text",
"=",
"to_unicode",
"(",
"final_text",
")",
"self",
".",
"_last_frame",
"=",
"self",
".",
"_compose_out",
"(",
"text",
",",
"mode",
"=",
"\"last\"",
")",
"# Should be stopped here, otherwise pr... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RevOptions.to_args | Return the VCS-specific command arguments. | pipenv/patched/notpip/_internal/vcs/__init__.py | def to_args(self):
# type: () -> List[str]
"""
Return the VCS-specific command arguments.
"""
args = [] # type: List[str]
rev = self.arg_rev
if rev is not None:
args += self.vcs.get_base_rev_args(rev)
args += self.extra_args
return ar... | def to_args(self):
# type: () -> List[str]
"""
Return the VCS-specific command arguments.
"""
args = [] # type: List[str]
rev = self.arg_rev
if rev is not None:
args += self.vcs.get_base_rev_args(rev)
args += self.extra_args
return ar... | [
"Return",
"the",
"VCS",
"-",
"specific",
"command",
"arguments",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L71-L82 | [
"def",
"to_args",
"(",
"self",
")",
":",
"# type: () -> List[str]",
"args",
"=",
"[",
"]",
"# type: List[str]",
"rev",
"=",
"self",
".",
"arg_rev",
"if",
"rev",
"is",
"not",
"None",
":",
"args",
"+=",
"self",
".",
"vcs",
".",
"get_base_rev_args",
"(",
"r... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RevOptions.make_new | Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object. | pipenv/patched/notpip/_internal/vcs/__init__.py | def make_new(self, rev):
# type: (str) -> RevOptions
"""
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
"""
return self.vcs.make_rev_options(rev, extra_args=self.extra_args) | def make_new(self, rev):
# type: (str) -> RevOptions
"""
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
"""
return self.vcs.make_rev_options(rev, extra_args=self.extra_args) | [
"Make",
"a",
"copy",
"of",
"the",
"current",
"instance",
"but",
"with",
"a",
"new",
"rev",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L91-L99 | [
"def",
"make_new",
"(",
"self",
",",
"rev",
")",
":",
"# type: (str) -> RevOptions",
"return",
"self",
".",
"vcs",
".",
"make_rev_options",
"(",
"rev",
",",
"extra_args",
"=",
"self",
".",
"extra_args",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VcsSupport.get_backend_type | Return the type of the version control backend if found at given
location, e.g. vcs.get_backend_type('/path/to/vcs/checkout') | pipenv/patched/notpip/_internal/vcs/__init__.py | def get_backend_type(self, location):
# type: (str) -> Optional[Type[VersionControl]]
"""
Return the type of the version control backend if found at given
location, e.g. vcs.get_backend_type('/path/to/vcs/checkout')
"""
for vc_type in self._registry.values():
... | def get_backend_type(self, location):
# type: (str) -> Optional[Type[VersionControl]]
"""
Return the type of the version control backend if found at given
location, e.g. vcs.get_backend_type('/path/to/vcs/checkout')
"""
for vc_type in self._registry.values():
... | [
"Return",
"the",
"type",
"of",
"the",
"version",
"control",
"backend",
"if",
"found",
"at",
"given",
"location",
"e",
".",
"g",
".",
"vcs",
".",
"get_backend_type",
"(",
"/",
"path",
"/",
"to",
"/",
"vcs",
"/",
"checkout",
")"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L155-L166 | [
"def",
"get_backend_type",
"(",
"self",
",",
"location",
")",
":",
"# type: (str) -> Optional[Type[VersionControl]]",
"for",
"vc_type",
"in",
"self",
".",
"_registry",
".",
"values",
"(",
")",
":",
"if",
"vc_type",
".",
"controls_location",
"(",
"location",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl._is_local_repository | posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder) | pipenv/patched/notpip/_internal/vcs/__init__.py | def _is_local_repository(cls, repo):
# type: (str) -> bool
"""
posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder)
"""
drive, tail = os.path.splitdrive(repo)
return repo.startswith(os.path.sep) or bool(drive) | def _is_local_repository(cls, repo):
# type: (str) -> bool
"""
posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder)
"""
drive, tail = os.path.splitdrive(repo)
return repo.startswith(os.path.sep) or bool(drive) | [
"posix",
"absolute",
"paths",
"start",
"with",
"os",
".",
"path",
".",
"sep",
"win32",
"ones",
"start",
"with",
"drive",
"(",
"like",
"c",
":",
"\\\\",
"folder",
")"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L214-L221 | [
"def",
"_is_local_repository",
"(",
"cls",
",",
"repo",
")",
":",
"# type: (str) -> bool",
"drive",
",",
"tail",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"repo",
")",
"return",
"repo",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"sep",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl.get_url_rev_and_auth | Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)). | pipenv/patched/notpip/_internal/vcs/__init__.py | def get_url_rev_and_auth(self, url):
# type: (str) -> Tuple[str, Optional[str], AuthInfo]
"""
Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)).
"""
scheme, netloc, path, query, frag = u... | def get_url_rev_and_auth(self, url):
# type: (str) -> Tuple[str, Optional[str], AuthInfo]
"""
Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)).
"""
scheme, netloc, path, query, frag = u... | [
"Parse",
"the",
"repository",
"URL",
"to",
"use",
"and",
"return",
"the",
"URL",
"revision",
"and",
"auth",
"info",
"to",
"use",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L248-L270 | [
"def",
"get_url_rev_and_auth",
"(",
"self",
",",
"url",
")",
":",
"# type: (str) -> Tuple[str, Optional[str], AuthInfo]",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"frag",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"'+'",
"not",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl.get_url_rev_options | Return the URL and RevOptions object to use in obtain() and in
some cases export(), as a tuple (url, rev_options). | pipenv/patched/notpip/_internal/vcs/__init__.py | def get_url_rev_options(self, url):
# type: (str) -> Tuple[str, RevOptions]
"""
Return the URL and RevOptions object to use in obtain() and in
some cases export(), as a tuple (url, rev_options).
"""
url, rev, user_pass = self.get_url_rev_and_auth(url)
username, pa... | def get_url_rev_options(self, url):
# type: (str) -> Tuple[str, RevOptions]
"""
Return the URL and RevOptions object to use in obtain() and in
some cases export(), as a tuple (url, rev_options).
"""
url, rev, user_pass = self.get_url_rev_and_auth(url)
username, pa... | [
"Return",
"the",
"URL",
"and",
"RevOptions",
"object",
"to",
"use",
"in",
"obtain",
"()",
"and",
"in",
"some",
"cases",
"export",
"()",
"as",
"a",
"tuple",
"(",
"url",
"rev_options",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L278-L289 | [
"def",
"get_url_rev_options",
"(",
"self",
",",
"url",
")",
":",
"# type: (str) -> Tuple[str, RevOptions]",
"url",
",",
"rev",
",",
"user_pass",
"=",
"self",
".",
"get_url_rev_and_auth",
"(",
"url",
")",
"username",
",",
"password",
"=",
"user_pass",
"extra_args",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl.compare_urls | Compare two repo URLs for identity, ignoring incidental differences. | pipenv/patched/notpip/_internal/vcs/__init__.py | def compare_urls(self, url1, url2):
# type: (str, str) -> bool
"""
Compare two repo URLs for identity, ignoring incidental differences.
"""
return (self.normalize_url(url1) == self.normalize_url(url2)) | def compare_urls(self, url1, url2):
# type: (str, str) -> bool
"""
Compare two repo URLs for identity, ignoring incidental differences.
"""
return (self.normalize_url(url1) == self.normalize_url(url2)) | [
"Compare",
"two",
"repo",
"URLs",
"for",
"identity",
"ignoring",
"incidental",
"differences",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L299-L304 | [
"def",
"compare_urls",
"(",
"self",
",",
"url1",
",",
"url2",
")",
":",
"# type: (str, str) -> bool",
"return",
"(",
"self",
".",
"normalize_url",
"(",
"url1",
")",
"==",
"self",
".",
"normalize_url",
"(",
"url2",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl.obtain | Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update. | pipenv/patched/notpip/_internal/vcs/__init__.py | def obtain(self, dest):
# type: (str) -> None
"""
Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update.
"""
url, rev_options = self.get_url_rev_optio... | def obtain(self, dest):
# type: (str) -> None
"""
Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update.
"""
url, rev_options = self.get_url_rev_optio... | [
"Install",
"or",
"update",
"in",
"editable",
"mode",
"the",
"package",
"represented",
"by",
"this",
"VersionControl",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L345-L436 | [
"def",
"obtain",
"(",
"self",
",",
"dest",
")",
":",
"# type: (str) -> None",
"url",
",",
"rev_options",
"=",
"self",
".",
"get_url_rev_options",
"(",
"self",
".",
"url",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl.run_command | Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the VCS
command name, and checks that the VCS is available | pipenv/patched/notpip/_internal/vcs/__init__.py | def run_command(
cls,
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_e... | def run_command(
cls,
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_e... | [
"Run",
"a",
"VCS",
"subcommand",
"This",
"is",
"simply",
"a",
"wrapper",
"around",
"call_subprocess",
"that",
"adds",
"the",
"VCS",
"command",
"name",
"and",
"checks",
"that",
"the",
"VCS",
"is",
"available"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L476-L511 | [
"def",
"run_command",
"(",
"cls",
",",
"cmd",
",",
"# type: List[str]",
"show_stdout",
"=",
"True",
",",
"# type: bool",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"on_returncode",
"=",
"'raise'",
",",
"# type: str",
"extra_ok_returncodes",
"=",
"None",
","... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionControl.is_repository_directory | Return whether a directory path is a repository directory. | pipenv/patched/notpip/_internal/vcs/__init__.py | def is_repository_directory(cls, path):
# type: (str) -> bool
"""
Return whether a directory path is a repository directory.
"""
logger.debug('Checking in %s for %s (%s)...',
path, cls.dirname, cls.name)
return os.path.exists(os.path.join(path, cls.di... | def is_repository_directory(cls, path):
# type: (str) -> bool
"""
Return whether a directory path is a repository directory.
"""
logger.debug('Checking in %s for %s (%s)...',
path, cls.dirname, cls.name)
return os.path.exists(os.path.join(path, cls.di... | [
"Return",
"whether",
"a",
"directory",
"path",
"is",
"a",
"repository",
"directory",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L514-L521 | [
"def",
"is_repository_directory",
"(",
"cls",
",",
"path",
")",
":",
"# type: (str) -> bool",
"logger",
".",
"debug",
"(",
"'Checking in %s for %s (%s)...'",
",",
"path",
",",
"cls",
".",
"dirname",
",",
"cls",
".",
"name",
")",
"return",
"os",
".",
"path",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _script_names | Create the fully qualified name of the files created by
{console,gui}_scripts for the given ``dist``.
Returns the list of file names | pipenv/patched/notpip/_internal/req/req_uninstall.py | def _script_names(dist, script_name, is_gui):
"""Create the fully qualified name of the files created by
{console,gui}_scripts for the given ``dist``.
Returns the list of file names
"""
if dist_in_usersite(dist):
bin_dir = bin_user
else:
bin_dir = bin_py
exe_name = os.path.jo... | def _script_names(dist, script_name, is_gui):
"""Create the fully qualified name of the files created by
{console,gui}_scripts for the given ``dist``.
Returns the list of file names
"""
if dist_in_usersite(dist):
bin_dir = bin_user
else:
bin_dir = bin_py
exe_name = os.path.jo... | [
"Create",
"the",
"fully",
"qualified",
"name",
"of",
"the",
"files",
"created",
"by",
"{",
"console",
"gui",
"}",
"_scripts",
"for",
"the",
"given",
"dist",
".",
"Returns",
"the",
"list",
"of",
"file",
"names"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L25-L43 | [
"def",
"_script_names",
"(",
"dist",
",",
"script_name",
",",
"is_gui",
")",
":",
"if",
"dist_in_usersite",
"(",
"dist",
")",
":",
"bin_dir",
"=",
"bin_user",
"else",
":",
"bin_dir",
"=",
"bin_py",
"exe_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | compact | Compact a path set to contain the minimal number of paths
necessary to contain all paths in the set. If /a/path/ and
/a/path/to/a/file.txt are both in the set, leave only the
shorter path. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def compact(paths):
"""Compact a path set to contain the minimal number of paths
necessary to contain all paths in the set. If /a/path/ and
/a/path/to/a/file.txt are both in the set, leave only the
shorter path."""
sep = os.path.sep
short_paths = set()
for path in sorted(paths, key=len):
... | def compact(paths):
"""Compact a path set to contain the minimal number of paths
necessary to contain all paths in the set. If /a/path/ and
/a/path/to/a/file.txt are both in the set, leave only the
shorter path."""
sep = os.path.sep
short_paths = set()
for path in sorted(paths, key=len):
... | [
"Compact",
"a",
"path",
"set",
"to",
"contain",
"the",
"minimal",
"number",
"of",
"paths",
"necessary",
"to",
"contain",
"all",
"paths",
"in",
"the",
"set",
".",
"If",
"/",
"a",
"/",
"path",
"/",
"and",
"/",
"a",
"/",
"path",
"/",
"to",
"/",
"a",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L80-L96 | [
"def",
"compact",
"(",
"paths",
")",
":",
"sep",
"=",
"os",
".",
"path",
".",
"sep",
"short_paths",
"=",
"set",
"(",
")",
"for",
"path",
"in",
"sorted",
"(",
"paths",
",",
"key",
"=",
"len",
")",
":",
"should_skip",
"=",
"any",
"(",
"path",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | compress_for_rename | Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def compress_for_rename(paths):
"""Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk.
"""
case_map = dict((os.path.normcase(p), p) for p in paths)
remaining = set(case_map)
unchecked =... | def compress_for_rename(paths):
"""Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk.
"""
case_map = dict((os.path.normcase(p), p) for p in paths)
remaining = set(case_map)
unchecked =... | [
"Returns",
"a",
"set",
"containing",
"the",
"paths",
"that",
"need",
"to",
"be",
"renamed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L99-L134 | [
"def",
"compress_for_rename",
"(",
"paths",
")",
":",
"case_map",
"=",
"dict",
"(",
"(",
"os",
".",
"path",
".",
"normcase",
"(",
"p",
")",
",",
"p",
")",
"for",
"p",
"in",
"paths",
")",
"remaining",
"=",
"set",
"(",
"case_map",
")",
"unchecked",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | compress_for_output_listing | Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are removed.
The second set contains files that wou... | pipenv/patched/notpip/_internal/req/req_uninstall.py | def compress_for_output_listing(paths):
"""Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are remov... | def compress_for_output_listing(paths):
"""Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are remov... | [
"Returns",
"a",
"tuple",
"of",
"2",
"sets",
"of",
"which",
"paths",
"to",
"display",
"to",
"user"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L137-L183 | [
"def",
"compress_for_output_listing",
"(",
"paths",
")",
":",
"will_remove",
"=",
"list",
"(",
"paths",
")",
"will_skip",
"=",
"set",
"(",
")",
"# Determine folders and files",
"folders",
"=",
"set",
"(",
")",
"files",
"=",
"set",
"(",
")",
"for",
"path",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | StashedUninstallPathSet._get_directory_stash | Stashes a directory.
Directories are stashed adjacent to their original location if
possible, or else moved/copied into the user's temp dir. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def _get_directory_stash(self, path):
"""Stashes a directory.
Directories are stashed adjacent to their original location if
possible, or else moved/copied into the user's temp dir."""
try:
save_dir = AdjacentTempDirectory(path)
save_dir.create()
except ... | def _get_directory_stash(self, path):
"""Stashes a directory.
Directories are stashed adjacent to their original location if
possible, or else moved/copied into the user's temp dir."""
try:
save_dir = AdjacentTempDirectory(path)
save_dir.create()
except ... | [
"Stashes",
"a",
"directory",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L197-L211 | [
"def",
"_get_directory_stash",
"(",
"self",
",",
"path",
")",
":",
"try",
":",
"save_dir",
"=",
"AdjacentTempDirectory",
"(",
"path",
")",
"save_dir",
".",
"create",
"(",
")",
"except",
"OSError",
":",
"save_dir",
"=",
"TempDirectory",
"(",
"kind",
"=",
"\... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | StashedUninstallPathSet._get_file_stash | Stashes a file.
If no root has been provided, one will be created for the directory
in the user's temp directory. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def _get_file_stash(self, path):
"""Stashes a file.
If no root has been provided, one will be created for the directory
in the user's temp directory."""
path = os.path.normcase(path)
head, old_head = os.path.dirname(path), None
save_dir = None
while head != old_... | def _get_file_stash(self, path):
"""Stashes a file.
If no root has been provided, one will be created for the directory
in the user's temp directory."""
path = os.path.normcase(path)
head, old_head = os.path.dirname(path), None
save_dir = None
while head != old_... | [
"Stashes",
"a",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L213-L239 | [
"def",
"_get_file_stash",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"path",
")",
"head",
",",
"old_head",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
",",
"None",
"save_dir",
"=",
"None"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | StashedUninstallPathSet.stash | Stashes the directory or file and returns its new location. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def stash(self, path):
"""Stashes the directory or file and returns its new location.
"""
if os.path.isdir(path):
new_path = self._get_directory_stash(path)
else:
new_path = self._get_file_stash(path)
self._moves.append((path, new_path))
if os.pat... | def stash(self, path):
"""Stashes the directory or file and returns its new location.
"""
if os.path.isdir(path):
new_path = self._get_directory_stash(path)
else:
new_path = self._get_file_stash(path)
self._moves.append((path, new_path))
if os.pat... | [
"Stashes",
"the",
"directory",
"or",
"file",
"and",
"returns",
"its",
"new",
"location",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L241-L258 | [
"def",
"stash",
"(",
"self",
",",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"new_path",
"=",
"self",
".",
"_get_directory_stash",
"(",
"path",
")",
"else",
":",
"new_path",
"=",
"self",
".",
"_get_file_stash",
"(... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | StashedUninstallPathSet.commit | Commits the uninstall by removing stashed files. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def commit(self):
"""Commits the uninstall by removing stashed files."""
for _, save_dir in self._save_dirs.items():
save_dir.cleanup()
self._moves = []
self._save_dirs = {} | def commit(self):
"""Commits the uninstall by removing stashed files."""
for _, save_dir in self._save_dirs.items():
save_dir.cleanup()
self._moves = []
self._save_dirs = {} | [
"Commits",
"the",
"uninstall",
"by",
"removing",
"stashed",
"files",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L260-L265 | [
"def",
"commit",
"(",
"self",
")",
":",
"for",
"_",
",",
"save_dir",
"in",
"self",
".",
"_save_dirs",
".",
"items",
"(",
")",
":",
"save_dir",
".",
"cleanup",
"(",
")",
"self",
".",
"_moves",
"=",
"[",
"]",
"self",
".",
"_save_dirs",
"=",
"{",
"}... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | StashedUninstallPathSet.rollback | Undoes the uninstall by moving stashed files back. | pipenv/patched/notpip/_internal/req/req_uninstall.py | def rollback(self):
"""Undoes the uninstall by moving stashed files back."""
for p in self._moves:
logging.info("Moving to %s\n from %s", *p)
for new_path, path in self._moves:
try:
logger.debug('Replacing %s from %s', new_path, path)
if o... | def rollback(self):
"""Undoes the uninstall by moving stashed files back."""
for p in self._moves:
logging.info("Moving to %s\n from %s", *p)
for new_path, path in self._moves:
try:
logger.debug('Replacing %s from %s', new_path, path)
if o... | [
"Undoes",
"the",
"uninstall",
"by",
"moving",
"stashed",
"files",
"back",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L267-L284 | [
"def",
"rollback",
"(",
"self",
")",
":",
"for",
"p",
"in",
"self",
".",
"_moves",
":",
"logging",
".",
"info",
"(",
"\"Moving to %s\\n from %s\"",
",",
"*",
"p",
")",
"for",
"new_path",
",",
"path",
"in",
"self",
".",
"_moves",
":",
"try",
":",
"log... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | UninstallPathSet.remove | Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True). | pipenv/patched/notpip/_internal/req/req_uninstall.py | def remove(self, auto_confirm=False, verbose=False):
"""Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True)."""
if not self.paths:
logger.info(
"Can't uninstall '%s'. No files were found to uninstall.",
self.dist.project... | def remove(self, auto_confirm=False, verbose=False):
"""Remove paths in ``self.paths`` with confirmation (unless
``auto_confirm`` is True)."""
if not self.paths:
logger.info(
"Can't uninstall '%s'. No files were found to uninstall.",
self.dist.project... | [
"Remove",
"paths",
"in",
"self",
".",
"paths",
"with",
"confirmation",
"(",
"unless",
"auto_confirm",
"is",
"True",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L337-L366 | [
"def",
"remove",
"(",
"self",
",",
"auto_confirm",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"paths",
":",
"logger",
".",
"info",
"(",
"\"Can't uninstall '%s'. No files were found to uninstall.\"",
",",
"self",
".",
"dist"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | UninstallPathSet._allowed_to_proceed | Display which files would be deleted and prompt for confirmation | pipenv/patched/notpip/_internal/req/req_uninstall.py | def _allowed_to_proceed(self, verbose):
"""Display which files would be deleted and prompt for confirmation
"""
def _display(msg, paths):
if not paths:
return
logger.info(msg)
with indent_log():
for path in sorted(compact(path... | def _allowed_to_proceed(self, verbose):
"""Display which files would be deleted and prompt for confirmation
"""
def _display(msg, paths):
if not paths:
return
logger.info(msg)
with indent_log():
for path in sorted(compact(path... | [
"Display",
"which",
"files",
"would",
"be",
"deleted",
"and",
"prompt",
"for",
"confirmation"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L368-L395 | [
"def",
"_allowed_to_proceed",
"(",
"self",
",",
"verbose",
")",
":",
"def",
"_display",
"(",
"msg",
",",
"paths",
")",
":",
"if",
"not",
"paths",
":",
"return",
"logger",
".",
"info",
"(",
"msg",
")",
"with",
"indent_log",
"(",
")",
":",
"for",
"path... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | UninstallPathSet.rollback | Rollback the changes previously made by remove(). | pipenv/patched/notpip/_internal/req/req_uninstall.py | def rollback(self):
"""Rollback the changes previously made by remove()."""
if not self._moved_paths.can_rollback:
logger.error(
"Can't roll back %s; was not uninstalled",
self.dist.project_name,
)
return False
logger.info('Roll... | def rollback(self):
"""Rollback the changes previously made by remove()."""
if not self._moved_paths.can_rollback:
logger.error(
"Can't roll back %s; was not uninstalled",
self.dist.project_name,
)
return False
logger.info('Roll... | [
"Rollback",
"the",
"changes",
"previously",
"made",
"by",
"remove",
"()",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L397-L408 | [
"def",
"rollback",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_moved_paths",
".",
"can_rollback",
":",
"logger",
".",
"error",
"(",
"\"Can't roll back %s; was not uninstalled\"",
",",
"self",
".",
"dist",
".",
"project_name",
",",
")",
"return",
"False"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.author | >>> package = yarg.get('yarg')
>>> package.author
Author(name=u'Kura', email=u'kura@kura.io') | pipenv/vendor/yarg/package.py | def author(self):
"""
>>> package = yarg.get('yarg')
>>> package.author
Author(name=u'Kura', email=u'kura@kura.io')
"""
author = namedtuple('Author', 'name email')
return author(name=self._package['author'],
email=self._package['a... | def author(self):
"""
>>> package = yarg.get('yarg')
>>> package.author
Author(name=u'Kura', email=u'kura@kura.io')
"""
author = namedtuple('Author', 'name email')
return author(name=self._package['author'],
email=self._package['a... | [
">>>",
"package",
"=",
"yarg",
".",
"get",
"(",
"yarg",
")",
">>>",
"package",
".",
"author",
"Author",
"(",
"name",
"=",
"u",
"Kura",
"email",
"=",
"u",
"kura"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L123-L131 | [
"def",
"author",
"(",
"self",
")",
":",
"author",
"=",
"namedtuple",
"(",
"'Author'",
",",
"'name email'",
")",
"return",
"author",
"(",
"name",
"=",
"self",
".",
"_package",
"[",
"'author'",
"]",
",",
"email",
"=",
"self",
".",
"_package",
"[",
"'auth... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.maintainer | >>> package = yarg.get('yarg')
>>> package.maintainer
Maintainer(name=u'Kura', email=u'kura@kura.io') | pipenv/vendor/yarg/package.py | def maintainer(self):
"""
>>> package = yarg.get('yarg')
>>> package.maintainer
Maintainer(name=u'Kura', email=u'kura@kura.io')
"""
maintainer = namedtuple('Maintainer', 'name email')
return maintainer(name=self._package['maintainer'],
... | def maintainer(self):
"""
>>> package = yarg.get('yarg')
>>> package.maintainer
Maintainer(name=u'Kura', email=u'kura@kura.io')
"""
maintainer = namedtuple('Maintainer', 'name email')
return maintainer(name=self._package['maintainer'],
... | [
">>>",
"package",
"=",
"yarg",
".",
"get",
"(",
"yarg",
")",
">>>",
"package",
".",
"maintainer",
"Maintainer",
"(",
"name",
"=",
"u",
"Kura",
"email",
"=",
"u",
"kura"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L134-L142 | [
"def",
"maintainer",
"(",
"self",
")",
":",
"maintainer",
"=",
"namedtuple",
"(",
"'Maintainer'",
",",
"'name email'",
")",
"return",
"maintainer",
"(",
"name",
"=",
"self",
".",
"_package",
"[",
"'maintainer'",
"]",
",",
"email",
"=",
"self",
".",
"_packa... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.license_from_classifiers | >>> package = yarg.get('yarg')
>>> package.license_from_classifiers
u'MIT License' | pipenv/vendor/yarg/package.py | def license_from_classifiers(self):
"""
>>> package = yarg.get('yarg')
>>> package.license_from_classifiers
u'MIT License'
"""
if len(self.classifiers) > 0:
for c in self.classifiers:
if c.startswith("License"):
... | def license_from_classifiers(self):
"""
>>> package = yarg.get('yarg')
>>> package.license_from_classifiers
u'MIT License'
"""
if len(self.classifiers) > 0:
for c in self.classifiers:
if c.startswith("License"):
... | [
">>>",
"package",
"=",
"yarg",
".",
"get",
"(",
"yarg",
")",
">>>",
"package",
".",
"license_from_classifiers",
"u",
"MIT",
"License"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L154-L163 | [
"def",
"license_from_classifiers",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"classifiers",
")",
">",
"0",
":",
"for",
"c",
"in",
"self",
".",
"classifiers",
":",
"if",
"c",
".",
"startswith",
"(",
"\"License\"",
")",
":",
"return",
"c",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.downloads | >>> package = yarg.get('yarg')
>>> package.downloads
Downloads(day=50100, week=367941, month=1601938) # I wish | pipenv/vendor/yarg/package.py | def downloads(self):
"""
>>> package = yarg.get('yarg')
>>> package.downloads
Downloads(day=50100, week=367941, month=1601938) # I wish
"""
_downloads = self._package['downloads']
downloads = namedtuple('Downloads', 'day week month')
return do... | def downloads(self):
"""
>>> package = yarg.get('yarg')
>>> package.downloads
Downloads(day=50100, week=367941, month=1601938) # I wish
"""
_downloads = self._package['downloads']
downloads = namedtuple('Downloads', 'day week month')
return do... | [
">>>",
"package",
"=",
"yarg",
".",
"get",
"(",
"yarg",
")",
">>>",
"package",
".",
"downloads",
"Downloads",
"(",
"day",
"=",
"50100",
"week",
"=",
"367941",
"month",
"=",
"1601938",
")",
"#",
"I",
"wish"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L166-L176 | [
"def",
"downloads",
"(",
"self",
")",
":",
"_downloads",
"=",
"self",
".",
"_package",
"[",
"'downloads'",
"]",
"downloads",
"=",
"namedtuple",
"(",
"'Downloads'",
",",
"'day week month'",
")",
"return",
"downloads",
"(",
"day",
"=",
"_downloads",
"[",
"'las... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.python_versions | Returns a list of Python version strings that
the package has listed in :attr:`yarg.Release.classifiers`.
>>> package = yarg.get('yarg')
>>> package.python_versions
[u'2.6', u'2.7', u'3.3', u'3.4'] | pipenv/vendor/yarg/package.py | def python_versions(self):
"""
Returns a list of Python version strings that
the package has listed in :attr:`yarg.Release.classifiers`.
>>> package = yarg.get('yarg')
>>> package.python_versions
[u'2.6', u'2.7', u'3.3', u'3.4']
"""
version_re... | def python_versions(self):
"""
Returns a list of Python version strings that
the package has listed in :attr:`yarg.Release.classifiers`.
>>> package = yarg.get('yarg')
>>> package.python_versions
[u'2.6', u'2.7', u'3.3', u'3.4']
"""
version_re... | [
"Returns",
"a",
"list",
"of",
"Python",
"version",
"strings",
"that",
"the",
"package",
"has",
"listed",
"in",
":",
"attr",
":",
"yarg",
".",
"Release",
".",
"classifiers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L190-L202 | [
"def",
"python_versions",
"(",
"self",
")",
":",
"version_re",
"=",
"re",
".",
"compile",
"(",
"r\"\"\"Programming Language \\:\\: \"\"\"",
"\"\"\"Python \\:\\: \\d\\.\\d\"\"\"",
")",
"return",
"[",
"c",
".",
"split",
"(",
"' :: '",
")",
"[",
"-",
"1",
"]",
"for... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.release_ids | >>> package = yarg.get('yarg')
>>> package.release_ids
[u'0.0.1', u'0.0.5', u'0.1.0'] | pipenv/vendor/yarg/package.py | def release_ids(self):
"""
>>> package = yarg.get('yarg')
>>> package.release_ids
[u'0.0.1', u'0.0.5', u'0.1.0']
"""
r = [(k, self._releases[k][0]['upload_time'])
for k in self._releases.keys()
if len(self._releases[k]) > 0]
r... | def release_ids(self):
"""
>>> package = yarg.get('yarg')
>>> package.release_ids
[u'0.0.1', u'0.0.5', u'0.1.0']
"""
r = [(k, self._releases[k][0]['upload_time'])
for k in self._releases.keys()
if len(self._releases[k]) > 0]
r... | [
">>>",
"package",
"=",
"yarg",
".",
"get",
"(",
"yarg",
")",
">>>",
"package",
".",
"release_ids",
"[",
"u",
"0",
".",
"0",
".",
"1",
"u",
"0",
".",
"0",
".",
"5",
"u",
"0",
".",
"1",
".",
"0",
"]"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L289-L298 | [
"def",
"release_ids",
"(",
"self",
")",
":",
"r",
"=",
"[",
"(",
"k",
",",
"self",
".",
"_releases",
"[",
"k",
"]",
"[",
"0",
"]",
"[",
"'upload_time'",
"]",
")",
"for",
"k",
"in",
"self",
".",
"_releases",
".",
"keys",
"(",
")",
"if",
"len",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Package.release | A list of :class:`yarg.release.Release` objects for each file in a
release.
:param release_id: A pypi release id.
>>> package = yarg.get('yarg')
>>> last_release = yarg.releases[-1]
>>> package.release(last_release)
[<Release 0.1.0>, <Release 0.1.0>] | pipenv/vendor/yarg/package.py | def release(self, release_id):
"""
A list of :class:`yarg.release.Release` objects for each file in a
release.
:param release_id: A pypi release id.
>>> package = yarg.get('yarg')
>>> last_release = yarg.releases[-1]
>>> package.release(last_release)... | def release(self, release_id):
"""
A list of :class:`yarg.release.Release` objects for each file in a
release.
:param release_id: A pypi release id.
>>> package = yarg.get('yarg')
>>> last_release = yarg.releases[-1]
>>> package.release(last_release)... | [
"A",
"list",
"of",
":",
"class",
":",
"yarg",
".",
"release",
".",
"Release",
"objects",
"for",
"each",
"file",
"in",
"a",
"release",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L300-L314 | [
"def",
"release",
"(",
"self",
",",
"release_id",
")",
":",
"if",
"release_id",
"not",
"in",
"self",
".",
"release_ids",
":",
"return",
"None",
"return",
"[",
"Release",
"(",
"release_id",
",",
"r",
")",
"for",
"r",
"in",
"self",
".",
"_releases",
"[",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_executable_file | Checks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``. | pipenv/vendor/pexpect/utils.py | def is_executable_file(path):
"""Checks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
"""
# follow symlinks,
fpath = os.path.realpath(path)
if not os.path.isfile(fpath):
# non-files (directories... | def is_executable_file(path):
"""Checks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
"""
# follow symlinks,
fpath = os.path.realpath(path)
if not os.path.isfile(fpath):
# non-files (directories... | [
"Checks",
"that",
"path",
"is",
"an",
"executable",
"regular",
"file",
"or",
"a",
"symlink",
"towards",
"one",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L20-L45 | [
"def",
"is_executable_file",
"(",
"path",
")",
":",
"# follow symlinks,",
"fpath",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"fpath",
")",
":",
"# non-files (directories, fifo, etc.)",
"ret... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | which | This takes a given filename; tries to find it in the environment path;
then checks if it is executable. This returns the full path to the filename
if found and executable. Otherwise this returns None. | pipenv/vendor/pexpect/utils.py | def which(filename, env=None):
'''This takes a given filename; tries to find it in the environment path;
then checks if it is executable. This returns the full path to the filename
if found and executable. Otherwise this returns None.'''
# Special case where filename contains an explicit path.
if o... | def which(filename, env=None):
'''This takes a given filename; tries to find it in the environment path;
then checks if it is executable. This returns the full path to the filename
if found and executable. Otherwise this returns None.'''
# Special case where filename contains an explicit path.
if o... | [
"This",
"takes",
"a",
"given",
"filename",
";",
"tries",
"to",
"find",
"it",
"in",
"the",
"environment",
"path",
";",
"then",
"checks",
"if",
"it",
"is",
"executable",
".",
"This",
"returns",
"the",
"full",
"path",
"to",
"the",
"filename",
"if",
"found",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L48-L66 | [
"def",
"which",
"(",
"filename",
",",
"env",
"=",
"None",
")",
":",
"# Special case where filename contains an explicit path.",
"if",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
"!=",
"''",
"and",
"is_executable_file",
"(",
"filename",
")",
":",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | split_command_line | This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command line. | pipenv/vendor/pexpect/utils.py | def split_command_line(command_line):
'''This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command li... | def split_command_line(command_line):
'''This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command li... | [
"This",
"splits",
"a",
"command",
"line",
"into",
"a",
"list",
"of",
"arguments",
".",
"It",
"splits",
"arguments",
"on",
"spaces",
"but",
"handles",
"embedded",
"quotes",
"doublequotes",
"and",
"escaped",
"characters",
".",
"It",
"s",
"impossible",
"to",
"d... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L69-L127 | [
"def",
"split_command_line",
"(",
"command_line",
")",
":",
"arg_list",
"=",
"[",
"]",
"arg",
"=",
"''",
"# Constants to name the states we can be in.",
"state_basic",
"=",
"0",
"state_esc",
"=",
"1",
"state_singlequote",
"=",
"2",
"state_doublequote",
"=",
"3",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | select_ignore_interrupts | This is a wrapper around select.select() that ignores signals. If
select.select raises a select.error exception and errno is an EINTR
error then it is ignored. Mainly this is used to ignore sigwinch
(terminal resize). | pipenv/vendor/pexpect/utils.py | def select_ignore_interrupts(iwtd, owtd, ewtd, timeout=None):
'''This is a wrapper around select.select() that ignores signals. If
select.select raises a select.error exception and errno is an EINTR
error then it is ignored. Mainly this is used to ignore sigwinch
(terminal resize). '''
# if select... | def select_ignore_interrupts(iwtd, owtd, ewtd, timeout=None):
'''This is a wrapper around select.select() that ignores signals. If
select.select raises a select.error exception and errno is an EINTR
error then it is ignored. Mainly this is used to ignore sigwinch
(terminal resize). '''
# if select... | [
"This",
"is",
"a",
"wrapper",
"around",
"select",
".",
"select",
"()",
"that",
"ignores",
"signals",
".",
"If",
"select",
".",
"select",
"raises",
"a",
"select",
".",
"error",
"exception",
"and",
"errno",
"is",
"an",
"EINTR",
"error",
"then",
"it",
"is",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L130-L156 | [
"def",
"select_ignore_interrupts",
"(",
"iwtd",
",",
"owtd",
",",
"ewtd",
",",
"timeout",
"=",
"None",
")",
":",
"# if select() is interrupted by a signal (errno==EINTR) then",
"# we loop back and enter the select() again.",
"if",
"timeout",
"is",
"not",
"None",
":",
"end... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | poll_ignore_interrupts | Simple wrapper around poll to register file descriptors and
ignore signals. | pipenv/vendor/pexpect/utils.py | def poll_ignore_interrupts(fds, timeout=None):
'''Simple wrapper around poll to register file descriptors and
ignore signals.'''
if timeout is not None:
end_time = time.time() + timeout
poller = select.poll()
for fd in fds:
poller.register(fd, select.POLLIN | select.POLLPRI | selec... | def poll_ignore_interrupts(fds, timeout=None):
'''Simple wrapper around poll to register file descriptors and
ignore signals.'''
if timeout is not None:
end_time = time.time() + timeout
poller = select.poll()
for fd in fds:
poller.register(fd, select.POLLIN | select.POLLPRI | selec... | [
"Simple",
"wrapper",
"around",
"poll",
"to",
"register",
"file",
"descriptors",
"and",
"ignore",
"signals",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L159-L187 | [
"def",
"poll_ignore_interrupts",
"(",
"fds",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
"is",
"not",
"None",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"timeout",
"poller",
"=",
"select",
".",
"poll",
"(",
")",
"for",
"fd"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _suggest_semantic_version | Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything. | pipenv/vendor/distlib/version.py | def _suggest_semantic_version(s):
"""
Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything.
"""
result = s.strip().lower()
for pat, repl in _REPLACEMENTS:
result = pat.sub(repl, result)
if not result:
result = '0.0.... | def _suggest_semantic_version(s):
"""
Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything.
"""
result = s.strip().lower()
for pat, repl in _REPLACEMENTS:
result = pat.sub(repl, result)
if not result:
result = '0.0.... | [
"Try",
"to",
"suggest",
"a",
"semantic",
"form",
"for",
"a",
"version",
"for",
"which",
"_suggest_normalized_version",
"couldn",
"t",
"come",
"up",
"with",
"anything",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L406-L449 | [
"def",
"_suggest_semantic_version",
"(",
"s",
")",
":",
"result",
"=",
"s",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"for",
"pat",
",",
"repl",
"in",
"_REPLACEMENTS",
":",
"result",
"=",
"pat",
".",
"sub",
"(",
"repl",
",",
"result",
")",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _suggest_normalized_version | Suggest a normalized version close to the given version string.
If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.
This does a number of simple normalizations to the given... | pipenv/vendor/distlib/version.py | def _suggest_normalized_version(s):
"""Suggest a normalized version close to the given version string.
If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.
This does a n... | def _suggest_normalized_version(s):
"""Suggest a normalized version close to the given version string.
If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.
This does a n... | [
"Suggest",
"a",
"normalized",
"version",
"close",
"to",
"the",
"given",
"version",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L452-L560 | [
"def",
"_suggest_normalized_version",
"(",
"s",
")",
":",
"try",
":",
"_normalized_key",
"(",
"s",
")",
"return",
"s",
"# already rational",
"except",
"UnsupportedVersionError",
":",
"pass",
"rs",
"=",
"s",
".",
"lower",
"(",
")",
"# part of this could use maketra... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Matcher.match | Check if the provided version matches the constraints.
:param version: The version to match against this instance.
:type version: String or :class:`Version` instance. | pipenv/vendor/distlib/version.py | def match(self, version):
"""
Check if the provided version matches the constraints.
:param version: The version to match against this instance.
:type version: String or :class:`Version` instance.
"""
if isinstance(version, string_types):
version = self.versi... | def match(self, version):
"""
Check if the provided version matches the constraints.
:param version: The version to match against this instance.
:type version: String or :class:`Version` instance.
"""
if isinstance(version, string_types):
version = self.versi... | [
"Check",
"if",
"the",
"provided",
"version",
"matches",
"the",
"constraints",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L129-L148 | [
"def",
"match",
"(",
"self",
",",
"version",
")",
":",
"if",
"isinstance",
"(",
"version",
",",
"string_types",
")",
":",
"version",
"=",
"self",
".",
"version_class",
"(",
"version",
")",
"for",
"operator",
",",
"constraint",
",",
"prefix",
"in",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | set_key | Adds or Updates a key/value to the given .env
If the .env path given doesn't exist, fails instead of risking creating
an orphan .env somewhere in the filesystem | pipenv/vendor/dotenv/main.py | def set_key(dotenv_path, key_to_set, value_to_set, quote_mode="always"):
"""
Adds or Updates a key/value to the given .env
If the .env path given doesn't exist, fails instead of risking creating
an orphan .env somewhere in the filesystem
"""
value_to_set = value_to_set.strip("'").strip('"')
... | def set_key(dotenv_path, key_to_set, value_to_set, quote_mode="always"):
"""
Adds or Updates a key/value to the given .env
If the .env path given doesn't exist, fails instead of risking creating
an orphan .env somewhere in the filesystem
"""
value_to_set = value_to_set.strip("'").strip('"')
... | [
"Adds",
"or",
"Updates",
"a",
"key",
"/",
"value",
"to",
"the",
"given",
".",
"env"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L177-L206 | [
"def",
"set_key",
"(",
"dotenv_path",
",",
"key_to_set",
",",
"value_to_set",
",",
"quote_mode",
"=",
"\"always\"",
")",
":",
"value_to_set",
"=",
"value_to_set",
".",
"strip",
"(",
"\"'\"",
")",
".",
"strip",
"(",
"'\"'",
")",
"if",
"not",
"os",
".",
"p... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | unset_key | Removes a given key from the given .env
If the .env path given doesn't exist, fails
If the given key doesn't exist in the .env, fails | pipenv/vendor/dotenv/main.py | def unset_key(dotenv_path, key_to_unset, quote_mode="always"):
"""
Removes a given key from the given .env
If the .env path given doesn't exist, fails
If the given key doesn't exist in the .env, fails
"""
if not os.path.exists(dotenv_path):
warnings.warn("can't delete from %s - it doesn... | def unset_key(dotenv_path, key_to_unset, quote_mode="always"):
"""
Removes a given key from the given .env
If the .env path given doesn't exist, fails
If the given key doesn't exist in the .env, fails
"""
if not os.path.exists(dotenv_path):
warnings.warn("can't delete from %s - it doesn... | [
"Removes",
"a",
"given",
"key",
"from",
"the",
"given",
".",
"env"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L209-L232 | [
"def",
"unset_key",
"(",
"dotenv_path",
",",
"key_to_unset",
",",
"quote_mode",
"=",
"\"always\"",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dotenv_path",
")",
":",
"warnings",
".",
"warn",
"(",
"\"can't delete from %s - it doesn't exist.\""... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _walk_to_root | Yield directories starting from the given directory up to the root | pipenv/vendor/dotenv/main.py | def _walk_to_root(path):
"""
Yield directories starting from the given directory up to the root
"""
if not os.path.exists(path):
raise IOError('Starting path not found')
if os.path.isfile(path):
path = os.path.dirname(path)
last_dir = None
current_dir = os.path.abspath(path... | def _walk_to_root(path):
"""
Yield directories starting from the given directory up to the root
"""
if not os.path.exists(path):
raise IOError('Starting path not found')
if os.path.isfile(path):
path = os.path.dirname(path)
last_dir = None
current_dir = os.path.abspath(path... | [
"Yield",
"directories",
"starting",
"from",
"the",
"given",
"directory",
"up",
"to",
"the",
"root"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L260-L275 | [
"def",
"_walk_to_root",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"IOError",
"(",
"'Starting path not found'",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"path",
"="... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | run_command | Run command in sub process.
Runs the command in a sub process with the variables from `env`
added in the current environment variables.
Parameters
----------
command: List[str]
The command and it's parameters
env: Dict
The additional environment variables
Returns
-----... | pipenv/vendor/dotenv/main.py | def run_command(command, env):
"""Run command in sub process.
Runs the command in a sub process with the variables from `env`
added in the current environment variables.
Parameters
----------
command: List[str]
The command and it's parameters
env: Dict
The additional enviro... | def run_command(command, env):
"""Run command in sub process.
Runs the command in a sub process with the variables from `env`
added in the current environment variables.
Parameters
----------
command: List[str]
The command and it's parameters
env: Dict
The additional enviro... | [
"Run",
"command",
"in",
"sub",
"process",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L317-L348 | [
"def",
"run_command",
"(",
"command",
",",
"env",
")",
":",
"# copy the current environment variables and add the vales from",
"# `env`",
"cmd_env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"cmd_env",
".",
"update",
"(",
"env",
")",
"p",
"=",
"Popen",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DotEnv.dict | Return dotenv as dict | pipenv/vendor/dotenv/main.py | def dict(self):
"""Return dotenv as dict"""
if self._dict:
return self._dict
values = OrderedDict(self.parse())
self._dict = resolve_nested_variables(values)
return self._dict | def dict(self):
"""Return dotenv as dict"""
if self._dict:
return self._dict
values = OrderedDict(self.parse())
self._dict = resolve_nested_variables(values)
return self._dict | [
"Return",
"dotenv",
"as",
"dict"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L110-L117 | [
"def",
"dict",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dict",
":",
"return",
"self",
".",
"_dict",
"values",
"=",
"OrderedDict",
"(",
"self",
".",
"parse",
"(",
")",
")",
"self",
".",
"_dict",
"=",
"resolve_nested_variables",
"(",
"values",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DotEnv.set_as_environment_variables | Load the current dotenv as system environemt variable. | pipenv/vendor/dotenv/main.py | def set_as_environment_variables(self, override=False):
"""
Load the current dotenv as system environemt variable.
"""
for k, v in self.dict().items():
if k in os.environ and not override:
continue
# With Python2 on Windows, force environment varia... | def set_as_environment_variables(self, override=False):
"""
Load the current dotenv as system environemt variable.
"""
for k, v in self.dict().items():
if k in os.environ and not override:
continue
# With Python2 on Windows, force environment varia... | [
"Load",
"the",
"current",
"dotenv",
"as",
"system",
"environemt",
"variable",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L125-L140 | [
"def",
"set_as_environment_variables",
"(",
"self",
",",
"override",
"=",
"False",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"dict",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"os",
".",
"environ",
"and",
"not",
"override",
":... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _key_from_req | Get an all-lowercase version of the requirement's name. | pipenv/vendor/passa/models/caches.py | def _key_from_req(req):
"""Get an all-lowercase version of the requirement's name."""
if hasattr(req, 'key'):
# from pkg_resources, such as installed dists for pip-sync
key = req.key
else:
# from packaging, such as install requirements from requirements.txt
key = req.name
... | def _key_from_req(req):
"""Get an all-lowercase version of the requirement's name."""
if hasattr(req, 'key'):
# from pkg_resources, such as installed dists for pip-sync
key = req.key
else:
# from packaging, such as install requirements from requirements.txt
key = req.name
... | [
"Get",
"an",
"all",
"-",
"lowercase",
"version",
"of",
"the",
"requirement",
"s",
"name",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/caches.py#L77-L87 | [
"def",
"_key_from_req",
"(",
"req",
")",
":",
"if",
"hasattr",
"(",
"req",
",",
"'key'",
")",
":",
"# from pkg_resources, such as installed dists for pip-sync",
"key",
"=",
"req",
".",
"key",
"else",
":",
"# from packaging, such as install requirements from requirements.t... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _JSONCache.read_cache | Reads the cached contents into memory. | pipenv/vendor/passa/models/caches.py | def read_cache(self):
"""Reads the cached contents into memory.
"""
if os.path.exists(self._cache_file):
self._cache = _read_cache_file(self._cache_file)
else:
self._cache = {} | def read_cache(self):
"""Reads the cached contents into memory.
"""
if os.path.exists(self._cache_file):
self._cache = _read_cache_file(self._cache_file)
else:
self._cache = {} | [
"Reads",
"the",
"cached",
"contents",
"into",
"memory",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/caches.py#L156-L162 | [
"def",
"read_cache",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_cache_file",
")",
":",
"self",
".",
"_cache",
"=",
"_read_cache_file",
"(",
"self",
".",
"_cache_file",
")",
"else",
":",
"self",
".",
"_cache",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | inject_into_urllib3 | Monkey-patch urllib3 with PyOpenSSL-backed SSL-support. | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | def inject_into_urllib3():
'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.'
_validate_dependencies_met()
util.ssl_.SSLContext = PyOpenSSLContext
util.HAS_SNI = HAS_SNI
util.ssl_.HAS_SNI = HAS_SNI
util.IS_PYOPENSSL = True
util.ssl_.IS_PYOPENSSL = True | def inject_into_urllib3():
'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.'
_validate_dependencies_met()
util.ssl_.SSLContext = PyOpenSSLContext
util.HAS_SNI = HAS_SNI
util.ssl_.HAS_SNI = HAS_SNI
util.IS_PYOPENSSL = True
util.ssl_.IS_PYOPENSSL = True | [
"Monkey",
"-",
"patch",
"urllib3",
"with",
"PyOpenSSL",
"-",
"backed",
"SSL",
"-",
"support",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L115-L124 | [
"def",
"inject_into_urllib3",
"(",
")",
":",
"_validate_dependencies_met",
"(",
")",
"util",
".",
"ssl_",
".",
"SSLContext",
"=",
"PyOpenSSLContext",
"util",
".",
"HAS_SNI",
"=",
"HAS_SNI",
"util",
".",
"ssl_",
".",
"HAS_SNI",
"=",
"HAS_SNI",
"util",
".",
"I... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _validate_dependencies_met | Verifies that PyOpenSSL's package-level dependencies have been met.
Throws `ImportError` if they are not met. | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | def _validate_dependencies_met():
"""
Verifies that PyOpenSSL's package-level dependencies have been met.
Throws `ImportError` if they are not met.
"""
# Method added in `cryptography==1.1`; not available in older versions
from cryptography.x509.extensions import Extensions
if getattr(Extens... | def _validate_dependencies_met():
"""
Verifies that PyOpenSSL's package-level dependencies have been met.
Throws `ImportError` if they are not met.
"""
# Method added in `cryptography==1.1`; not available in older versions
from cryptography.x509.extensions import Extensions
if getattr(Extens... | [
"Verifies",
"that",
"PyOpenSSL",
"s",
"package",
"-",
"level",
"dependencies",
"have",
"been",
"met",
".",
"Throws",
"ImportError",
"if",
"they",
"are",
"not",
"met",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L137-L154 | [
"def",
"_validate_dependencies_met",
"(",
")",
":",
"# Method added in `cryptography==1.1`; not available in older versions",
"from",
"cryptography",
".",
"x509",
".",
"extensions",
"import",
"Extensions",
"if",
"getattr",
"(",
"Extensions",
",",
"\"get_extension_for_class\"",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _dnsname_to_stdlib | Converts a dNSName SubjectAlternativeName field to the form used by the
standard library on the given Python version.
Cryptography produces a dNSName as a unicode string that was idna-decoded
from ASCII bytes. We need to idna-encode that string to get it back, and
then on Python 3 we also need to conve... | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | def _dnsname_to_stdlib(name):
"""
Converts a dNSName SubjectAlternativeName field to the form used by the
standard library on the given Python version.
Cryptography produces a dNSName as a unicode string that was idna-decoded
from ASCII bytes. We need to idna-encode that string to get it back, and
... | def _dnsname_to_stdlib(name):
"""
Converts a dNSName SubjectAlternativeName field to the form used by the
standard library on the given Python version.
Cryptography produces a dNSName as a unicode string that was idna-decoded
from ASCII bytes. We need to idna-encode that string to get it back, and
... | [
"Converts",
"a",
"dNSName",
"SubjectAlternativeName",
"field",
"to",
"the",
"form",
"used",
"by",
"the",
"standard",
"library",
"on",
"the",
"given",
"Python",
"version",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L157-L192 | [
"def",
"_dnsname_to_stdlib",
"(",
"name",
")",
":",
"def",
"idna_encode",
"(",
"name",
")",
":",
"\"\"\"\n Borrowed wholesale from the Python Cryptography Project. It turns out\n that we can't just safely call `idna.encode`: it can explode for\n wildcard names. This avoi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_subj_alt_name | Given an PyOpenSSL certificate, provides all the subject alternative names. | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | def get_subj_alt_name(peer_cert):
"""
Given an PyOpenSSL certificate, provides all the subject alternative names.
"""
# Pass the cert to cryptography, which has much better APIs for this.
if hasattr(peer_cert, "to_cryptography"):
cert = peer_cert.to_cryptography()
else:
# This is... | def get_subj_alt_name(peer_cert):
"""
Given an PyOpenSSL certificate, provides all the subject alternative names.
"""
# Pass the cert to cryptography, which has much better APIs for this.
if hasattr(peer_cert, "to_cryptography"):
cert = peer_cert.to_cryptography()
else:
# This is... | [
"Given",
"an",
"PyOpenSSL",
"certificate",
"provides",
"all",
"the",
"subject",
"alternative",
"names",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L195-L244 | [
"def",
"get_subj_alt_name",
"(",
"peer_cert",
")",
":",
"# Pass the cert to cryptography, which has much better APIs for this.",
"if",
"hasattr",
"(",
"peer_cert",
",",
"\"to_cryptography\"",
")",
":",
"cert",
"=",
"peer_cert",
".",
"to_cryptography",
"(",
")",
"else",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CharDistributionAnalysis.feed | feed a character with known length | pipenv/vendor/chardet/chardistribution.py | def feed(self, char, char_len):
"""feed a character with known length"""
if char_len == 2:
# we only care about 2-bytes character in our distribution analysis
order = self.get_order(char)
else:
order = -1
if order >= 0:
self._total_chars +=... | def feed(self, char, char_len):
"""feed a character with known length"""
if char_len == 2:
# we only care about 2-bytes character in our distribution analysis
order = self.get_order(char)
else:
order = -1
if order >= 0:
self._total_chars +=... | [
"feed",
"a",
"character",
"with",
"known",
"length"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/chardistribution.py#L70-L82 | [
"def",
"feed",
"(",
"self",
",",
"char",
",",
"char_len",
")",
":",
"if",
"char_len",
"==",
"2",
":",
"# we only care about 2-bytes character in our distribution analysis",
"order",
"=",
"self",
".",
"get_order",
"(",
"char",
")",
"else",
":",
"order",
"=",
"-... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CharDistributionAnalysis.get_confidence | return confidence based on existing data | pipenv/vendor/chardet/chardistribution.py | def get_confidence(self):
"""return confidence based on existing data"""
# if we didn't receive any character in our consideration range,
# return negative answer
if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD:
return self.SURE_NO
if sel... | def get_confidence(self):
"""return confidence based on existing data"""
# if we didn't receive any character in our consideration range,
# return negative answer
if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD:
return self.SURE_NO
if sel... | [
"return",
"confidence",
"based",
"on",
"existing",
"data"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/chardistribution.py#L84-L98 | [
"def",
"get_confidence",
"(",
"self",
")",
":",
"# if we didn't receive any character in our consideration range,",
"# return negative answer",
"if",
"self",
".",
"_total_chars",
"<=",
"0",
"or",
"self",
".",
"_freq_chars",
"<=",
"self",
".",
"MINIMUM_DATA_THRESHOLD",
":"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _get_requests_session | Load requests lazily. | pipenv/utils.py | def _get_requests_session():
"""Load requests lazily."""
global requests_session
if requests_session is not None:
return requests_session
import requests
requests_session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
max_retries=environments.PIPENV_MAX_RETRIES
... | def _get_requests_session():
"""Load requests lazily."""
global requests_session
if requests_session is not None:
return requests_session
import requests
requests_session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
max_retries=environments.PIPENV_MAX_RETRIES
... | [
"Load",
"requests",
"lazily",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L53-L65 | [
"def",
"_get_requests_session",
"(",
")",
":",
"global",
"requests_session",
"if",
"requests_session",
"is",
"not",
"None",
":",
"return",
"requests_session",
"import",
"requests",
"requests_session",
"=",
"requests",
".",
"Session",
"(",
")",
"adapter",
"=",
"req... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | convert_toml_outline_tables | Converts all outline tables to inline tables. | pipenv/utils.py | def convert_toml_outline_tables(parsed):
"""Converts all outline tables to inline tables."""
def convert_tomlkit_table(section):
for key, value in section._body:
if not key:
continue
if hasattr(value, "keys") and not isinstance(value, tomlkit.items.InlineTable):
... | def convert_toml_outline_tables(parsed):
"""Converts all outline tables to inline tables."""
def convert_tomlkit_table(section):
for key, value in section._body:
if not key:
continue
if hasattr(value, "keys") and not isinstance(value, tomlkit.items.InlineTable):
... | [
"Converts",
"all",
"outline",
"tables",
"to",
"inline",
"tables",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L91-L119 | [
"def",
"convert_toml_outline_tables",
"(",
"parsed",
")",
":",
"def",
"convert_tomlkit_table",
"(",
"section",
")",
":",
"for",
"key",
",",
"value",
"in",
"section",
".",
"_body",
":",
"if",
"not",
"key",
":",
"continue",
"if",
"hasattr",
"(",
"value",
","... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | run_command | Take an input command and run it, handling exceptions and error codes and returning
its stdout and stderr.
:param cmd: The list of command and arguments.
:type cmd: list
:returns: A 2-tuple of the output and error from the command
:rtype: Tuple[str, str]
:raises: exceptions.PipenvCmdError | pipenv/utils.py | def run_command(cmd, *args, **kwargs):
"""
Take an input command and run it, handling exceptions and error codes and returning
its stdout and stderr.
:param cmd: The list of command and arguments.
:type cmd: list
:returns: A 2-tuple of the output and error from the command
:rtype: Tuple[str... | def run_command(cmd, *args, **kwargs):
"""
Take an input command and run it, handling exceptions and error codes and returning
its stdout and stderr.
:param cmd: The list of command and arguments.
:type cmd: list
:returns: A 2-tuple of the output and error from the command
:rtype: Tuple[str... | [
"Take",
"an",
"input",
"command",
"and",
"run",
"it",
"handling",
"exceptions",
"and",
"error",
"codes",
"and",
"returning",
"its",
"stdout",
"and",
"stderr",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L122-L160 | [
"def",
"run_command",
"(",
"cmd",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pipenv",
".",
"vendor",
"import",
"delegator",
"from",
".",
"_compat",
"import",
"decode_for_output",
"from",
".",
"cmdparse",
"import",
"Script",
"catch_exceptio... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse_python_version | Parse a Python version output returned by `python --version`.
Return a dict with three keys: major, minor, and micro. Each value is a
string containing a version part.
Note: The micro part would be `'0'` if it's missing from the input string. | pipenv/utils.py | def parse_python_version(output):
"""Parse a Python version output returned by `python --version`.
Return a dict with three keys: major, minor, and micro. Each value is a
string containing a version part.
Note: The micro part would be `'0'` if it's missing from the input string.
"""
version_li... | def parse_python_version(output):
"""Parse a Python version output returned by `python --version`.
Return a dict with three keys: major, minor, and micro. Each value is a
string containing a version part.
Note: The micro part would be `'0'` if it's missing from the input string.
"""
version_li... | [
"Parse",
"a",
"Python",
"version",
"output",
"returned",
"by",
"python",
"--",
"version",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L163-L193 | [
"def",
"parse_python_version",
"(",
"output",
")",
":",
"version_line",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
",",
"1",
")",
"[",
"0",
"]",
"version_pattern",
"=",
"re",
".",
"compile",
"(",
"r\"\"\"\n ^ # Beginning of line.\n ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | escape_grouped_arguments | Prepares a string for the shell (on Windows too!)
Only for use on grouped arguments (passed as a string to Popen) | pipenv/utils.py | def escape_grouped_arguments(s):
"""Prepares a string for the shell (on Windows too!)
Only for use on grouped arguments (passed as a string to Popen)
"""
if s is None:
return None
# Additional escaping for windows paths
if os.name == "nt":
s = "{}".format(s.replace("\\", "\\\\"... | def escape_grouped_arguments(s):
"""Prepares a string for the shell (on Windows too!)
Only for use on grouped arguments (passed as a string to Popen)
"""
if s is None:
return None
# Additional escaping for windows paths
if os.name == "nt":
s = "{}".format(s.replace("\\", "\\\\"... | [
"Prepares",
"a",
"string",
"for",
"the",
"shell",
"(",
"on",
"Windows",
"too!",
")"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L208-L219 | [
"def",
"escape_grouped_arguments",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"None",
"# Additional escaping for windows paths",
"if",
"os",
".",
"name",
"==",
"\"nt\"",
":",
"s",
"=",
"\"{}\"",
".",
"format",
"(",
"s",
".",
"replace",
"("... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | venv_resolve_deps | Resolve dependencies for a pipenv project, acts as a portal to the target environment.
Regardless of whether a virtual environment is present or not, this will spawn
a subproces which is isolated to the target environment and which will perform
dependency resolution. This function reads the output of that... | pipenv/utils.py | def venv_resolve_deps(
deps,
which,
project,
pre=False,
clear=False,
allow_global=False,
pypi_mirror=None,
dev=False,
pipfile=None,
lockfile=None,
keep_outdated=False
):
"""
Resolve dependencies for a pipenv project, acts as a portal to the target environment.
Re... | def venv_resolve_deps(
deps,
which,
project,
pre=False,
clear=False,
allow_global=False,
pypi_mirror=None,
dev=False,
pipfile=None,
lockfile=None,
keep_outdated=False
):
"""
Resolve dependencies for a pipenv project, acts as a portal to the target environment.
Re... | [
"Resolve",
"dependencies",
"for",
"a",
"pipenv",
"project",
"acts",
"as",
"a",
"portal",
"to",
"the",
"target",
"environment",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L930-L1046 | [
"def",
"venv_resolve_deps",
"(",
"deps",
",",
"which",
",",
"project",
",",
"pre",
"=",
"False",
",",
"clear",
"=",
"False",
",",
"allow_global",
"=",
"False",
",",
"pypi_mirror",
"=",
"None",
",",
"dev",
"=",
"False",
",",
"pipfile",
"=",
"None",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | resolve_deps | Given a list of dependencies, return a resolved list of dependencies,
using pip-tools -- and their hashes, using the warehouse API / pip. | pipenv/utils.py | def resolve_deps(
deps,
which,
project,
sources=None,
python=False,
clear=False,
pre=False,
allow_global=False,
req_dir=None
):
"""Given a list of dependencies, return a resolved list of dependencies,
using pip-tools -- and their hashes, using the warehouse API / pip.
"""... | def resolve_deps(
deps,
which,
project,
sources=None,
python=False,
clear=False,
pre=False,
allow_global=False,
req_dir=None
):
"""Given a list of dependencies, return a resolved list of dependencies,
using pip-tools -- and their hashes, using the warehouse API / pip.
"""... | [
"Given",
"a",
"list",
"of",
"dependencies",
"return",
"a",
"resolved",
"list",
"of",
"dependencies",
"using",
"pip",
"-",
"tools",
"--",
"and",
"their",
"hashes",
"using",
"the",
"warehouse",
"API",
"/",
"pip",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1049-L1114 | [
"def",
"resolve_deps",
"(",
"deps",
",",
"which",
",",
"project",
",",
"sources",
"=",
"None",
",",
"python",
"=",
"False",
",",
"clear",
"=",
"False",
",",
"pre",
"=",
"False",
",",
"allow_global",
"=",
"False",
",",
"req_dir",
"=",
"None",
")",
":"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | convert_deps_to_pip | Converts a Pipfile-formatted dependency to a pip-formatted one. | pipenv/utils.py | def convert_deps_to_pip(deps, project=None, r=True, include_index=True):
""""Converts a Pipfile-formatted dependency to a pip-formatted one."""
from .vendor.requirementslib.models.requirements import Requirement
dependencies = []
for dep_name, dep in deps.items():
if project:
projec... | def convert_deps_to_pip(deps, project=None, r=True, include_index=True):
""""Converts a Pipfile-formatted dependency to a pip-formatted one."""
from .vendor.requirementslib.models.requirements import Requirement
dependencies = []
for dep_name, dep in deps.items():
if project:
projec... | [
"Converts",
"a",
"Pipfile",
"-",
"formatted",
"dependency",
"to",
"a",
"pip",
"-",
"formatted",
"one",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1127-L1149 | [
"def",
"convert_deps_to_pip",
"(",
"deps",
",",
"project",
"=",
"None",
",",
"r",
"=",
"True",
",",
"include_index",
"=",
"True",
")",
":",
"from",
".",
"vendor",
".",
"requirementslib",
".",
"models",
".",
"requirements",
"import",
"Requirement",
"dependenc... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_required_version | Check to see if there's a hard requirement for version
number provided in the Pipfile. | pipenv/utils.py | def is_required_version(version, specified_version):
"""Check to see if there's a hard requirement for version
number provided in the Pipfile.
"""
# Certain packages may be defined with multiple values.
if isinstance(specified_version, dict):
specified_version = specified_version.get("versio... | def is_required_version(version, specified_version):
"""Check to see if there's a hard requirement for version
number provided in the Pipfile.
"""
# Certain packages may be defined with multiple values.
if isinstance(specified_version, dict):
specified_version = specified_version.get("versio... | [
"Check",
"to",
"see",
"if",
"there",
"s",
"a",
"hard",
"requirement",
"for",
"version",
"number",
"provided",
"in",
"the",
"Pipfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1185-L1195 | [
"def",
"is_required_version",
"(",
"version",
",",
"specified_version",
")",
":",
"# Certain packages may be defined with multiple values.",
"if",
"isinstance",
"(",
"specified_version",
",",
"dict",
")",
":",
"specified_version",
"=",
"specified_version",
".",
"get",
"("... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_installable_file | Determine if a path can potentially be installed | pipenv/utils.py | def is_installable_file(path):
"""Determine if a path can potentially be installed"""
from .vendor.pip_shims.shims import is_installable_dir, is_archive_file
from .patched.notpip._internal.utils.packaging import specifiers
from ._compat import Path
if hasattr(path, "keys") and any(
key for ... | def is_installable_file(path):
"""Determine if a path can potentially be installed"""
from .vendor.pip_shims.shims import is_installable_dir, is_archive_file
from .patched.notpip._internal.utils.packaging import specifiers
from ._compat import Path
if hasattr(path, "keys") and any(
key for ... | [
"Determine",
"if",
"a",
"path",
"can",
"potentially",
"be",
"installed"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1206-L1241 | [
"def",
"is_installable_file",
"(",
"path",
")",
":",
"from",
".",
"vendor",
".",
"pip_shims",
".",
"shims",
"import",
"is_installable_dir",
",",
"is_archive_file",
"from",
".",
"patched",
".",
"notpip",
".",
"_internal",
".",
"utils",
".",
"packaging",
"import... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_file | Determine if a package name is for a File dependency. | pipenv/utils.py | def is_file(package):
"""Determine if a package name is for a File dependency."""
if hasattr(package, "keys"):
return any(key for key in package.keys() if key in ["file", "path"])
if os.path.exists(str(package)):
return True
for start in SCHEME_LIST:
if str(package).startswith(... | def is_file(package):
"""Determine if a package name is for a File dependency."""
if hasattr(package, "keys"):
return any(key for key in package.keys() if key in ["file", "path"])
if os.path.exists(str(package)):
return True
for start in SCHEME_LIST:
if str(package).startswith(... | [
"Determine",
"if",
"a",
"package",
"name",
"is",
"for",
"a",
"File",
"dependency",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1244-L1256 | [
"def",
"is_file",
"(",
"package",
")",
":",
"if",
"hasattr",
"(",
"package",
",",
"\"keys\"",
")",
":",
"return",
"any",
"(",
"key",
"for",
"key",
"in",
"package",
".",
"keys",
"(",
")",
"if",
"key",
"in",
"[",
"\"file\"",
",",
"\"path\"",
"]",
")"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pep423_name | Normalize package name to PEP 423 style standard. | pipenv/utils.py | def pep423_name(name):
"""Normalize package name to PEP 423 style standard."""
name = name.lower()
if any(i not in name for i in (VCS_LIST + SCHEME_LIST)):
return name.replace("_", "-")
else:
return name | def pep423_name(name):
"""Normalize package name to PEP 423 style standard."""
name = name.lower()
if any(i not in name for i in (VCS_LIST + SCHEME_LIST)):
return name.replace("_", "-")
else:
return name | [
"Normalize",
"package",
"name",
"to",
"PEP",
"423",
"style",
"standard",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1267-L1274 | [
"def",
"pep423_name",
"(",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"any",
"(",
"i",
"not",
"in",
"name",
"for",
"i",
"in",
"(",
"VCS_LIST",
"+",
"SCHEME_LIST",
")",
")",
":",
"return",
"name",
".",
"replace",
"(",
"\"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | proper_case | Properly case project name from pypi.org. | pipenv/utils.py | def proper_case(package_name):
"""Properly case project name from pypi.org."""
# Hit the simple API.
r = _get_requests_session().get(
"https://pypi.org/pypi/{0}/json".format(package_name), timeout=0.3, stream=True
)
if not r.ok:
raise IOError(
"Unable to find package {0} ... | def proper_case(package_name):
"""Properly case project name from pypi.org."""
# Hit the simple API.
r = _get_requests_session().get(
"https://pypi.org/pypi/{0}/json".format(package_name), timeout=0.3, stream=True
)
if not r.ok:
raise IOError(
"Unable to find package {0} ... | [
"Properly",
"case",
"project",
"name",
"from",
"pypi",
".",
"org",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1277-L1290 | [
"def",
"proper_case",
"(",
"package_name",
")",
":",
"# Hit the simple API.",
"r",
"=",
"_get_requests_session",
"(",
")",
".",
"get",
"(",
"\"https://pypi.org/pypi/{0}/json\"",
".",
"format",
"(",
"package_name",
")",
",",
"timeout",
"=",
"0.3",
",",
"stream",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | find_windows_executable | Given an executable name, search the given location for an executable | pipenv/utils.py | def find_windows_executable(bin_path, exe_name):
"""Given an executable name, search the given location for an executable"""
requested_path = get_windows_path(bin_path, exe_name)
if os.path.isfile(requested_path):
return requested_path
try:
pathext = os.environ["PATHEXT"]
except Key... | def find_windows_executable(bin_path, exe_name):
"""Given an executable name, search the given location for an executable"""
requested_path = get_windows_path(bin_path, exe_name)
if os.path.isfile(requested_path):
return requested_path
try:
pathext = os.environ["PATHEXT"]
except Key... | [
"Given",
"an",
"executable",
"name",
"search",
"the",
"given",
"location",
"for",
"an",
"executable"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1300-L1316 | [
"def",
"find_windows_executable",
"(",
"bin_path",
",",
"exe_name",
")",
":",
"requested_path",
"=",
"get_windows_path",
"(",
"bin_path",
",",
"exe_name",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"requested_path",
")",
":",
"return",
"requested_path",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_canonical_names | Canonicalize a list of packages and return a set of canonical names | pipenv/utils.py | def get_canonical_names(packages):
"""Canonicalize a list of packages and return a set of canonical names"""
from .vendor.packaging.utils import canonicalize_name
if not isinstance(packages, Sequence):
if not isinstance(packages, six.string_types):
return packages
packages = [pa... | def get_canonical_names(packages):
"""Canonicalize a list of packages and return a set of canonical names"""
from .vendor.packaging.utils import canonicalize_name
if not isinstance(packages, Sequence):
if not isinstance(packages, six.string_types):
return packages
packages = [pa... | [
"Canonicalize",
"a",
"list",
"of",
"packages",
"and",
"return",
"a",
"set",
"of",
"canonical",
"names"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1337-L1345 | [
"def",
"get_canonical_names",
"(",
"packages",
")",
":",
"from",
".",
"vendor",
".",
"packaging",
".",
"utils",
"import",
"canonicalize_name",
"if",
"not",
"isinstance",
"(",
"packages",
",",
"Sequence",
")",
":",
"if",
"not",
"isinstance",
"(",
"packages",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | find_requirements | Returns the path of a Pipfile in parent directories. | pipenv/utils.py | def find_requirements(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if "requirements.txt":
r = os.path.join(c, "requirements.txt")
if os.path.isfile(r):
... | def find_requirements(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if "requirements.txt":
r = os.path.join(c, "requirements.txt")
if os.path.isfile(r):
... | [
"Returns",
"the",
"path",
"of",
"a",
"Pipfile",
"in",
"parent",
"directories",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1376-L1387 | [
"def",
"find_requirements",
"(",
"max_depth",
"=",
"3",
")",
":",
"i",
"=",
"0",
"for",
"c",
",",
"d",
",",
"f",
"in",
"walk_up",
"(",
"os",
".",
"getcwd",
"(",
")",
")",
":",
"i",
"+=",
"1",
"if",
"i",
"<",
"max_depth",
":",
"if",
"\"requireme... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | temp_environ | Allow the ability to set os.environ temporarily | pipenv/utils.py | def temp_environ():
"""Allow the ability to set os.environ temporarily"""
environ = dict(os.environ)
try:
yield
finally:
os.environ.clear()
os.environ.update(environ) | def temp_environ():
"""Allow the ability to set os.environ temporarily"""
environ = dict(os.environ)
try:
yield
finally:
os.environ.clear()
os.environ.update(environ) | [
"Allow",
"the",
"ability",
"to",
"set",
"os",
".",
"environ",
"temporarily"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1393-L1401 | [
"def",
"temp_environ",
"(",
")",
":",
"environ",
"=",
"dict",
"(",
"os",
".",
"environ",
")",
"try",
":",
"yield",
"finally",
":",
"os",
".",
"environ",
".",
"clear",
"(",
")",
"os",
".",
"environ",
".",
"update",
"(",
"environ",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | temp_path | Allow the ability to set os.environ temporarily | pipenv/utils.py | def temp_path():
"""Allow the ability to set os.environ temporarily"""
path = [p for p in sys.path]
try:
yield
finally:
sys.path = [p for p in path] | def temp_path():
"""Allow the ability to set os.environ temporarily"""
path = [p for p in sys.path]
try:
yield
finally:
sys.path = [p for p in path] | [
"Allow",
"the",
"ability",
"to",
"set",
"os",
".",
"environ",
"temporarily"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1405-L1411 | [
"def",
"temp_path",
"(",
")",
":",
"path",
"=",
"[",
"p",
"for",
"p",
"in",
"sys",
".",
"path",
"]",
"try",
":",
"yield",
"finally",
":",
"sys",
".",
"path",
"=",
"[",
"p",
"for",
"p",
"in",
"path",
"]"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_valid_url | Checks if a given string is an url | pipenv/utils.py | def is_valid_url(url):
"""Checks if a given string is an url"""
pieces = urlparse(url)
return all([pieces.scheme, pieces.netloc]) | def is_valid_url(url):
"""Checks if a given string is an url"""
pieces = urlparse(url)
return all([pieces.scheme, pieces.netloc]) | [
"Checks",
"if",
"a",
"given",
"string",
"is",
"an",
"url"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1427-L1430 | [
"def",
"is_valid_url",
"(",
"url",
")",
":",
"pieces",
"=",
"urlparse",
"(",
"url",
")",
"return",
"all",
"(",
"[",
"pieces",
".",
"scheme",
",",
"pieces",
".",
"netloc",
"]",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | download_file | Downloads file from url to a path with filename | pipenv/utils.py | def download_file(url, filename):
"""Downloads file from url to a path with filename"""
r = _get_requests_session().get(url, stream=True)
if not r.ok:
raise IOError("Unable to download file")
with open(filename, "wb") as f:
f.write(r.content) | def download_file(url, filename):
"""Downloads file from url to a path with filename"""
r = _get_requests_session().get(url, stream=True)
if not r.ok:
raise IOError("Unable to download file")
with open(filename, "wb") as f:
f.write(r.content) | [
"Downloads",
"file",
"from",
"url",
"to",
"a",
"path",
"with",
"filename"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1451-L1458 | [
"def",
"download_file",
"(",
"url",
",",
"filename",
")",
":",
"r",
"=",
"_get_requests_session",
"(",
")",
".",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
"if",
"not",
"r",
".",
"ok",
":",
"raise",
"IOError",
"(",
"\"Unable to download file\"",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | normalize_drive | Normalize drive in path so they stay consistent.
This currently only affects local drives on Windows, which can be
identified with either upper or lower cased drive names. The case is
always converted to uppercase because it seems to be preferred.
See: <https://github.com/pypa/pipenv/issues/1218> | pipenv/utils.py | def normalize_drive(path):
"""Normalize drive in path so they stay consistent.
This currently only affects local drives on Windows, which can be
identified with either upper or lower cased drive names. The case is
always converted to uppercase because it seems to be preferred.
See: <https://github... | def normalize_drive(path):
"""Normalize drive in path so they stay consistent.
This currently only affects local drives on Windows, which can be
identified with either upper or lower cased drive names. The case is
always converted to uppercase because it seems to be preferred.
See: <https://github... | [
"Normalize",
"drive",
"in",
"path",
"so",
"they",
"stay",
"consistent",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1461-L1478 | [
"def",
"normalize_drive",
"(",
"path",
")",
":",
"if",
"os",
".",
"name",
"!=",
"\"nt\"",
"or",
"not",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"return",
"path",
"drive",
",",
"tail",
"=",
"os",
".",
"path",
".",
"splitdr... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_readonly_path | Check if a provided path exists and is readonly.
Permissions check is `bool(path.stat & stat.S_IREAD)` or `not os.access(path, os.W_OK)` | pipenv/utils.py | def is_readonly_path(fn):
"""Check if a provided path exists and is readonly.
Permissions check is `bool(path.stat & stat.S_IREAD)` or `not os.access(path, os.W_OK)`
"""
if os.path.exists(fn):
return (os.stat(fn).st_mode & stat.S_IREAD) or not os.access(fn, os.W_OK)
return False | def is_readonly_path(fn):
"""Check if a provided path exists and is readonly.
Permissions check is `bool(path.stat & stat.S_IREAD)` or `not os.access(path, os.W_OK)`
"""
if os.path.exists(fn):
return (os.stat(fn).st_mode & stat.S_IREAD) or not os.access(fn, os.W_OK)
return False | [
"Check",
"if",
"a",
"provided",
"path",
"exists",
"and",
"is",
"readonly",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1481-L1489 | [
"def",
"is_readonly_path",
"(",
"fn",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fn",
")",
":",
"return",
"(",
"os",
".",
"stat",
"(",
"fn",
")",
".",
"st_mode",
"&",
"stat",
".",
"S_IREAD",
")",
"or",
"not",
"os",
".",
"access",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | handle_remove_readonly | Error handler for shutil.rmtree.
Windows source repo folders are read-only by default, so this error handler
attempts to set them as writeable and then proceed with deletion. | pipenv/utils.py | def handle_remove_readonly(func, path, exc):
"""Error handler for shutil.rmtree.
Windows source repo folders are read-only by default, so this error handler
attempts to set them as writeable and then proceed with deletion."""
# Check for read-only attribute
default_warning_message = (
"Unab... | def handle_remove_readonly(func, path, exc):
"""Error handler for shutil.rmtree.
Windows source repo folders are read-only by default, so this error handler
attempts to set them as writeable and then proceed with deletion."""
# Check for read-only attribute
default_warning_message = (
"Unab... | [
"Error",
"handler",
"for",
"shutil",
".",
"rmtree",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1505-L1530 | [
"def",
"handle_remove_readonly",
"(",
"func",
",",
"path",
",",
"exc",
")",
":",
"# Check for read-only attribute",
"default_warning_message",
"=",
"(",
"\"Unable to remove file due to permissions restriction: {!r}\"",
")",
"# split the initial exception out into its type, exception,... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | safe_expandvars | Call os.path.expandvars if value is a string, otherwise do nothing. | pipenv/utils.py | def safe_expandvars(value):
"""Call os.path.expandvars if value is a string, otherwise do nothing.
"""
if isinstance(value, six.string_types):
return os.path.expandvars(value)
return value | def safe_expandvars(value):
"""Call os.path.expandvars if value is a string, otherwise do nothing.
"""
if isinstance(value, six.string_types):
return os.path.expandvars(value)
return value | [
"Call",
"os",
".",
"path",
".",
"expandvars",
"if",
"value",
"is",
"a",
"string",
"otherwise",
"do",
"nothing",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1539-L1544 | [
"def",
"safe_expandvars",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"return",
"os",
".",
"path",
".",
"expandvars",
"(",
"value",
")",
"return",
"value"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.