id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
25,200 | pypa/pipenv | pipenv/vendor/pep517/envbuild.py | BuildEnvironment.pip_install | def pip_install(self, reqs):
"""Install dependencies into this env by calling pip in a subprocess"""
if not reqs:
return
log.info('Calling pip to install %s', reqs)
check_call([
sys.executable, '-m', 'pip', 'install', '--ignore-installed',
'--prefix', ... | python | def pip_install(self, reqs):
"""Install dependencies into this env by calling pip in a subprocess"""
if not reqs:
return
log.info('Calling pip to install %s', reqs)
check_call([
sys.executable, '-m', 'pip', 'install', '--ignore-installed',
'--prefix', ... | [
"def",
"pip_install",
"(",
"self",
",",
"reqs",
")",
":",
"if",
"not",
"reqs",
":",
"return",
"log",
".",
"info",
"(",
"'Calling pip to install %s'",
",",
"reqs",
")",
"check_call",
"(",
"[",
"sys",
".",
"executable",
",",
"'-m'",
",",
"'pip'",
",",
"'... | Install dependencies into this env by calling pip in a subprocess | [
"Install",
"dependencies",
"into",
"this",
"env",
"by",
"calling",
"pip",
"in",
"a",
"subprocess"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/envbuild.py#L88-L95 |
25,201 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | Node.reparentChildren | def reparentChildren(self, newParent):
"""Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way
:arg newParent: the node to move all this node's children to
"""
# XXX - should... | python | def reparentChildren(self, newParent):
"""Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way
:arg newParent: the node to move all this node's children to
"""
# XXX - should... | [
"def",
"reparentChildren",
"(",
"self",
",",
"newParent",
")",
":",
"# XXX - should this method be made more general?",
"for",
"child",
"in",
"self",
".",
"childNodes",
":",
"newParent",
".",
"appendChild",
"(",
"child",
")",
"self",
".",
"childNodes",
"=",
"[",
... | Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way
:arg newParent: the node to move all this node's children to | [
"Move",
"all",
"the",
"children",
"of",
"the",
"current",
"node",
"to",
"newParent",
".",
"This",
"is",
"needed",
"so",
"that",
"trees",
"that",
"don",
"t",
"store",
"text",
"as",
"nodes",
"move",
"the",
"text",
"in",
"the",
"correct",
"way"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L97-L108 |
25,202 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | TreeBuilder.elementInActiveFormattingElements | def elementInActiveFormattingElements(self, name):
"""Check if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return false"""
for item in self.activeFormattingElements[::-1]:
# Check for Marker first becau... | python | def elementInActiveFormattingElements(self, name):
"""Check if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return false"""
for item in self.activeFormattingElements[::-1]:
# Check for Marker first becau... | [
"def",
"elementInActiveFormattingElements",
"(",
"self",
",",
"name",
")",
":",
"for",
"item",
"in",
"self",
".",
"activeFormattingElements",
"[",
":",
":",
"-",
"1",
"]",
":",
"# Check for Marker first because if it's a Marker it doesn't have a",
"# name attribute.",
"... | Check if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return false | [
"Check",
"if",
"an",
"element",
"exists",
"between",
"the",
"end",
"of",
"the",
"active",
"formatting",
"elements",
"and",
"the",
"last",
"marker",
".",
"If",
"it",
"does",
"return",
"it",
"else",
"return",
"false"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L269-L281 |
25,203 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | TreeBuilder.createElement | def createElement(self, token):
"""Create an element but don't insert it anywhere"""
name = token["name"]
namespace = token.get("namespace", self.defaultNamespace)
element = self.elementClass(name, namespace)
element.attributes = token["data"]
return element | python | def createElement(self, token):
"""Create an element but don't insert it anywhere"""
name = token["name"]
namespace = token.get("namespace", self.defaultNamespace)
element = self.elementClass(name, namespace)
element.attributes = token["data"]
return element | [
"def",
"createElement",
"(",
"self",
",",
"token",
")",
":",
"name",
"=",
"token",
"[",
"\"name\"",
"]",
"namespace",
"=",
"token",
".",
"get",
"(",
"\"namespace\"",
",",
"self",
".",
"defaultNamespace",
")",
"element",
"=",
"self",
".",
"elementClass",
... | Create an element but don't insert it anywhere | [
"Create",
"an",
"element",
"but",
"don",
"t",
"insert",
"it",
"anywhere"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L301-L307 |
25,204 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | TreeBuilder._setInsertFromTable | def _setInsertFromTable(self, value):
"""Switch the function used to insert an element from the
normal one to the misnested table one and back again"""
self._insertFromTable = value
if value:
self.insertElement = self.insertElementTable
else:
self.insertEl... | python | def _setInsertFromTable(self, value):
"""Switch the function used to insert an element from the
normal one to the misnested table one and back again"""
self._insertFromTable = value
if value:
self.insertElement = self.insertElementTable
else:
self.insertEl... | [
"def",
"_setInsertFromTable",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_insertFromTable",
"=",
"value",
"if",
"value",
":",
"self",
".",
"insertElement",
"=",
"self",
".",
"insertElementTable",
"else",
":",
"self",
".",
"insertElement",
"=",
"self"... | Switch the function used to insert an element from the
normal one to the misnested table one and back again | [
"Switch",
"the",
"function",
"used",
"to",
"insert",
"an",
"element",
"from",
"the",
"normal",
"one",
"to",
"the",
"misnested",
"table",
"one",
"and",
"back",
"again"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L312-L319 |
25,205 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | TreeBuilder.insertElementTable | def insertElementTable(self, token):
"""Create an element and insert it into the tree"""
element = self.createElement(token)
if self.openElements[-1].name not in tableInsertModeElements:
return self.insertElementNormal(token)
else:
# We should be in the InTable mo... | python | def insertElementTable(self, token):
"""Create an element and insert it into the tree"""
element = self.createElement(token)
if self.openElements[-1].name not in tableInsertModeElements:
return self.insertElementNormal(token)
else:
# We should be in the InTable mo... | [
"def",
"insertElementTable",
"(",
"self",
",",
"token",
")",
":",
"element",
"=",
"self",
".",
"createElement",
"(",
"token",
")",
"if",
"self",
".",
"openElements",
"[",
"-",
"1",
"]",
".",
"name",
"not",
"in",
"tableInsertModeElements",
":",
"return",
... | Create an element and insert it into the tree | [
"Create",
"an",
"element",
"and",
"insert",
"it",
"into",
"the",
"tree"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L333-L347 |
25,206 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | TreeBuilder.insertText | def insertText(self, data, parent=None):
"""Insert text data."""
if parent is None:
parent = self.openElements[-1]
if (not self.insertFromTable or (self.insertFromTable and
self.openElements[-1].name
n... | python | def insertText(self, data, parent=None):
"""Insert text data."""
if parent is None:
parent = self.openElements[-1]
if (not self.insertFromTable or (self.insertFromTable and
self.openElements[-1].name
n... | [
"def",
"insertText",
"(",
"self",
",",
"data",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"self",
".",
"openElements",
"[",
"-",
"1",
"]",
"if",
"(",
"not",
"self",
".",
"insertFromTable",
"or",
"(",
"se... | Insert text data. | [
"Insert",
"text",
"data",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L349-L362 |
25,207 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py | TreeBuilder.getFragment | def getFragment(self):
"""Return the final fragment"""
# assert self.innerHTML
fragment = self.fragmentClass()
self.openElements[0].reparentChildren(fragment)
return fragment | python | def getFragment(self):
"""Return the final fragment"""
# assert self.innerHTML
fragment = self.fragmentClass()
self.openElements[0].reparentChildren(fragment)
return fragment | [
"def",
"getFragment",
"(",
"self",
")",
":",
"# assert self.innerHTML",
"fragment",
"=",
"self",
".",
"fragmentClass",
"(",
")",
"self",
".",
"openElements",
"[",
"0",
"]",
".",
"reparentChildren",
"(",
"fragment",
")",
"return",
"fragment"
] | Return the final fragment | [
"Return",
"the",
"final",
"fragment"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/base.py#L404-L409 |
25,208 | pypa/pipenv | pipenv/vendor/packaging/markers.py | Marker.evaluate | def evaluate(self, environment=None):
"""Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Pyt... | python | def evaluate(self, environment=None):
"""Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Pyt... | [
"def",
"evaluate",
"(",
"self",
",",
"environment",
"=",
"None",
")",
":",
"current_environment",
"=",
"default_environment",
"(",
")",
"if",
"environment",
"is",
"not",
"None",
":",
"current_environment",
".",
"update",
"(",
"environment",
")",
"return",
"_ev... | Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Python process. | [
"Evaluate",
"a",
"marker",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/packaging/markers.py#L283-L296 |
25,209 | pypa/pipenv | pipenv/vendor/passa/internals/hashes.py | _allow_all_wheels | def _allow_all_wheels():
"""Monkey patch pip.Wheel to allow all wheels
The usual checks against platforms and Python versions are ignored to allow
fetching all available entries in PyPI. This also saves the candidate cache
and set a new one, or else the results from the previous non-patched calls
w... | python | def _allow_all_wheels():
"""Monkey patch pip.Wheel to allow all wheels
The usual checks against platforms and Python versions are ignored to allow
fetching all available entries in PyPI. This also saves the candidate cache
and set a new one, or else the results from the previous non-patched calls
w... | [
"def",
"_allow_all_wheels",
"(",
")",
":",
"original_wheel_supported",
"=",
"Wheel",
".",
"supported",
"original_support_index_min",
"=",
"Wheel",
".",
"support_index_min",
"Wheel",
".",
"supported",
"=",
"_wheel_supported",
"Wheel",
".",
"support_index_min",
"=",
"_w... | Monkey patch pip.Wheel to allow all wheels
The usual checks against platforms and Python versions are ignored to allow
fetching all available entries in PyPI. This also saves the candidate cache
and set a new one, or else the results from the previous non-patched calls
will interfere. | [
"Monkey",
"patch",
"pip",
".",
"Wheel",
"to",
"allow",
"all",
"wheels"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/hashes.py#L21-L36 |
25,210 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/temp_dir.py | TempDirectory.create | def create(self):
"""Create a temporary directory and store its path in self.path
"""
if self.path is not None:
logger.debug(
"Skipped creation of temporary directory: {}".format(self.path)
)
return
# We realpath here because some syste... | python | def create(self):
"""Create a temporary directory and store its path in self.path
"""
if self.path is not None:
logger.debug(
"Skipped creation of temporary directory: {}".format(self.path)
)
return
# We realpath here because some syste... | [
"def",
"create",
"(",
"self",
")",
":",
"if",
"self",
".",
"path",
"is",
"not",
"None",
":",
"logger",
".",
"debug",
"(",
"\"Skipped creation of temporary directory: {}\"",
".",
"format",
"(",
"self",
".",
"path",
")",
")",
"return",
"# We realpath here becaus... | Create a temporary directory and store its path in self.path | [
"Create",
"a",
"temporary",
"directory",
"and",
"store",
"its",
"path",
"in",
"self",
".",
"path"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/temp_dir.py#L78-L94 |
25,211 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/temp_dir.py | TempDirectory.cleanup | def cleanup(self):
"""Remove the temporary directory created and reset state
"""
if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
if os.path.exists(self.path):
try:
rmtree(self.path)
except OSError:
... | python | def cleanup(self):
"""Remove the temporary directory created and reset state
"""
if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
if os.path.exists(self.path):
try:
rmtree(self.path)
except OSError:
... | [
"def",
"cleanup",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
".",
"_finalizer",
",",
"\"detach\"",
",",
"None",
")",
"and",
"self",
".",
"_finalizer",
".",
"detach",
"(",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",... | Remove the temporary directory created and reset state | [
"Remove",
"the",
"temporary",
"directory",
"created",
"and",
"reset",
"state"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/temp_dir.py#L106-L116 |
25,212 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/temp_dir.py | AdjacentTempDirectory._generate_names | def _generate_names(cls, name):
"""Generates a series of temporary names.
The algorithm replaces the leading characters in the name
with ones that are valid filesystem characters, but are not
valid package names (for both Python and pip definitions of
package).
"""
... | python | def _generate_names(cls, name):
"""Generates a series of temporary names.
The algorithm replaces the leading characters in the name
with ones that are valid filesystem characters, but are not
valid package names (for both Python and pip definitions of
package).
"""
... | [
"def",
"_generate_names",
"(",
"cls",
",",
"name",
")",
":",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"name",
")",
")",
":",
"for",
"candidate",
"in",
"itertools",
".",
"combinations_with_replacement",
"(",
"cls",
".",
"LEADING_CHARS",
",",
... | Generates a series of temporary names.
The algorithm replaces the leading characters in the name
with ones that are valid filesystem characters, but are not
valid package names (for both Python and pip definitions of
package). | [
"Generates",
"a",
"series",
"of",
"temporary",
"names",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/temp_dir.py#L145-L166 |
25,213 | pypa/pipenv | pipenv/vendor/chardet/__init__.py | detect | def detect(byte_str):
"""
Detect the encoding of the given byte string.
:param byte_str: The byte sequence to examine.
:type byte_str: ``bytes`` or ``bytearray``
"""
if not isinstance(byte_str, bytearray):
if not isinstance(byte_str, bytes):
raise TypeError('Expecte... | python | def detect(byte_str):
"""
Detect the encoding of the given byte string.
:param byte_str: The byte sequence to examine.
:type byte_str: ``bytes`` or ``bytearray``
"""
if not isinstance(byte_str, bytearray):
if not isinstance(byte_str, bytes):
raise TypeError('Expecte... | [
"def",
"detect",
"(",
"byte_str",
")",
":",
"if",
"not",
"isinstance",
"(",
"byte_str",
",",
"bytearray",
")",
":",
"if",
"not",
"isinstance",
"(",
"byte_str",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"'Expected object of type bytes or bytearray, got: ... | Detect the encoding of the given byte string.
:param byte_str: The byte sequence to examine.
:type byte_str: ``bytes`` or ``bytearray`` | [
"Detect",
"the",
"encoding",
"of",
"the",
"given",
"byte",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/__init__.py#L24-L39 |
25,214 | pypa/pipenv | pipenv/vendor/markupsafe/__init__.py | Markup.unescape | def unescape(self):
"""Convert escaped markup back into a text string. This replaces
HTML entities with the characters they represent.
>>> Markup('Main » <em>About</em>').unescape()
'Main » <em>About</em>'
"""
from ._constants import HTML_ENTITIES
def hand... | python | def unescape(self):
"""Convert escaped markup back into a text string. This replaces
HTML entities with the characters they represent.
>>> Markup('Main » <em>About</em>').unescape()
'Main » <em>About</em>'
"""
from ._constants import HTML_ENTITIES
def hand... | [
"def",
"unescape",
"(",
"self",
")",
":",
"from",
".",
"_constants",
"import",
"HTML_ENTITIES",
"def",
"handle_match",
"(",
"m",
")",
":",
"name",
"=",
"m",
".",
"group",
"(",
"1",
")",
"if",
"name",
"in",
"HTML_ENTITIES",
":",
"return",
"unichr",
"(",... | Convert escaped markup back into a text string. This replaces
HTML entities with the characters they represent.
>>> Markup('Main » <em>About</em>').unescape()
'Main » <em>About</em>' | [
"Convert",
"escaped",
"markup",
"back",
"into",
"a",
"text",
"string",
".",
"This",
"replaces",
"HTML",
"entities",
"with",
"the",
"characters",
"they",
"represent",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/markupsafe/__init__.py#L127-L150 |
25,215 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_install.py | InstallRequirement.populate_link | def populate_link(self, finder, upgrade, require_hashes):
# type: (PackageFinder, bool, bool) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If requi... | python | def populate_link(self, finder, upgrade, require_hashes):
# type: (PackageFinder, bool, bool) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If requi... | [
"def",
"populate_link",
"(",
"self",
",",
"finder",
",",
"upgrade",
",",
"require_hashes",
")",
":",
"# type: (PackageFinder, bool, bool) -> None",
"if",
"self",
".",
"link",
"is",
"None",
":",
"self",
".",
"link",
"=",
"finder",
".",
"find_requirement",
"(",
... | Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If require_hashes is True, don't use the wheel cache, because cached
wheels, always built locally, have different hashes ... | [
"Ensure",
"that",
"if",
"a",
"link",
"can",
"be",
"found",
"for",
"this",
"that",
"it",
"is",
"found",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L182-L201 |
25,216 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_install.py | InstallRequirement.is_pinned | def is_pinned(self):
# type: () -> bool
"""Return whether I am pinned to an exact version.
For example, some-package==1.2 is pinned; some-package>1.2 is not.
"""
specifiers = self.specifier
return (len(specifiers) == 1 and
next(iter(specifiers)).operator ... | python | def is_pinned(self):
# type: () -> bool
"""Return whether I am pinned to an exact version.
For example, some-package==1.2 is pinned; some-package>1.2 is not.
"""
specifiers = self.specifier
return (len(specifiers) == 1 and
next(iter(specifiers)).operator ... | [
"def",
"is_pinned",
"(",
"self",
")",
":",
"# type: () -> bool",
"specifiers",
"=",
"self",
".",
"specifier",
"return",
"(",
"len",
"(",
"specifiers",
")",
"==",
"1",
"and",
"next",
"(",
"iter",
"(",
"specifiers",
")",
")",
".",
"operator",
"in",
"{",
... | Return whether I am pinned to an exact version.
For example, some-package==1.2 is pinned; some-package>1.2 is not. | [
"Return",
"whether",
"I",
"am",
"pinned",
"to",
"an",
"exact",
"version",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L217-L225 |
25,217 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_install.py | InstallRequirement.hashes | def hashes(self, trust_internet=True):
# type: (bool) -> Hashes
"""Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.
Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones... | python | def hashes(self, trust_internet=True):
# type: (bool) -> Hashes
"""Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.
Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones... | [
"def",
"hashes",
"(",
"self",
",",
"trust_internet",
"=",
"True",
")",
":",
"# type: (bool) -> Hashes",
"good_hashes",
"=",
"self",
".",
"options",
".",
"get",
"(",
"'hashes'",
",",
"{",
"}",
")",
".",
"copy",
"(",
")",
"link",
"=",
"self",
".",
"link"... | Return a hash-comparer that considers my option- and URL-based
hashes to be known-good.
Hashes in URLs--ones embedded in the requirements file, not ones
downloaded from an index server--are almost peers with ones from
flags. They satisfy --require-hashes (whether it was implicitly or
... | [
"Return",
"a",
"hash",
"-",
"comparer",
"that",
"considers",
"my",
"option",
"-",
"and",
"URL",
"-",
"based",
"hashes",
"to",
"be",
"known",
"-",
"good",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L255-L275 |
25,218 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_install.py | InstallRequirement.prepare_metadata | def prepare_metadata(self):
# type: () -> None
"""Ensure that project metadata is available.
Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info.
"""
assert self.source_dir
with indent_log():
... | python | def prepare_metadata(self):
# type: () -> None
"""Ensure that project metadata is available.
Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info.
"""
assert self.source_dir
with indent_log():
... | [
"def",
"prepare_metadata",
"(",
"self",
")",
":",
"# type: () -> None",
"assert",
"self",
".",
"source_dir",
"with",
"indent_log",
"(",
")",
":",
"if",
"self",
".",
"use_pep517",
":",
"self",
".",
"prepare_pep517_metadata",
"(",
")",
"else",
":",
"self",
"."... | Ensure that project metadata is available.
Under PEP 517, call the backend hook to prepare the metadata.
Under legacy processing, call setup.py egg-info. | [
"Ensure",
"that",
"project",
"metadata",
"is",
"available",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L517-L554 |
25,219 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_install.py | InstallRequirement.get_dist | def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
if self.metadata_directory:
base_dir, distinfo = os.path.split(self.metadata_directory)
metadata = pkg_resources.PathMetadata(
base_dir, self.meta... | python | def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
if self.metadata_directory:
base_dir, distinfo = os.path.split(self.metadata_directory)
metadata = pkg_resources.PathMetadata(
base_dir, self.meta... | [
"def",
"get_dist",
"(",
"self",
")",
":",
"# type: () -> Distribution",
"if",
"self",
".",
"metadata_directory",
":",
"base_dir",
",",
"distinfo",
"=",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"metadata_directory",
")",
"metadata",
"=",
"pkg_resource... | Return a pkg_resources.Distribution for this requirement | [
"Return",
"a",
"pkg_resources",
".",
"Distribution",
"for",
"this",
"requirement"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L672-L694 |
25,220 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_install.py | InstallRequirement.uninstall | def uninstall(self, auto_confirm=False, verbose=False,
use_user_site=False):
# type: (bool, bool, bool) -> Optional[UninstallPathSet]
"""
Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_... | python | def uninstall(self, auto_confirm=False, verbose=False,
use_user_site=False):
# type: (bool, bool, bool) -> Optional[UninstallPathSet]
"""
Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_... | [
"def",
"uninstall",
"(",
"self",
",",
"auto_confirm",
"=",
"False",
",",
"verbose",
"=",
"False",
",",
"use_user_site",
"=",
"False",
")",
":",
"# type: (bool, bool, bool) -> Optional[UninstallPathSet]",
"if",
"not",
"self",
".",
"check_if_exists",
"(",
"use_user_si... | Uninstall the distribution currently satisfying this requirement.
Prompts before removing or modifying files unless
``auto_confirm`` is True.
Refuses to delete or modify files outside of ``sys.prefix`` -
thus uninstallation within a virtual environment can only
modify that virt... | [
"Uninstall",
"the",
"distribution",
"currently",
"satisfying",
"this",
"requirement",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_install.py#L798-L820 |
25,221 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/base_command.py | RequirementCommand.populate_requirement_set | def populate_requirement_set(requirement_set, # type: RequirementSet
args, # type: List[str]
options, # type: Values
finder, # type: PackageFinder
session, ... | python | def populate_requirement_set(requirement_set, # type: RequirementSet
args, # type: List[str]
options, # type: Values
finder, # type: PackageFinder
session, ... | [
"def",
"populate_requirement_set",
"(",
"requirement_set",
",",
"# type: RequirementSet",
"args",
",",
"# type: List[str]",
"options",
",",
"# type: Values",
"finder",
",",
"# type: PackageFinder",
"session",
",",
"# type: PipSession",
"name",
",",
"# type: str",
"wheel_cac... | Marshal cmd line args into a requirement set. | [
"Marshal",
"cmd",
"line",
"args",
"into",
"a",
"requirement",
"set",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/base_command.py#L242-L306 |
25,222 | pypa/pipenv | pipenv/patched/notpip/_internal/cli/base_command.py | RequirementCommand._build_package_finder | def _build_package_finder(
self,
options, # type: Values
session, # type: PipSession
platform=None, # type: Optional[str]
python_versions=None, # type: Optional[List[str]]
abi=None, # type: Optional[str]
implementa... | python | def _build_package_finder(
self,
options, # type: Values
session, # type: PipSession
platform=None, # type: Optional[str]
python_versions=None, # type: Optional[List[str]]
abi=None, # type: Optional[str]
implementa... | [
"def",
"_build_package_finder",
"(",
"self",
",",
"options",
",",
"# type: Values",
"session",
",",
"# type: PipSession",
"platform",
"=",
"None",
",",
"# type: Optional[str]",
"python_versions",
"=",
"None",
",",
"# type: Optional[List[str]]",
"abi",
"=",
"None",
","... | Create a package finder appropriate to this requirement command. | [
"Create",
"a",
"package",
"finder",
"appropriate",
"to",
"this",
"requirement",
"command",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/base_command.py#L308-L341 |
25,223 | pypa/pipenv | pipenv/vendor/idna/intranges.py | intranges_contain | def intranges_contain(int_, ranges):
"""Determine if `int_` falls into one of the ranges in `ranges`."""
tuple_ = _encode_range(int_, 0)
pos = bisect.bisect_left(ranges, tuple_)
# we could be immediately ahead of a tuple (start, end)
# with start < int_ <= end
if pos > 0:
left, right = _... | python | def intranges_contain(int_, ranges):
"""Determine if `int_` falls into one of the ranges in `ranges`."""
tuple_ = _encode_range(int_, 0)
pos = bisect.bisect_left(ranges, tuple_)
# we could be immediately ahead of a tuple (start, end)
# with start < int_ <= end
if pos > 0:
left, right = _... | [
"def",
"intranges_contain",
"(",
"int_",
",",
"ranges",
")",
":",
"tuple_",
"=",
"_encode_range",
"(",
"int_",
",",
"0",
")",
"pos",
"=",
"bisect",
".",
"bisect_left",
"(",
"ranges",
",",
"tuple_",
")",
"# we could be immediately ahead of a tuple (start, end)",
... | Determine if `int_` falls into one of the ranges in `ranges`. | [
"Determine",
"if",
"int_",
"falls",
"into",
"one",
"of",
"the",
"ranges",
"in",
"ranges",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/idna/intranges.py#L38-L53 |
25,224 | pypa/pipenv | pipenv/patched/notpip/_internal/commands/hash.py | _hash_of_file | def _hash_of_file(path, algorithm):
"""Return the hash digest of a file."""
with open(path, 'rb') as archive:
hash = hashlib.new(algorithm)
for chunk in read_chunks(archive):
hash.update(chunk)
return hash.hexdigest() | python | def _hash_of_file(path, algorithm):
"""Return the hash digest of a file."""
with open(path, 'rb') as archive:
hash = hashlib.new(algorithm)
for chunk in read_chunks(archive):
hash.update(chunk)
return hash.hexdigest() | [
"def",
"_hash_of_file",
"(",
"path",
",",
"algorithm",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"archive",
":",
"hash",
"=",
"hashlib",
".",
"new",
"(",
"algorithm",
")",
"for",
"chunk",
"in",
"read_chunks",
"(",
"archive",
")",
... | Return the hash digest of a file. | [
"Return",
"the",
"hash",
"digest",
"of",
"a",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/hash.py#L51-L57 |
25,225 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution.id | def id(self):
"""Return the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`.
"""
def normalize(distro_id, table):
distro_id = distro_id.lower().replace(' ', '_')
return table.get(distro_id, distro_id)
distro_id = self.os... | python | def id(self):
"""Return the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`.
"""
def normalize(distro_id, table):
distro_id = distro_id.lower().replace(' ', '_')
return table.get(distro_id, distro_id)
distro_id = self.os... | [
"def",
"id",
"(",
"self",
")",
":",
"def",
"normalize",
"(",
"distro_id",
",",
"table",
")",
":",
"distro_id",
"=",
"distro_id",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"' '",
",",
"'_'",
")",
"return",
"table",
".",
"get",
"(",
"distro_id",
"... | Return the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`. | [
"Return",
"the",
"distro",
"ID",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L679-L704 |
25,226 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution.name | def name(self, pretty=False):
"""
Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`.
"""
name = self.os_release_attr('name') \
or self.lsb_release_attr('distributor_id') \
or self.distro_release_attr('name') \
... | python | def name(self, pretty=False):
"""
Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`.
"""
name = self.os_release_attr('name') \
or self.lsb_release_attr('distributor_id') \
or self.distro_release_attr('name') \
... | [
"def",
"name",
"(",
"self",
",",
"pretty",
"=",
"False",
")",
":",
"name",
"=",
"self",
".",
"os_release_attr",
"(",
"'name'",
")",
"or",
"self",
".",
"lsb_release_attr",
"(",
"'distributor_id'",
")",
"or",
"self",
".",
"distro_release_attr",
"(",
"'name'"... | Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`. | [
"Return",
"the",
"name",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L706-L725 |
25,227 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution.version | def version(self, pretty=False, best=False):
"""
Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`.
"""
versions = [
self.os_release_attr('version_id'),
self.lsb_release_attr('release'),
self.distr... | python | def version(self, pretty=False, best=False):
"""
Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`.
"""
versions = [
self.os_release_attr('version_id'),
self.lsb_release_attr('release'),
self.distr... | [
"def",
"version",
"(",
"self",
",",
"pretty",
"=",
"False",
",",
"best",
"=",
"False",
")",
":",
"versions",
"=",
"[",
"self",
".",
"os_release_attr",
"(",
"'version_id'",
")",
",",
"self",
".",
"lsb_release_attr",
"(",
"'release'",
")",
",",
"self",
"... | Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`. | [
"Return",
"the",
"version",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L727-L759 |
25,228 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution.version_parts | def version_parts(self, best=False):
"""
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
"""
version_str = self.version(best=best)
if version_str:
version_regex = re.compile(r'(\... | python | def version_parts(self, best=False):
"""
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
"""
version_str = self.version(best=best)
if version_str:
version_regex = re.compile(r'(\... | [
"def",
"version_parts",
"(",
"self",
",",
"best",
"=",
"False",
")",
":",
"version_str",
"=",
"self",
".",
"version",
"(",
"best",
"=",
"best",
")",
"if",
"version_str",
":",
"version_regex",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\.?(\\d+)?\\.?(\\d+)?'",... | Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`. | [
"Return",
"the",
"version",
"of",
"the",
"OS",
"distribution",
"as",
"a",
"tuple",
"of",
"version",
"numbers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L761-L775 |
25,229 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution.info | def info(self, pretty=False, best=False):
"""
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
"""
return dict(
id=self.id(),
version=self.version(pretty, best),
version_parts... | python | def info(self, pretty=False, best=False):
"""
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
"""
return dict(
id=self.id(),
version=self.version(pretty, best),
version_parts... | [
"def",
"info",
"(",
"self",
",",
"pretty",
"=",
"False",
",",
"best",
"=",
"False",
")",
":",
"return",
"dict",
"(",
"id",
"=",
"self",
".",
"id",
"(",
")",
",",
"version",
"=",
"self",
".",
"version",
"(",
"pretty",
",",
"best",
")",
",",
"ver... | Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`. | [
"Return",
"certain",
"machine",
"-",
"readable",
"information",
"about",
"the",
"OS",
"distribution",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L820-L837 |
25,230 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution._os_release_info | def _os_release_info(self):
"""
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
"""
if os.path.isfile(self.os_release_file):
with open(self.os_release_file) as release_file:
... | python | def _os_release_info(self):
"""
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
"""
if os.path.isfile(self.os_release_file):
with open(self.os_release_file) as release_file:
... | [
"def",
"_os_release_info",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"os_release_file",
")",
":",
"with",
"open",
"(",
"self",
".",
"os_release_file",
")",
"as",
"release_file",
":",
"return",
"self",
".",
"_parse_o... | Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items. | [
"Get",
"the",
"information",
"items",
"from",
"the",
"specified",
"os",
"-",
"release",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L913-L923 |
25,231 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution._lsb_release_info | def _lsb_release_info(self):
"""
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
"""
if not self.include_lsb:
return {}
with open(os.devnull, 'w') as devnull:
try:
... | python | def _lsb_release_info(self):
"""
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
"""
if not self.include_lsb:
return {}
with open(os.devnull, 'w') as devnull:
try:
... | [
"def",
"_lsb_release_info",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"include_lsb",
":",
"return",
"{",
"}",
"with",
"open",
"(",
"os",
".",
"devnull",
",",
"'w'",
")",
"as",
"devnull",
":",
"try",
":",
"cmd",
"=",
"(",
"'lsb_release'",
",",
... | Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items. | [
"Get",
"the",
"information",
"items",
"from",
"the",
"lsb_release",
"command",
"output",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L986-L1002 |
25,232 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution._parse_lsb_release_content | def _parse_lsb_release_content(lines):
"""
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
... | python | def _parse_lsb_release_content(lines):
"""
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
... | [
"def",
"_parse_lsb_release_content",
"(",
"lines",
")",
":",
"props",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"kv",
"=",
"line",
".",
"strip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"':'",
",",
"1",
")",
"if",
"len",
"(",
"kv",
")",
"!="... | Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items. | [
"Parse",
"the",
"output",
"of",
"the",
"lsb_release",
"command",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1005-L1026 |
25,233 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution._distro_release_info | def _distro_release_info(self):
"""
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
"""
if self.distro_release_file:
# If it was specified, we use it and parse what we can, even if
... | python | def _distro_release_info(self):
"""
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
"""
if self.distro_release_file:
# If it was specified, we use it and parse what we can, even if
... | [
"def",
"_distro_release_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"distro_release_file",
":",
"# If it was specified, we use it and parse what we can, even if",
"# its file name or content does not match the expected pattern.",
"distro_info",
"=",
"self",
".",
"_parse_distro... | Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items. | [
"Get",
"the",
"information",
"items",
"from",
"the",
"specified",
"distro",
"release",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1057-L1117 |
25,234 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution._parse_distro_release_file | def _parse_distro_release_file(self, filepath):
"""
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
"""
try:
with open(filepath) as fp:
... | python | def _parse_distro_release_file(self, filepath):
"""
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
"""
try:
with open(filepath) as fp:
... | [
"def",
"_parse_distro_release_file",
"(",
"self",
",",
"filepath",
")",
":",
"try",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"fp",
":",
"# Only parse the first line. For instance, on SLES there",
"# are multiple lines. We don't want them...",
"return",
"self",
"."... | Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items. | [
"Parse",
"a",
"distro",
"release",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1119-L1139 |
25,235 | pypa/pipenv | pipenv/patched/notpip/_vendor/distro.py | LinuxDistribution._parse_distro_release_content | def _parse_distro_release_content(line):
"""
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information ite... | python | def _parse_distro_release_content(line):
"""
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information ite... | [
"def",
"_parse_distro_release_content",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"bytes",
")",
":",
"line",
"=",
"line",
".",
"decode",
"(",
"'utf-8'",
")",
"matches",
"=",
"_DISTRO_RELEASE_CONTENT_REVERSED_PATTERN",
".",
"match",
"(",
"lin... | Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information items. | [
"Parse",
"a",
"line",
"from",
"a",
"distro",
"release",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L1142-L1167 |
25,236 | pypa/pipenv | pipenv/patched/piptools/sync.py | dependency_tree | def dependency_tree(installed_keys, root_key):
"""
Calculate the dependency tree for the package `root_key` and return
a collection of all its dependencies. Uses a DFS traversal algorithm.
`installed_keys` should be a {key: requirement} mapping, e.g.
{'django': from_line('django==1.8')}
`r... | python | def dependency_tree(installed_keys, root_key):
"""
Calculate the dependency tree for the package `root_key` and return
a collection of all its dependencies. Uses a DFS traversal algorithm.
`installed_keys` should be a {key: requirement} mapping, e.g.
{'django': from_line('django==1.8')}
`r... | [
"def",
"dependency_tree",
"(",
"installed_keys",
",",
"root_key",
")",
":",
"dependencies",
"=",
"set",
"(",
")",
"queue",
"=",
"collections",
".",
"deque",
"(",
")",
"if",
"root_key",
"in",
"installed_keys",
":",
"dep",
"=",
"installed_keys",
"[",
"root_key... | Calculate the dependency tree for the package `root_key` and return
a collection of all its dependencies. Uses a DFS traversal algorithm.
`installed_keys` should be a {key: requirement} mapping, e.g.
{'django': from_line('django==1.8')}
`root_key` should be the key to return the dependency tree fo... | [
"Calculate",
"the",
"dependency",
"tree",
"for",
"the",
"package",
"root_key",
"and",
"return",
"a",
"collection",
"of",
"all",
"its",
"dependencies",
".",
"Uses",
"a",
"DFS",
"traversal",
"algorithm",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L21-L53 |
25,237 | pypa/pipenv | pipenv/patched/piptools/sync.py | diff | def diff(compiled_requirements, installed_dists):
"""
Calculate which packages should be installed or uninstalled, given a set
of compiled requirements and a list of currently installed modules.
"""
requirements_lut = {r.link or key_from_req(r.req): r for r in compiled_requirements}
satisfied =... | python | def diff(compiled_requirements, installed_dists):
"""
Calculate which packages should be installed or uninstalled, given a set
of compiled requirements and a list of currently installed modules.
"""
requirements_lut = {r.link or key_from_req(r.req): r for r in compiled_requirements}
satisfied =... | [
"def",
"diff",
"(",
"compiled_requirements",
",",
"installed_dists",
")",
":",
"requirements_lut",
"=",
"{",
"r",
".",
"link",
"or",
"key_from_req",
"(",
"r",
".",
"req",
")",
":",
"r",
"for",
"r",
"in",
"compiled_requirements",
"}",
"satisfied",
"=",
"set... | Calculate which packages should be installed or uninstalled, given a set
of compiled requirements and a list of currently installed modules. | [
"Calculate",
"which",
"packages",
"should",
"be",
"installed",
"or",
"uninstalled",
"given",
"a",
"set",
"of",
"compiled",
"requirements",
"and",
"a",
"list",
"of",
"currently",
"installed",
"modules",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L94-L120 |
25,238 | pypa/pipenv | pipenv/patched/piptools/sync.py | sync | def sync(to_install, to_uninstall, verbose=False, dry_run=False, install_flags=None):
"""
Install and uninstalls the given sets of modules.
"""
if not to_uninstall and not to_install:
click.echo("Everything up-to-date")
pip_flags = []
if not verbose:
pip_flags += ['-q']
if ... | python | def sync(to_install, to_uninstall, verbose=False, dry_run=False, install_flags=None):
"""
Install and uninstalls the given sets of modules.
"""
if not to_uninstall and not to_install:
click.echo("Everything up-to-date")
pip_flags = []
if not verbose:
pip_flags += ['-q']
if ... | [
"def",
"sync",
"(",
"to_install",
",",
"to_uninstall",
",",
"verbose",
"=",
"False",
",",
"dry_run",
"=",
"False",
",",
"install_flags",
"=",
"None",
")",
":",
"if",
"not",
"to_uninstall",
"and",
"not",
"to_install",
":",
"click",
".",
"echo",
"(",
"\"Ev... | Install and uninstalls the given sets of modules. | [
"Install",
"and",
"uninstalls",
"the",
"given",
"sets",
"of",
"modules",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L123-L168 |
25,239 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | _environment_sanity_check | def _environment_sanity_check(environment):
"""Perform a sanity check on the environment."""
assert issubclass(environment.undefined, Undefined), 'undefined must ' \
'be a subclass of undefined because filters depend on it.'
assert environment.block_start_string != \
environment.variable_sta... | python | def _environment_sanity_check(environment):
"""Perform a sanity check on the environment."""
assert issubclass(environment.undefined, Undefined), 'undefined must ' \
'be a subclass of undefined because filters depend on it.'
assert environment.block_start_string != \
environment.variable_sta... | [
"def",
"_environment_sanity_check",
"(",
"environment",
")",
":",
"assert",
"issubclass",
"(",
"environment",
".",
"undefined",
",",
"Undefined",
")",
",",
"'undefined must '",
"'be a subclass of undefined because filters depend on it.'",
"assert",
"environment",
".",
"bloc... | Perform a sanity check on the environment. | [
"Perform",
"a",
"sanity",
"check",
"on",
"the",
"environment",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L100-L110 |
25,240 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Environment.overlay | def overlay(self, block_start_string=missing, block_end_string=missing,
variable_start_string=missing, variable_end_string=missing,
comment_start_string=missing, comment_end_string=missing,
line_statement_prefix=missing, line_comment_prefix=missing,
trim_b... | python | def overlay(self, block_start_string=missing, block_end_string=missing,
variable_start_string=missing, variable_end_string=missing,
comment_start_string=missing, comment_end_string=missing,
line_statement_prefix=missing, line_comment_prefix=missing,
trim_b... | [
"def",
"overlay",
"(",
"self",
",",
"block_start_string",
"=",
"missing",
",",
"block_end_string",
"=",
"missing",
",",
"variable_start_string",
"=",
"missing",
",",
"variable_end_string",
"=",
"missing",
",",
"comment_start_string",
"=",
"missing",
",",
"comment_en... | Create a new overlay environment that shares all the data with the
current environment except for cache and the overridden attributes.
Extensions cannot be removed for an overlayed environment. An overlayed
environment automatically gets all the extensions of the environment it
is linke... | [
"Create",
"a",
"new",
"overlay",
"environment",
"that",
"shares",
"all",
"the",
"data",
"with",
"the",
"current",
"environment",
"except",
"for",
"cache",
"and",
"the",
"overridden",
"attributes",
".",
"Extensions",
"cannot",
"be",
"removed",
"for",
"an",
"ove... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L356-L399 |
25,241 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Environment.iter_extensions | def iter_extensions(self):
"""Iterates over the extensions by priority."""
return iter(sorted(self.extensions.values(),
key=lambda x: x.priority)) | python | def iter_extensions(self):
"""Iterates over the extensions by priority."""
return iter(sorted(self.extensions.values(),
key=lambda x: x.priority)) | [
"def",
"iter_extensions",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"sorted",
"(",
"self",
".",
"extensions",
".",
"values",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
".",
"priority",
")",
")"
] | Iterates over the extensions by priority. | [
"Iterates",
"over",
"the",
"extensions",
"by",
"priority",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L403-L406 |
25,242 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Environment.call_filter | def call_filter(self, name, value, args=None, kwargs=None,
context=None, eval_ctx=None):
"""Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and ... | python | def call_filter(self, name, value, args=None, kwargs=None,
context=None, eval_ctx=None):
"""Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and ... | [
"def",
"call_filter",
"(",
"self",
",",
"name",
",",
"value",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"context",
"=",
"None",
",",
"eval_ctx",
"=",
"None",
")",
":",
"func",
"=",
"self",
".",
"filters",
".",
"get",
"(",
"name",
... | Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and the filter
supports async execution. It's your responsibility to await this
if needed.
.. vers... | [
"Invokes",
"a",
"filter",
"on",
"a",
"value",
"the",
"same",
"way",
"the",
"compiler",
"does",
"it",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L438-L467 |
25,243 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Environment.parse | def parse(self, source, name=None, filename=None):
"""Parse the sourcecode and return the abstract syntax tree. This
tree of nodes is used by the compiler to convert the template into
executable source- or bytecode. This is useful for debugging or to
extract information from templates.... | python | def parse(self, source, name=None, filename=None):
"""Parse the sourcecode and return the abstract syntax tree. This
tree of nodes is used by the compiler to convert the template into
executable source- or bytecode. This is useful for debugging or to
extract information from templates.... | [
"def",
"parse",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"_parse",
"(",
"source",
",",
"name",
",",
"filename",
")",
"except",
"TemplateSyntaxError",
":",
"exc_info... | Parse the sourcecode and return the abstract syntax tree. This
tree of nodes is used by the compiler to convert the template into
executable source- or bytecode. This is useful for debugging or to
extract information from templates.
If you are :ref:`developing Jinja2 extensions <writi... | [
"Parse",
"the",
"sourcecode",
"and",
"return",
"the",
"abstract",
"syntax",
"tree",
".",
"This",
"tree",
"of",
"nodes",
"is",
"used",
"by",
"the",
"compiler",
"to",
"convert",
"the",
"template",
"into",
"executable",
"source",
"-",
"or",
"bytecode",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L480-L493 |
25,244 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Environment.compile_expression | def compile_expression(self, source, undefined_to_none=True):
"""A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the sa... | python | def compile_expression(self, source, undefined_to_none=True):
"""A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the sa... | [
"def",
"compile_expression",
"(",
"self",
",",
"source",
",",
"undefined_to_none",
"=",
"True",
")",
":",
"parser",
"=",
"Parser",
"(",
"self",
",",
"source",
",",
"state",
"=",
"'variable'",
")",
"exc_info",
"=",
"None",
"try",
":",
"expr",
"=",
"parser... | A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the same rules as Jinja
in template "configuration files" or similar si... | [
"A",
"handy",
"helper",
"method",
"that",
"returns",
"a",
"callable",
"that",
"accepts",
"keyword",
"arguments",
"that",
"appear",
"as",
"variables",
"in",
"the",
"expression",
".",
"If",
"called",
"it",
"returns",
"the",
"result",
"of",
"the",
"expression",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L593-L636 |
25,245 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Environment.make_globals | def make_globals(self, d):
"""Return a dict for the globals."""
if not d:
return self.globals
return dict(self.globals, **d) | python | def make_globals(self, d):
"""Return a dict for the globals."""
if not d:
return self.globals
return dict(self.globals, **d) | [
"def",
"make_globals",
"(",
"self",
",",
"d",
")",
":",
"if",
"not",
"d",
":",
"return",
"self",
".",
"globals",
"return",
"dict",
"(",
"self",
".",
"globals",
",",
"*",
"*",
"d",
")"
] | Return a dict for the globals. | [
"Return",
"a",
"dict",
"for",
"the",
"globals",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L882-L886 |
25,246 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Template.from_module_dict | def from_module_dict(cls, environment, module_dict, globals):
"""Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
"""
return cls._from_namespace(environment, module_dict, globals) | python | def from_module_dict(cls, environment, module_dict, globals):
"""Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
"""
return cls._from_namespace(environment, module_dict, globals) | [
"def",
"from_module_dict",
"(",
"cls",
",",
"environment",
",",
"module_dict",
",",
"globals",
")",
":",
"return",
"cls",
".",
"_from_namespace",
"(",
"environment",
",",
"module_dict",
",",
"globals",
")"
] | Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4 | [
"Creates",
"a",
"template",
"object",
"from",
"a",
"module",
".",
"This",
"is",
"used",
"by",
"the",
"module",
"loader",
"to",
"create",
"a",
"template",
"object",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L962-L968 |
25,247 | pypa/pipenv | pipenv/vendor/jinja2/environment.py | Template.get_corresponding_lineno | def get_corresponding_lineno(self, lineno):
"""Return the source line number of a line number in the
generated bytecode as they are not in sync.
"""
for template_line, code_line in reversed(self.debug_info):
if code_line <= lineno:
return template_line
... | python | def get_corresponding_lineno(self, lineno):
"""Return the source line number of a line number in the
generated bytecode as they are not in sync.
"""
for template_line, code_line in reversed(self.debug_info):
if code_line <= lineno:
return template_line
... | [
"def",
"get_corresponding_lineno",
"(",
"self",
",",
"lineno",
")",
":",
"for",
"template_line",
",",
"code_line",
"in",
"reversed",
"(",
"self",
".",
"debug_info",
")",
":",
"if",
"code_line",
"<=",
"lineno",
":",
"return",
"template_line",
"return",
"1"
] | Return the source line number of a line number in the
generated bytecode as they are not in sync. | [
"Return",
"the",
"source",
"line",
"number",
"of",
"a",
"line",
"number",
"in",
"the",
"generated",
"bytecode",
"as",
"they",
"are",
"not",
"in",
"sync",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/environment.py#L1108-L1115 |
25,248 | pypa/pipenv | pipenv/vendor/requirementslib/models/url.py | _get_parsed_url | def _get_parsed_url(url):
# type: (S) -> Url
"""
This is a stand-in function for `urllib3.util.parse_url`
The orignal function doesn't handle special characters very well, this simply splits
out the authentication section, creates the parsed url, then puts the authentication
section back in, by... | python | def _get_parsed_url(url):
# type: (S) -> Url
"""
This is a stand-in function for `urllib3.util.parse_url`
The orignal function doesn't handle special characters very well, this simply splits
out the authentication section, creates the parsed url, then puts the authentication
section back in, by... | [
"def",
"_get_parsed_url",
"(",
"url",
")",
":",
"# type: (S) -> Url",
"try",
":",
"parsed",
"=",
"urllib3_parse",
"(",
"url",
")",
"except",
"ValueError",
":",
"scheme",
",",
"_",
",",
"url",
"=",
"url",
".",
"partition",
"(",
"\"://\"",
")",
"auth",
","... | This is a stand-in function for `urllib3.util.parse_url`
The orignal function doesn't handle special characters very well, this simply splits
out the authentication section, creates the parsed url, then puts the authentication
section back in, bypassing validation.
:return: The new, parsed URL object
... | [
"This",
"is",
"a",
"stand",
"-",
"in",
"function",
"for",
"urllib3",
".",
"util",
".",
"parse_url"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/url.py#L24-L44 |
25,249 | pypa/pipenv | pipenv/vendor/requirementslib/models/url.py | remove_password_from_url | def remove_password_from_url(url):
# type: (S) -> S
"""
Given a url, remove the password and insert 4 dashes
:param url: The url to replace the authentication in
:type url: S
:return: The new URL without authentication
:rtype: S
"""
parsed = _get_parsed_url(url)
if parsed.auth:... | python | def remove_password_from_url(url):
# type: (S) -> S
"""
Given a url, remove the password and insert 4 dashes
:param url: The url to replace the authentication in
:type url: S
:return: The new URL without authentication
:rtype: S
"""
parsed = _get_parsed_url(url)
if parsed.auth:... | [
"def",
"remove_password_from_url",
"(",
"url",
")",
":",
"# type: (S) -> S",
"parsed",
"=",
"_get_parsed_url",
"(",
"url",
")",
"if",
"parsed",
".",
"auth",
":",
"auth",
",",
"_",
",",
"_",
"=",
"parsed",
".",
"auth",
".",
"partition",
"(",
"\":\"",
")",... | Given a url, remove the password and insert 4 dashes
:param url: The url to replace the authentication in
:type url: S
:return: The new URL without authentication
:rtype: S | [
"Given",
"a",
"url",
"remove",
"the",
"password",
"and",
"insert",
"4",
"dashes"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/url.py#L47-L62 |
25,250 | pypa/pipenv | pipenv/vendor/click/_unicodefun.py | _verify_python3_env | def _verify_python3_env():
"""Ensures that the environment is good for unicode on Python 3."""
if PY2:
return
try:
import locale
fs_enc = codecs.lookup(locale.getpreferredencoding()).name
except Exception:
fs_enc = 'ascii'
if fs_enc != 'ascii':
return
ext... | python | def _verify_python3_env():
"""Ensures that the environment is good for unicode on Python 3."""
if PY2:
return
try:
import locale
fs_enc = codecs.lookup(locale.getpreferredencoding()).name
except Exception:
fs_enc = 'ascii'
if fs_enc != 'ascii':
return
ext... | [
"def",
"_verify_python3_env",
"(",
")",
":",
"if",
"PY2",
":",
"return",
"try",
":",
"import",
"locale",
"fs_enc",
"=",
"codecs",
".",
"lookup",
"(",
"locale",
".",
"getpreferredencoding",
"(",
")",
")",
".",
"name",
"except",
"Exception",
":",
"fs_enc",
... | Ensures that the environment is good for unicode on Python 3. | [
"Ensures",
"that",
"the",
"environment",
"is",
"good",
"for",
"unicode",
"on",
"Python",
"3",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_unicodefun.py#L50-L125 |
25,251 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | is_installable_dir | def is_installable_dir(path):
# type: (str) -> bool
"""Is path is a directory containing setup.py or pyproject.toml?
"""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
pyproject_toml = os.path.join(p... | python | def is_installable_dir(path):
# type: (str) -> bool
"""Is path is a directory containing setup.py or pyproject.toml?
"""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
pyproject_toml = os.path.join(p... | [
"def",
"is_installable_dir",
"(",
"path",
")",
":",
"# type: (str) -> bool",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"return",
"False",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'setup.py'",
")",
"... | Is path is a directory containing setup.py or pyproject.toml? | [
"Is",
"path",
"is",
"a",
"directory",
"containing",
"setup",
".",
"py",
"or",
"pyproject",
".",
"toml?"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L204-L216 |
25,252 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | is_svn_page | def is_svn_page(html):
# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]
"""
Returns true if the page appears to be the index page of an svn repository
"""
return (re.search(r'<title>[^<]*Revision \d+:', html) and
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I... | python | def is_svn_page(html):
# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]
"""
Returns true if the page appears to be the index page of an svn repository
"""
return (re.search(r'<title>[^<]*Revision \d+:', html) and
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I... | [
"def",
"is_svn_page",
"(",
"html",
")",
":",
"# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]",
"return",
"(",
"re",
".",
"search",
"(",
"r'<title>[^<]*Revision \\d+:'",
",",
"html",
")",
"and",
"re",
".",
"search",
"(",
"r'Powered by (?:<a[^>]*?>)?Subvers... | Returns true if the page appears to be the index page of an svn repository | [
"Returns",
"true",
"if",
"the",
"page",
"appears",
"to",
"be",
"the",
"index",
"page",
"of",
"an",
"svn",
"repository"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L219-L225 |
25,253 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | read_chunks | def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
"""Yield pieces of data from a file-like object until EOF."""
while True:
chunk = file.read(size)
if not chunk:
break
yield chunk | python | def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
"""Yield pieces of data from a file-like object until EOF."""
while True:
chunk = file.read(size)
if not chunk:
break
yield chunk | [
"def",
"read_chunks",
"(",
"file",
",",
"size",
"=",
"io",
".",
"DEFAULT_BUFFER_SIZE",
")",
":",
"while",
"True",
":",
"chunk",
"=",
"file",
".",
"read",
"(",
"size",
")",
"if",
"not",
"chunk",
":",
"break",
"yield",
"chunk"
] | Yield pieces of data from a file-like object until EOF. | [
"Yield",
"pieces",
"of",
"data",
"from",
"a",
"file",
"-",
"like",
"object",
"until",
"EOF",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L234-L240 |
25,254 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | normalize_path | def normalize_path(path, resolve_symlinks=True):
# type: (str, bool) -> str
"""
Convert a path to its canonical, case-normalized, absolute version.
"""
path = expanduser(path)
if resolve_symlinks:
path = os.path.realpath(path)
else:
path = os.path.abspath(path)
return os... | python | def normalize_path(path, resolve_symlinks=True):
# type: (str, bool) -> str
"""
Convert a path to its canonical, case-normalized, absolute version.
"""
path = expanduser(path)
if resolve_symlinks:
path = os.path.realpath(path)
else:
path = os.path.abspath(path)
return os... | [
"def",
"normalize_path",
"(",
"path",
",",
"resolve_symlinks",
"=",
"True",
")",
":",
"# type: (str, bool) -> str",
"path",
"=",
"expanduser",
"(",
"path",
")",
"if",
"resolve_symlinks",
":",
"path",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",... | Convert a path to its canonical, case-normalized, absolute version. | [
"Convert",
"a",
"path",
"to",
"its",
"canonical",
"case",
"-",
"normalized",
"absolute",
"version",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L271-L282 |
25,255 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | splitext | def splitext(path):
# type: (str) -> Tuple[str, str]
"""Like os.path.splitext, but take off .tar too"""
base, ext = posixpath.splitext(path)
if base.lower().endswith('.tar'):
ext = base[-4:] + ext
base = base[:-4]
return base, ext | python | def splitext(path):
# type: (str) -> Tuple[str, str]
"""Like os.path.splitext, but take off .tar too"""
base, ext = posixpath.splitext(path)
if base.lower().endswith('.tar'):
ext = base[-4:] + ext
base = base[:-4]
return base, ext | [
"def",
"splitext",
"(",
"path",
")",
":",
"# type: (str) -> Tuple[str, str]",
"base",
",",
"ext",
"=",
"posixpath",
".",
"splitext",
"(",
"path",
")",
"if",
"base",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.tar'",
")",
":",
"ext",
"=",
"base",
"... | Like os.path.splitext, but take off .tar too | [
"Like",
"os",
".",
"path",
".",
"splitext",
"but",
"take",
"off",
".",
"tar",
"too"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L285-L292 |
25,256 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | is_local | def is_local(path):
# type: (str) -> bool
"""
Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local."
"""
if not running_under_virtualenv():
return True
return normalize_path(path).startswith(normal... | python | def is_local(path):
# type: (str) -> bool
"""
Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local."
"""
if not running_under_virtualenv():
return True
return normalize_path(path).startswith(normal... | [
"def",
"is_local",
"(",
"path",
")",
":",
"# type: (str) -> bool",
"if",
"not",
"running_under_virtualenv",
"(",
")",
":",
"return",
"True",
"return",
"normalize_path",
"(",
"path",
")",
".",
"startswith",
"(",
"normalize_path",
"(",
"sys",
".",
"prefix",
")",... | Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local." | [
"Return",
"True",
"if",
"path",
"is",
"within",
"sys",
".",
"prefix",
"if",
"we",
"re",
"running",
"in",
"a",
"virtualenv",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L313-L323 |
25,257 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | dist_is_editable | def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
return ... | python | def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
return ... | [
"def",
"dist_is_editable",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"for",
"path_item",
"in",
"sys",
".",
"path",
":",
"egg_link",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_item",
",",
"dist",
".",
"project_name",
"+",
"'.egg-link'",
")... | Return True if given Distribution is an editable install. | [
"Return",
"True",
"if",
"given",
"Distribution",
"is",
"an",
"editable",
"install",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L358-L367 |
25,258 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | egg_link_path | def egg_link_path(dist):
# type: (Distribution) -> Optional[str]
"""
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site... | python | def egg_link_path(dist):
# type: (Distribution) -> Optional[str]
"""
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site... | [
"def",
"egg_link_path",
"(",
"dist",
")",
":",
"# type: (Distribution) -> Optional[str]",
"sites",
"=",
"[",
"]",
"if",
"running_under_virtualenv",
"(",
")",
":",
"if",
"virtualenv_no_global",
"(",
")",
":",
"sites",
".",
"append",
"(",
"site_packages",
")",
"el... | Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site_packages
3) in a yes-global virtualenv
try to find in site_packages, ... | [
"Return",
"the",
"path",
"for",
"the",
".",
"egg",
"-",
"link",
"file",
"if",
"it",
"exists",
"otherwise",
"None",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L429-L465 |
25,259 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | get_installed_version | def get_installed_version(dist_name, working_set=None):
"""Get the installed version of dist_name avoiding pkg_resources cache"""
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_name)
if working_set is None:
# We want to avoid having t... | python | def get_installed_version(dist_name, working_set=None):
"""Get the installed version of dist_name avoiding pkg_resources cache"""
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_name)
if working_set is None:
# We want to avoid having t... | [
"def",
"get_installed_version",
"(",
"dist_name",
",",
"working_set",
"=",
"None",
")",
":",
"# Create a requirement that we'll look for inside of setuptools.",
"req",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",
"(",
"dist_name",
")",
"if",
"working_set",
"i... | Get the installed version of dist_name avoiding pkg_resources cache | [
"Get",
"the",
"installed",
"version",
"of",
"dist_name",
"avoiding",
"pkg_resources",
"cache"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L894-L909 |
25,260 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | make_vcs_requirement_url | def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
"""
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
"""
egg_project_name = pkg_resources.to_filename(pr... | python | def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
"""
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
"""
egg_project_name = pkg_resources.to_filename(pr... | [
"def",
"make_vcs_requirement_url",
"(",
"repo_url",
",",
"rev",
",",
"project_name",
",",
"subdir",
"=",
"None",
")",
":",
"egg_project_name",
"=",
"pkg_resources",
".",
"to_filename",
"(",
"project_name",
")",
"req",
"=",
"'{}@{}#egg={}'",
".",
"format",
"(",
... | Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name. | [
"Return",
"the",
"URL",
"for",
"a",
"VCS",
"requirement",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L925-L938 |
25,261 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | split_auth_from_netloc | def split_auth_from_netloc(netloc):
"""
Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)).
"""
if '@' not in netloc:
return netloc, (None, None)
# Split from the right because that's how urllib.parse.urlsplit()
# behaves if more than o... | python | def split_auth_from_netloc(netloc):
"""
Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)).
"""
if '@' not in netloc:
return netloc, (None, None)
# Split from the right because that's how urllib.parse.urlsplit()
# behaves if more than o... | [
"def",
"split_auth_from_netloc",
"(",
"netloc",
")",
":",
"if",
"'@'",
"not",
"in",
"netloc",
":",
"return",
"netloc",
",",
"(",
"None",
",",
"None",
")",
"# Split from the right because that's how urllib.parse.urlsplit()",
"# behaves if more than one @ is present (which ca... | Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)). | [
"Parse",
"out",
"and",
"remove",
"the",
"auth",
"information",
"from",
"a",
"netloc",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L941-L966 |
25,262 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/misc.py | protect_pip_from_modification_on_windows | def protect_pip_from_modification_on_windows(modifying_pip):
"""Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
"""
pip_names = [
"pip.exe",
"pip{}.exe".format(sys.version_info[0]),
"pip{}.{}.... | python | def protect_pip_from_modification_on_windows(modifying_pip):
"""Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
"""
pip_names = [
"pip.exe",
"pip{}.exe".format(sys.version_info[0]),
"pip{}.{}.... | [
"def",
"protect_pip_from_modification_on_windows",
"(",
"modifying_pip",
")",
":",
"pip_names",
"=",
"[",
"\"pip.exe\"",
",",
"\"pip{}.exe\"",
".",
"format",
"(",
"sys",
".",
"version_info",
"[",
"0",
"]",
")",
",",
"\"pip{}.{}.exe\"",
".",
"format",
"(",
"*",
... | Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ... | [
"Protection",
"of",
"pip",
".",
"exe",
"from",
"modification",
"on",
"Windows"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L1014-L1040 |
25,263 | pypa/pipenv | pipenv/patched/notpip/_internal/utils/packaging.py | check_requires_python | def check_requires_python(requires_python):
# type: (Optional[str]) -> bool
"""
Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
... | python | def check_requires_python(requires_python):
# type: (Optional[str]) -> bool
"""
Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
... | [
"def",
"check_requires_python",
"(",
"requires_python",
")",
":",
"# type: (Optional[str]) -> bool",
"if",
"requires_python",
"is",
"None",
":",
"# The package provides no information",
"return",
"True",
"requires_python_specifier",
"=",
"specifiers",
".",
"SpecifierSet",
"("... | Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
requirement.
Raises an InvalidSpecifier if `requires_python` have an invalid format. | [
"Check",
"if",
"the",
"python",
"version",
"in",
"use",
"match",
"the",
"requires_python",
"specifier",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/packaging.py#L23-L41 |
25,264 | pypa/pipenv | pipenv/vendor/click_completion/__init__.py | init | def init(complete_options=False, match_incomplete=None):
"""Initialize the enhanced click completion
Parameters
----------
complete_options : bool
always complete the options, even when the user hasn't typed a first dash (Default value = False)
match_incomplete : func
a function wit... | python | def init(complete_options=False, match_incomplete=None):
"""Initialize the enhanced click completion
Parameters
----------
complete_options : bool
always complete the options, even when the user hasn't typed a first dash (Default value = False)
match_incomplete : func
a function wit... | [
"def",
"init",
"(",
"complete_options",
"=",
"False",
",",
"match_incomplete",
"=",
"None",
")",
":",
"global",
"_initialized",
"if",
"not",
"_initialized",
":",
"_patch",
"(",
")",
"completion_configuration",
".",
"complete_options",
"=",
"complete_options",
"if"... | Initialize the enhanced click completion
Parameters
----------
complete_options : bool
always complete the options, even when the user hasn't typed a first dash (Default value = False)
match_incomplete : func
a function with two parameters choice and incomplete. Must return True
... | [
"Initialize",
"the",
"enhanced",
"click",
"completion"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/__init__.py#L27-L44 |
25,265 | pypa/pipenv | pipenv/patched/notpip/_internal/commands/search.py | transform_hits | def transform_hits(hits):
"""
The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use.
"""
packages = OrderedDict()
for hit in hits:
name = hit['name']
summary = ... | python | def transform_hits(hits):
"""
The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use.
"""
packages = OrderedDict()
for hit in hits:
name = hit['name']
summary = ... | [
"def",
"transform_hits",
"(",
"hits",
")",
":",
"packages",
"=",
"OrderedDict",
"(",
")",
"for",
"hit",
"in",
"hits",
":",
"name",
"=",
"hit",
"[",
"'name'",
"]",
"summary",
"=",
"hit",
"[",
"'summary'",
"]",
"version",
"=",
"hit",
"[",
"'version'",
... | The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use. | [
"The",
"list",
"from",
"pypi",
"is",
"really",
"a",
"list",
"of",
"versions",
".",
"We",
"want",
"a",
"list",
"of",
"packages",
"with",
"the",
"list",
"of",
"versions",
"stored",
"inline",
".",
"This",
"converts",
"the",
"list",
"from",
"pypi",
"into",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/search.py#L69-L94 |
25,266 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_set.py | RequirementSet.add_requirement | def add_requirement(
self,
install_req, # type: InstallRequirement
parent_req_name=None, # type: Optional[str]
extras_requested=None # type: Optional[Iterable[str]]
):
# type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501
"""A... | python | def add_requirement(
self,
install_req, # type: InstallRequirement
parent_req_name=None, # type: Optional[str]
extras_requested=None # type: Optional[Iterable[str]]
):
# type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501
"""A... | [
"def",
"add_requirement",
"(",
"self",
",",
"install_req",
",",
"# type: InstallRequirement",
"parent_req_name",
"=",
"None",
",",
"# type: Optional[str]",
"extras_requested",
"=",
"None",
"# type: Optional[Iterable[str]]",
")",
":",
"# type: (...) -> Tuple[List[InstallRequirem... | Add install_req as a requirement to install.
:param parent_req_name: The name of the requirement that needed this
added. The name is used because when multiple unnamed requirements
resolve to the same name, we could otherwise end up with dependency
links that point outside t... | [
"Add",
"install_req",
"as",
"a",
"requirement",
"to",
"install",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_set.py#L52-L167 |
25,267 | pypa/pipenv | pipenv/patched/notpip/_internal/resolve.py | Resolver.resolve | def resolve(self, requirement_set):
# type: (RequirementSet) -> None
"""Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operat... | python | def resolve(self, requirement_set):
# type: (RequirementSet) -> None
"""Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operat... | [
"def",
"resolve",
"(",
"self",
",",
"requirement_set",
")",
":",
"# type: (RequirementSet) -> None",
"# make the wheelhouse",
"if",
"self",
".",
"preparer",
".",
"wheel_download_dir",
":",
"ensure_dir",
"(",
"self",
".",
"preparer",
".",
"wheel_download_dir",
")",
"... | Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operations.prepare``.
Once PyPI has static dependency metadata available, it would be... | [
"Resolve",
"what",
"operations",
"need",
"to",
"be",
"done"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L96-L144 |
25,268 | pypa/pipenv | pipenv/patched/notpip/_internal/resolve.py | Resolver._set_req_to_reinstall | def _set_req_to_reinstall(self, req):
# type: (InstallRequirement) -> None
"""
Set a requirement to be installed.
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
if not self.use_user_site or dist_in_usersite(req... | python | def _set_req_to_reinstall(self, req):
# type: (InstallRequirement) -> None
"""
Set a requirement to be installed.
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
if not self.use_user_site or dist_in_usersite(req... | [
"def",
"_set_req_to_reinstall",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"# Don't uninstall the conflict if doing a user install and the",
"# conflict is not a user install.",
"if",
"not",
"self",
".",
"use_user_site",
"or",
"dist_in_usersite",
"... | Set a requirement to be installed. | [
"Set",
"a",
"requirement",
"to",
"be",
"installed",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L156-L165 |
25,269 | pypa/pipenv | pipenv/patched/notpip/_internal/resolve.py | Resolver._check_skip_installed | def _check_skip_installed(self, req_to_install):
# type: (InstallRequirement) -> Optional[str]
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
... | python | def _check_skip_installed(self, req_to_install):
# type: (InstallRequirement) -> Optional[str]
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
... | [
"def",
"_check_skip_installed",
"(",
"self",
",",
"req_to_install",
")",
":",
"# type: (InstallRequirement) -> Optional[str]",
"if",
"self",
".",
"ignore_installed",
":",
"return",
"None",
"req_to_install",
".",
"check_if_exists",
"(",
"self",
".",
"use_user_site",
")",... | Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only have satisfied_by set to
None if the req_to_install is to be... | [
"Check",
"if",
"req_to_install",
"should",
"be",
"skipped",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L168-L219 |
25,270 | pypa/pipenv | pipenv/patched/notpip/_internal/resolve.py | Resolver._get_abstract_dist_for | def _get_abstract_dist_for(self, req):
# type: (InstallRequirement) -> DistAbstraction
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
assert self.require_hashes is not None, (
"require_hashes should h... | python | def _get_abstract_dist_for(self, req):
# type: (InstallRequirement) -> DistAbstraction
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
assert self.require_hashes is not None, (
"require_hashes should h... | [
"def",
"_get_abstract_dist_for",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> DistAbstraction",
"assert",
"self",
".",
"require_hashes",
"is",
"not",
"None",
",",
"(",
"\"require_hashes should have been set in Resolver.resolve()\"",
")",
"if",
"req",
... | Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same. | [
"Takes",
"a",
"InstallRequirement",
"and",
"returns",
"a",
"single",
"AbstractDist",
"\\",
"representing",
"a",
"prepared",
"variant",
"of",
"the",
"same",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L221-L277 |
25,271 | pypa/pipenv | pipenv/patched/notpip/_internal/resolve.py | Resolver._resolve_one | def _resolve_one(
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
ignore_requires_python=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Prepare a single requirements file.
:return: A list of addi... | python | def _resolve_one(
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
ignore_requires_python=False # type: bool
):
# type: (...) -> List[InstallRequirement]
"""Prepare a single requirements file.
:return: A list of addi... | [
"def",
"_resolve_one",
"(",
"self",
",",
"requirement_set",
",",
"# type: RequirementSet",
"req_to_install",
",",
"# type: InstallRequirement",
"ignore_requires_python",
"=",
"False",
"# type: bool",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"# Tell user what we are ... | Prepare a single requirements file.
:return: A list of additional InstallRequirements to also install. | [
"Prepare",
"a",
"single",
"requirements",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L279-L397 |
25,272 | pypa/pipenv | pipenv/patched/notpip/_internal/resolve.py | Resolver.get_installation_order | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no oth... | python | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no oth... | [
"def",
"get_installation_order",
"(",
"self",
",",
"req_set",
")",
":",
"# type: (RequirementSet) -> List[InstallRequirement]",
"# The current implementation, which we may change at any point",
"# installs the user specified things in the order given, except when",
"# dependencies must come ea... | Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees. | [
"Create",
"the",
"installation",
"order",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L399-L425 |
25,273 | pypa/pipenv | pipenv/vendor/pyparsing.py | line | def line( loc, strg ):
"""Returns the line of text containing loc within a string, counting newlines as line separators.
"""
lastCR = strg.rfind("\n", 0, loc)
nextCR = strg.find("\n", loc)
if nextCR >= 0:
return strg[lastCR+1:nextCR]
else:
return strg[lastCR+1:] | python | def line( loc, strg ):
"""Returns the line of text containing loc within a string, counting newlines as line separators.
"""
lastCR = strg.rfind("\n", 0, loc)
nextCR = strg.find("\n", loc)
if nextCR >= 0:
return strg[lastCR+1:nextCR]
else:
return strg[lastCR+1:] | [
"def",
"line",
"(",
"loc",
",",
"strg",
")",
":",
"lastCR",
"=",
"strg",
".",
"rfind",
"(",
"\"\\n\"",
",",
"0",
",",
"loc",
")",
"nextCR",
"=",
"strg",
".",
"find",
"(",
"\"\\n\"",
",",
"loc",
")",
"if",
"nextCR",
">=",
"0",
":",
"return",
"st... | Returns the line of text containing loc within a string, counting newlines as line separators. | [
"Returns",
"the",
"line",
"of",
"text",
"containing",
"loc",
"within",
"a",
"string",
"counting",
"newlines",
"as",
"line",
"separators",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1124-L1132 |
25,274 | pypa/pipenv | pipenv/vendor/pyparsing.py | traceParseAction | def traceParseAction(f):
"""Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by... | python | def traceParseAction(f):
"""Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by... | [
"def",
"traceParseAction",
"(",
"f",
")",
":",
"f",
"=",
"_trim_arity",
"(",
"f",
")",
"def",
"z",
"(",
"*",
"paArgs",
")",
":",
"thisFunc",
"=",
"f",
".",
"__name__",
"s",
",",
"l",
",",
"t",
"=",
"paArgs",
"[",
"-",
"3",
":",
"]",
"if",
"le... | Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by the returned value, or any exce... | [
"Decorator",
"for",
"debugging",
"parse",
"actions",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L4846-L4889 |
25,275 | pypa/pipenv | pipenv/vendor/pyparsing.py | delimitedList | def delimitedList( expr, delim=",", combine=False ):
"""Helper to define a delimited list of expressions - the delimiter
defaults to ','. By default, the list elements and delimiters can
have intervening whitespace, and comments, but this can be
overridden by passing ``combine=True`` in the constructor.... | python | def delimitedList( expr, delim=",", combine=False ):
"""Helper to define a delimited list of expressions - the delimiter
defaults to ','. By default, the list elements and delimiters can
have intervening whitespace, and comments, but this can be
overridden by passing ``combine=True`` in the constructor.... | [
"def",
"delimitedList",
"(",
"expr",
",",
"delim",
"=",
"\",\"",
",",
"combine",
"=",
"False",
")",
":",
"dlName",
"=",
"_ustr",
"(",
"expr",
")",
"+",
"\" [\"",
"+",
"_ustr",
"(",
"delim",
")",
"+",
"\" \"",
"+",
"_ustr",
"(",
"expr",
")",
"+",
... | Helper to define a delimited list of expressions - the delimiter
defaults to ','. By default, the list elements and delimiters can
have intervening whitespace, and comments, but this can be
overridden by passing ``combine=True`` in the constructor. If
``combine`` is set to ``True``, the matching tokens ... | [
"Helper",
"to",
"define",
"a",
"delimited",
"list",
"of",
"expressions",
"-",
"the",
"delimiter",
"defaults",
"to",
".",
"By",
"default",
"the",
"list",
"elements",
"and",
"delimiters",
"can",
"have",
"intervening",
"whitespace",
"and",
"comments",
"but",
"thi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L4894-L4913 |
25,276 | pypa/pipenv | pipenv/vendor/pyparsing.py | originalTextFor | def originalTextFor(expr, asString=True):
"""Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. ... | python | def originalTextFor(expr, asString=True):
"""Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. ... | [
"def",
"originalTextFor",
"(",
"expr",
",",
"asString",
"=",
"True",
")",
":",
"locMarker",
"=",
"Empty",
"(",
")",
".",
"setParseAction",
"(",
"lambda",
"s",
",",
"loc",
",",
"t",
":",
"loc",
")",
"endlocMarker",
"=",
"locMarker",
".",
"copy",
"(",
... | Helper to return the original, untokenized text for a given
expression. Useful to restore the parsed fields of an HTML start
tag into the raw tag text itself, or to revert separate tokens with
intervening whitespace back to the original matching input text. By
default, returns astring containing the or... | [
"Helper",
"to",
"return",
"the",
"original",
"untokenized",
"text",
"for",
"a",
"given",
"expression",
".",
"Useful",
"to",
"restore",
"the",
"parsed",
"fields",
"of",
"an",
"HTML",
"start",
"tag",
"into",
"the",
"raw",
"tag",
"text",
"itself",
"or",
"to",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5146-L5186 |
25,277 | pypa/pipenv | pipenv/vendor/pyparsing.py | locatedExpr | def locatedExpr(expr):
"""Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- locn_start = location where matched expression begins
- locn_end = location where matched expression ends
- value = the a... | python | def locatedExpr(expr):
"""Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- locn_start = location where matched expression begins
- locn_end = location where matched expression ends
- value = the a... | [
"def",
"locatedExpr",
"(",
"expr",
")",
":",
"locator",
"=",
"Empty",
"(",
")",
".",
"setParseAction",
"(",
"lambda",
"s",
",",
"l",
",",
"t",
":",
"l",
")",
"return",
"Group",
"(",
"locator",
"(",
"\"locn_start\"",
")",
"+",
"expr",
"(",
"\"value\""... | Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- locn_start = location where matched expression begins
- locn_end = location where matched expression ends
- value = the actual parsed results
Be c... | [
"Helper",
"to",
"decorate",
"a",
"returned",
"token",
"with",
"its",
"starting",
"and",
"ending",
"locations",
"in",
"the",
"input",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5194-L5220 |
25,278 | pypa/pipenv | pipenv/vendor/pyparsing.py | matchOnlyAtCol | def matchOnlyAtCol(n):
"""Helper method for defining parse actions that require matching at
a specific column in the input text.
"""
def verifyCol(strg,locn,toks):
if col(locn,strg) != n:
raise ParseException(strg,locn,"matched token not at column %d" % n)
return verifyCol | python | def matchOnlyAtCol(n):
"""Helper method for defining parse actions that require matching at
a specific column in the input text.
"""
def verifyCol(strg,locn,toks):
if col(locn,strg) != n:
raise ParseException(strg,locn,"matched token not at column %d" % n)
return verifyCol | [
"def",
"matchOnlyAtCol",
"(",
"n",
")",
":",
"def",
"verifyCol",
"(",
"strg",
",",
"locn",
",",
"toks",
")",
":",
"if",
"col",
"(",
"locn",
",",
"strg",
")",
"!=",
"n",
":",
"raise",
"ParseException",
"(",
"strg",
",",
"locn",
",",
"\"matched token n... | Helper method for defining parse actions that require matching at
a specific column in the input text. | [
"Helper",
"method",
"for",
"defining",
"parse",
"actions",
"that",
"require",
"matching",
"at",
"a",
"specific",
"column",
"in",
"the",
"input",
"text",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5269-L5276 |
25,279 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParseBaseException.markInputline | def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "".join(... | python | def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "".join(... | [
"def",
"markInputline",
"(",
"self",
",",
"markerString",
"=",
"\">!<\"",
")",
":",
"line_str",
"=",
"self",
".",
"line",
"line_column",
"=",
"self",
".",
"column",
"-",
"1",
"if",
"markerString",
":",
"line_str",
"=",
"\"\"",
".",
"join",
"(",
"(",
"l... | Extracts the exception line from the input string, and marks
the location of the exception with a special symbol. | [
"Extracts",
"the",
"exception",
"line",
"from",
"the",
"input",
"string",
"and",
"marks",
"the",
"location",
"of",
"the",
"exception",
"with",
"a",
"special",
"symbol",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L279-L288 |
25,280 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParseException.explain | def explain(exc, depth=16):
"""
Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in suppor... | python | def explain(exc, depth=16):
"""
Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in suppor... | [
"def",
"explain",
"(",
"exc",
",",
"depth",
"=",
"16",
")",
":",
"import",
"inspect",
"if",
"depth",
"is",
"None",
":",
"depth",
"=",
"sys",
".",
"getrecursionlimit",
"(",
")",
"ret",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"exc",
",",
"ParseBaseExce... | Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in support
of Python exceptions that might be ... | [
"Method",
"to",
"take",
"an",
"exception",
"and",
"translate",
"the",
"Python",
"internal",
"traceback",
"into",
"a",
"list",
"of",
"the",
"pyparsing",
"expressions",
"that",
"caused",
"the",
"exception",
"to",
"be",
"raised",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L316-L382 |
25,281 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParseResults.extend | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
... | python | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
... | [
"def",
"extend",
"(",
"self",
",",
"itemseq",
")",
":",
"if",
"isinstance",
"(",
"itemseq",
",",
"ParseResults",
")",
":",
"self",
"+=",
"itemseq",
"else",
":",
"self",
".",
"__toklist",
".",
"extend",
"(",
"itemseq",
")"
] | Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
tokens.extend(reversed([t[::-1] f... | [
"Add",
"sequence",
"of",
"elements",
"to",
"end",
"of",
"ParseResults",
"list",
"of",
"elements",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L736-L753 |
25,282 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParseResults.asDict | def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(resu... | python | def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(resu... | [
"def",
"asDict",
"(",
"self",
")",
":",
"if",
"PY_3",
":",
"item_fn",
"=",
"self",
".",
"items",
"else",
":",
"item_fn",
"=",
"self",
".",
"iteritems",
"def",
"toItem",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"ParseResults",
")",
... | Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(result), repr(result)) # -> <class 'pyparsin... | [
"Returns",
"the",
"named",
"parse",
"results",
"as",
"a",
"nested",
"dictionary",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L839-L873 |
25,283 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParseResults.getName | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = S... | python | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = S... | [
"def",
"getName",
"(",
"self",
")",
":",
"if",
"self",
".",
"__name",
":",
"return",
"self",
".",
"__name",
"elif",
"self",
".",
"__parent",
":",
"par",
"=",
"self",
".",
"__parent",
"(",
")",
"if",
"par",
":",
"return",
"par",
".",
"__lookup",
"("... | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(nums, a... | [
"r",
"Returns",
"the",
"results",
"name",
"for",
"this",
"token",
"expression",
".",
"Useful",
"when",
"several",
"different",
"expressions",
"might",
"match",
"at",
"a",
"particular",
"location",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L954-L992 |
25,284 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParserElement.setName | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") #... | python | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") #... | [
"def",
"setName",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"errmsg",
"=",
"\"Expected \"",
"+",
"self",
".",
"name",
"if",
"hasattr",
"(",
"self",
",",
"\"exception\"",
")",
":",
"self",
".",
"exception",
"."... | Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (l... | [
"Define",
"name",
"for",
"this",
"expression",
"makes",
"debugging",
"and",
"exception",
"messages",
"clearer",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1329-L1342 |
25,285 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParserElement.setWhitespaceChars | def setWhitespaceChars( self, chars ):
"""
Overrides the default whitespace chars
"""
self.skipWhitespace = True
self.whiteChars = chars
self.copyDefaultWhiteChars = False
return self | python | def setWhitespaceChars( self, chars ):
"""
Overrides the default whitespace chars
"""
self.skipWhitespace = True
self.whiteChars = chars
self.copyDefaultWhiteChars = False
return self | [
"def",
"setWhitespaceChars",
"(",
"self",
",",
"chars",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"True",
"self",
".",
"whiteChars",
"=",
"chars",
"self",
".",
"copyDefaultWhiteChars",
"=",
"False",
"return",
"self"
] | Overrides the default whitespace chars | [
"Overrides",
"the",
"default",
"whitespace",
"chars"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2235-L2242 |
25,286 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParserElement.setDebugActions | def setDebugActions( self, startAction, successAction, exceptionAction ):
"""
Enable display of debugging messages while doing pattern matching.
"""
self.debugActions = (startAction or _defaultStartDebugAction,
successAction or _defaultSuccessDebugAction,
... | python | def setDebugActions( self, startAction, successAction, exceptionAction ):
"""
Enable display of debugging messages while doing pattern matching.
"""
self.debugActions = (startAction or _defaultStartDebugAction,
successAction or _defaultSuccessDebugAction,
... | [
"def",
"setDebugActions",
"(",
"self",
",",
"startAction",
",",
"successAction",
",",
"exceptionAction",
")",
":",
"self",
".",
"debugActions",
"=",
"(",
"startAction",
"or",
"_defaultStartDebugAction",
",",
"successAction",
"or",
"_defaultSuccessDebugAction",
",",
... | Enable display of debugging messages while doing pattern matching. | [
"Enable",
"display",
"of",
"debugging",
"messages",
"while",
"doing",
"pattern",
"matching",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2277-L2285 |
25,287 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParserElement.setDebug | def setDebug( self, flag=True ):
"""
Enable display of debugging messages while doing pattern matching.
Set ``flag`` to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = ... | python | def setDebug( self, flag=True ):
"""
Enable display of debugging messages while doing pattern matching.
Set ``flag`` to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = ... | [
"def",
"setDebug",
"(",
"self",
",",
"flag",
"=",
"True",
")",
":",
"if",
"flag",
":",
"self",
".",
"setDebugActions",
"(",
"_defaultStartDebugAction",
",",
"_defaultSuccessDebugAction",
",",
"_defaultExceptionDebugAction",
")",
"else",
":",
"self",
".",
"debug"... | Enable display of debugging messages while doing pattern matching.
Set ``flag`` to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = wd | integer
# turn on debugging for wd
... | [
"Enable",
"display",
"of",
"debugging",
"messages",
"while",
"doing",
"pattern",
"matching",
".",
"Set",
"flag",
"to",
"True",
"to",
"enable",
"False",
"to",
"disable",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2287-L2328 |
25,288 | pypa/pipenv | pipenv/vendor/pyparsing.py | ParseExpression.leaveWhitespace | def leaveWhitespace( self ):
"""Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
all contained expressions."""
self.skipWhitespace = False
self.exprs = [ e.copy() for e in self.exprs ]
for e in self.exprs:
e.leaveWhitespace... | python | def leaveWhitespace( self ):
"""Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
all contained expressions."""
self.skipWhitespace = False
self.exprs = [ e.copy() for e in self.exprs ]
for e in self.exprs:
e.leaveWhitespace... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"self",
".",
"exprs",
"=",
"[",
"e",
".",
"copy",
"(",
")",
"for",
"e",
"in",
"self",
".",
"exprs",
"]",
"for",
"e",
"in",
"self",
".",
"exprs",
":",
"e... | Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
all contained expressions. | [
"Extends",
"leaveWhitespace",
"defined",
"in",
"base",
"class",
"and",
"also",
"invokes",
"leaveWhitespace",
"on",
"all",
"contained",
"expressions",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L3586-L3593 |
25,289 | pypa/pipenv | pipenv/vendor/pyparsing.py | pyparsing_common.convertToDate | def convertToDate(fmt="%Y-%m-%d"):
"""
Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
Example::
date_expr = pyparsing_common.iso8601_date... | python | def convertToDate(fmt="%Y-%m-%d"):
"""
Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
Example::
date_expr = pyparsing_common.iso8601_date... | [
"def",
"convertToDate",
"(",
"fmt",
"=",
"\"%Y-%m-%d\"",
")",
":",
"def",
"cvt_fn",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"try",
":",
"return",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"0",
"]",
",",
"fmt",
")",
".",
"date",
"(",
")",
"exc... | Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
Example::
date_expr = pyparsing_common.iso8601_date.copy()
date_expr.setParseAction(pyparsing_... | [
"Helper",
"to",
"create",
"a",
"parse",
"action",
"for",
"converting",
"parsed",
"date",
"string",
"to",
"Python",
"datetime",
".",
"date"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L6136-L6158 |
25,290 | pypa/pipenv | pipenv/vendor/pyparsing.py | pyparsing_common.convertToDatetime | def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"):
"""Helper to create a parse action for converting parsed
datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
Example::
dt_exp... | python | def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"):
"""Helper to create a parse action for converting parsed
datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
Example::
dt_exp... | [
"def",
"convertToDatetime",
"(",
"fmt",
"=",
"\"%Y-%m-%dT%H:%M:%S.%f\"",
")",
":",
"def",
"cvt_fn",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"try",
":",
"return",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"0",
"]",
",",
"fmt",
")",
"except",
"ValueE... | Helper to create a parse action for converting parsed
datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
Example::
dt_expr = pyparsing_common.iso8601_datetime.copy()
dt_ex... | [
"Helper",
"to",
"create",
"a",
"parse",
"action",
"for",
"converting",
"parsed",
"datetime",
"string",
"to",
"Python",
"datetime",
".",
"datetime"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L6161-L6183 |
25,291 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _match_vcs_scheme | def _match_vcs_scheme(url):
# type: (str) -> Optional[str]
"""Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match.
"""
from pipenv.patched.notpip._internal.vcs import VcsSupport
for scheme in VcsSupport.schemes:
if url.lower().startswith(scheme) ... | python | def _match_vcs_scheme(url):
# type: (str) -> Optional[str]
"""Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match.
"""
from pipenv.patched.notpip._internal.vcs import VcsSupport
for scheme in VcsSupport.schemes:
if url.lower().startswith(scheme) ... | [
"def",
"_match_vcs_scheme",
"(",
"url",
")",
":",
"# type: (str) -> Optional[str]",
"from",
"pipenv",
".",
"patched",
".",
"notpip",
".",
"_internal",
".",
"vcs",
"import",
"VcsSupport",
"for",
"scheme",
"in",
"VcsSupport",
".",
"schemes",
":",
"if",
"url",
".... | Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match. | [
"Look",
"for",
"VCS",
"schemes",
"in",
"the",
"URL",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L77-L87 |
25,292 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _is_url_like_archive | def _is_url_like_archive(url):
# type: (str) -> bool
"""Return whether the URL looks like an archive.
"""
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False | python | def _is_url_like_archive(url):
# type: (str) -> bool
"""Return whether the URL looks like an archive.
"""
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False | [
"def",
"_is_url_like_archive",
"(",
"url",
")",
":",
"# type: (str) -> bool",
"filename",
"=",
"Link",
"(",
"url",
")",
".",
"filename",
"for",
"bad_ext",
"in",
"ARCHIVE_EXTENSIONS",
":",
"if",
"filename",
".",
"endswith",
"(",
"bad_ext",
")",
":",
"return",
... | Return whether the URL looks like an archive. | [
"Return",
"whether",
"the",
"URL",
"looks",
"like",
"an",
"archive",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L90-L98 |
25,293 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _ensure_html_header | def _ensure_html_header(response):
# type: (Response) -> None
"""Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html.
"""
content_type = response.headers.get("Content-Type", "")
if not content_type.lower().startswith("text/h... | python | def _ensure_html_header(response):
# type: (Response) -> None
"""Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html.
"""
content_type = response.headers.get("Content-Type", "")
if not content_type.lower().startswith("text/h... | [
"def",
"_ensure_html_header",
"(",
"response",
")",
":",
"# type: (Response) -> None",
"content_type",
"=",
"response",
".",
"headers",
".",
"get",
"(",
"\"Content-Type\"",
",",
"\"\"",
")",
"if",
"not",
"content_type",
".",
"lower",
"(",
")",
".",
"startswith",... | Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html. | [
"Check",
"the",
"Content",
"-",
"Type",
"header",
"to",
"ensure",
"the",
"response",
"contains",
"HTML",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L109-L117 |
25,294 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _ensure_html_response | def _ensure_html_response(url, session):
# type: (str, PipSession) -> None
"""Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html.
"""
scheme, netloc, path, qu... | python | def _ensure_html_response(url, session):
# type: (str, PipSession) -> None
"""Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html.
"""
scheme, netloc, path, qu... | [
"def",
"_ensure_html_response",
"(",
"url",
",",
"session",
")",
":",
"# type: (str, PipSession) -> None",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"fragment",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"scheme",
"not",
"in",
... | Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html. | [
"Send",
"a",
"HEAD",
"request",
"to",
"the",
"URL",
"and",
"ensure",
"the",
"response",
"contains",
"HTML",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L124-L138 |
25,295 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _get_html_response | def _get_html_response(url, session):
# type: (str, PipSession) -> Response
"""Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large... | python | def _get_html_response(url, session):
# type: (str, PipSession) -> Response
"""Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large... | [
"def",
"_get_html_response",
"(",
"url",
",",
"session",
")",
":",
"# type: (str, PipSession) -> Response",
"if",
"_is_url_like_archive",
"(",
"url",
")",
":",
"_ensure_html_response",
"(",
"url",
",",
"session",
"=",
"session",
")",
"logger",
".",
"debug",
"(",
... | Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large file.
Raise `_NotHTTP` if the content type cannot be determined, or
`_No... | [
"Access",
"an",
"HTML",
"page",
"with",
"GET",
"and",
"return",
"the",
"response",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L141-L189 |
25,296 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _find_name_version_sep | def _find_name_version_sep(egg_info, canonical_name):
# type: (str, str) -> int
"""Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since... | python | def _find_name_version_sep(egg_info, canonical_name):
# type: (str, str) -> int
"""Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since... | [
"def",
"_find_name_version_sep",
"(",
"egg_info",
",",
"canonical_name",
")",
":",
"# type: (str, str) -> int",
"# Project name and version must be separated by one single dash. Find all",
"# occurrences of dashes; if the string in front of it matches the canonical",
"# name, this is the one s... | Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since the canonicalized name does not necessarily
have the same length as the egg info's nam... | [
"Find",
"the",
"separator",
"s",
"index",
"based",
"on",
"the",
"package",
"s",
"canonical",
"name",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L896-L919 |
25,297 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _egg_info_matches | def _egg_info_matches(egg_info, canonical_name):
# type: (str, str) -> Optional[str]
"""Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param canonical_name: The canonicalized name of the package this
belongs to.
"""
try:
version_start ... | python | def _egg_info_matches(egg_info, canonical_name):
# type: (str, str) -> Optional[str]
"""Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param canonical_name: The canonicalized name of the package this
belongs to.
"""
try:
version_start ... | [
"def",
"_egg_info_matches",
"(",
"egg_info",
",",
"canonical_name",
")",
":",
"# type: (str, str) -> Optional[str]",
"try",
":",
"version_start",
"=",
"_find_name_version_sep",
"(",
"egg_info",
",",
"canonical_name",
")",
"+",
"1",
"except",
"ValueError",
":",
"return... | Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param canonical_name: The canonicalized name of the package this
belongs to. | [
"Pull",
"the",
"version",
"part",
"out",
"of",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L922-L937 |
25,298 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _determine_base_url | def _determine_base_url(document, page_url):
"""Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the ... | python | def _determine_base_url(document, page_url):
"""Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the ... | [
"def",
"_determine_base_url",
"(",
"document",
",",
"page_url",
")",
":",
"for",
"base",
"in",
"document",
".",
"findall",
"(",
"\".//base\"",
")",
":",
"href",
"=",
"base",
".",
"get",
"(",
"\"href\"",
")",
"if",
"href",
"is",
"not",
"None",
":",
"ret... | Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the HTML
file's URL is used as the base URL.
:p... | [
"Determine",
"the",
"HTML",
"document",
"s",
"base",
"URL",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L940-L956 |
25,299 | pypa/pipenv | pipenv/patched/notpip/_internal/index.py | _get_encoding_from_headers | def _get_encoding_from_headers(headers):
"""Determine if we have any encoding information in our headers.
"""
if headers and "Content-Type" in headers:
content_type, params = cgi.parse_header(headers["Content-Type"])
if "charset" in params:
return params['charset']
return Non... | python | def _get_encoding_from_headers(headers):
"""Determine if we have any encoding information in our headers.
"""
if headers and "Content-Type" in headers:
content_type, params = cgi.parse_header(headers["Content-Type"])
if "charset" in params:
return params['charset']
return Non... | [
"def",
"_get_encoding_from_headers",
"(",
"headers",
")",
":",
"if",
"headers",
"and",
"\"Content-Type\"",
"in",
"headers",
":",
"content_type",
",",
"params",
"=",
"cgi",
".",
"parse_header",
"(",
"headers",
"[",
"\"Content-Type\"",
"]",
")",
"if",
"\"charset\"... | Determine if we have any encoding information in our headers. | [
"Determine",
"if",
"we",
"have",
"any",
"encoding",
"information",
"in",
"our",
"headers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L959-L966 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.