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 | _is_unpacked_egg | Determine if given path appears to be an unpacked egg. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _is_unpacked_egg(path):
"""
Determine if given path appears to be an unpacked egg.
"""
return (
_is_egg_path(path) and
os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO'))
) | def _is_unpacked_egg(path):
"""
Determine if given path appears to be an unpacked egg.
"""
return (
_is_egg_path(path) and
os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO'))
) | [
"Determine",
"if",
"given",
"path",
"appears",
"to",
"be",
"an",
"unpacked",
"egg",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2263-L2270 | [
"def",
"_is_unpacked_egg",
"(",
"path",
")",
":",
"return",
"(",
"_is_egg_path",
"(",
"path",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'EGG-INFO'",
",",
"'PKG-INFO'",
")",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _version_from_file | Given an iterable of lines from a Metadata file, return
the value of the Version field, if present, or None otherwise. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _version_from_file(lines):
"""
Given an iterable of lines from a Metadata file, return
the value of the Version field, if present, or None otherwise.
"""
def is_version_line(line):
return line.lower().startswith('version:')
version_lines = filter(is_version_line, lines)
line = ne... | def _version_from_file(lines):
"""
Given an iterable of lines from a Metadata file, return
the value of the Version field, if present, or None otherwise.
"""
def is_version_line(line):
return line.lower().startswith('version:')
version_lines = filter(is_version_line, lines)
line = ne... | [
"Given",
"an",
"iterable",
"of",
"lines",
"from",
"a",
"Metadata",
"file",
"return",
"the",
"value",
"of",
"the",
"Version",
"field",
"if",
"present",
"or",
"None",
"otherwise",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2451-L2461 | [
"def",
"_version_from_file",
"(",
"lines",
")",
":",
"def",
"is_version_line",
"(",
"line",
")",
":",
"return",
"line",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"'version:'",
")",
"version_lines",
"=",
"filter",
"(",
"is_version_line",
",",
"lines",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse_requirements | Yield ``Requirement`` objects for each specification in `strs`
`strs` must be a string, or a (possibly-nested) iterable thereof. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs`
`strs` must be a string, or a (possibly-nested) iterable thereof.
"""
# create a steppable iterator, so we can handle \-continuations
lines = iter(yield_lines(strs))
for line in lines:
# Dro... | def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs`
`strs` must be a string, or a (possibly-nested) iterable thereof.
"""
# create a steppable iterator, so we can handle \-continuations
lines = iter(yield_lines(strs))
for line in lines:
# Dro... | [
"Yield",
"Requirement",
"objects",
"for",
"each",
"specification",
"in",
"strs"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2951-L2970 | [
"def",
"parse_requirements",
"(",
"strs",
")",
":",
"# create a steppable iterator, so we can handle \\-continuations",
"lines",
"=",
"iter",
"(",
"yield_lines",
"(",
"strs",
")",
")",
"for",
"line",
"in",
"lines",
":",
"# Drop comments -- a hash without a space may be in a... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _find_adapter | Return an adapter factory for `ob` from `registry` | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _find_adapter(registry, ob):
"""Return an adapter factory for `ob` from `registry`"""
types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob))))
for t in types:
if t in registry:
return registry[t] | def _find_adapter(registry, ob):
"""Return an adapter factory for `ob` from `registry`"""
types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob))))
for t in types:
if t in registry:
return registry[t] | [
"Return",
"an",
"adapter",
"factory",
"for",
"ob",
"from",
"registry"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3037-L3042 | [
"def",
"_find_adapter",
"(",
"registry",
",",
"ob",
")",
":",
"types",
"=",
"_always_object",
"(",
"inspect",
".",
"getmro",
"(",
"getattr",
"(",
"ob",
",",
"'__class__'",
",",
"type",
"(",
"ob",
")",
")",
")",
")",
"for",
"t",
"in",
"types",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ensure_directory | Ensure that the parent directory of `path` exists | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def ensure_directory(path):
"""Ensure that the parent directory of `path` exists"""
dirname = os.path.dirname(path)
py31compat.makedirs(dirname, exist_ok=True) | def ensure_directory(path):
"""Ensure that the parent directory of `path` exists"""
dirname = os.path.dirname(path)
py31compat.makedirs(dirname, exist_ok=True) | [
"Ensure",
"that",
"the",
"parent",
"directory",
"of",
"path",
"exists"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3045-L3048 | [
"def",
"ensure_directory",
"(",
"path",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"py31compat",
".",
"makedirs",
"(",
"dirname",
",",
"exist_ok",
"=",
"True",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | split_sections | Split a string or iterable thereof into (section, content) pairs
Each ``section`` is a stripped version of the section header ("[section]")
and each ``content`` is a list of stripped lines excluding blank lines and
comment-only lines. If there are any such lines before the first section
header, they'r... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def split_sections(s):
"""Split a string or iterable thereof into (section, content) pairs
Each ``section`` is a stripped version of the section header ("[section]")
and each ``content`` is a list of stripped lines excluding blank lines and
comment-only lines. If there are any such lines before the fi... | def split_sections(s):
"""Split a string or iterable thereof into (section, content) pairs
Each ``section`` is a stripped version of the section header ("[section]")
and each ``content`` is a list of stripped lines excluding blank lines and
comment-only lines. If there are any such lines before the fi... | [
"Split",
"a",
"string",
"or",
"iterable",
"thereof",
"into",
"(",
"section",
"content",
")",
"pairs"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3064-L3087 | [
"def",
"split_sections",
"(",
"s",
")",
":",
"section",
"=",
"None",
"content",
"=",
"[",
"]",
"for",
"line",
"in",
"yield_lines",
"(",
"s",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"[\"",
")",
":",
"if",
"line",
".",
"endswith",
"(",
"\"]... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | VersionConflict.with_context | If required_by is non-empty, return a version of self that is a
ContextualVersionConflict. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def with_context(self, required_by):
"""
If required_by is non-empty, return a version of self that is a
ContextualVersionConflict.
"""
if not required_by:
return self
args = self.args + (required_by,)
return ContextualVersionConflict(*args) | def with_context(self, required_by):
"""
If required_by is non-empty, return a version of self that is a
ContextualVersionConflict.
"""
if not required_by:
return self
args = self.args + (required_by,)
return ContextualVersionConflict(*args) | [
"If",
"required_by",
"is",
"non",
"-",
"empty",
"return",
"a",
"version",
"of",
"self",
"that",
"is",
"a",
"ContextualVersionConflict",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L277-L285 | [
"def",
"with_context",
"(",
"self",
",",
"required_by",
")",
":",
"if",
"not",
"required_by",
":",
"return",
"self",
"args",
"=",
"self",
".",
"args",
"+",
"(",
"required_by",
",",
")",
"return",
"ContextualVersionConflict",
"(",
"*",
"args",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet._build_master | Prepare the master working set. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _build_master(cls):
"""
Prepare the master working set.
"""
ws = cls()
try:
from __main__ import __requires__
except ImportError:
# The main program does not list any requirements
return ws
# ensure the requirements are met... | def _build_master(cls):
"""
Prepare the master working set.
"""
ws = cls()
try:
from __main__ import __requires__
except ImportError:
# The main program does not list any requirements
return ws
# ensure the requirements are met... | [
"Prepare",
"the",
"master",
"working",
"set",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L568-L585 | [
"def",
"_build_master",
"(",
"cls",
")",
":",
"ws",
"=",
"cls",
"(",
")",
"try",
":",
"from",
"__main__",
"import",
"__requires__",
"except",
"ImportError",
":",
"# The main program does not list any requirements",
"return",
"ws",
"# ensure the requirements are met",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet._build_from_requirements | Build a working set from a requirement spec. Rewrites sys.path. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _build_from_requirements(cls, req_spec):
"""
Build a working set from a requirement spec. Rewrites sys.path.
"""
# try it without defaults already on sys.path
# by starting with an empty path
ws = cls([])
reqs = parse_requirements(req_spec)
dists = ws.... | def _build_from_requirements(cls, req_spec):
"""
Build a working set from a requirement spec. Rewrites sys.path.
"""
# try it without defaults already on sys.path
# by starting with an empty path
ws = cls([])
reqs = parse_requirements(req_spec)
dists = ws.... | [
"Build",
"a",
"working",
"set",
"from",
"a",
"requirement",
"spec",
".",
"Rewrites",
"sys",
".",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L588-L607 | [
"def",
"_build_from_requirements",
"(",
"cls",
",",
"req_spec",
")",
":",
"# try it without defaults already on sys.path",
"# by starting with an empty path",
"ws",
"=",
"cls",
"(",
"[",
"]",
")",
"reqs",
"=",
"parse_requirements",
"(",
"req_spec",
")",
"dists",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet.add_entry | Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already present.
(This is because ``sys.path... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def add_entry(self, entry):
"""Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already prese... | def add_entry(self, entry):
"""Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already prese... | [
"Add",
"a",
"path",
"item",
"to",
".",
"entries",
"finding",
"any",
"distributions",
"on",
"it"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L609-L622 | [
"def",
"add_entry",
"(",
"self",
",",
"entry",
")",
":",
"self",
".",
"entry_keys",
".",
"setdefault",
"(",
"entry",
",",
"[",
"]",
")",
"self",
".",
"entries",
".",
"append",
"(",
"entry",
")",
"for",
"dist",
"in",
"find_distributions",
"(",
"entry",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet.iter_entry_points | Yield entry point objects from `group` matching `name`
If `name` is None, yields all entry points in `group` from all
distributions in the working set, otherwise only ones matching
both `group` and `name` are yielded (in distribution order). | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def iter_entry_points(self, group, name=None):
"""Yield entry point objects from `group` matching `name`
If `name` is None, yields all entry points in `group` from all
distributions in the working set, otherwise only ones matching
both `group` and `name` are yielded (in distribution ord... | def iter_entry_points(self, group, name=None):
"""Yield entry point objects from `group` matching `name`
If `name` is None, yields all entry points in `group` from all
distributions in the working set, otherwise only ones matching
both `group` and `name` are yielded (in distribution ord... | [
"Yield",
"entry",
"point",
"objects",
"from",
"group",
"matching",
"name"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L644-L656 | [
"def",
"iter_entry_points",
"(",
"self",
",",
"group",
",",
"name",
"=",
"None",
")",
":",
"return",
"(",
"entry",
"for",
"dist",
"in",
"self",
"for",
"entry",
"in",
"dist",
".",
"get_entry_map",
"(",
"group",
")",
".",
"values",
"(",
")",
"if",
"nam... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet.run_script | Locate distribution for `requires` and run `script_name` script | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def run_script(self, requires, script_name):
"""Locate distribution for `requires` and run `script_name` script"""
ns = sys._getframe(1).f_globals
name = ns['__name__']
ns.clear()
ns['__name__'] = name
self.require(requires)[0].run_script(script_name, ns) | def run_script(self, requires, script_name):
"""Locate distribution for `requires` and run `script_name` script"""
ns = sys._getframe(1).f_globals
name = ns['__name__']
ns.clear()
ns['__name__'] = name
self.require(requires)[0].run_script(script_name, ns) | [
"Locate",
"distribution",
"for",
"requires",
"and",
"run",
"script_name",
"script"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L658-L664 | [
"def",
"run_script",
"(",
"self",
",",
"requires",
",",
"script_name",
")",
":",
"ns",
"=",
"sys",
".",
"_getframe",
"(",
"1",
")",
".",
"f_globals",
"name",
"=",
"ns",
"[",
"'__name__'",
"]",
"ns",
".",
"clear",
"(",
")",
"ns",
"[",
"'__name__'",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet.require | Ensure that distributions matching `requirements` are activated
`requirements` must be a string or a (possibly-nested) sequence
thereof, specifying the distributions and versions required. The
return value is a sequence of the distributions that needed to be
activated to fulfill the re... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def require(self, *requirements):
"""Ensure that distributions matching `requirements` are activated
`requirements` must be a string or a (possibly-nested) sequence
thereof, specifying the distributions and versions required. The
return value is a sequence of the distributions that nee... | def require(self, *requirements):
"""Ensure that distributions matching `requirements` are activated
`requirements` must be a string or a (possibly-nested) sequence
thereof, specifying the distributions and versions required. The
return value is a sequence of the distributions that nee... | [
"Ensure",
"that",
"distributions",
"matching",
"requirements",
"are",
"activated"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L889-L903 | [
"def",
"require",
"(",
"self",
",",
"*",
"requirements",
")",
":",
"needed",
"=",
"self",
".",
"resolve",
"(",
"parse_requirements",
"(",
"requirements",
")",
")",
"for",
"dist",
"in",
"needed",
":",
"self",
".",
"add",
"(",
"dist",
")",
"return",
"nee... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | WorkingSet.subscribe | Invoke `callback` for all distributions
If `existing=True` (default),
call on all existing ones, as well. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def subscribe(self, callback, existing=True):
"""Invoke `callback` for all distributions
If `existing=True` (default),
call on all existing ones, as well.
"""
if callback in self.callbacks:
return
self.callbacks.append(callback)
if not existing:
... | def subscribe(self, callback, existing=True):
"""Invoke `callback` for all distributions
If `existing=True` (default),
call on all existing ones, as well.
"""
if callback in self.callbacks:
return
self.callbacks.append(callback)
if not existing:
... | [
"Invoke",
"callback",
"for",
"all",
"distributions"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L905-L917 | [
"def",
"subscribe",
"(",
"self",
",",
"callback",
",",
"existing",
"=",
"True",
")",
":",
"if",
"callback",
"in",
"self",
".",
"callbacks",
":",
"return",
"self",
".",
"callbacks",
".",
"append",
"(",
"callback",
")",
"if",
"not",
"existing",
":",
"ret... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _ReqExtras.markers_pass | Evaluate markers for req against each extra that
demanded it.
Return False if the req has a marker and fails
evaluation. Otherwise, return True. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def markers_pass(self, req, extras=None):
"""
Evaluate markers for req against each extra that
demanded it.
Return False if the req has a marker and fails
evaluation. Otherwise, return True.
"""
extra_evals = (
req.marker.evaluate({'extra': extra})
... | def markers_pass(self, req, extras=None):
"""
Evaluate markers for req against each extra that
demanded it.
Return False if the req has a marker and fails
evaluation. Otherwise, return True.
"""
extra_evals = (
req.marker.evaluate({'extra': extra})
... | [
"Evaluate",
"markers",
"for",
"req",
"against",
"each",
"extra",
"that",
"demanded",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L942-L954 | [
"def",
"markers_pass",
"(",
"self",
",",
"req",
",",
"extras",
"=",
"None",
")",
":",
"extra_evals",
"=",
"(",
"req",
".",
"marker",
".",
"evaluate",
"(",
"{",
"'extra'",
":",
"extra",
"}",
")",
"for",
"extra",
"in",
"self",
".",
"get",
"(",
"req",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.scan | Scan `search_path` for distributions usable in this environment
Any distributions found are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used. Only distributions conforming to
the platform/python version defined a... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def scan(self, search_path=None):
"""Scan `search_path` for distributions usable in this environment
Any distributions found are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used. Only distributions conforming to
... | def scan(self, search_path=None):
"""Scan `search_path` for distributions usable in this environment
Any distributions found are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used. Only distributions conforming to
... | [
"Scan",
"search_path",
"for",
"distributions",
"usable",
"in",
"this",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1002-L1015 | [
"def",
"scan",
"(",
"self",
",",
"search_path",
"=",
"None",
")",
":",
"if",
"search_path",
"is",
"None",
":",
"search_path",
"=",
"sys",
".",
"path",
"for",
"item",
"in",
"search_path",
":",
"for",
"dist",
"in",
"find_distributions",
"(",
"item",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.add | Add `dist` if we ``can_add()`` it and it has not already been added | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def add(self, dist):
"""Add `dist` if we ``can_add()`` it and it has not already been added
"""
if self.can_add(dist) and dist.has_version():
dists = self._distmap.setdefault(dist.key, [])
if dist not in dists:
dists.append(dist)
dists.sort... | def add(self, dist):
"""Add `dist` if we ``can_add()`` it and it has not already been added
"""
if self.can_add(dist) and dist.has_version():
dists = self._distmap.setdefault(dist.key, [])
if dist not in dists:
dists.append(dist)
dists.sort... | [
"Add",
"dist",
"if",
"we",
"can_add",
"()",
"it",
"and",
"it",
"has",
"not",
"already",
"been",
"added"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1028-L1035 | [
"def",
"add",
"(",
"self",
",",
"dist",
")",
":",
"if",
"self",
".",
"can_add",
"(",
"dist",
")",
"and",
"dist",
".",
"has_version",
"(",
")",
":",
"dists",
"=",
"self",
".",
"_distmap",
".",
"setdefault",
"(",
"dist",
".",
"key",
",",
"[",
"]",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.best_match | Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
``VersionConflict`` if an unsuitable version of the project is already
active in the specified... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def best_match(
self, req, working_set, installer=None, replace_conflicting=False):
"""Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
... | def best_match(
self, req, working_set, installer=None, replace_conflicting=False):
"""Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
... | [
"Find",
"distribution",
"best",
"matching",
"req",
"and",
"usable",
"on",
"working_set"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1037-L1063 | [
"def",
"best_match",
"(",
"self",
",",
"req",
",",
"working_set",
",",
"installer",
"=",
"None",
",",
"replace_conflicting",
"=",
"False",
")",
":",
"try",
":",
"dist",
"=",
"working_set",
".",
"find",
"(",
"req",
")",
"except",
"VersionConflict",
":",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ResourceManager.extraction_error | Give an error message for problems extracting file(s) | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def extraction_error(self):
"""Give an error message for problems extracting file(s)"""
old_exc = sys.exc_info()[1]
cache_path = self.extraction_path or get_default_cache()
tmpl = textwrap.dedent("""
Can't extract file(s) to egg cache
The following error occurr... | def extraction_error(self):
"""Give an error message for problems extracting file(s)"""
old_exc = sys.exc_info()[1]
cache_path = self.extraction_path or get_default_cache()
tmpl = textwrap.dedent("""
Can't extract file(s) to egg cache
The following error occurr... | [
"Give",
"an",
"error",
"message",
"for",
"problems",
"extracting",
"file",
"(",
"s",
")"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1164-L1190 | [
"def",
"extraction_error",
"(",
"self",
")",
":",
"old_exc",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"cache_path",
"=",
"self",
".",
"extraction_path",
"or",
"get_default_cache",
"(",
")",
"tmpl",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ResourceManager._warn_unsafe_extraction_path | If the default extraction path is overridden and set to an insecure
location, such as /tmp, it opens up an opportunity for an attacker to
replace an extracted file with an unauthorized payload. Warn the user
if a known insecure location is used.
See Distribute #375 for more details. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _warn_unsafe_extraction_path(path):
"""
If the default extraction path is overridden and set to an insecure
location, such as /tmp, it opens up an opportunity for an attacker to
replace an extracted file with an unauthorized payload. Warn the user
if a known insecure location... | def _warn_unsafe_extraction_path(path):
"""
If the default extraction path is overridden and set to an insecure
location, such as /tmp, it opens up an opportunity for an attacker to
replace an extracted file with an unauthorized payload. Warn the user
if a known insecure location... | [
"If",
"the",
"default",
"extraction",
"path",
"is",
"overridden",
"and",
"set",
"to",
"an",
"insecure",
"location",
"such",
"as",
"/",
"tmp",
"it",
"opens",
"up",
"an",
"opportunity",
"for",
"an",
"attacker",
"to",
"replace",
"an",
"extracted",
"file",
"wi... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1218-L1241 | [
"def",
"_warn_unsafe_extraction_path",
"(",
"path",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
"and",
"not",
"path",
".",
"startswith",
"(",
"os",
".",
"environ",
"[",
"'windir'",
"]",
")",
":",
"# On Windows, permissions are generally restrictive by default... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ResourceManager.postprocess | Perform any platform-specific postprocessing of `tempname`
This is where Mac header rewrites should be done; other platforms don't
have anything special they should do.
Resource providers should call this method ONLY after successfully
extracting a compressed resource. They must NOT c... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def postprocess(self, tempname, filename):
"""Perform any platform-specific postprocessing of `tempname`
This is where Mac header rewrites should be done; other platforms don't
have anything special they should do.
Resource providers should call this method ONLY after successfully
... | def postprocess(self, tempname, filename):
"""Perform any platform-specific postprocessing of `tempname`
This is where Mac header rewrites should be done; other platforms don't
have anything special they should do.
Resource providers should call this method ONLY after successfully
... | [
"Perform",
"any",
"platform",
"-",
"specific",
"postprocessing",
"of",
"tempname"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1243-L1261 | [
"def",
"postprocess",
"(",
"self",
",",
"tempname",
",",
"filename",
")",
":",
"if",
"os",
".",
"name",
"==",
"'posix'",
":",
"# Make the resource executable",
"mode",
"=",
"(",
"(",
"os",
".",
"stat",
"(",
"tempname",
")",
".",
"st_mode",
")",
"|",
"0... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ZipManifests.build | Build a dictionary similar to the zipimport directory
caches, except instead of tuples, store ZipInfo objects.
Use a platform-specific path separator (os.sep) for the path keys
for compatibility with pypy on Windows. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def build(cls, path):
"""
Build a dictionary similar to the zipimport directory
caches, except instead of tuples, store ZipInfo objects.
Use a platform-specific path separator (os.sep) for the path keys
for compatibility with pypy on Windows.
"""
with zipfile.Zip... | def build(cls, path):
"""
Build a dictionary similar to the zipimport directory
caches, except instead of tuples, store ZipInfo objects.
Use a platform-specific path separator (os.sep) for the path keys
for compatibility with pypy on Windows.
"""
with zipfile.Zip... | [
"Build",
"a",
"dictionary",
"similar",
"to",
"the",
"zipimport",
"directory",
"caches",
"except",
"instead",
"of",
"tuples",
"store",
"ZipInfo",
"objects",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1562-L1578 | [
"def",
"build",
"(",
"cls",
",",
"path",
")",
":",
"with",
"zipfile",
".",
"ZipFile",
"(",
"path",
")",
"as",
"zfile",
":",
"items",
"=",
"(",
"(",
"name",
".",
"replace",
"(",
"'/'",
",",
"os",
".",
"sep",
")",
",",
"zfile",
".",
"getinfo",
"(... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | MemoizedZipManifests.load | Load a manifest at path or return a suitable manifest already loaded. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def load(self, path):
"""
Load a manifest at path or return a suitable manifest already loaded.
"""
path = os.path.normpath(path)
mtime = os.stat(path).st_mtime
if path not in self or self[path].mtime != mtime:
manifest = self.build(path)
self[pat... | def load(self, path):
"""
Load a manifest at path or return a suitable manifest already loaded.
"""
path = os.path.normpath(path)
mtime = os.stat(path).st_mtime
if path not in self or self[path].mtime != mtime:
manifest = self.build(path)
self[pat... | [
"Load",
"a",
"manifest",
"at",
"path",
"or",
"return",
"a",
"suitable",
"manifest",
"already",
"loaded",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1589-L1600 | [
"def",
"load",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"path",
")",
"mtime",
"=",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mtime",
"if",
"path",
"not",
"in",
"self",
"or",
"self",
"[",
"pat... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ZipProvider._is_current | Return True if the file_path is current for this zip_path | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _is_current(self, file_path, zip_path):
"""
Return True if the file_path is current for this zip_path
"""
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
if not os.path.isfile(file_path):
return False
stat = os.stat(file_path)
if ... | def _is_current(self, file_path, zip_path):
"""
Return True if the file_path is current for this zip_path
"""
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
if not os.path.isfile(file_path):
return False
stat = os.stat(file_path)
if ... | [
"Return",
"True",
"if",
"the",
"file_path",
"is",
"current",
"for",
"this",
"zip_path"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1716-L1730 | [
"def",
"_is_current",
"(",
"self",
",",
"file_path",
",",
"zip_path",
")",
":",
"timestamp",
",",
"size",
"=",
"self",
".",
"_get_date_and_size",
"(",
"self",
".",
"zipinfo",
"[",
"zip_path",
"]",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"("... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EntryPoint.load | Require packages for this EntryPoint, then resolve it. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def load(self, require=True, *args, **kwargs):
"""
Require packages for this EntryPoint, then resolve it.
"""
if not require or args or kwargs:
warnings.warn(
"Parameters to load are deprecated. Call .resolve and "
".require separately.",
... | def load(self, require=True, *args, **kwargs):
"""
Require packages for this EntryPoint, then resolve it.
"""
if not require or args or kwargs:
warnings.warn(
"Parameters to load are deprecated. Call .resolve and "
".require separately.",
... | [
"Require",
"packages",
"for",
"this",
"EntryPoint",
"then",
"resolve",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2333-L2346 | [
"def",
"load",
"(",
"self",
",",
"require",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"require",
"or",
"args",
"or",
"kwargs",
":",
"warnings",
".",
"warn",
"(",
"\"Parameters to load are deprecated. Call .resolve and \"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EntryPoint.resolve | Resolve the entry point from its module and attrs. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def resolve(self):
"""
Resolve the entry point from its module and attrs.
"""
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
except AttributeError as exc:
raise Import... | def resolve(self):
"""
Resolve the entry point from its module and attrs.
"""
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
except AttributeError as exc:
raise Import... | [
"Resolve",
"the",
"entry",
"point",
"from",
"its",
"module",
"and",
"attrs",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2348-L2356 | [
"def",
"resolve",
"(",
"self",
")",
":",
"module",
"=",
"__import__",
"(",
"self",
".",
"module_name",
",",
"fromlist",
"=",
"[",
"'__name__'",
"]",
",",
"level",
"=",
"0",
")",
"try",
":",
"return",
"functools",
".",
"reduce",
"(",
"getattr",
",",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EntryPoint.parse | Parse a single entry point from string `src`
Entry point syntax follows the form::
name = some.module:some.attr [extra1, extra2]
The entry name and module name are required, but the ``:attrs`` and
``[extras]`` parts are optional | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def parse(cls, src, dist=None):
"""Parse a single entry point from string `src`
Entry point syntax follows the form::
name = some.module:some.attr [extra1, extra2]
The entry name and module name are required, but the ``:attrs`` and
``[extras]`` parts are optional
"... | def parse(cls, src, dist=None):
"""Parse a single entry point from string `src`
Entry point syntax follows the form::
name = some.module:some.attr [extra1, extra2]
The entry name and module name are required, but the ``:attrs`` and
``[extras]`` parts are optional
"... | [
"Parse",
"a",
"single",
"entry",
"point",
"from",
"string",
"src"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2381-L2398 | [
"def",
"parse",
"(",
"cls",
",",
"src",
",",
"dist",
"=",
"None",
")",
":",
"m",
"=",
"cls",
".",
"pattern",
".",
"match",
"(",
"src",
")",
"if",
"not",
"m",
":",
"msg",
"=",
"\"EntryPoint must be in 'name=module:attrs [extras]' format\"",
"raise",
"ValueE... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EntryPoint.parse_group | Parse an entry point group | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def parse_group(cls, group, lines, dist=None):
"""Parse an entry point group"""
if not MODULE(group):
raise ValueError("Invalid group name", group)
this = {}
for line in yield_lines(lines):
ep = cls.parse(line, dist)
if ep.name in this:
... | def parse_group(cls, group, lines, dist=None):
"""Parse an entry point group"""
if not MODULE(group):
raise ValueError("Invalid group name", group)
this = {}
for line in yield_lines(lines):
ep = cls.parse(line, dist)
if ep.name in this:
... | [
"Parse",
"an",
"entry",
"point",
"group"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2410-L2420 | [
"def",
"parse_group",
"(",
"cls",
",",
"group",
",",
"lines",
",",
"dist",
"=",
"None",
")",
":",
"if",
"not",
"MODULE",
"(",
"group",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid group name\"",
",",
"group",
")",
"this",
"=",
"{",
"}",
"for",
"l... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EntryPoint.parse_map | Parse a map of entry point groups | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def parse_map(cls, data, dist=None):
"""Parse a map of entry point groups"""
if isinstance(data, dict):
data = data.items()
else:
data = split_sections(data)
maps = {}
for group, lines in data:
if group is None:
if not lines:
... | def parse_map(cls, data, dist=None):
"""Parse a map of entry point groups"""
if isinstance(data, dict):
data = data.items()
else:
data = split_sections(data)
maps = {}
for group, lines in data:
if group is None:
if not lines:
... | [
"Parse",
"a",
"map",
"of",
"entry",
"point",
"groups"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2423-L2439 | [
"def",
"parse_map",
"(",
"cls",
",",
"data",
",",
"dist",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"data",
"=",
"data",
".",
"items",
"(",
")",
"else",
":",
"data",
"=",
"split_sections",
"(",
"data",
")",
"m... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution._dep_map | A map of extra to its list of (direct) requirements
for this distribution, including the null extra. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _dep_map(self):
"""
A map of extra to its list of (direct) requirements
for this distribution, including the null extra.
"""
try:
return self.__dep_map
except AttributeError:
self.__dep_map = self._filter_extras(self._build_dep_map())
r... | def _dep_map(self):
"""
A map of extra to its list of (direct) requirements
for this distribution, including the null extra.
"""
try:
return self.__dep_map
except AttributeError:
self.__dep_map = self._filter_extras(self._build_dep_map())
r... | [
"A",
"map",
"of",
"extra",
"to",
"its",
"list",
"of",
"(",
"direct",
")",
"requirements",
"for",
"this",
"distribution",
"including",
"the",
"null",
"extra",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2593-L2602 | [
"def",
"_dep_map",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"__dep_map",
"except",
"AttributeError",
":",
"self",
".",
"__dep_map",
"=",
"self",
".",
"_filter_extras",
"(",
"self",
".",
"_build_dep_map",
"(",
")",
")",
"return",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution._filter_extras | Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _filter_extras(dm):
"""
Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers.
"""
for extra in list(filter(None, dm)):
new_extra = extra
reqs = dm.pop(extra)
... | def _filter_extras(dm):
"""
Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers.
"""
for extra in list(filter(None, dm)):
new_extra = extra
reqs = dm.pop(extra)
... | [
"Given",
"a",
"mapping",
"of",
"extras",
"to",
"dependencies",
"strip",
"off",
"environment",
"markers",
"and",
"filter",
"out",
"any",
"dependencies",
"not",
"matching",
"the",
"markers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2605-L2624 | [
"def",
"_filter_extras",
"(",
"dm",
")",
":",
"for",
"extra",
"in",
"list",
"(",
"filter",
"(",
"None",
",",
"dm",
")",
")",
":",
"new_extra",
"=",
"extra",
"reqs",
"=",
"dm",
".",
"pop",
"(",
"extra",
")",
"new_extra",
",",
"_",
",",
"marker",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.requires | List of Requirements needed for this distro if `extras` are used | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def requires(self, extras=()):
"""List of Requirements needed for this distro if `extras` are used"""
dm = self._dep_map
deps = []
deps.extend(dm.get(None, ()))
for ext in extras:
try:
deps.extend(dm[safe_extra(ext)])
except KeyError:
... | def requires(self, extras=()):
"""List of Requirements needed for this distro if `extras` are used"""
dm = self._dep_map
deps = []
deps.extend(dm.get(None, ()))
for ext in extras:
try:
deps.extend(dm[safe_extra(ext)])
except KeyError:
... | [
"List",
"of",
"Requirements",
"needed",
"for",
"this",
"distro",
"if",
"extras",
"are",
"used"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2633-L2645 | [
"def",
"requires",
"(",
"self",
",",
"extras",
"=",
"(",
")",
")",
":",
"dm",
"=",
"self",
".",
"_dep_map",
"deps",
"=",
"[",
"]",
"deps",
".",
"extend",
"(",
"dm",
".",
"get",
"(",
"None",
",",
"(",
")",
")",
")",
"for",
"ext",
"in",
"extras... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.activate | Ensure distribution is importable on `path` (default=sys.path) | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def activate(self, path=None, replace=False):
"""Ensure distribution is importable on `path` (default=sys.path)"""
if path is None:
path = sys.path
self.insert_on(path, replace=replace)
if path is sys.path:
fixup_namespace_packages(self.location)
for p... | def activate(self, path=None, replace=False):
"""Ensure distribution is importable on `path` (default=sys.path)"""
if path is None:
path = sys.path
self.insert_on(path, replace=replace)
if path is sys.path:
fixup_namespace_packages(self.location)
for p... | [
"Ensure",
"distribution",
"is",
"importable",
"on",
"path",
"(",
"default",
"=",
"sys",
".",
"path",
")"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2652-L2661 | [
"def",
"activate",
"(",
"self",
",",
"path",
"=",
"None",
",",
"replace",
"=",
"False",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"sys",
".",
"path",
"self",
".",
"insert_on",
"(",
"path",
",",
"replace",
"=",
"replace",
")",
"if",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.egg_name | Return what this distribution's standard .egg filename should be | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def egg_name(self):
"""Return what this distribution's standard .egg filename should be"""
filename = "%s-%s-py%s" % (
to_filename(self.project_name), to_filename(self.version),
self.py_version or PY_MAJOR
)
if self.platform:
filename += '-' + self.pl... | def egg_name(self):
"""Return what this distribution's standard .egg filename should be"""
filename = "%s-%s-py%s" % (
to_filename(self.project_name), to_filename(self.version),
self.py_version or PY_MAJOR
)
if self.platform:
filename += '-' + self.pl... | [
"Return",
"what",
"this",
"distribution",
"s",
"standard",
".",
"egg",
"filename",
"should",
"be"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2663-L2672 | [
"def",
"egg_name",
"(",
"self",
")",
":",
"filename",
"=",
"\"%s-%s-py%s\"",
"%",
"(",
"to_filename",
"(",
"self",
".",
"project_name",
")",
",",
"to_filename",
"(",
"self",
".",
"version",
")",
",",
"self",
".",
"py_version",
"or",
"PY_MAJOR",
")",
"if"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.as_requirement | Return a ``Requirement`` that matches this distribution exactly | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def as_requirement(self):
"""Return a ``Requirement`` that matches this distribution exactly"""
if isinstance(self.parsed_version, packaging.version.Version):
spec = "%s==%s" % (self.project_name, self.parsed_version)
else:
spec = "%s===%s" % (self.project_name, self.pars... | def as_requirement(self):
"""Return a ``Requirement`` that matches this distribution exactly"""
if isinstance(self.parsed_version, packaging.version.Version):
spec = "%s==%s" % (self.project_name, self.parsed_version)
else:
spec = "%s===%s" % (self.project_name, self.pars... | [
"Return",
"a",
"Requirement",
"that",
"matches",
"this",
"distribution",
"exactly"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2714-L2721 | [
"def",
"as_requirement",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"parsed_version",
",",
"packaging",
".",
"version",
".",
"Version",
")",
":",
"spec",
"=",
"\"%s==%s\"",
"%",
"(",
"self",
".",
"project_name",
",",
"self",
".",
"parse... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.load_entry_point | Return the `name` entry point of `group` or raise ImportError | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def load_entry_point(self, group, name):
"""Return the `name` entry point of `group` or raise ImportError"""
ep = self.get_entry_info(group, name)
if ep is None:
raise ImportError("Entry point %r not found" % ((group, name),))
return ep.load() | def load_entry_point(self, group, name):
"""Return the `name` entry point of `group` or raise ImportError"""
ep = self.get_entry_info(group, name)
if ep is None:
raise ImportError("Entry point %r not found" % ((group, name),))
return ep.load() | [
"Return",
"the",
"name",
"entry",
"point",
"of",
"group",
"or",
"raise",
"ImportError"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2723-L2728 | [
"def",
"load_entry_point",
"(",
"self",
",",
"group",
",",
"name",
")",
":",
"ep",
"=",
"self",
".",
"get_entry_info",
"(",
"group",
",",
"name",
")",
"if",
"ep",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"Entry point %r not found\"",
"%",
"(",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.get_entry_map | Return the entry point map for `group`, or the full entry map | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def get_entry_map(self, group=None):
"""Return the entry point map for `group`, or the full entry map"""
try:
ep_map = self._ep_map
except AttributeError:
ep_map = self._ep_map = EntryPoint.parse_map(
self._get_metadata('entry_points.txt'), self
... | def get_entry_map(self, group=None):
"""Return the entry point map for `group`, or the full entry map"""
try:
ep_map = self._ep_map
except AttributeError:
ep_map = self._ep_map = EntryPoint.parse_map(
self._get_metadata('entry_points.txt'), self
... | [
"Return",
"the",
"entry",
"point",
"map",
"for",
"group",
"or",
"the",
"full",
"entry",
"map"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2730-L2740 | [
"def",
"get_entry_map",
"(",
"self",
",",
"group",
"=",
"None",
")",
":",
"try",
":",
"ep_map",
"=",
"self",
".",
"_ep_map",
"except",
"AttributeError",
":",
"ep_map",
"=",
"self",
".",
"_ep_map",
"=",
"EntryPoint",
".",
"parse_map",
"(",
"self",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Distribution.clone | Copy this distribution, substituting in any changed keyword args | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def clone(self, **kw):
"""Copy this distribution, substituting in any changed keyword args"""
names = 'project_name version py_version platform location precedence'
for attr in names.split():
kw.setdefault(attr, getattr(self, attr, None))
kw.setdefault('metadata', self._provi... | def clone(self, **kw):
"""Copy this distribution, substituting in any changed keyword args"""
names = 'project_name version py_version platform location precedence'
for attr in names.split():
kw.setdefault(attr, getattr(self, attr, None))
kw.setdefault('metadata', self._provi... | [
"Copy",
"this",
"distribution",
"substituting",
"in",
"any",
"changed",
"keyword",
"args"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2844-L2850 | [
"def",
"clone",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"names",
"=",
"'project_name version py_version platform location precedence'",
"for",
"attr",
"in",
"names",
".",
"split",
"(",
")",
":",
"kw",
".",
"setdefault",
"(",
"attr",
",",
"getattr",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EggInfoDistribution._reload_version | Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions will not be
parsed properly
downstream b... | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _reload_version(self):
"""
Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions will not ... | def _reload_version(self):
"""
Packages installed by distutils (e.g. numpy or scipy),
which uses an old safe_version, and so
their version numbers can get mangled when
converted to filenames (e.g., 1.11.0.dev0+2329eae to
1.11.0.dev0_2329eae). These distributions will not ... | [
"Packages",
"installed",
"by",
"distutils",
"(",
"e",
".",
"g",
".",
"numpy",
"or",
"scipy",
")",
"which",
"uses",
"an",
"old",
"safe_version",
"and",
"so",
"their",
"version",
"numbers",
"can",
"get",
"mangled",
"when",
"converted",
"to",
"filenames",
"("... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2858-L2873 | [
"def",
"_reload_version",
"(",
"self",
")",
":",
"md_version",
"=",
"_version_from_file",
"(",
"self",
".",
"_get_metadata",
"(",
"self",
".",
"PKG_INFO",
")",
")",
"if",
"md_version",
":",
"self",
".",
"_version",
"=",
"md_version",
"return",
"self"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DistInfoDistribution._compute_dependencies | Recompute this distribution's dependencies. | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | def _compute_dependencies(self):
"""Recompute this distribution's dependencies."""
dm = self.__dep_map = {None: []}
reqs = []
# Including any condition expressions
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
reqs.extend(parse_requirements(req))
... | def _compute_dependencies(self):
"""Recompute this distribution's dependencies."""
dm = self.__dep_map = {None: []}
reqs = []
# Including any condition expressions
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
reqs.extend(parse_requirements(req))
... | [
"Recompute",
"this",
"distribution",
"s",
"dependencies",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2902-L2923 | [
"def",
"_compute_dependencies",
"(",
"self",
")",
":",
"dm",
"=",
"self",
".",
"__dep_map",
"=",
"{",
"None",
":",
"[",
"]",
"}",
"reqs",
"=",
"[",
"]",
"# Including any condition expressions",
"for",
"req",
"in",
"self",
".",
"_parsed_pkg_info",
".",
"get... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DefinitionSchema._expand_logical_shortcuts | Expand agglutinated rules in a definition-schema.
:param schema: The schema-definition to expand.
:return: The expanded schema-definition. | pipenv/vendor/cerberus/schema.py | def _expand_logical_shortcuts(cls, schema):
""" Expand agglutinated rules in a definition-schema.
:param schema: The schema-definition to expand.
:return: The expanded schema-definition.
"""
def is_of_rule(x):
return isinstance(x, _str_type) and \
x.s... | def _expand_logical_shortcuts(cls, schema):
""" Expand agglutinated rules in a definition-schema.
:param schema: The schema-definition to expand.
:return: The expanded schema-definition.
"""
def is_of_rule(x):
return isinstance(x, _str_type) and \
x.s... | [
"Expand",
"agglutinated",
"rules",
"in",
"a",
"definition",
"-",
"schema",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L116-L133 | [
"def",
"_expand_logical_shortcuts",
"(",
"cls",
",",
"schema",
")",
":",
"def",
"is_of_rule",
"(",
"x",
")",
":",
"return",
"isinstance",
"(",
"x",
",",
"_str_type",
")",
"and",
"x",
".",
"startswith",
"(",
"(",
"'allof_'",
",",
"'anyof_'",
",",
"'noneof... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DefinitionSchema._validate | Validates a schema that defines rules against supported rules.
:param schema: The schema to be validated as a legal cerberus schema
according to the rules of this Validator object. | pipenv/vendor/cerberus/schema.py | def _validate(self, schema):
""" Validates a schema that defines rules against supported rules.
:param schema: The schema to be validated as a legal cerberus schema
according to the rules of this Validator object.
"""
if isinstance(schema, _str_type):
... | def _validate(self, schema):
""" Validates a schema that defines rules against supported rules.
:param schema: The schema to be validated as a legal cerberus schema
according to the rules of this Validator object.
"""
if isinstance(schema, _str_type):
... | [
"Validates",
"a",
"schema",
"that",
"defines",
"rules",
"against",
"supported",
"rules",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L200-L219 | [
"def",
"_validate",
"(",
"self",
",",
"schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"_str_type",
")",
":",
"schema",
"=",
"self",
".",
"validator",
".",
"schema_registry",
".",
"get",
"(",
"schema",
",",
"schema",
")",
"if",
"schema",
"is... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SchemaValidatorMixin._validate_logical | {'allowed': ('allof', 'anyof', 'noneof', 'oneof')} | pipenv/vendor/cerberus/schema.py | def _validate_logical(self, rule, field, value):
""" {'allowed': ('allof', 'anyof', 'noneof', 'oneof')} """
if not isinstance(value, Sequence):
self._error(field, errors.BAD_TYPE)
return
validator = self._get_child_validator(
document_crumb=rule, allow_unknow... | def _validate_logical(self, rule, field, value):
""" {'allowed': ('allof', 'anyof', 'noneof', 'oneof')} """
if not isinstance(value, Sequence):
self._error(field, errors.BAD_TYPE)
return
validator = self._get_child_validator(
document_crumb=rule, allow_unknow... | [
"{",
"allowed",
":",
"(",
"allof",
"anyof",
"noneof",
"oneof",
")",
"}"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L275-L295 | [
"def",
"_validate_logical",
"(",
"self",
",",
"rule",
",",
"field",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Sequence",
")",
":",
"self",
".",
"_error",
"(",
"field",
",",
"errors",
".",
"BAD_TYPE",
")",
"return",
"validat... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Registry.add | Register a definition to the registry. Existing definitions are
replaced silently.
:param name: The name which can be used as reference in a validation
schema.
:type name: :class:`str`
:param definition: The definition.
:type definition: any :term:`mapping` | pipenv/vendor/cerberus/schema.py | def add(self, name, definition):
""" Register a definition to the registry. Existing definitions are
replaced silently.
:param name: The name which can be used as reference in a validation
schema.
:type name: :class:`str`
:param definition: The definition.
... | def add(self, name, definition):
""" Register a definition to the registry. Existing definitions are
replaced silently.
:param name: The name which can be used as reference in a validation
schema.
:type name: :class:`str`
:param definition: The definition.
... | [
"Register",
"a",
"definition",
"to",
"the",
"registry",
".",
"Existing",
"definitions",
"are",
"replaced",
"silently",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L423-L432 | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"definition",
")",
":",
"self",
".",
"_storage",
"[",
"name",
"]",
"=",
"self",
".",
"_expand_definition",
"(",
"definition",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Registry.extend | Add several definitions at once. Existing definitions are
replaced silently.
:param definitions: The names and definitions.
:type definitions: a :term:`mapping` or an :term:`iterable` with
two-value :class:`tuple` s | pipenv/vendor/cerberus/schema.py | def extend(self, definitions):
""" Add several definitions at once. Existing definitions are
replaced silently.
:param definitions: The names and definitions.
:type definitions: a :term:`mapping` or an :term:`iterable` with
two-value :class:`tuple` s """
... | def extend(self, definitions):
""" Add several definitions at once. Existing definitions are
replaced silently.
:param definitions: The names and definitions.
:type definitions: a :term:`mapping` or an :term:`iterable` with
two-value :class:`tuple` s """
... | [
"Add",
"several",
"definitions",
"at",
"once",
".",
"Existing",
"definitions",
"are",
"replaced",
"silently",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/schema.py#L443-L451 | [
"def",
"extend",
"(",
"self",
",",
"definitions",
")",
":",
"for",
"name",
",",
"definition",
"in",
"dict",
"(",
"definitions",
")",
".",
"items",
"(",
")",
":",
"self",
".",
"add",
"(",
"name",
",",
"definition",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Subversion.export | Export the svn repository at the url to the destination location | pipenv/patched/notpip/_internal/vcs/subversion.py | def export(self, location):
"""Export the svn repository at the url to the destination location"""
url, rev_options = self.get_url_rev_options(self.url)
logger.info('Exporting svn repository %s to %s', url, location)
with indent_log():
if os.path.exists(location):
... | def export(self, location):
"""Export the svn repository at the url to the destination location"""
url, rev_options = self.get_url_rev_options(self.url)
logger.info('Exporting svn repository %s to %s', url, location)
with indent_log():
if os.path.exists(location):
... | [
"Export",
"the",
"svn",
"repository",
"at",
"the",
"url",
"to",
"the",
"destination",
"location"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/subversion.py#L31-L42 | [
"def",
"export",
"(",
"self",
",",
"location",
")",
":",
"url",
",",
"rev_options",
"=",
"self",
".",
"get_url_rev_options",
"(",
"self",
".",
"url",
")",
"logger",
".",
"info",
"(",
"'Exporting svn repository %s to %s'",
",",
"url",
",",
"location",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Subversion.get_netloc_and_auth | This override allows the auth information to be passed to svn via the
--username and --password options instead of via the URL. | pipenv/patched/notpip/_internal/vcs/subversion.py | def get_netloc_and_auth(self, netloc, scheme):
"""
This override allows the auth information to be passed to svn via the
--username and --password options instead of via the URL.
"""
if scheme == 'ssh':
# The --username and --password options can't be used for
... | def get_netloc_and_auth(self, netloc, scheme):
"""
This override allows the auth information to be passed to svn via the
--username and --password options instead of via the URL.
"""
if scheme == 'ssh':
# The --username and --password options can't be used for
... | [
"This",
"override",
"allows",
"the",
"auth",
"information",
"to",
"be",
"passed",
"to",
"svn",
"via",
"the",
"--",
"username",
"and",
"--",
"password",
"options",
"instead",
"of",
"via",
"the",
"URL",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/subversion.py#L91-L102 | [
"def",
"get_netloc_and_auth",
"(",
"self",
",",
"netloc",
",",
"scheme",
")",
":",
"if",
"scheme",
"==",
"'ssh'",
":",
"# The --username and --password options can't be used for",
"# svn+ssh URLs, so keep the auth information in the URL.",
"return",
"super",
"(",
"Subversion"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | cd | Context manager to temporarily change working directories
:param str path: The directory to move into
>>> print(os.path.abspath(os.curdir))
'/home/user/code/myrepo'
>>> with cd("/home/user/code/otherdir/subdir"):
... print("Changed directory: %s" % os.path.abspath(os.curdir))
Changed direc... | pipenv/vendor/vistir/contextmanagers.py | def cd(path):
"""Context manager to temporarily change working directories
:param str path: The directory to move into
>>> print(os.path.abspath(os.curdir))
'/home/user/code/myrepo'
>>> with cd("/home/user/code/otherdir/subdir"):
... print("Changed directory: %s" % os.path.abspath(os.curdi... | def cd(path):
"""Context manager to temporarily change working directories
:param str path: The directory to move into
>>> print(os.path.abspath(os.curdir))
'/home/user/code/myrepo'
>>> with cd("/home/user/code/otherdir/subdir"):
... print("Changed directory: %s" % os.path.abspath(os.curdi... | [
"Context",
"manager",
"to",
"temporarily",
"change",
"working",
"directories"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L63-L85 | [
"def",
"cd",
"(",
"path",
")",
":",
"if",
"not",
"path",
":",
"return",
"prev_cwd",
"=",
"Path",
".",
"cwd",
"(",
")",
".",
"as_posix",
"(",
")",
"if",
"isinstance",
"(",
"path",
",",
"Path",
")",
":",
"path",
"=",
"path",
".",
"as_posix",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | spinner | Get a spinner object or a dummy spinner to wrap a context.
:param str spinner_name: A spinner type e.g. "dots" or "bouncingBar" (default: {"bouncingBar"})
:param str start_text: Text to start off the spinner with (default: {None})
:param dict handler_map: Handler map for signals to be handled gracefully (d... | pipenv/vendor/vistir/contextmanagers.py | def spinner(
spinner_name=None,
start_text=None,
handler_map=None,
nospin=False,
write_to_stdout=True,
):
"""Get a spinner object or a dummy spinner to wrap a context.
:param str spinner_name: A spinner type e.g. "dots" or "bouncingBar" (default: {"bouncingBar"})
:param str start_text: ... | def spinner(
spinner_name=None,
start_text=None,
handler_map=None,
nospin=False,
write_to_stdout=True,
):
"""Get a spinner object or a dummy spinner to wrap a context.
:param str spinner_name: A spinner type e.g. "dots" or "bouncingBar" (default: {"bouncingBar"})
:param str start_text: ... | [
"Get",
"a",
"spinner",
"object",
"or",
"a",
"dummy",
"spinner",
"to",
"wrap",
"a",
"context",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L111-L162 | [
"def",
"spinner",
"(",
"spinner_name",
"=",
"None",
",",
"start_text",
"=",
"None",
",",
"handler_map",
"=",
"None",
",",
"nospin",
"=",
"False",
",",
"write_to_stdout",
"=",
"True",
",",
")",
":",
"from",
".",
"spin",
"import",
"create_spinner",
"has_yasp... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | atomic_open_for_write | Atomically open `target` for writing.
This is based on Lektor's `atomic_open()` utility, but simplified a lot
to handle only writing, and skip many multi-process/thread edge cases
handled by Werkzeug.
:param str target: Target filename to write
:param bool binary: Whether to open in binary mode, d... | pipenv/vendor/vistir/contextmanagers.py | def atomic_open_for_write(target, binary=False, newline=None, encoding=None):
"""Atomically open `target` for writing.
This is based on Lektor's `atomic_open()` utility, but simplified a lot
to handle only writing, and skip many multi-process/thread edge cases
handled by Werkzeug.
:param str targe... | def atomic_open_for_write(target, binary=False, newline=None, encoding=None):
"""Atomically open `target` for writing.
This is based on Lektor's `atomic_open()` utility, but simplified a lot
to handle only writing, and skip many multi-process/thread edge cases
handled by Werkzeug.
:param str targe... | [
"Atomically",
"open",
"target",
"for",
"writing",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L166-L252 | [
"def",
"atomic_open_for_write",
"(",
"target",
",",
"binary",
"=",
"False",
",",
"newline",
"=",
"None",
",",
"encoding",
"=",
"None",
")",
":",
"mode",
"=",
"\"w+b\"",
"if",
"binary",
"else",
"\"w\"",
"f",
"=",
"NamedTemporaryFile",
"(",
"dir",
"=",
"os... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | open_file | Open local or remote file for reading.
:type link: pip._internal.index.Link or str
:type session: requests.Session
:param bool stream: Try to stream if remote, default True
:raises ValueError: If link points to a local directory.
:return: a context manager to the opened file-like object | pipenv/vendor/vistir/contextmanagers.py | def open_file(link, session=None, stream=True):
"""
Open local or remote file for reading.
:type link: pip._internal.index.Link or str
:type session: requests.Session
:param bool stream: Try to stream if remote, default True
:raises ValueError: If link points to a local directory.
:return: ... | def open_file(link, session=None, stream=True):
"""
Open local or remote file for reading.
:type link: pip._internal.index.Link or str
:type session: requests.Session
:param bool stream: Try to stream if remote, default True
:raises ValueError: If link points to a local directory.
:return: ... | [
"Open",
"local",
"or",
"remote",
"file",
"for",
"reading",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L256-L300 | [
"def",
"open_file",
"(",
"link",
",",
"session",
"=",
"None",
",",
"stream",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"link",
",",
"six",
".",
"string_types",
")",
":",
"try",
":",
"link",
"=",
"link",
".",
"url_without_fragment",
"except... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | replaced_stream | Context manager to temporarily swap out *stream_name* with a stream wrapper.
:param str stream_name: The name of a sys stream to wrap
:returns: A ``StreamWrapper`` replacement, temporarily
>>> orig_stdout = sys.stdout
>>> with replaced_stream("stdout") as stdout:
... sys.stdout.write("hello")
... | pipenv/vendor/vistir/contextmanagers.py | def replaced_stream(stream_name):
"""
Context manager to temporarily swap out *stream_name* with a stream wrapper.
:param str stream_name: The name of a sys stream to wrap
:returns: A ``StreamWrapper`` replacement, temporarily
>>> orig_stdout = sys.stdout
>>> with replaced_stream("stdout") as ... | def replaced_stream(stream_name):
"""
Context manager to temporarily swap out *stream_name* with a stream wrapper.
:param str stream_name: The name of a sys stream to wrap
:returns: A ``StreamWrapper`` replacement, temporarily
>>> orig_stdout = sys.stdout
>>> with replaced_stream("stdout") as ... | [
"Context",
"manager",
"to",
"temporarily",
"swap",
"out",
"*",
"stream_name",
"*",
"with",
"a",
"stream",
"wrapper",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/contextmanagers.py#L304-L325 | [
"def",
"replaced_stream",
"(",
"stream_name",
")",
":",
"orig_stream",
"=",
"getattr",
"(",
"sys",
",",
"stream_name",
")",
"new_stream",
"=",
"six",
".",
"StringIO",
"(",
")",
"try",
":",
"setattr",
"(",
"sys",
",",
"stream_name",
",",
"new_stream",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.read_nonblocking | This reads data from the file descriptor.
This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it.
The timeout parameter is ignored. | pipenv/vendor/pexpect/spawnbase.py | def read_nonblocking(self, size=1, timeout=None):
"""This reads data from the file descriptor.
This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it.
The timeout parameter is ignored.
"""
try:
s = os.read(sel... | def read_nonblocking(self, size=1, timeout=None):
"""This reads data from the file descriptor.
This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it.
The timeout parameter is ignored.
"""
try:
s = os.read(sel... | [
"This",
"reads",
"data",
"from",
"the",
"file",
"descriptor",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L157-L180 | [
"def",
"read_nonblocking",
"(",
"self",
",",
"size",
"=",
"1",
",",
"timeout",
"=",
"None",
")",
":",
"try",
":",
"s",
"=",
"os",
".",
"read",
"(",
"self",
".",
"child_fd",
",",
"size",
")",
"except",
"OSError",
"as",
"err",
":",
"if",
"err",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.compile_pattern_list | This compiles a pattern-string or a list of pattern-strings.
Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of
those. Patterns may also be None which results in an empty list (you
might do this if waiting for an EOF or TIMEOUT condition without
expecting any pattern)... | pipenv/vendor/pexpect/spawnbase.py | def compile_pattern_list(self, patterns):
'''This compiles a pattern-string or a list of pattern-strings.
Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of
those. Patterns may also be None which results in an empty list (you
might do this if waiting for an EOF or TIM... | def compile_pattern_list(self, patterns):
'''This compiles a pattern-string or a list of pattern-strings.
Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of
those. Patterns may also be None which results in an empty list (you
might do this if waiting for an EOF or TIM... | [
"This",
"compiles",
"a",
"pattern",
"-",
"string",
"or",
"a",
"list",
"of",
"pattern",
"-",
"strings",
".",
"Patterns",
"must",
"be",
"a",
"StringType",
"EOF",
"TIMEOUT",
"SRE_Pattern",
"or",
"a",
"list",
"of",
"those",
".",
"Patterns",
"may",
"also",
"b... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L192-L238 | [
"def",
"compile_pattern_list",
"(",
"self",
",",
"patterns",
")",
":",
"if",
"patterns",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"not",
"isinstance",
"(",
"patterns",
",",
"list",
")",
":",
"patterns",
"=",
"[",
"patterns",
"]",
"# Allow dot to match ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.expect | This seeks through the stream until a pattern is matched. The
pattern is overloaded and may take several types. The pattern can be a
StringType, EOF, a compiled re, or a list of any of those types.
Strings will be compiled to re types. This returns the index into the
pattern list. If the... | pipenv/vendor/pexpect/spawnbase.py | def expect(self, pattern, timeout=-1, searchwindowsize=-1, async_=False, **kw):
'''This seeks through the stream until a pattern is matched. The
pattern is overloaded and may take several types. The pattern can be a
StringType, EOF, a compiled re, or a list of any of those types.
Strings... | def expect(self, pattern, timeout=-1, searchwindowsize=-1, async_=False, **kw):
'''This seeks through the stream until a pattern is matched. The
pattern is overloaded and may take several types. The pattern can be a
StringType, EOF, a compiled re, or a list of any of those types.
Strings... | [
"This",
"seeks",
"through",
"the",
"stream",
"until",
"a",
"pattern",
"is",
"matched",
".",
"The",
"pattern",
"is",
"overloaded",
"and",
"may",
"take",
"several",
"types",
".",
"The",
"pattern",
"can",
"be",
"a",
"StringType",
"EOF",
"a",
"compiled",
"re",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L240-L341 | [
"def",
"expect",
"(",
"self",
",",
"pattern",
",",
"timeout",
"=",
"-",
"1",
",",
"searchwindowsize",
"=",
"-",
"1",
",",
"async_",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"if",
"'async'",
"in",
"kw",
":",
"async_",
"=",
"kw",
".",
"pop",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.expect_list | This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not compiled regular
expressions). This method is similar to the expect() method except that
expect_list() does ... | pipenv/vendor/pexpect/spawnbase.py | def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1,
async_=False, **kw):
'''This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not com... | def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1,
async_=False, **kw):
'''This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not com... | [
"This",
"takes",
"a",
"list",
"of",
"compiled",
"regular",
"expressions",
"and",
"returns",
"the",
"index",
"into",
"the",
"pattern_list",
"that",
"matched",
"the",
"child",
"output",
".",
"The",
"list",
"may",
"also",
"contain",
"EOF",
"or",
"TIMEOUT",
"(",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L343-L369 | [
"def",
"expect_list",
"(",
"self",
",",
"pattern_list",
",",
"timeout",
"=",
"-",
"1",
",",
"searchwindowsize",
"=",
"-",
"1",
",",
"async_",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.expect_exact | This is similar to expect(), but uses plain string matching instead
of compiled regular expressions in 'pattern_list'. The 'pattern_list'
may be a string; a list or other sequence of strings; or TIMEOUT and
EOF.
This call might be faster than expect() for two reasons: string
sea... | pipenv/vendor/pexpect/spawnbase.py | def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1,
async_=False, **kw):
'''This is similar to expect(), but uses plain string matching instead
of compiled regular expressions in 'pattern_list'. The 'pattern_list'
may be a string; a list or other sequence ... | def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1,
async_=False, **kw):
'''This is similar to expect(), but uses plain string matching instead
of compiled regular expressions in 'pattern_list'. The 'pattern_list'
may be a string; a list or other sequence ... | [
"This",
"is",
"similar",
"to",
"expect",
"()",
"but",
"uses",
"plain",
"string",
"matching",
"instead",
"of",
"compiled",
"regular",
"expressions",
"in",
"pattern_list",
".",
"The",
"pattern_list",
"may",
"be",
"a",
"string",
";",
"a",
"list",
"or",
"other",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L371-L418 | [
"def",
"expect_exact",
"(",
"self",
",",
"pattern_list",
",",
"timeout",
"=",
"-",
"1",
",",
"searchwindowsize",
"=",
"-",
"1",
",",
"async_",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.expect_loop | This is the common loop used inside expect. The 'searcher' should be
an instance of searcher_re or searcher_string, which describes how and
what to search for in the input.
See expect() for other arguments, return value and exceptions. | pipenv/vendor/pexpect/spawnbase.py | def expect_loop(self, searcher, timeout=-1, searchwindowsize=-1):
'''This is the common loop used inside expect. The 'searcher' should be
an instance of searcher_re or searcher_string, which describes how and
what to search for in the input.
See expect() for other arguments, return valu... | def expect_loop(self, searcher, timeout=-1, searchwindowsize=-1):
'''This is the common loop used inside expect. The 'searcher' should be
an instance of searcher_re or searcher_string, which describes how and
what to search for in the input.
See expect() for other arguments, return valu... | [
"This",
"is",
"the",
"common",
"loop",
"used",
"inside",
"expect",
".",
"The",
"searcher",
"should",
"be",
"an",
"instance",
"of",
"searcher_re",
"or",
"searcher_string",
"which",
"describes",
"how",
"and",
"what",
"to",
"search",
"for",
"in",
"the",
"input"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L420-L428 | [
"def",
"expect_loop",
"(",
"self",
",",
"searcher",
",",
"timeout",
"=",
"-",
"1",
",",
"searchwindowsize",
"=",
"-",
"1",
")",
":",
"exp",
"=",
"Expecter",
"(",
"self",
",",
"searcher",
",",
"searchwindowsize",
")",
"return",
"exp",
".",
"expect_loop",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.read | This reads at most "size" bytes from the file (less if the read hits
EOF before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as
a string object. An empty string is returned when EOF is encountered
immediate... | pipenv/vendor/pexpect/spawnbase.py | def read(self, size=-1):
'''This reads at most "size" bytes from the file (less if the read hits
EOF before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as
a string object. An empty string is returned when ... | def read(self, size=-1):
'''This reads at most "size" bytes from the file (less if the read hits
EOF before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as
a string object. An empty string is returned when ... | [
"This",
"reads",
"at",
"most",
"size",
"bytes",
"from",
"the",
"file",
"(",
"less",
"if",
"the",
"read",
"hits",
"EOF",
"before",
"obtaining",
"size",
"bytes",
")",
".",
"If",
"the",
"size",
"argument",
"is",
"negative",
"or",
"omitted",
"read",
"all",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L430-L457 | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"size",
"==",
"0",
":",
"return",
"self",
".",
"string_type",
"(",
")",
"if",
"size",
"<",
"0",
":",
"# delimiter default is EOF",
"self",
".",
"expect",
"(",
"self",
".",
"del... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.readline | This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\\r\\n) even on UNIX because
this is ... | pipenv/vendor/pexpect/spawnbase.py | def readline(self, size=-1):
'''This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\\r\\... | def readline(self, size=-1):
'''This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\\r\\... | [
"This",
"reads",
"and",
"returns",
"one",
"entire",
"line",
".",
"The",
"newline",
"at",
"the",
"end",
"of",
"line",
"is",
"returned",
"as",
"part",
"of",
"the",
"string",
"unless",
"the",
"file",
"ends",
"without",
"a",
"newline",
".",
"An",
"empty",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L459-L478 | [
"def",
"readline",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"size",
"==",
"0",
":",
"return",
"self",
".",
"string_type",
"(",
")",
"# delimiter default is EOF",
"index",
"=",
"self",
".",
"expect",
"(",
"[",
"self",
".",
"crlf",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SpawnBase.readlines | This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this method on
a child that is still running... | pipenv/vendor/pexpect/spawnbase.py | def readlines(self, sizehint=-1):
'''This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this me... | def readlines(self, sizehint=-1):
'''This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this me... | [
"This",
"reads",
"until",
"EOF",
"using",
"readline",
"()",
"and",
"returns",
"a",
"list",
"containing",
"the",
"lines",
"thus",
"read",
".",
"The",
"optional",
"sizehint",
"argument",
"is",
"ignored",
".",
"Remember",
"because",
"this",
"reads",
"until",
"E... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L485-L499 | [
"def",
"readlines",
"(",
"self",
",",
"sizehint",
"=",
"-",
"1",
")",
":",
"lines",
"=",
"[",
"]",
"while",
"True",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"break",
"lines",
".",
"append",
"(",
"line",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _length_hint | Returns the length hint of an object. | pipenv/vendor/click/_termui_impl.py | def _length_hint(obj):
"""Returns the length hint of an object."""
try:
return len(obj)
except (AttributeError, TypeError):
try:
get_hint = type(obj).__length_hint__
except AttributeError:
return None
try:
hint = get_hint(obj)
excep... | def _length_hint(obj):
"""Returns the length hint of an object."""
try:
return len(obj)
except (AttributeError, TypeError):
try:
get_hint = type(obj).__length_hint__
except AttributeError:
return None
try:
hint = get_hint(obj)
excep... | [
"Returns",
"the",
"length",
"hint",
"of",
"an",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L34-L51 | [
"def",
"_length_hint",
"(",
"obj",
")",
":",
"try",
":",
"return",
"len",
"(",
"obj",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
")",
":",
"try",
":",
"get_hint",
"=",
"type",
"(",
"obj",
")",
".",
"__length_hint__",
"except",
"AttributeErro... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _tempfilepager | Page through text by invoking a program on a temporary file. | pipenv/vendor/click/_termui_impl.py | def _tempfilepager(generator, cmd, color):
"""Page through text by invoking a program on a temporary file."""
import tempfile
filename = tempfile.mktemp()
# TODO: This never terminates if the passed generator never terminates.
text = "".join(generator)
if not color:
text = strip_ansi(tex... | def _tempfilepager(generator, cmd, color):
"""Page through text by invoking a program on a temporary file."""
import tempfile
filename = tempfile.mktemp()
# TODO: This never terminates if the passed generator never terminates.
text = "".join(generator)
if not color:
text = strip_ansi(tex... | [
"Page",
"through",
"text",
"by",
"invoking",
"a",
"program",
"on",
"a",
"temporary",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L370-L384 | [
"def",
"_tempfilepager",
"(",
"generator",
",",
"cmd",
",",
"color",
")",
":",
"import",
"tempfile",
"filename",
"=",
"tempfile",
".",
"mktemp",
"(",
")",
"# TODO: This never terminates if the passed generator never terminates.",
"text",
"=",
"\"\"",
".",
"join",
"(... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _nullpager | Simply print unformatted text. This is the ultimate fallback. | pipenv/vendor/click/_termui_impl.py | def _nullpager(stream, generator, color):
"""Simply print unformatted text. This is the ultimate fallback."""
for text in generator:
if not color:
text = strip_ansi(text)
stream.write(text) | def _nullpager(stream, generator, color):
"""Simply print unformatted text. This is the ultimate fallback."""
for text in generator:
if not color:
text = strip_ansi(text)
stream.write(text) | [
"Simply",
"print",
"unformatted",
"text",
".",
"This",
"is",
"the",
"ultimate",
"fallback",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L387-L392 | [
"def",
"_nullpager",
"(",
"stream",
",",
"generator",
",",
"color",
")",
":",
"for",
"text",
"in",
"generator",
":",
"if",
"not",
"color",
":",
"text",
"=",
"strip_ansi",
"(",
"text",
")",
"stream",
".",
"write",
"(",
"text",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ProgressBar.generator | Returns a generator which yields the items added to the bar during
construction, and updates the progress bar *after* the yielded block
returns. | pipenv/vendor/click/_termui_impl.py | def generator(self):
"""
Returns a generator which yields the items added to the bar during
construction, and updates the progress bar *after* the yielded block
returns.
"""
if not self.entered:
raise RuntimeError('You need to use progress bars in a with block... | def generator(self):
"""
Returns a generator which yields the items added to the bar during
construction, and updates the progress bar *after* the yielded block
returns.
"""
if not self.entered:
raise RuntimeError('You need to use progress bars in a with block... | [
"Returns",
"a",
"generator",
"which",
"yields",
"the",
"items",
"added",
"to",
"the",
"bar",
"during",
"construction",
"and",
"updates",
"the",
"progress",
"bar",
"*",
"after",
"*",
"the",
"yielded",
"block",
"returns",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_termui_impl.py#L272-L290 | [
"def",
"generator",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"entered",
":",
"raise",
"RuntimeError",
"(",
"'You need to use progress bars in a with block.'",
")",
"if",
"self",
".",
"is_hidden",
":",
"for",
"rv",
"in",
"self",
".",
"iter",
":",
"yie... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | bar | Progress iterator. Wrap your iterables with it. | pipenv/progress.py | def bar(
it,
label="",
width=32,
hide=None,
empty_char=BAR_EMPTY_CHAR,
filled_char=BAR_FILLED_CHAR,
expected_size=None,
every=1,
):
"""Progress iterator. Wrap your iterables with it."""
count = len(it) if expected_size is None else expected_size
with Bar(
label=label,... | def bar(
it,
label="",
width=32,
hide=None,
empty_char=BAR_EMPTY_CHAR,
filled_char=BAR_FILLED_CHAR,
expected_size=None,
every=1,
):
"""Progress iterator. Wrap your iterables with it."""
count = len(it) if expected_size is None else expected_size
with Bar(
label=label,... | [
"Progress",
"iterator",
".",
"Wrap",
"your",
"iterables",
"with",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/progress.py#L154-L178 | [
"def",
"bar",
"(",
"it",
",",
"label",
"=",
"\"\"",
",",
"width",
"=",
"32",
",",
"hide",
"=",
"None",
",",
"empty_char",
"=",
"BAR_EMPTY_CHAR",
",",
"filled_char",
"=",
"BAR_FILLED_CHAR",
",",
"expected_size",
"=",
"None",
",",
"every",
"=",
"1",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | dots | Progress iterator. Prints a dot for each item being iterated | pipenv/progress.py | def dots(it, label="", hide=None, every=1):
"""Progress iterator. Prints a dot for each item being iterated"""
count = 0
if not hide:
STREAM.write(label)
for i, item in enumerate(it):
if not hide:
if i % every == 0: # True every "every" updates
STREAM.write(D... | def dots(it, label="", hide=None, every=1):
"""Progress iterator. Prints a dot for each item being iterated"""
count = 0
if not hide:
STREAM.write(label)
for i, item in enumerate(it):
if not hide:
if i % every == 0: # True every "every" updates
STREAM.write(D... | [
"Progress",
"iterator",
".",
"Prints",
"a",
"dot",
"for",
"each",
"item",
"being",
"iterated"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/progress.py#L181-L195 | [
"def",
"dots",
"(",
"it",
",",
"label",
"=",
"\"\"",
",",
"hide",
"=",
"None",
",",
"every",
"=",
"1",
")",
":",
"count",
"=",
"0",
"if",
"not",
"hide",
":",
"STREAM",
".",
"write",
"(",
"label",
")",
"for",
"i",
",",
"item",
"in",
"enumerate",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse | Parse version to major, minor, patch, pre-release, build parts.
:param version: version string
:return: dictionary with the keys 'build', 'major', 'minor', 'patch',
and 'prerelease'. The prerelease or build keys can be None
if not provided
:rtype: dict
>>> import semver
>... | pipenv/vendor/semver.py | def parse(version):
"""Parse version to major, minor, patch, pre-release, build parts.
:param version: version string
:return: dictionary with the keys 'build', 'major', 'minor', 'patch',
and 'prerelease'. The prerelease or build keys can be None
if not provided
:rtype: dict
... | def parse(version):
"""Parse version to major, minor, patch, pre-release, build parts.
:param version: version string
:return: dictionary with the keys 'build', 'major', 'minor', 'patch',
and 'prerelease'. The prerelease or build keys can be None
if not provided
:rtype: dict
... | [
"Parse",
"version",
"to",
"major",
"minor",
"patch",
"pre",
"-",
"release",
"build",
"parts",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L41-L73 | [
"def",
"parse",
"(",
"version",
")",
":",
"match",
"=",
"_REGEX",
".",
"match",
"(",
"version",
")",
"if",
"match",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'%s is not valid SemVer string'",
"%",
"version",
")",
"version_parts",
"=",
"match",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse_version_info | Parse version string to a VersionInfo instance.
:param version: version string
:return: a :class:`VersionInfo` instance
:rtype: :class:`VersionInfo`
>>> import semver
>>> version_info = semver.parse_version_info("3.4.5-pre.2+build.4")
>>> version_info.major
3
>>> version_info.minor
... | pipenv/vendor/semver.py | def parse_version_info(version):
"""Parse version string to a VersionInfo instance.
:param version: version string
:return: a :class:`VersionInfo` instance
:rtype: :class:`VersionInfo`
>>> import semver
>>> version_info = semver.parse_version_info("3.4.5-pre.2+build.4")
>>> version_info.ma... | def parse_version_info(version):
"""Parse version string to a VersionInfo instance.
:param version: version string
:return: a :class:`VersionInfo` instance
:rtype: :class:`VersionInfo`
>>> import semver
>>> version_info = semver.parse_version_info("3.4.5-pre.2+build.4")
>>> version_info.ma... | [
"Parse",
"version",
"string",
"to",
"a",
"VersionInfo",
"instance",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L190-L215 | [
"def",
"parse_version_info",
"(",
"version",
")",
":",
"parts",
"=",
"parse",
"(",
"version",
")",
"version_info",
"=",
"VersionInfo",
"(",
"parts",
"[",
"'major'",
"]",
",",
"parts",
"[",
"'minor'",
"]",
",",
"parts",
"[",
"'patch'",
"]",
",",
"parts",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | compare | Compare two versions
:param ver1: version string 1
:param ver2: version string 2
:return: The return value is negative if ver1 < ver2,
zero if ver1 == ver2 and strictly positive if ver1 > ver2
:rtype: int
>>> import semver
>>> semver.compare("1.0.0", "2.0.0")
-1
>>> semver... | pipenv/vendor/semver.py | def compare(ver1, ver2):
"""Compare two versions
:param ver1: version string 1
:param ver2: version string 2
:return: The return value is negative if ver1 < ver2,
zero if ver1 == ver2 and strictly positive if ver1 > ver2
:rtype: int
>>> import semver
>>> semver.compare("1.0.0"... | def compare(ver1, ver2):
"""Compare two versions
:param ver1: version string 1
:param ver2: version string 2
:return: The return value is negative if ver1 < ver2,
zero if ver1 == ver2 and strictly positive if ver1 > ver2
:rtype: int
>>> import semver
>>> semver.compare("1.0.0"... | [
"Compare",
"two",
"versions"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L264-L284 | [
"def",
"compare",
"(",
"ver1",
",",
"ver2",
")",
":",
"v1",
",",
"v2",
"=",
"parse",
"(",
"ver1",
")",
",",
"parse",
"(",
"ver2",
")",
"return",
"_compare_by_keys",
"(",
"v1",
",",
"v2",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | match | Compare two versions through a comparison
:param str version: a version string
:param str match_expr: operator and version; valid operators are
< smaller than
> greater than
>= greator or equal than
<= smaller or equal than
== equal
!= not equ... | pipenv/vendor/semver.py | def match(version, match_expr):
"""Compare two versions through a comparison
:param str version: a version string
:param str match_expr: operator and version; valid operators are
< smaller than
> greater than
>= greator or equal than
<= smaller or equal than
... | def match(version, match_expr):
"""Compare two versions through a comparison
:param str version: a version string
:param str match_expr: operator and version; valid operators are
< smaller than
> greater than
>= greator or equal than
<= smaller or equal than
... | [
"Compare",
"two",
"versions",
"through",
"a",
"comparison"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L287-L331 | [
"def",
"match",
"(",
"version",
",",
"match_expr",
")",
":",
"prefix",
"=",
"match_expr",
"[",
":",
"2",
"]",
"if",
"prefix",
"in",
"(",
"'>='",
",",
"'<='",
",",
"'=='",
",",
"'!='",
")",
":",
"match_version",
"=",
"match_expr",
"[",
"2",
":",
"]"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | max_ver | Returns the greater version of two versions
:param ver1: version string 1
:param ver2: version string 2
:return: the greater version of the two
:rtype: :class:`VersionInfo`
>>> import semver
>>> semver.max_ver("1.0.0", "2.0.0")
'2.0.0' | pipenv/vendor/semver.py | def max_ver(ver1, ver2):
"""Returns the greater version of two versions
:param ver1: version string 1
:param ver2: version string 2
:return: the greater version of the two
:rtype: :class:`VersionInfo`
>>> import semver
>>> semver.max_ver("1.0.0", "2.0.0")
'2.0.0'
"""
cmp_res = ... | def max_ver(ver1, ver2):
"""Returns the greater version of two versions
:param ver1: version string 1
:param ver2: version string 2
:return: the greater version of the two
:rtype: :class:`VersionInfo`
>>> import semver
>>> semver.max_ver("1.0.0", "2.0.0")
'2.0.0'
"""
cmp_res = ... | [
"Returns",
"the",
"greater",
"version",
"of",
"two",
"versions"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L334-L350 | [
"def",
"max_ver",
"(",
"ver1",
",",
"ver2",
")",
":",
"cmp_res",
"=",
"compare",
"(",
"ver1",
",",
"ver2",
")",
"if",
"cmp_res",
"==",
"0",
"or",
"cmp_res",
"==",
"1",
":",
"return",
"ver1",
"else",
":",
"return",
"ver2"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | min_ver | Returns the smaller version of two versions
:param ver1: version string 1
:param ver2: version string 2
:return: the smaller version of the two
:rtype: :class:`VersionInfo`
>>> import semver
>>> semver.min_ver("1.0.0", "2.0.0")
'1.0.0' | pipenv/vendor/semver.py | def min_ver(ver1, ver2):
"""Returns the smaller version of two versions
:param ver1: version string 1
:param ver2: version string 2
:return: the smaller version of the two
:rtype: :class:`VersionInfo`
>>> import semver
>>> semver.min_ver("1.0.0", "2.0.0")
'1.0.0'
"""
cmp_res = ... | def min_ver(ver1, ver2):
"""Returns the smaller version of two versions
:param ver1: version string 1
:param ver2: version string 2
:return: the smaller version of the two
:rtype: :class:`VersionInfo`
>>> import semver
>>> semver.min_ver("1.0.0", "2.0.0")
'1.0.0'
"""
cmp_res = ... | [
"Returns",
"the",
"smaller",
"version",
"of",
"two",
"versions"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L353-L369 | [
"def",
"min_ver",
"(",
"ver1",
",",
"ver2",
")",
":",
"cmp_res",
"=",
"compare",
"(",
"ver1",
",",
"ver2",
")",
"if",
"cmp_res",
"==",
"0",
"or",
"cmp_res",
"==",
"-",
"1",
":",
"return",
"ver1",
"else",
":",
"return",
"ver2"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | format_version | Format a version according to the Semantic Versioning specification
:param str major: the required major part of a version
:param str minor: the required minor part of a version
:param str patch: the required patch part of a version
:param str prerelease: the optional prerelease part of a version
:... | pipenv/vendor/semver.py | def format_version(major, minor, patch, prerelease=None, build=None):
"""Format a version according to the Semantic Versioning specification
:param str major: the required major part of a version
:param str minor: the required minor part of a version
:param str patch: the required patch part of a versi... | def format_version(major, minor, patch, prerelease=None, build=None):
"""Format a version according to the Semantic Versioning specification
:param str major: the required major part of a version
:param str minor: the required minor part of a version
:param str patch: the required patch part of a versi... | [
"Format",
"a",
"version",
"according",
"to",
"the",
"Semantic",
"Versioning",
"specification"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/semver.py#L372-L394 | [
"def",
"format_version",
"(",
"major",
",",
"minor",
",",
"patch",
",",
"prerelease",
"=",
"None",
",",
"build",
"=",
"None",
")",
":",
"version",
"=",
"\"%d.%d.%d\"",
"%",
"(",
"major",
",",
"minor",
",",
"patch",
")",
"if",
"prerelease",
"is",
"not",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _make_eof_intr | Set constants _EOF and _INTR.
This avoids doing potentially costly operations on module load. | pipenv/vendor/ptyprocess/ptyprocess.py | def _make_eof_intr():
"""Set constants _EOF and _INTR.
This avoids doing potentially costly operations on module load.
"""
global _EOF, _INTR
if (_EOF is not None) and (_INTR is not None):
return
# inherit EOF and INTR definitions from controlling process.
try:
from ter... | def _make_eof_intr():
"""Set constants _EOF and _INTR.
This avoids doing potentially costly operations on module load.
"""
global _EOF, _INTR
if (_EOF is not None) and (_INTR is not None):
return
# inherit EOF and INTR definitions from controlling process.
try:
from ter... | [
"Set",
"constants",
"_EOF",
"and",
"_INTR",
".",
"This",
"avoids",
"doing",
"potentially",
"costly",
"operations",
"on",
"module",
"load",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L51-L89 | [
"def",
"_make_eof_intr",
"(",
")",
":",
"global",
"_EOF",
",",
"_INTR",
"if",
"(",
"_EOF",
"is",
"not",
"None",
")",
"and",
"(",
"_INTR",
"is",
"not",
"None",
")",
":",
"return",
"# inherit EOF and INTR definitions from controlling process.",
"try",
":",
"from... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.spawn | Start the given command in a child process in a pseudo terminal.
This does all the fork/exec type of stuff for a pty, and returns an
instance of PtyProcess.
If preexec_fn is supplied, it will be called with no arguments in the
child process before exec-ing the specified command.
... | pipenv/vendor/ptyprocess/ptyprocess.py | def spawn(
cls, argv, cwd=None, env=None, echo=True, preexec_fn=None,
dimensions=(24, 80)):
'''Start the given command in a child process in a pseudo terminal.
This does all the fork/exec type of stuff for a pty, and returns an
instance of PtyProcess.
If preexec... | def spawn(
cls, argv, cwd=None, env=None, echo=True, preexec_fn=None,
dimensions=(24, 80)):
'''Start the given command in a child process in a pseudo terminal.
This does all the fork/exec type of stuff for a pty, and returns an
instance of PtyProcess.
If preexec... | [
"Start",
"the",
"given",
"command",
"in",
"a",
"child",
"process",
"in",
"a",
"pseudo",
"terminal",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L179-L338 | [
"def",
"spawn",
"(",
"cls",
",",
"argv",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"echo",
"=",
"True",
",",
"preexec_fn",
"=",
"None",
",",
"dimensions",
"=",
"(",
"24",
",",
"80",
")",
")",
":",
"# Note that it is difficult for this meth... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.close | This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the child ignores SIGHUP
and SIGINT). | pipenv/vendor/ptyprocess/ptyprocess.py | def close(self, force=True):
'''This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the chi... | def close(self, force=True):
'''This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the chi... | [
"This",
"closes",
"the",
"connection",
"with",
"the",
"child",
"application",
".",
"Note",
"that",
"calling",
"close",
"()",
"more",
"than",
"once",
"is",
"valid",
".",
"This",
"emulates",
"standard",
"Python",
"behavior",
"with",
"files",
".",
"Set",
"force... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L387-L402 | [
"def",
"close",
"(",
"self",
",",
"force",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"closed",
":",
"self",
".",
"flush",
"(",
")",
"self",
".",
"fileobj",
".",
"close",
"(",
")",
"# Closes the file descriptor",
"# Give kernel time to update process s... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.getecho | This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. | pipenv/vendor/ptyprocess/ptyprocess.py | def getecho(self):
'''This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. '''
... | def getecho(self):
'''This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. '''
... | [
"This",
"returns",
"the",
"terminal",
"echo",
"mode",
".",
"This",
"returns",
"True",
"if",
"echo",
"is",
"on",
"or",
"False",
"if",
"echo",
"is",
"off",
".",
"Child",
"applications",
"that",
"are",
"expecting",
"you",
"to",
"enter",
"a",
"password",
"of... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L449-L465 | [
"def",
"getecho",
"(",
"self",
")",
":",
"try",
":",
"attr",
"=",
"termios",
".",
"tcgetattr",
"(",
"self",
".",
"fd",
")",
"except",
"termios",
".",
"error",
"as",
"err",
":",
"errmsg",
"=",
"'getecho() may not be called on this platform'",
"if",
"err",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.setecho | This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pexpect.spawn('cat') # Echo is on by de... | pipenv/vendor/ptyprocess/ptyprocess.py | def setecho(self, state):
'''This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pe... | def setecho(self, state):
'''This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pe... | [
"This",
"sets",
"the",
"terminal",
"echo",
"mode",
"on",
"or",
"off",
".",
"Note",
"that",
"anything",
"the",
"child",
"sent",
"before",
"the",
"echo",
"will",
"be",
"lost",
"so",
"you",
"should",
"be",
"sure",
"that",
"your",
"input",
"buffer",
"is",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L467-L501 | [
"def",
"setecho",
"(",
"self",
",",
"state",
")",
":",
"_setecho",
"(",
"self",
".",
"fd",
",",
"state",
")",
"self",
".",
"echo",
"=",
"state"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.read | Read and return at most ``size`` bytes from the pty.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
with the vagaries of EOF on platforms that do strange things, li... | pipenv/vendor/ptyprocess/ptyprocess.py | def read(self, size=1024):
"""Read and return at most ``size`` bytes from the pty.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
with the vagaries of EOF o... | def read(self, size=1024):
"""Read and return at most ``size`` bytes from the pty.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
with the vagaries of EOF o... | [
"Read",
"and",
"return",
"at",
"most",
"size",
"bytes",
"from",
"the",
"pty",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L503-L528 | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"1024",
")",
":",
"try",
":",
"s",
"=",
"self",
".",
"fileobj",
".",
"read1",
"(",
"size",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
"as",
"err",
":",
"if",
"err",
".",
"args",
"[",
"0",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.readline | Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed. | pipenv/vendor/ptyprocess/ptyprocess.py | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
try:
s = self.fileobj.readline()
except (OSError, IOError) as err:
... | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
try:
s = self.fileobj.readline()
except (OSError, IOError) as err:
... | [
"Read",
"one",
"line",
"from",
"the",
"pseudoterminal",
"and",
"return",
"it",
"as",
"unicode",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L530-L549 | [
"def",
"readline",
"(",
"self",
")",
":",
"try",
":",
"s",
"=",
"self",
".",
"fileobj",
".",
"readline",
"(",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
"as",
"err",
":",
"if",
"err",
".",
"args",
"[",
"0",
"]",
"==",
"errno",
".",
"EI... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.write | Write bytes to the pseudoterminal.
Returns the number of bytes written. | pipenv/vendor/ptyprocess/ptyprocess.py | def write(self, s, flush=True):
"""Write bytes to the pseudoterminal.
Returns the number of bytes written.
"""
return self._writeb(s, flush=flush) | def write(self, s, flush=True):
"""Write bytes to the pseudoterminal.
Returns the number of bytes written.
"""
return self._writeb(s, flush=flush) | [
"Write",
"bytes",
"to",
"the",
"pseudoterminal",
".",
"Returns",
"the",
"number",
"of",
"bytes",
"written",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L557-L562 | [
"def",
"write",
"(",
"self",
",",
"s",
",",
"flush",
"=",
"True",
")",
":",
"return",
"self",
".",
"_writeb",
"(",
"s",
",",
"flush",
"=",
"flush",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.sendcontrol | Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '\a')::
child.sendcontrol('g')
See also, sendintr() and sendeof(). | pipenv/vendor/ptyprocess/ptyprocess.py | def sendcontrol(self, char):
'''Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '\a')::
child.sendcontrol('g')
See also, sendintr() and sendeof().
... | def sendcontrol(self, char):
'''Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '\a')::
child.sendcontrol('g')
See also, sendintr() and sendeof().
... | [
"Helper",
"method",
"that",
"wraps",
"send",
"()",
"with",
"mnemonic",
"access",
"for",
"sending",
"control",
"character",
"to",
"the",
"child",
"(",
"such",
"as",
"Ctrl",
"-",
"C",
"or",
"Ctrl",
"-",
"D",
")",
".",
"For",
"example",
"to",
"send",
"Ctr... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L564-L590 | [
"def",
"sendcontrol",
"(",
"self",
",",
"char",
")",
":",
"char",
"=",
"char",
".",
"lower",
"(",
")",
"a",
"=",
"ord",
"(",
"char",
")",
"if",
"97",
"<=",
"a",
"<=",
"122",
":",
"a",
"=",
"a",
"-",
"ord",
"(",
"'a'",
")",
"+",
"1",
"byte",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.terminate | This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated. | pipenv/vendor/ptyprocess/ptyprocess.py | def terminate(self, force=False):
'''This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated. '''
if not ... | def terminate(self, force=False):
'''This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated. '''
if not ... | [
"This",
"forces",
"a",
"child",
"process",
"to",
"terminate",
".",
"It",
"starts",
"nicely",
"with",
"SIGHUP",
"and",
"SIGINT",
".",
"If",
"force",
"is",
"True",
"then",
"moves",
"onto",
"SIGKILL",
".",
"This",
"returns",
"True",
"if",
"the",
"child",
"w... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L616-L654 | [
"def",
"terminate",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"isalive",
"(",
")",
":",
"return",
"True",
"try",
":",
"self",
".",
"kill",
"(",
"signal",
".",
"SIGHUP",
")",
"time",
".",
"sleep",
"(",
"self",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.wait | This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
technically still a... | pipenv/vendor/ptyprocess/ptyprocess.py | def wait(self):
'''This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
... | def wait(self):
'''This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
... | [
"This",
"waits",
"until",
"the",
"child",
"exits",
".",
"This",
"is",
"a",
"blocking",
"call",
".",
"This",
"will",
"not",
"read",
"any",
"data",
"from",
"the",
"child",
"so",
"this",
"will",
"block",
"forever",
"if",
"the",
"child",
"has",
"unread",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L656-L683 | [
"def",
"wait",
"(",
"self",
")",
":",
"if",
"self",
".",
"isalive",
"(",
")",
":",
"pid",
",",
"status",
"=",
"os",
".",
"waitpid",
"(",
"self",
".",
"pid",
",",
"0",
")",
"else",
":",
"return",
"self",
".",
"exitstatus",
"self",
".",
"exitstatus... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.isalive | This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
SECONDS for Solaris to... | pipenv/vendor/ptyprocess/ptyprocess.py | def isalive(self):
'''This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
... | def isalive(self):
'''This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
... | [
"This",
"tests",
"if",
"the",
"child",
"process",
"is",
"running",
"or",
"not",
".",
"This",
"is",
"non",
"-",
"blocking",
".",
"If",
"the",
"child",
"was",
"terminated",
"then",
"this",
"will",
"read",
"the",
"exitstatus",
"or",
"signalstatus",
"of",
"t... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L685-L760 | [
"def",
"isalive",
"(",
"self",
")",
":",
"if",
"self",
".",
"terminated",
":",
"return",
"False",
"if",
"self",
".",
"flag_eof",
":",
"# This is for Linux, which requires the blocking form",
"# of waitpid to get the status of a defunct process.",
"# This is super-lame. The fl... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcess.kill | Send the given signal to the child application.
In keeping with UNIX tradition it has a misleading name. It does not
necessarily kill the child unless you send the right signal. See the
:mod:`signal` module for constants representing signal numbers. | pipenv/vendor/ptyprocess/ptyprocess.py | def kill(self, sig):
"""Send the given signal to the child application.
In keeping with UNIX tradition it has a misleading name. It does not
necessarily kill the child unless you send the right signal. See the
:mod:`signal` module for constants representing signal numbers.
"""
... | def kill(self, sig):
"""Send the given signal to the child application.
In keeping with UNIX tradition it has a misleading name. It does not
necessarily kill the child unless you send the right signal. See the
:mod:`signal` module for constants representing signal numbers.
"""
... | [
"Send",
"the",
"given",
"signal",
"to",
"the",
"child",
"application",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L762-L772 | [
"def",
"kill",
"(",
"self",
",",
"sig",
")",
":",
"# Same as os.kill, but the pid is given for you.",
"if",
"self",
".",
"isalive",
"(",
")",
":",
"os",
".",
"kill",
"(",
"self",
".",
"pid",
",",
"sig",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcessUnicode.read | Read at most ``size`` bytes from the pty, return them as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
The size argument still refers to bytes, not unicode code points. | pipenv/vendor/ptyprocess/ptyprocess.py | def read(self, size=1024):
"""Read at most ``size`` bytes from the pty, return them as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
The size argument still refers to bytes, not unicode code points.
"""
b = super(PtyP... | def read(self, size=1024):
"""Read at most ``size`` bytes from the pty, return them as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
The size argument still refers to bytes, not unicode code points.
"""
b = super(PtyP... | [
"Read",
"at",
"most",
"size",
"bytes",
"from",
"the",
"pty",
"return",
"them",
"as",
"unicode",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L810-L819 | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"1024",
")",
":",
"b",
"=",
"super",
"(",
"PtyProcessUnicode",
",",
"self",
")",
".",
"read",
"(",
"size",
")",
"return",
"self",
".",
"decoder",
".",
"decode",
"(",
"b",
",",
"final",
"=",
"False",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcessUnicode.readline | Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed. | pipenv/vendor/ptyprocess/ptyprocess.py | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
b = super(PtyProcessUnicode, self).readline()
return self.decoder.decode(b, final=False) | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
b = super(PtyProcessUnicode, self).readline()
return self.decoder.decode(b, final=False) | [
"Read",
"one",
"line",
"from",
"the",
"pseudoterminal",
"and",
"return",
"it",
"as",
"unicode",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L821-L828 | [
"def",
"readline",
"(",
"self",
")",
":",
"b",
"=",
"super",
"(",
"PtyProcessUnicode",
",",
"self",
")",
".",
"readline",
"(",
")",
"return",
"self",
".",
"decoder",
".",
"decode",
"(",
"b",
",",
"final",
"=",
"False",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PtyProcessUnicode.write | Write the unicode string ``s`` to the pseudoterminal.
Returns the number of bytes written. | pipenv/vendor/ptyprocess/ptyprocess.py | def write(self, s):
"""Write the unicode string ``s`` to the pseudoterminal.
Returns the number of bytes written.
"""
b = s.encode(self.encoding)
return super(PtyProcessUnicode, self).write(b) | def write(self, s):
"""Write the unicode string ``s`` to the pseudoterminal.
Returns the number of bytes written.
"""
b = s.encode(self.encoding)
return super(PtyProcessUnicode, self).write(b) | [
"Write",
"the",
"unicode",
"string",
"s",
"to",
"the",
"pseudoterminal",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L830-L836 | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"b",
"=",
"s",
".",
"encode",
"(",
"self",
".",
"encoding",
")",
"return",
"super",
"(",
"PtyProcessUnicode",
",",
"self",
")",
".",
"write",
"(",
"b",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Criterion.from_requirement | Build an instance from a requirement. | pipenv/vendor/resolvelib/resolvers.py | def from_requirement(cls, provider, requirement, parent):
"""Build an instance from a requirement.
"""
candidates = provider.find_matches(requirement)
if not candidates:
raise NoVersionsAvailable(requirement, parent)
return cls(
candidates=candidates,
... | def from_requirement(cls, provider, requirement, parent):
"""Build an instance from a requirement.
"""
candidates = provider.find_matches(requirement)
if not candidates:
raise NoVersionsAvailable(requirement, parent)
return cls(
candidates=candidates,
... | [
"Build",
"an",
"instance",
"from",
"a",
"requirement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L40-L49 | [
"def",
"from_requirement",
"(",
"cls",
",",
"provider",
",",
"requirement",
",",
"parent",
")",
":",
"candidates",
"=",
"provider",
".",
"find_matches",
"(",
"requirement",
")",
"if",
"not",
"candidates",
":",
"raise",
"NoVersionsAvailable",
"(",
"requirement",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Criterion.merged_with | Build a new instance from this and a new requirement. | pipenv/vendor/resolvelib/resolvers.py | def merged_with(self, provider, requirement, parent):
"""Build a new instance from this and a new requirement.
"""
infos = list(self.information)
infos.append(RequirementInformation(requirement, parent))
candidates = [
c for c in self.candidates
if provide... | def merged_with(self, provider, requirement, parent):
"""Build a new instance from this and a new requirement.
"""
infos = list(self.information)
infos.append(RequirementInformation(requirement, parent))
candidates = [
c for c in self.candidates
if provide... | [
"Build",
"a",
"new",
"instance",
"from",
"this",
"and",
"a",
"new",
"requirement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L57-L68 | [
"def",
"merged_with",
"(",
"self",
",",
"provider",
",",
"requirement",
",",
"parent",
")",
":",
"infos",
"=",
"list",
"(",
"self",
".",
"information",
")",
"infos",
".",
"append",
"(",
"RequirementInformation",
"(",
"requirement",
",",
"parent",
")",
")",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolution._push_new_state | Push a new state into history.
This new state will be used to hold resolution results of the next
coming round. | pipenv/vendor/resolvelib/resolvers.py | def _push_new_state(self):
"""Push a new state into history.
This new state will be used to hold resolution results of the next
coming round.
"""
try:
base = self._states[-1]
except IndexError:
graph = DirectedGraph()
graph.add(None) ... | def _push_new_state(self):
"""Push a new state into history.
This new state will be used to hold resolution results of the next
coming round.
"""
try:
base = self._states[-1]
except IndexError:
graph = DirectedGraph()
graph.add(None) ... | [
"Push",
"a",
"new",
"state",
"into",
"history",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L110-L127 | [
"def",
"_push_new_state",
"(",
"self",
")",
":",
"try",
":",
"base",
"=",
"self",
".",
"_states",
"[",
"-",
"1",
"]",
"except",
"IndexError",
":",
"graph",
"=",
"DirectedGraph",
"(",
")",
"graph",
".",
"add",
"(",
"None",
")",
"# Sentinel as root depende... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Resolver.resolve | Take a collection of constraints, spit out the resolution result.
The return value is a representation to the final resolution result. It
is a tuple subclass with two public members:
* `mapping`: A dict of resolved candidates. Each key is an identifier
of a requirement (as returned... | pipenv/vendor/resolvelib/resolvers.py | def resolve(self, requirements, max_rounds=20):
"""Take a collection of constraints, spit out the resolution result.
The return value is a representation to the final resolution result. It
is a tuple subclass with two public members:
* `mapping`: A dict of resolved candidates. Each key... | def resolve(self, requirements, max_rounds=20):
"""Take a collection of constraints, spit out the resolution result.
The return value is a representation to the final resolution result. It
is a tuple subclass with two public members:
* `mapping`: A dict of resolved candidates. Each key... | [
"Take",
"a",
"collection",
"of",
"constraints",
"spit",
"out",
"the",
"resolution",
"result",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L261-L287 | [
"def",
"resolve",
"(",
"self",
",",
"requirements",
",",
"max_rounds",
"=",
"20",
")",
":",
"resolution",
"=",
"Resolution",
"(",
"self",
".",
"provider",
",",
"self",
".",
"reporter",
")",
"resolution",
".",
"resolve",
"(",
"requirements",
",",
"max_round... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _strip_extra | Remove the "extra == ..." operands from the list.
This is not a comprehensive implementation, but relies on an important
characteristic of metadata generation: The "extra == ..." operand is always
associated with an "and" operator. This means that we can simply remove the
operand and the "and" operator... | pipenv/vendor/passa/internals/markers.py | def _strip_extra(elements):
"""Remove the "extra == ..." operands from the list.
This is not a comprehensive implementation, but relies on an important
characteristic of metadata generation: The "extra == ..." operand is always
associated with an "and" operator. This means that we can simply remove the... | def _strip_extra(elements):
"""Remove the "extra == ..." operands from the list.
This is not a comprehensive implementation, but relies on an important
characteristic of metadata generation: The "extra == ..." operand is always
associated with an "and" operator. This means that we can simply remove the... | [
"Remove",
"the",
"extra",
"==",
"...",
"operands",
"from",
"the",
"list",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L8-L34 | [
"def",
"_strip_extra",
"(",
"elements",
")",
":",
"extra_indexes",
"=",
"[",
"]",
"for",
"i",
",",
"element",
"in",
"enumerate",
"(",
"elements",
")",
":",
"if",
"isinstance",
"(",
"element",
",",
"list",
")",
":",
"cancelled",
"=",
"_strip_extra",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_without_extra | Build a new marker without the `extra == ...` part.
The implementation relies very deep into packaging's internals, but I don't
have a better way now (except implementing the whole thing myself).
This could return `None` if the `extra == ...` part is the only one in the
input marker. | pipenv/vendor/passa/internals/markers.py | def get_without_extra(marker):
"""Build a new marker without the `extra == ...` part.
The implementation relies very deep into packaging's internals, but I don't
have a better way now (except implementing the whole thing myself).
This could return `None` if the `extra == ...` part is the only one in t... | def get_without_extra(marker):
"""Build a new marker without the `extra == ...` part.
The implementation relies very deep into packaging's internals, but I don't
have a better way now (except implementing the whole thing myself).
This could return `None` if the `extra == ...` part is the only one in t... | [
"Build",
"a",
"new",
"marker",
"without",
"the",
"extra",
"==",
"...",
"part",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L37-L57 | [
"def",
"get_without_extra",
"(",
"marker",
")",
":",
"# TODO: Why is this very deep in the internals? Why is a better solution",
"# implementing it yourself when someone is already maintaining a codebase",
"# for this? It's literally a grammar implementation that is required to",
"# meet the deman... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_contained_extras | Collect "extra == ..." operands from a marker.
Returns a list of str. Each str is a speficied extra in this marker. | pipenv/vendor/passa/internals/markers.py | def get_contained_extras(marker):
"""Collect "extra == ..." operands from a marker.
Returns a list of str. Each str is a speficied extra in this marker.
"""
if not marker:
return set()
marker = Marker(str(marker))
extras = set()
_markers_collect_extras(marker._markers, extras)
r... | def get_contained_extras(marker):
"""Collect "extra == ..." operands from a marker.
Returns a list of str. Each str is a speficied extra in this marker.
"""
if not marker:
return set()
marker = Marker(str(marker))
extras = set()
_markers_collect_extras(marker._markers, extras)
r... | [
"Collect",
"extra",
"==",
"...",
"operands",
"from",
"a",
"marker",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L71-L81 | [
"def",
"get_contained_extras",
"(",
"marker",
")",
":",
"if",
"not",
"marker",
":",
"return",
"set",
"(",
")",
"marker",
"=",
"Marker",
"(",
"str",
"(",
"marker",
")",
")",
"extras",
"=",
"set",
"(",
")",
"_markers_collect_extras",
"(",
"marker",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | contains_extra | Check whehter a marker contains an "extra == ..." operand. | pipenv/vendor/passa/internals/markers.py | def contains_extra(marker):
"""Check whehter a marker contains an "extra == ..." operand.
"""
if not marker:
return False
marker = Marker(str(marker))
return _markers_contains_extra(marker._markers) | def contains_extra(marker):
"""Check whehter a marker contains an "extra == ..." operand.
"""
if not marker:
return False
marker = Marker(str(marker))
return _markers_contains_extra(marker._markers) | [
"Check",
"whehter",
"a",
"marker",
"contains",
"an",
"extra",
"==",
"...",
"operand",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L95-L101 | [
"def",
"contains_extra",
"(",
"marker",
")",
":",
"if",
"not",
"marker",
":",
"return",
"False",
"marker",
"=",
"Marker",
"(",
"str",
"(",
"marker",
")",
")",
"return",
"_markers_contains_extra",
"(",
"marker",
".",
"_markers",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Locator.get_errors | Return any errors which have occurred. | pipenv/vendor/distlib/locators.py | def get_errors(self):
"""
Return any errors which have occurred.
"""
result = []
while not self.errors.empty(): # pragma: no cover
try:
e = self.errors.get(False)
result.append(e)
except self.errors.Empty:
c... | def get_errors(self):
"""
Return any errors which have occurred.
"""
result = []
while not self.errors.empty(): # pragma: no cover
try:
e = self.errors.get(False)
result.append(e)
except self.errors.Empty:
c... | [
"Return",
"any",
"errors",
"which",
"have",
"occurred",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L121-L133 | [
"def",
"get_errors",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"while",
"not",
"self",
".",
"errors",
".",
"empty",
"(",
")",
":",
"# pragma: no cover",
"try",
":",
"e",
"=",
"self",
".",
"errors",
".",
"get",
"(",
"False",
")",
"result",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Locator.get_project | For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top. | pipenv/vendor/distlib/locators.py | def get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top.
"""
if self._cache is None: # pragma: no cover
... | def get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top.
"""
if self._cache is None: # pragma: no cover
... | [
"For",
"a",
"given",
"project",
"get",
"a",
"dictionary",
"mapping",
"available",
"versions",
"to",
"Distribution",
"instances",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L171-L186 | [
"def",
"get_project",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"_cache",
"is",
"None",
":",
"# pragma: no cover",
"result",
"=",
"self",
".",
"_get_project",
"(",
"name",
")",
"elif",
"name",
"in",
"self",
".",
"_cache",
":",
"result",
"=... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.