partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Locator.score_url | Give an url a score which can be used to choose preferred URLs
for a given project release. | pipenv/vendor/distlib/locators.py | def score_url(self, url):
"""
Give an url a score which can be used to choose preferred URLs
for a given project release.
"""
t = urlparse(url)
basename = posixpath.basename(t.path)
compatible = True
is_wheel = basename.endswith('.whl')
is_download... | def score_url(self, url):
"""
Give an url a score which can be used to choose preferred URLs
for a given project release.
"""
t = urlparse(url)
basename = posixpath.basename(t.path)
compatible = True
is_wheel = basename.endswith('.whl')
is_download... | [
"Give",
"an",
"url",
"a",
"score",
"which",
"can",
"be",
"used",
"to",
"choose",
"preferred",
"URLs",
"for",
"a",
"given",
"project",
"release",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L188-L201 | [
"def",
"score_url",
"(",
"self",
",",
"url",
")",
":",
"t",
"=",
"urlparse",
"(",
"url",
")",
"basename",
"=",
"posixpath",
".",
"basename",
"(",
"t",
".",
"path",
")",
"compatible",
"=",
"True",
"is_wheel",
"=",
"basename",
".",
"endswith",
"(",
"'.... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Locator.prefer_url | Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).
The current implementation favours https:// URLs over http://, archives
from PyPI over those from other locations, wheel compatibility (if a
... | pipenv/vendor/distlib/locators.py | def prefer_url(self, url1, url2):
"""
Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).
The current implementation favours https:// URLs over http://, archives
from PyPI over ... | def prefer_url(self, url1, url2):
"""
Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).
The current implementation favours https:// URLs over http://, archives
from PyPI over ... | [
"Choose",
"one",
"of",
"two",
"URLs",
"where",
"both",
"are",
"candidates",
"for",
"distribution",
"archives",
"for",
"the",
"same",
"version",
"of",
"a",
"distribution",
"(",
"for",
"example",
".",
"tar",
".",
"gz",
"vs",
".",
"zip",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L203-L223 | [
"def",
"prefer_url",
"(",
"self",
",",
"url1",
",",
"url2",
")",
":",
"result",
"=",
"url2",
"if",
"url1",
":",
"s1",
"=",
"self",
".",
"score_url",
"(",
"url1",
")",
"s2",
"=",
"self",
".",
"score_url",
"(",
"url2",
")",
"if",
"s1",
">",
"s2",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Locator._get_digest | Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5. | pipenv/vendor/distlib/locators.py | def _get_digest(self, info):
"""
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
"""
result = None
for algo in ('sha256', 'md5'):... | def _get_digest(self, info):
"""
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
"""
result = None
for algo in ('sha256', 'md5'):... | [
"Get",
"a",
"digest",
"from",
"a",
"dictionary",
"by",
"looking",
"at",
"keys",
"of",
"the",
"form",
"algo_digest",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L305-L319 | [
"def",
"_get_digest",
"(",
"self",
",",
"info",
")",
":",
"result",
"=",
"None",
"for",
"algo",
"in",
"(",
"'sha256'",
",",
"'md5'",
")",
":",
"key",
"=",
"'%s_digest'",
"%",
"algo",
"if",
"key",
"in",
"info",
":",
"result",
"=",
"(",
"algo",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Page.links | Return the URLs of all the links on a page together with information
about their "rel" attribute, for determining which ones to treat as
downloads and which ones to queue for further scraping. | pipenv/vendor/distlib/locators.py | def links(self):
"""
Return the URLs of all the links on a page together with information
about their "rel" attribute, for determining which ones to treat as
downloads and which ones to queue for further scraping.
"""
def clean(url):
"Tidy up an URL."
... | def links(self):
"""
Return the URLs of all the links on a page together with information
about their "rel" attribute, for determining which ones to treat as
downloads and which ones to queue for further scraping.
"""
def clean(url):
"Tidy up an URL."
... | [
"Return",
"the",
"URLs",
"of",
"all",
"the",
"links",
"on",
"a",
"page",
"together",
"with",
"information",
"about",
"their",
"rel",
"attribute",
"for",
"determining",
"which",
"ones",
"to",
"treat",
"as",
"downloads",
"and",
"which",
"ones",
"to",
"queue",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L551-L576 | [
"def",
"links",
"(",
"self",
")",
":",
"def",
"clean",
"(",
"url",
")",
":",
"\"Tidy up an URL.\"",
"scheme",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"frag",
"=",
"urlparse",
"(",
"url",
")",
"return",
"urlunparse",
"(",
"(",
"s... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SimpleScrapingLocator._prepare_threads | Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages). | pipenv/vendor/distlib/locators.py | def _prepare_threads(self):
"""
Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages).
"""
self._threads = []
for i in range(self.num_workers):
t = th... | def _prepare_threads(self):
"""
Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages).
"""
self._threads = []
for i in range(self.num_workers):
t = th... | [
"Threads",
"are",
"created",
"only",
"when",
"get_project",
"is",
"called",
"and",
"terminate",
"before",
"it",
"returns",
".",
"They",
"are",
"there",
"primarily",
"to",
"parallelise",
"I",
"/",
"O",
"(",
"i",
".",
"e",
".",
"fetching",
"web",
"pages",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L620-L631 | [
"def",
"_prepare_threads",
"(",
"self",
")",
":",
"self",
".",
"_threads",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_workers",
")",
":",
"t",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"_fetch",
")",
"t... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SimpleScrapingLocator._wait_threads | Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so. | pipenv/vendor/distlib/locators.py | def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | [
"Tell",
"all",
"the",
"threads",
"to",
"terminate",
"(",
"by",
"sending",
"a",
"sentinel",
"value",
")",
"and",
"wait",
"for",
"them",
"to",
"do",
"so",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L633-L644 | [
"def",
"_wait_threads",
"(",
"self",
")",
":",
"# Note that you need two loops, since you can't say which",
"# thread will get each sentinel",
"for",
"t",
"in",
"self",
".",
"_threads",
":",
"self",
".",
"_to_fetch",
".",
"put",
"(",
"None",
")",
"# sentinel",
"for",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SimpleScrapingLocator._process_download | See if an URL is a suitable download for a project.
If it is, register information in the result dictionary (for
_get_project) about the specific version it's for.
Note that the return value isn't actually used other than as a boolean
value. | pipenv/vendor/distlib/locators.py | def _process_download(self, url):
"""
See if an URL is a suitable download for a project.
If it is, register information in the result dictionary (for
_get_project) about the specific version it's for.
Note that the return value isn't actually used other than as a boolean
... | def _process_download(self, url):
"""
See if an URL is a suitable download for a project.
If it is, register information in the result dictionary (for
_get_project) about the specific version it's for.
Note that the return value isn't actually used other than as a boolean
... | [
"See",
"if",
"an",
"URL",
"is",
"a",
"suitable",
"download",
"for",
"a",
"project",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L673-L691 | [
"def",
"_process_download",
"(",
"self",
",",
"url",
")",
":",
"if",
"self",
".",
"platform_check",
"and",
"self",
".",
"_is_platform_dependent",
"(",
"url",
")",
":",
"info",
"=",
"None",
"else",
":",
"info",
"=",
"self",
".",
"convert_url_to_download_info"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SimpleScrapingLocator._should_queue | Determine whether a link URL from a referring page and with a
particular "rel" attribute should be queued for scraping. | pipenv/vendor/distlib/locators.py | def _should_queue(self, link, referrer, rel):
"""
Determine whether a link URL from a referring page and with a
particular "rel" attribute should be queued for scraping.
"""
scheme, netloc, path, _, _, _ = urlparse(link)
if path.endswith(self.source_extensions + self.bina... | def _should_queue(self, link, referrer, rel):
"""
Determine whether a link URL from a referring page and with a
particular "rel" attribute should be queued for scraping.
"""
scheme, netloc, path, _, _, _ = urlparse(link)
if path.endswith(self.source_extensions + self.bina... | [
"Determine",
"whether",
"a",
"link",
"URL",
"from",
"a",
"referring",
"page",
"and",
"with",
"a",
"particular",
"rel",
"attribute",
"should",
"be",
"queued",
"for",
"scraping",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L693-L720 | [
"def",
"_should_queue",
"(",
"self",
",",
"link",
",",
"referrer",
",",
"rel",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"_",
",",
"_",
",",
"_",
"=",
"urlparse",
"(",
"link",
")",
"if",
"path",
".",
"endswith",
"(",
"self",
".",
"sour... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SimpleScrapingLocator._fetch | Get a URL to fetch from the work queue, get the HTML page, examine its
links for download candidates and candidates for further scraping.
This is a handy method to run in a thread. | pipenv/vendor/distlib/locators.py | def _fetch(self):
"""
Get a URL to fetch from the work queue, get the HTML page, examine its
links for download candidates and candidates for further scraping.
This is a handy method to run in a thread.
"""
while True:
url = self._to_fetch.get()
t... | def _fetch(self):
"""
Get a URL to fetch from the work queue, get the HTML page, examine its
links for download candidates and candidates for further scraping.
This is a handy method to run in a thread.
"""
while True:
url = self._to_fetch.get()
t... | [
"Get",
"a",
"URL",
"to",
"fetch",
"from",
"the",
"work",
"queue",
"get",
"the",
"HTML",
"page",
"examine",
"its",
"links",
"for",
"download",
"candidates",
"and",
"candidates",
"for",
"further",
"scraping",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L722-L753 | [
"def",
"_fetch",
"(",
"self",
")",
":",
"while",
"True",
":",
"url",
"=",
"self",
".",
"_to_fetch",
".",
"get",
"(",
")",
"try",
":",
"if",
"url",
":",
"page",
"=",
"self",
".",
"get_page",
"(",
"url",
")",
"if",
"page",
"is",
"None",
":",
"# e... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SimpleScrapingLocator.get_distribution_names | Return all the distribution names known to this locator. | pipenv/vendor/distlib/locators.py | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
page = self.get_page(self.base_url)
if not page:
raise DistlibException('Unable to get %s' % self.base_url)
for match in self._distname_re... | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
page = self.get_page(self.base_url)
if not page:
raise DistlibException('Unable to get %s' % self.base_url)
for match in self._distname_re... | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L816-L826 | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"page",
"=",
"self",
".",
"get_page",
"(",
"self",
".",
"base_url",
")",
"if",
"not",
"page",
":",
"raise",
"DistlibException",
"(",
"'Unable to get %s'",
"%",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DirectoryLocator.get_distribution_names | Return all the distribution names known to this locator. | pipenv/vendor/distlib/locators.py | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for root, dirs, files in os.walk(self.base_dir):
for fn in files:
if self.should_include(fn, root):
fn = os.path.join(... | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for root, dirs, files in os.walk(self.base_dir):
for fn in files:
if self.should_include(fn, root):
fn = os.path.join(... | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L874-L891 | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"base_dir",
")",
":",
"for",
"fn",
"in",
"files",
":",
"if",
"self",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | AggregatingLocator.get_distribution_names | Return all the distribution names known to this locator. | pipenv/vendor/distlib/locators.py | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for locator in self.locators:
try:
result |= locator.get_distribution_names()
except NotImplementedError:
pass... | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for locator in self.locators:
try:
result |= locator.get_distribution_names()
except NotImplementedError:
pass... | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1035-L1045 | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"locator",
"in",
"self",
".",
"locators",
":",
"try",
":",
"result",
"|=",
"locator",
".",
"get_distribution_names",
"(",
")",
"except",
"NotImplementedError",
":"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyFinder.add_distribution | Add a distribution to the finder. This will update internal information
about who provides what.
:param dist: The distribution to add. | pipenv/vendor/distlib/locators.py | def add_distribution(self, dist):
"""
Add a distribution to the finder. This will update internal information
about who provides what.
:param dist: The distribution to add.
"""
logger.debug('adding distribution %s', dist)
name = dist.key
self.dists_by_name... | def add_distribution(self, dist):
"""
Add a distribution to the finder. This will update internal information
about who provides what.
:param dist: The distribution to add.
"""
logger.debug('adding distribution %s', dist)
name = dist.key
self.dists_by_name... | [
"Add",
"a",
"distribution",
"to",
"the",
"finder",
".",
"This",
"will",
"update",
"internal",
"information",
"about",
"who",
"provides",
"what",
".",
":",
"param",
"dist",
":",
"The",
"distribution",
"to",
"add",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1074-L1087 | [
"def",
"add_distribution",
"(",
"self",
",",
"dist",
")",
":",
"logger",
".",
"debug",
"(",
"'adding distribution %s'",
",",
"dist",
")",
"name",
"=",
"dist",
".",
"key",
"self",
".",
"dists_by_name",
"[",
"name",
"]",
"=",
"dist",
"self",
".",
"dists",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyFinder.remove_distribution | Remove a distribution from the finder. This will update internal
information about who provides what.
:param dist: The distribution to remove. | pipenv/vendor/distlib/locators.py | def remove_distribution(self, dist):
"""
Remove a distribution from the finder. This will update internal
information about who provides what.
:param dist: The distribution to remove.
"""
logger.debug('removing distribution %s', dist)
name = dist.key
del s... | def remove_distribution(self, dist):
"""
Remove a distribution from the finder. This will update internal
information about who provides what.
:param dist: The distribution to remove.
"""
logger.debug('removing distribution %s', dist)
name = dist.key
del s... | [
"Remove",
"a",
"distribution",
"from",
"the",
"finder",
".",
"This",
"will",
"update",
"internal",
"information",
"about",
"who",
"provides",
"what",
".",
":",
"param",
"dist",
":",
"The",
"distribution",
"to",
"remove",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1089-L1105 | [
"def",
"remove_distribution",
"(",
"self",
",",
"dist",
")",
":",
"logger",
".",
"debug",
"(",
"'removing distribution %s'",
",",
"dist",
")",
"name",
"=",
"dist",
".",
"key",
"del",
"self",
".",
"dists_by_name",
"[",
"name",
"]",
"del",
"self",
".",
"di... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyFinder.get_matcher | Get a version matcher for a requirement.
:param reqt: The requirement
:type reqt: str
:return: A version matcher (an instance of
:class:`distlib.version.Matcher`). | pipenv/vendor/distlib/locators.py | def get_matcher(self, reqt):
"""
Get a version matcher for a requirement.
:param reqt: The requirement
:type reqt: str
:return: A version matcher (an instance of
:class:`distlib.version.Matcher`).
"""
try:
matcher = self.scheme.matcher... | def get_matcher(self, reqt):
"""
Get a version matcher for a requirement.
:param reqt: The requirement
:type reqt: str
:return: A version matcher (an instance of
:class:`distlib.version.Matcher`).
"""
try:
matcher = self.scheme.matcher... | [
"Get",
"a",
"version",
"matcher",
"for",
"a",
"requirement",
".",
":",
"param",
"reqt",
":",
"The",
"requirement",
":",
"type",
"reqt",
":",
"str",
":",
"return",
":",
"A",
"version",
"matcher",
"(",
"an",
"instance",
"of",
":",
"class",
":",
"distlib"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1107-L1121 | [
"def",
"get_matcher",
"(",
"self",
",",
"reqt",
")",
":",
"try",
":",
"matcher",
"=",
"self",
".",
"scheme",
".",
"matcher",
"(",
"reqt",
")",
"except",
"UnsupportedVersionError",
":",
"# pragma: no cover",
"# XXX compat-mode if cannot read the version",
"name",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyFinder.find_providers | Find the distributions which can fulfill a requirement.
:param reqt: The requirement.
:type reqt: str
:return: A set of distribution which can fulfill the requirement. | pipenv/vendor/distlib/locators.py | def find_providers(self, reqt):
"""
Find the distributions which can fulfill a requirement.
:param reqt: The requirement.
:type reqt: str
:return: A set of distribution which can fulfill the requirement.
"""
matcher = self.get_matcher(reqt)
name = matche... | def find_providers(self, reqt):
"""
Find the distributions which can fulfill a requirement.
:param reqt: The requirement.
:type reqt: str
:return: A set of distribution which can fulfill the requirement.
"""
matcher = self.get_matcher(reqt)
name = matche... | [
"Find",
"the",
"distributions",
"which",
"can",
"fulfill",
"a",
"requirement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1123-L1145 | [
"def",
"find_providers",
"(",
"self",
",",
"reqt",
")",
":",
"matcher",
"=",
"self",
".",
"get_matcher",
"(",
"reqt",
")",
"name",
"=",
"matcher",
".",
"key",
"# case-insensitive",
"result",
"=",
"set",
"(",
")",
"provided",
"=",
"self",
".",
"provided",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyFinder.try_to_replace | Attempt to replace one provider with another. This is typically used
when resolving dependencies from multiple sources, e.g. A requires
(B >= 1.0) while C requires (B >= 1.1).
For successful replacement, ``provider`` must meet all the requirements
which ``other`` fulfills.
:par... | pipenv/vendor/distlib/locators.py | def try_to_replace(self, provider, other, problems):
"""
Attempt to replace one provider with another. This is typically used
when resolving dependencies from multiple sources, e.g. A requires
(B >= 1.0) while C requires (B >= 1.1).
For successful replacement, ``provider`` must ... | def try_to_replace(self, provider, other, problems):
"""
Attempt to replace one provider with another. This is typically used
when resolving dependencies from multiple sources, e.g. A requires
(B >= 1.0) while C requires (B >= 1.1).
For successful replacement, ``provider`` must ... | [
"Attempt",
"to",
"replace",
"one",
"provider",
"with",
"another",
".",
"This",
"is",
"typically",
"used",
"when",
"resolving",
"dependencies",
"from",
"multiple",
"sources",
"e",
".",
"g",
".",
"A",
"requires",
"(",
"B",
">",
"=",
"1",
".",
"0",
")",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1147-L1185 | [
"def",
"try_to_replace",
"(",
"self",
",",
"provider",
",",
"other",
",",
"problems",
")",
":",
"rlist",
"=",
"self",
".",
"reqts",
"[",
"other",
"]",
"unmatched",
"=",
"set",
"(",
")",
"for",
"s",
"in",
"rlist",
":",
"matcher",
"=",
"self",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | DependencyFinder.find | Find a distribution and all distributions it depends on.
:param requirement: The requirement specifying the distribution to
find, or a Distribution instance.
:param meta_extras: A list of meta extras such as :test:, :build: and
so on.
:par... | pipenv/vendor/distlib/locators.py | def find(self, requirement, meta_extras=None, prereleases=False):
"""
Find a distribution and all distributions it depends on.
:param requirement: The requirement specifying the distribution to
find, or a Distribution instance.
:param meta_extras: A list of m... | def find(self, requirement, meta_extras=None, prereleases=False):
"""
Find a distribution and all distributions it depends on.
:param requirement: The requirement specifying the distribution to
find, or a Distribution instance.
:param meta_extras: A list of m... | [
"Find",
"a",
"distribution",
"and",
"all",
"distributions",
"it",
"depends",
"on",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1187-L1295 | [
"def",
"find",
"(",
"self",
",",
"requirement",
",",
"meta_extras",
"=",
"None",
",",
"prereleases",
"=",
"False",
")",
":",
"self",
".",
"provided",
"=",
"{",
"}",
"self",
".",
"dists",
"=",
"{",
"}",
"self",
".",
"dists_by_name",
"=",
"{",
"}",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PopenSpawn._read_incoming | Run in a thread to move output from a pipe to a queue. | pipenv/vendor/pexpect/popen_spawn.py | def _read_incoming(self):
"""Run in a thread to move output from a pipe to a queue."""
fileno = self.proc.stdout.fileno()
while 1:
buf = b''
try:
buf = os.read(fileno, 1024)
except OSError as e:
self._log(e, 'read')
... | def _read_incoming(self):
"""Run in a thread to move output from a pipe to a queue."""
fileno = self.proc.stdout.fileno()
while 1:
buf = b''
try:
buf = os.read(fileno, 1024)
except OSError as e:
self._log(e, 'read')
... | [
"Run",
"in",
"a",
"thread",
"to",
"move",
"output",
"from",
"a",
"pipe",
"to",
"a",
"queue",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L100-L115 | [
"def",
"_read_incoming",
"(",
"self",
")",
":",
"fileno",
"=",
"self",
".",
"proc",
".",
"stdout",
".",
"fileno",
"(",
")",
"while",
"1",
":",
"buf",
"=",
"b''",
"try",
":",
"buf",
"=",
"os",
".",
"read",
"(",
"fileno",
",",
"1024",
")",
"except"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PopenSpawn.send | Send data to the subprocess' stdin.
Returns the number of bytes written. | pipenv/vendor/pexpect/popen_spawn.py | def send(self, s):
'''Send data to the subprocess' stdin.
Returns the number of bytes written.
'''
s = self._coerce_send_string(s)
self._log(s, 'send')
b = self._encoder.encode(s, final=False)
if PY3:
return self.proc.stdin.write(b)
else:
... | def send(self, s):
'''Send data to the subprocess' stdin.
Returns the number of bytes written.
'''
s = self._coerce_send_string(s)
self._log(s, 'send')
b = self._encoder.encode(s, final=False)
if PY3:
return self.proc.stdin.write(b)
else:
... | [
"Send",
"data",
"to",
"the",
"subprocess",
"stdin",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L132-L147 | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"s",
"=",
"self",
".",
"_coerce_send_string",
"(",
"s",
")",
"self",
".",
"_log",
"(",
"s",
",",
"'send'",
")",
"b",
"=",
"self",
".",
"_encoder",
".",
"encode",
"(",
"s",
",",
"final",
"=",
"Fals... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PopenSpawn.sendline | Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. | pipenv/vendor/pexpect/popen_spawn.py | def sendline(self, s=''):
'''Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. '''
n = self.send(s)
return n + self.send(self.linesep) | def sendline(self, s=''):
'''Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. '''
n = self.send(s)
return n + self.send(self.linesep) | [
"Wraps",
"send",
"()",
"sending",
"string",
"s",
"to",
"child",
"process",
"with",
"os",
".",
"linesep",
"automatically",
"appended",
".",
"Returns",
"number",
"of",
"bytes",
"written",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L149-L154 | [
"def",
"sendline",
"(",
"self",
",",
"s",
"=",
"''",
")",
":",
"n",
"=",
"self",
".",
"send",
"(",
"s",
")",
"return",
"n",
"+",
"self",
".",
"send",
"(",
"self",
".",
"linesep",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PopenSpawn.wait | Wait for the subprocess to finish.
Returns the exit code. | pipenv/vendor/pexpect/popen_spawn.py | def wait(self):
'''Wait for the subprocess to finish.
Returns the exit code.
'''
status = self.proc.wait()
if status >= 0:
self.exitstatus = status
self.signalstatus = None
else:
self.exitstatus = None
self.signalstatus = -... | def wait(self):
'''Wait for the subprocess to finish.
Returns the exit code.
'''
status = self.proc.wait()
if status >= 0:
self.exitstatus = status
self.signalstatus = None
else:
self.exitstatus = None
self.signalstatus = -... | [
"Wait",
"for",
"the",
"subprocess",
"to",
"finish",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L156-L169 | [
"def",
"wait",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"proc",
".",
"wait",
"(",
")",
"if",
"status",
">=",
"0",
":",
"self",
".",
"exitstatus",
"=",
"status",
"self",
".",
"signalstatus",
"=",
"None",
"else",
":",
"self",
".",
"exitstat... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PopenSpawn.kill | Sends a Unix signal to the subprocess.
Use constants from the :mod:`signal` module to specify which signal. | pipenv/vendor/pexpect/popen_spawn.py | def kill(self, sig):
'''Sends a Unix signal to the subprocess.
Use constants from the :mod:`signal` module to specify which signal.
'''
if sys.platform == 'win32':
if sig in [signal.SIGINT, signal.CTRL_C_EVENT]:
sig = signal.CTRL_C_EVENT
elif sig ... | def kill(self, sig):
'''Sends a Unix signal to the subprocess.
Use constants from the :mod:`signal` module to specify which signal.
'''
if sys.platform == 'win32':
if sig in [signal.SIGINT, signal.CTRL_C_EVENT]:
sig = signal.CTRL_C_EVENT
elif sig ... | [
"Sends",
"a",
"Unix",
"signal",
"to",
"the",
"subprocess",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L171-L184 | [
"def",
"kill",
"(",
"self",
",",
"sig",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"if",
"sig",
"in",
"[",
"signal",
".",
"SIGINT",
",",
"signal",
".",
"CTRL_C_EVENT",
"]",
":",
"sig",
"=",
"signal",
".",
"CTRL_C_EVENT",
"elif",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | mkdir_p | Like `mkdir`, but does not raise an exception if the
directory already exists. | pipenv/vendor/pep517/build.py | def mkdir_p(*args, **kwargs):
"""Like `mkdir`, but does not raise an exception if the
directory already exists.
"""
try:
return os.mkdir(*args, **kwargs)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise | def mkdir_p(*args, **kwargs):
"""Like `mkdir`, but does not raise an exception if the
directory already exists.
"""
try:
return os.mkdir(*args, **kwargs)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise | [
"Like",
"mkdir",
"but",
"does",
"not",
"raise",
"an",
"exception",
"if",
"the",
"directory",
"already",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/build.py#L45-L53 | [
"def",
"mkdir_p",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"os",
".",
"mkdir",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"!=",
"errno",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | with_pattern | Attach a regular expression pattern matcher to a custom type converter
function.
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
>>> import parse
>>> @parse.with_pattern(r"\d+")
... def parse_number(text):
... return int(text)
is equi... | pipenv/vendor/parse.py | def with_pattern(pattern, regex_group_count=None):
"""Attach a regular expression pattern matcher to a custom type converter
function.
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
>>> import parse
>>> @parse.with_pattern(r"\d+")
... def parse_n... | def with_pattern(pattern, regex_group_count=None):
"""Attach a regular expression pattern matcher to a custom type converter
function.
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
>>> import parse
>>> @parse.with_pattern(r"\d+")
... def parse_n... | [
"Attach",
"a",
"regular",
"expression",
"pattern",
"matcher",
"to",
"a",
"custom",
"type",
"converter",
"function",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L433-L459 | [
"def",
"with_pattern",
"(",
"pattern",
",",
"regex_group_count",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"func",
".",
"pattern",
"=",
"pattern",
"func",
".",
"regex_group_count",
"=",
"regex_group_count",
"return",
"func",
"return",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | int_convert | Convert a string to an integer.
The string may start with a sign.
It may be of a base other than 10.
If may start with a base indicator, 0#nnnn, which we assume should
override the specified base.
It may also have other non-numeric characters that we can ignore. | pipenv/vendor/parse.py | def int_convert(base):
'''Convert a string to an integer.
The string may start with a sign.
It may be of a base other than 10.
If may start with a base indicator, 0#nnnn, which we assume should
override the specified base.
It may also have other non-numeric characters that we can ignore.
... | def int_convert(base):
'''Convert a string to an integer.
The string may start with a sign.
It may be of a base other than 10.
If may start with a base indicator, 0#nnnn, which we assume should
override the specified base.
It may also have other non-numeric characters that we can ignore.
... | [
"Convert",
"a",
"string",
"to",
"an",
"integer",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L462-L496 | [
"def",
"int_convert",
"(",
"base",
")",
":",
"CHARS",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyz'",
"def",
"f",
"(",
"string",
",",
"match",
",",
"base",
"=",
"base",
")",
":",
"if",
"string",
"[",
"0",
"]",
"==",
"'-'",
":",
"sign",
"=",
"-",
"1",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | date_convert | Convert the incoming string containing some date / time info into a
datetime instance. | pipenv/vendor/parse.py | def date_convert(string, match, ymd=None, mdy=None, dmy=None,
d_m_y=None, hms=None, am=None, tz=None, mm=None, dd=None):
'''Convert the incoming string containing some date / time info into a
datetime instance.
'''
groups = match.groups()
time_only = False
if mm and dd:
y=datetim... | def date_convert(string, match, ymd=None, mdy=None, dmy=None,
d_m_y=None, hms=None, am=None, tz=None, mm=None, dd=None):
'''Convert the incoming string containing some date / time info into a
datetime instance.
'''
groups = match.groups()
time_only = False
if mm and dd:
y=datetim... | [
"Convert",
"the",
"incoming",
"string",
"containing",
"some",
"date",
"/",
"time",
"info",
"into",
"a",
"datetime",
"instance",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L551-L636 | [
"def",
"date_convert",
"(",
"string",
",",
"match",
",",
"ymd",
"=",
"None",
",",
"mdy",
"=",
"None",
",",
"dmy",
"=",
"None",
",",
"d_m_y",
"=",
"None",
",",
"hms",
"=",
"None",
",",
"am",
"=",
"None",
",",
"tz",
"=",
"None",
",",
"mm",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | extract_format | Pull apart the format [[fill]align][0][width][.precision][type] | pipenv/vendor/parse.py | def extract_format(format, extra_types):
'''Pull apart the format [[fill]align][0][width][.precision][type]
'''
fill = align = None
if format[0] in '<>=^':
align = format[0]
format = format[1:]
elif len(format) > 1 and format[1] in '<>=^':
fill = format[0]
align = for... | def extract_format(format, extra_types):
'''Pull apart the format [[fill]align][0][width][.precision][type]
'''
fill = align = None
if format[0] in '<>=^':
align = format[0]
format = format[1:]
elif len(format) > 1 and format[1] in '<>=^':
fill = format[0]
align = for... | [
"Pull",
"apart",
"the",
"format",
"[[",
"fill",
"]",
"align",
"]",
"[",
"0",
"]",
"[",
"width",
"]",
"[",
".",
"precision",
"]",
"[",
"type",
"]"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L656-L696 | [
"def",
"extract_format",
"(",
"format",
",",
"extra_types",
")",
":",
"fill",
"=",
"align",
"=",
"None",
"if",
"format",
"[",
"0",
"]",
"in",
"'<>=^'",
":",
"align",
"=",
"format",
"[",
"0",
"]",
"format",
"=",
"format",
"[",
"1",
":",
"]",
"elif",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse | Using "format" attempt to pull values from "string".
The format must match the string contents exactly. If the value
you're looking for is instead just a part of the string use
search().
If ``evaluate_result`` is True the return value will be an Result instance with two attributes:
.fixed - tupl... | pipenv/vendor/parse.py | def parse(format, string, extra_types=None, evaluate_result=True, case_sensitive=False):
'''Using "format" attempt to pull values from "string".
The format must match the string contents exactly. If the value
you're looking for is instead just a part of the string use
search().
If ``evaluate_resul... | def parse(format, string, extra_types=None, evaluate_result=True, case_sensitive=False):
'''Using "format" attempt to pull values from "string".
The format must match the string contents exactly. If the value
you're looking for is instead just a part of the string use
search().
If ``evaluate_resul... | [
"Using",
"format",
"attempt",
"to",
"pull",
"values",
"from",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L1201-L1228 | [
"def",
"parse",
"(",
"format",
",",
"string",
",",
"extra_types",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
",",
"case_sensitive",
"=",
"False",
")",
":",
"p",
"=",
"Parser",
"(",
"format",
",",
"extra_types",
"=",
"extra_types",
",",
"case_sensiti... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | search | Search "string" for the first occurrence of "format".
The format may occur anywhere within the string. If
instead you wish for the format to exactly match the string
use parse().
Optionally start the search at "pos" character index and limit the search
to a maximum index of endpos - equivalent to ... | pipenv/vendor/parse.py | def search(format, string, pos=0, endpos=None, extra_types=None, evaluate_result=True,
case_sensitive=False):
'''Search "string" for the first occurrence of "format".
The format may occur anywhere within the string. If
instead you wish for the format to exactly match the string
use parse().
... | def search(format, string, pos=0, endpos=None, extra_types=None, evaluate_result=True,
case_sensitive=False):
'''Search "string" for the first occurrence of "format".
The format may occur anywhere within the string. If
instead you wish for the format to exactly match the string
use parse().
... | [
"Search",
"string",
"for",
"the",
"first",
"occurrence",
"of",
"format",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L1231-L1262 | [
"def",
"search",
"(",
"format",
",",
"string",
",",
"pos",
"=",
"0",
",",
"endpos",
"=",
"None",
",",
"extra_types",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
",",
"case_sensitive",
"=",
"False",
")",
":",
"p",
"=",
"Parser",
"(",
"format",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse | Match my format to the string exactly.
Return a Result or Match instance or None if there's no match. | pipenv/vendor/parse.py | def parse(self, string, evaluate_result=True):
'''Match my format to the string exactly.
Return a Result or Match instance or None if there's no match.
'''
m = self._match_re.match(string)
if m is None:
return None
if evaluate_result:
return self... | def parse(self, string, evaluate_result=True):
'''Match my format to the string exactly.
Return a Result or Match instance or None if there's no match.
'''
m = self._match_re.match(string)
if m is None:
return None
if evaluate_result:
return self... | [
"Match",
"my",
"format",
"to",
"the",
"string",
"exactly",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L773-L785 | [
"def",
"parse",
"(",
"self",
",",
"string",
",",
"evaluate_result",
"=",
"True",
")",
":",
"m",
"=",
"self",
".",
"_match_re",
".",
"match",
"(",
"string",
")",
"if",
"m",
"is",
"None",
":",
"return",
"None",
"if",
"evaluate_result",
":",
"return",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.search | Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` argument is set to ``False`` a
Match instance is returned instead of the a... | pipenv/vendor/parse.py | def search(self, string, pos=0, endpos=None, evaluate_result=True):
'''Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` arg... | def search(self, string, pos=0, endpos=None, evaluate_result=True):
'''Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` arg... | [
"Search",
"the",
"string",
"for",
"my",
"format",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L787-L808 | [
"def",
"search",
"(",
"self",
",",
"string",
",",
"pos",
"=",
"0",
",",
"endpos",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
")",
":",
"if",
"endpos",
"is",
"None",
":",
"endpos",
"=",
"len",
"(",
"string",
")",
"m",
"=",
"self",
".",
"_se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.findall | Search "string" for all occurrences of "format".
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
Returns an iterator that holds Result or Match instances for each format match
found. | pipenv/vendor/parse.py | def findall(self, string, pos=0, endpos=None, extra_types=None, evaluate_result=True):
'''Search "string" for all occurrences of "format".
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
... | def findall(self, string, pos=0, endpos=None, extra_types=None, evaluate_result=True):
'''Search "string" for all occurrences of "format".
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
... | [
"Search",
"string",
"for",
"all",
"occurrences",
"of",
"format",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L810-L822 | [
"def",
"findall",
"(",
"self",
",",
"string",
",",
"pos",
"=",
"0",
",",
"endpos",
"=",
"None",
",",
"extra_types",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
")",
":",
"if",
"endpos",
"is",
"None",
":",
"endpos",
"=",
"len",
"(",
"string",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.evaluate_result | Generate a Result instance for the given regex match object | pipenv/vendor/parse.py | def evaluate_result(self, m):
'''Generate a Result instance for the given regex match object'''
# ok, figure the fixed fields we've pulled out and type convert them
fixed_fields = list(m.groups())
for n in self._fixed_fields:
if n in self._type_conversions:
fi... | def evaluate_result(self, m):
'''Generate a Result instance for the given regex match object'''
# ok, figure the fixed fields we've pulled out and type convert them
fixed_fields = list(m.groups())
for n in self._fixed_fields:
if n in self._type_conversions:
fi... | [
"Generate",
"a",
"Result",
"instance",
"for",
"the",
"given",
"regex",
"match",
"object"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L844-L873 | [
"def",
"evaluate_result",
"(",
"self",
",",
"m",
")",
":",
"# ok, figure the fixed fields we've pulled out and type convert them",
"fixed_fields",
"=",
"list",
"(",
"m",
".",
"groups",
"(",
")",
")",
"for",
"n",
"in",
"self",
".",
"_fixed_fields",
":",
"if",
"n"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | install | Installs provided packages and adds them to Pipfile, or (if no packages are given), installs all packages from Pipfile. | pipenv/cli/command.py | def install(
ctx,
state,
**kwargs
):
"""Installs provided packages and adds them to Pipfile, or (if no packages are given), installs all packages from Pipfile."""
from ..core import do_install
retcode = do_install(
dev=state.installstate.dev,
three=state.three,
python=st... | def install(
ctx,
state,
**kwargs
):
"""Installs provided packages and adds them to Pipfile, or (if no packages are given), installs all packages from Pipfile."""
from ..core import do_install
retcode = do_install(
dev=state.installstate.dev,
three=state.three,
python=st... | [
"Installs",
"provided",
"packages",
"and",
"adds",
"them",
"to",
"Pipfile",
"or",
"(",
"if",
"no",
"packages",
"are",
"given",
")",
"installs",
"all",
"packages",
"from",
"Pipfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L228-L258 | [
"def",
"install",
"(",
"ctx",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_install",
"retcode",
"=",
"do_install",
"(",
"dev",
"=",
"state",
".",
"installstate",
".",
"dev",
",",
"three",
"=",
"state",
".",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | uninstall | Un-installs a provided package and removes it from Pipfile. | pipenv/cli/command.py | def uninstall(
ctx,
state,
all_dev=False,
all=False,
**kwargs
):
"""Un-installs a provided package and removes it from Pipfile."""
from ..core import do_uninstall
retcode = do_uninstall(
packages=state.installstate.packages,
editable_packages=state.installstate.editables,... | def uninstall(
ctx,
state,
all_dev=False,
all=False,
**kwargs
):
"""Un-installs a provided package and removes it from Pipfile."""
from ..core import do_uninstall
retcode = do_uninstall(
packages=state.installstate.packages,
editable_packages=state.installstate.editables,... | [
"Un",
"-",
"installs",
"a",
"provided",
"package",
"and",
"removes",
"it",
"from",
"Pipfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L280-L303 | [
"def",
"uninstall",
"(",
"ctx",
",",
"state",
",",
"all_dev",
"=",
"False",
",",
"all",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_uninstall",
"retcode",
"=",
"do_uninstall",
"(",
"packages",
"=",
"state",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | lock | Generates Pipfile.lock. | pipenv/cli/command.py | def lock(
ctx,
state,
**kwargs
):
"""Generates Pipfile.lock."""
from ..core import ensure_project, do_init, do_lock
# Ensure that virtualenv is available.
ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
if state.installstate.requirementstxt:
... | def lock(
ctx,
state,
**kwargs
):
"""Generates Pipfile.lock."""
from ..core import ensure_project, do_init, do_lock
# Ensure that virtualenv is available.
ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
if state.installstate.requirementstxt:
... | [
"Generates",
"Pipfile",
".",
"lock",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L310-L333 | [
"def",
"lock",
"(",
"ctx",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"ensure_project",
",",
"do_init",
",",
"do_lock",
"# Ensure that virtualenv is available.",
"ensure_project",
"(",
"three",
"=",
"state",
".",
"th... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | shell | Spawns a shell within the virtualenv. | pipenv/cli/command.py | def shell(
state,
fancy=False,
shell_args=None,
anyway=False,
):
"""Spawns a shell within the virtualenv."""
from ..core import load_dot_env, do_shell
# Prevent user from activating nested environments.
if "PIPENV_ACTIVE" in os.environ:
# If PIPENV_ACTIVE is set, VIRTUAL_ENV sho... | def shell(
state,
fancy=False,
shell_args=None,
anyway=False,
):
"""Spawns a shell within the virtualenv."""
from ..core import load_dot_env, do_shell
# Prevent user from activating nested environments.
if "PIPENV_ACTIVE" in os.environ:
# If PIPENV_ACTIVE is set, VIRTUAL_ENV sho... | [
"Spawns",
"a",
"shell",
"within",
"the",
"virtualenv",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L357-L391 | [
"def",
"shell",
"(",
"state",
",",
"fancy",
"=",
"False",
",",
"shell_args",
"=",
"None",
",",
"anyway",
"=",
"False",
",",
")",
":",
"from",
".",
".",
"core",
"import",
"load_dot_env",
",",
"do_shell",
"# Prevent user from activating nested environments.",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | run | Spawns a command installed into the virtualenv. | pipenv/cli/command.py | def run(state, command, args):
"""Spawns a command installed into the virtualenv."""
from ..core import do_run
do_run(
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
) | def run(state, command, args):
"""Spawns a command installed into the virtualenv."""
from ..core import do_run
do_run(
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
) | [
"Spawns",
"a",
"command",
"installed",
"into",
"the",
"virtualenv",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L403-L408 | [
"def",
"run",
"(",
"state",
",",
"command",
",",
"args",
")",
":",
"from",
".",
".",
"core",
"import",
"do_run",
"do_run",
"(",
"command",
"=",
"command",
",",
"args",
"=",
"args",
",",
"three",
"=",
"state",
".",
"three",
",",
"python",
"=",
"stat... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | check | Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile. | pipenv/cli/command.py | def check(
state,
unused=False,
style=False,
ignore=None,
args=None,
**kwargs
):
"""Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile."""
from ..core import do_check
do_check(
three=state.three,
python=state.python,
system=st... | def check(
state,
unused=False,
style=False,
ignore=None,
args=None,
**kwargs
):
"""Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile."""
from ..core import do_check
do_check(
three=state.three,
python=state.python,
system=st... | [
"Checks",
"for",
"security",
"vulnerabilities",
"and",
"against",
"PEP",
"508",
"markers",
"provided",
"in",
"Pipfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L431-L450 | [
"def",
"check",
"(",
"state",
",",
"unused",
"=",
"False",
",",
"style",
"=",
"False",
",",
"ignore",
"=",
"None",
",",
"args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_check",
"do_check",
"(",
"three"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | update | Runs lock, then sync. | pipenv/cli/command.py | def update(
ctx,
state,
bare=False,
dry_run=None,
outdated=False,
**kwargs
):
"""Runs lock, then sync."""
from ..core import (
ensure_project,
do_outdated,
do_lock,
do_sync,
project,
)
ensure_project(three=state.three, python=state.python,... | def update(
ctx,
state,
bare=False,
dry_run=None,
outdated=False,
**kwargs
):
"""Runs lock, then sync."""
from ..core import (
ensure_project,
do_outdated,
do_lock,
do_sync,
project,
)
ensure_project(three=state.three, python=state.python,... | [
"Runs",
"lock",
"then",
"sync",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L462-L527 | [
"def",
"update",
"(",
"ctx",
",",
"state",
",",
"bare",
"=",
"False",
",",
"dry_run",
"=",
"None",
",",
"outdated",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"(",
"ensure_project",
",",
"do_outdated",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | graph | Displays currently-installed dependency graph information. | pipenv/cli/command.py | def graph(bare=False, json=False, json_tree=False, reverse=False):
"""Displays currently-installed dependency graph information."""
from ..core import do_graph
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse) | def graph(bare=False, json=False, json_tree=False, reverse=False):
"""Displays currently-installed dependency graph information."""
from ..core import do_graph
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse) | [
"Displays",
"currently",
"-",
"installed",
"dependency",
"graph",
"information",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L538-L542 | [
"def",
"graph",
"(",
"bare",
"=",
"False",
",",
"json",
"=",
"False",
",",
"json_tree",
"=",
"False",
",",
"reverse",
"=",
"False",
")",
":",
"from",
".",
".",
"core",
"import",
"do_graph",
"do_graph",
"(",
"bare",
"=",
"bare",
",",
"json",
"=",
"j... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | run_open | View a given module in your editor.
This uses the EDITOR environment variable. You can temporarily override it,
for example:
EDITOR=atom pipenv open requests | pipenv/cli/command.py | def run_open(state, module, *args, **kwargs):
"""View a given module in your editor.
This uses the EDITOR environment variable. You can temporarily override it,
for example:
EDITOR=atom pipenv open requests
"""
from ..core import which, ensure_project, inline_activate_virtual_environment
... | def run_open(state, module, *args, **kwargs):
"""View a given module in your editor.
This uses the EDITOR environment variable. You can temporarily override it,
for example:
EDITOR=atom pipenv open requests
"""
from ..core import which, ensure_project, inline_activate_virtual_environment
... | [
"View",
"a",
"given",
"module",
"in",
"your",
"editor",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L552-L582 | [
"def",
"run_open",
"(",
"state",
",",
"module",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"which",
",",
"ensure_project",
",",
"inline_activate_virtual_environment",
"# Ensure that virtualenv is available.",
"ensure_p... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | sync | Installs all packages specified in Pipfile.lock. | pipenv/cli/command.py | def sync(
ctx,
state,
bare=False,
user=False,
unused=False,
**kwargs
):
"""Installs all packages specified in Pipfile.lock."""
from ..core import do_sync
retcode = do_sync(
ctx=ctx,
dev=state.installstate.dev,
three=state.three,
python=state.python,
... | def sync(
ctx,
state,
bare=False,
user=False,
unused=False,
**kwargs
):
"""Installs all packages specified in Pipfile.lock."""
from ..core import do_sync
retcode = do_sync(
ctx=ctx,
dev=state.installstate.dev,
three=state.three,
python=state.python,
... | [
"Installs",
"all",
"packages",
"specified",
"in",
"Pipfile",
".",
"lock",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L593-L618 | [
"def",
"sync",
"(",
"ctx",
",",
"state",
",",
"bare",
"=",
"False",
",",
"user",
"=",
"False",
",",
"unused",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_sync",
"retcode",
"=",
"do_sync",
"(",
"ctx",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | clean | Uninstalls all packages not specified in Pipfile.lock. | pipenv/cli/command.py | def clean(ctx, state, dry_run=False, bare=False, user=False):
"""Uninstalls all packages not specified in Pipfile.lock."""
from ..core import do_clean
do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run,
system=state.system) | def clean(ctx, state, dry_run=False, bare=False, user=False):
"""Uninstalls all packages not specified in Pipfile.lock."""
from ..core import do_clean
do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run,
system=state.system) | [
"Uninstalls",
"all",
"packages",
"not",
"specified",
"in",
"Pipfile",
".",
"lock",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L632-L636 | [
"def",
"clean",
"(",
"ctx",
",",
"state",
",",
"dry_run",
"=",
"False",
",",
"bare",
"=",
"False",
",",
"user",
"=",
"False",
")",
":",
"from",
".",
".",
"core",
"import",
"do_clean",
"do_clean",
"(",
"ctx",
"=",
"ctx",
",",
"three",
"=",
"state",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLTokenizer.consumeNumberEntity | This function returns either U+FFFD or the character based on the
decimal or hexadecimal representation. It also discards ";" if present.
If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked. | pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py | def consumeNumberEntity(self, isHex):
"""This function returns either U+FFFD or the character based on the
decimal or hexadecimal representation. It also discards ";" if present.
If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked.
"""
allowed = ... | def consumeNumberEntity(self, isHex):
"""This function returns either U+FFFD or the character based on the
decimal or hexadecimal representation. It also discards ";" if present.
If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked.
"""
allowed = ... | [
"This",
"function",
"returns",
"either",
"U",
"+",
"FFFD",
"or",
"the",
"character",
"based",
"on",
"the",
"decimal",
"or",
"hexadecimal",
"representation",
".",
"It",
"also",
"discards",
";",
"if",
"present",
".",
"If",
"not",
"present",
"self",
".",
"tok... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py#L65-L135 | [
"def",
"consumeNumberEntity",
"(",
"self",
",",
"isHex",
")",
":",
"allowed",
"=",
"digits",
"radix",
"=",
"10",
"if",
"isHex",
":",
"allowed",
"=",
"hexDigits",
"radix",
"=",
"16",
"charStack",
"=",
"[",
"]",
"# Consume all the characters that are in range whil... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLTokenizer.emitCurrentToken | This method is a generic handler for emitting the tags. It also sets
the state to "data" because that's what's needed after a token has been
emitted. | pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py | def emitCurrentToken(self):
"""This method is a generic handler for emitting the tags. It also sets
the state to "data" because that's what's needed after a token has been
emitted.
"""
token = self.currentToken
# Add token to the queue to be yielded
if (token["typ... | def emitCurrentToken(self):
"""This method is a generic handler for emitting the tags. It also sets
the state to "data" because that's what's needed after a token has been
emitted.
"""
token = self.currentToken
# Add token to the queue to be yielded
if (token["typ... | [
"This",
"method",
"is",
"a",
"generic",
"handler",
"for",
"emitting",
"the",
"tags",
".",
"It",
"also",
"sets",
"the",
"state",
"to",
"data",
"because",
"that",
"s",
"what",
"s",
"needed",
"after",
"a",
"token",
"has",
"been",
"emitted",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py#L222-L239 | [
"def",
"emitCurrentToken",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"currentToken",
"# Add token to the queue to be yielded",
"if",
"(",
"token",
"[",
"\"type\"",
"]",
"in",
"tagTokenTypes",
")",
":",
"token",
"[",
"\"name\"",
"]",
"=",
"token",
"[",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | create_package_set_from_installed | Converts a list of distributions into a PackageSet. | pipenv/patched/notpip/_internal/operations/check.py | def create_package_set_from_installed(**kwargs):
# type: (**Any) -> Tuple[PackageSet, bool]
"""Converts a list of distributions into a PackageSet.
"""
# Default to using all packages installed on the system
if kwargs == {}:
kwargs = {"local_only": False, "skip": ()}
package_set = {}
... | def create_package_set_from_installed(**kwargs):
# type: (**Any) -> Tuple[PackageSet, bool]
"""Converts a list of distributions into a PackageSet.
"""
# Default to using all packages installed on the system
if kwargs == {}:
kwargs = {"local_only": False, "skip": ()}
package_set = {}
... | [
"Converts",
"a",
"list",
"of",
"distributions",
"into",
"a",
"PackageSet",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L34-L52 | [
"def",
"create_package_set_from_installed",
"(",
"*",
"*",
"kwargs",
")",
":",
"# type: (**Any) -> Tuple[PackageSet, bool]",
"# Default to using all packages installed on the system",
"if",
"kwargs",
"==",
"{",
"}",
":",
"kwargs",
"=",
"{",
"\"local_only\"",
":",
"False",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | check_package_set | Check if a package set is consistent
If should_ignore is passed, it should be a callable that takes a
package name and returns a boolean. | pipenv/patched/notpip/_internal/operations/check.py | def check_package_set(package_set, should_ignore=None):
# type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult
"""Check if a package set is consistent
If should_ignore is passed, it should be a callable that takes a
package name and returns a boolean.
"""
if should_ignore is None:... | def check_package_set(package_set, should_ignore=None):
# type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult
"""Check if a package set is consistent
If should_ignore is passed, it should be a callable that takes a
package name and returns a boolean.
"""
if should_ignore is None:... | [
"Check",
"if",
"a",
"package",
"set",
"is",
"consistent"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L55-L99 | [
"def",
"check_package_set",
"(",
"package_set",
",",
"should_ignore",
"=",
"None",
")",
":",
"# type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult",
"if",
"should_ignore",
"is",
"None",
":",
"def",
"should_ignore",
"(",
"name",
")",
":",
"return",
"False... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | check_install_conflicts | For checking if the dependency graph would be consistent after \
installing given requirements | pipenv/patched/notpip/_internal/operations/check.py | def check_install_conflicts(to_install):
# type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]
"""For checking if the dependency graph would be consistent after \
installing given requirements
"""
# Start from the current state
package_set, _ = create_package_set_from_installed()
... | def check_install_conflicts(to_install):
# type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]
"""For checking if the dependency graph would be consistent after \
installing given requirements
"""
# Start from the current state
package_set, _ = create_package_set_from_installed()
... | [
"For",
"checking",
"if",
"the",
"dependency",
"graph",
"would",
"be",
"consistent",
"after",
"\\",
"installing",
"given",
"requirements"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L102-L120 | [
"def",
"check_install_conflicts",
"(",
"to_install",
")",
":",
"# type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]",
"# Start from the current state",
"package_set",
",",
"_",
"=",
"create_package_set_from_installed",
"(",
")",
"# Install packages",
"would_be_instal... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _simulate_installation_of | Computes the version of packages after installing to_install. | pipenv/patched/notpip/_internal/operations/check.py | def _simulate_installation_of(to_install, package_set):
# type: (List[InstallRequirement], PackageSet) -> Set[str]
"""Computes the version of packages after installing to_install.
"""
# Keep track of packages that were installed
installed = set()
# Modify it as installing requirement_set would... | def _simulate_installation_of(to_install, package_set):
# type: (List[InstallRequirement], PackageSet) -> Set[str]
"""Computes the version of packages after installing to_install.
"""
# Keep track of packages that were installed
installed = set()
# Modify it as installing requirement_set would... | [
"Computes",
"the",
"version",
"of",
"packages",
"after",
"installing",
"to_install",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L123-L139 | [
"def",
"_simulate_installation_of",
"(",
"to_install",
",",
"package_set",
")",
":",
"# type: (List[InstallRequirement], PackageSet) -> Set[str]",
"# Keep track of packages that were installed",
"installed",
"=",
"set",
"(",
")",
"# Modify it as installing requirement_set would (assumi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CharSetProber.filter_international_words | We define three types of bytes:
alphabet: english alphabets [a-zA-Z]
international: international characters [\x80-\xFF]
marker: everything else [^a-zA-Z\x80-\xFF]
The input buffer can be thought to contain a series of words delimited
by markers. This function works to filter al... | pipenv/vendor/chardet/charsetprober.py | def filter_international_words(buf):
"""
We define three types of bytes:
alphabet: english alphabets [a-zA-Z]
international: international characters [\x80-\xFF]
marker: everything else [^a-zA-Z\x80-\xFF]
The input buffer can be thought to contain a series of words delim... | def filter_international_words(buf):
"""
We define three types of bytes:
alphabet: english alphabets [a-zA-Z]
international: international characters [\x80-\xFF]
marker: everything else [^a-zA-Z\x80-\xFF]
The input buffer can be thought to contain a series of words delim... | [
"We",
"define",
"three",
"types",
"of",
"bytes",
":",
"alphabet",
":",
"english",
"alphabets",
"[",
"a",
"-",
"zA",
"-",
"Z",
"]",
"international",
":",
"international",
"characters",
"[",
"\\",
"x80",
"-",
"\\",
"xFF",
"]",
"marker",
":",
"everything",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/charsetprober.py#L67-L101 | [
"def",
"filter_international_words",
"(",
"buf",
")",
":",
"filtered",
"=",
"bytearray",
"(",
")",
"# This regex expression filters out only words that have at-least one",
"# international character. The word may include one marker character at",
"# the end.",
"words",
"=",
"re",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CharSetProber.filter_with_english_letters | Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
This filter can be applied to all scripts which contain ... | pipenv/vendor/chardet/charsetprober.py | def filter_with_english_letters(buf):
"""
Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
... | def filter_with_english_letters(buf):
"""
Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
... | [
"Returns",
"a",
"copy",
"of",
"buf",
"that",
"retains",
"only",
"the",
"sequences",
"of",
"English",
"alphabet",
"and",
"high",
"byte",
"characters",
"that",
"are",
"not",
"between",
"<",
">",
"characters",
".",
"Also",
"retains",
"English",
"alphabet",
"and... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/charsetprober.py#L104-L145 | [
"def",
"filter_with_english_letters",
"(",
"buf",
")",
":",
"filtered",
"=",
"bytearray",
"(",
")",
"in_tag",
"=",
"False",
"prev",
"=",
"0",
"for",
"curr",
"in",
"range",
"(",
"len",
"(",
"buf",
")",
")",
":",
"# Slice here to get bytes instead of an int with... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Flavour.join_parsed_parts | Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple. | pipenv/vendor/pathlib2/__init__.py | def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2):
"""
Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
"""
if root2:
if not drv2 and drv:
return drv, root2, [drv +... | def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2):
"""
Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
"""
if root2:
if not drv2 and drv:
return drv, root2, [drv +... | [
"Join",
"the",
"two",
"paths",
"represented",
"by",
"the",
"respective",
"(",
"drive",
"root",
"parts",
")",
"tuples",
".",
"Return",
"a",
"new",
"(",
"drive",
"root",
"parts",
")",
"tuple",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L239-L254 | [
"def",
"join_parsed_parts",
"(",
"self",
",",
"drv",
",",
"root",
",",
"parts",
",",
"drv2",
",",
"root2",
",",
"parts2",
")",
":",
"if",
"root2",
":",
"if",
"not",
"drv2",
"and",
"drv",
":",
"return",
"drv",
",",
"root2",
",",
"[",
"drv",
"+",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Selector.select_from | Iterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself. | pipenv/vendor/pathlib2/__init__.py | def select_from(self, parent_path):
"""Iterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself."""
path_cls = type(parent_path)
is_dir = path_cls.is_dir
exists = path_cls.exists
scandir = parent_path._accessor.scandir
... | def select_from(self, parent_path):
"""Iterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself."""
path_cls = type(parent_path)
is_dir = path_cls.is_dir
exists = path_cls.exists
scandir = parent_path._accessor.scandir
... | [
"Iterate",
"over",
"all",
"child",
"paths",
"of",
"parent_path",
"matched",
"by",
"this",
"selector",
".",
"This",
"can",
"contain",
"parent_path",
"itself",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L639-L648 | [
"def",
"select_from",
"(",
"self",
",",
"parent_path",
")",
":",
"path_cls",
"=",
"type",
"(",
"parent_path",
")",
"is_dir",
"=",
"path_cls",
".",
"is_dir",
"exists",
"=",
"path_cls",
".",
"exists",
"scandir",
"=",
"parent_path",
".",
"_accessor",
".",
"sc... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.as_posix | Return the string representation of the path with forward (/)
slashes. | pipenv/vendor/pathlib2/__init__.py | def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""
f = self._flavour
return str(self).replace(f.sep, '/') | def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""
f = self._flavour
return str(self).replace(f.sep, '/') | [
"Return",
"the",
"string",
"representation",
"of",
"the",
"path",
"with",
"forward",
"(",
"/",
")",
"slashes",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L896-L900 | [
"def",
"as_posix",
"(",
"self",
")",
":",
"f",
"=",
"self",
".",
"_flavour",
"return",
"str",
"(",
"self",
")",
".",
"replace",
"(",
"f",
".",
"sep",
",",
"'/'",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.name | The final path component, if any. | pipenv/vendor/pathlib2/__init__.py | def name(self):
"""The final path component, if any."""
parts = self._parts
if len(parts) == (1 if (self._drv or self._root) else 0):
return ''
return parts[-1] | def name(self):
"""The final path component, if any."""
parts = self._parts
if len(parts) == (1 if (self._drv or self._root) else 0):
return ''
return parts[-1] | [
"The",
"final",
"path",
"component",
"if",
"any",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L981-L986 | [
"def",
"name",
"(",
"self",
")",
":",
"parts",
"=",
"self",
".",
"_parts",
"if",
"len",
"(",
"parts",
")",
"==",
"(",
"1",
"if",
"(",
"self",
".",
"_drv",
"or",
"self",
".",
"_root",
")",
"else",
"0",
")",
":",
"return",
"''",
"return",
"parts"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.suffix | The final component's last suffix, if any. | pipenv/vendor/pathlib2/__init__.py | def suffix(self):
"""The final component's last suffix, if any."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[i:]
else:
return '' | def suffix(self):
"""The final component's last suffix, if any."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[i:]
else:
return '' | [
"The",
"final",
"component",
"s",
"last",
"suffix",
"if",
"any",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L989-L996 | [
"def",
"suffix",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"i",
"=",
"name",
".",
"rfind",
"(",
"'.'",
")",
"if",
"0",
"<",
"i",
"<",
"len",
"(",
"name",
")",
"-",
"1",
":",
"return",
"name",
"[",
"i",
":",
"]",
"else",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.suffixes | A list of the final component's suffixes, if any. | pipenv/vendor/pathlib2/__init__.py | def suffixes(self):
"""A list of the final component's suffixes, if any."""
name = self.name
if name.endswith('.'):
return []
name = name.lstrip('.')
return ['.' + suffix for suffix in name.split('.')[1:]] | def suffixes(self):
"""A list of the final component's suffixes, if any."""
name = self.name
if name.endswith('.'):
return []
name = name.lstrip('.')
return ['.' + suffix for suffix in name.split('.')[1:]] | [
"A",
"list",
"of",
"the",
"final",
"component",
"s",
"suffixes",
"if",
"any",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L999-L1005 | [
"def",
"suffixes",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"if",
"name",
".",
"endswith",
"(",
"'.'",
")",
":",
"return",
"[",
"]",
"name",
"=",
"name",
".",
"lstrip",
"(",
"'.'",
")",
"return",
"[",
"'.'",
"+",
"suffix",
"for",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.stem | The final path component, minus its last suffix. | pipenv/vendor/pathlib2/__init__.py | def stem(self):
"""The final path component, minus its last suffix."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[:i]
else:
return name | def stem(self):
"""The final path component, minus its last suffix."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[:i]
else:
return name | [
"The",
"final",
"path",
"component",
"minus",
"its",
"last",
"suffix",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1008-L1015 | [
"def",
"stem",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"i",
"=",
"name",
".",
"rfind",
"(",
"'.'",
")",
"if",
"0",
"<",
"i",
"<",
"len",
"(",
"name",
")",
"-",
"1",
":",
"return",
"name",
"[",
":",
"i",
"]",
"else",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.with_name | Return a new path with the file name changed. | pipenv/vendor/pathlib2/__init__.py | def with_name(self, name):
"""Return a new path with the file name changed."""
if not self.name:
raise ValueError("%r has an empty name" % (self,))
drv, root, parts = self._flavour.parse_parts((name,))
if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
... | def with_name(self, name):
"""Return a new path with the file name changed."""
if not self.name:
raise ValueError("%r has an empty name" % (self,))
drv, root, parts = self._flavour.parse_parts((name,))
if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
... | [
"Return",
"a",
"new",
"path",
"with",
"the",
"file",
"name",
"changed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1017-L1026 | [
"def",
"with_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"self",
".",
"name",
":",
"raise",
"ValueError",
"(",
"\"%r has an empty name\"",
"%",
"(",
"self",
",",
")",
")",
"drv",
",",
"root",
",",
"parts",
"=",
"self",
".",
"_flavour",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.with_suffix | Return a new path with the file suffix changed (or added, if
none). | pipenv/vendor/pathlib2/__init__.py | def with_suffix(self, suffix):
"""Return a new path with the file suffix changed (or added, if
none).
"""
# XXX if suffix is None, should the current suffix be removed?
f = self._flavour
if f.sep in suffix or f.altsep and f.altsep in suffix:
raise ValueError("... | def with_suffix(self, suffix):
"""Return a new path with the file suffix changed (or added, if
none).
"""
# XXX if suffix is None, should the current suffix be removed?
f = self._flavour
if f.sep in suffix or f.altsep and f.altsep in suffix:
raise ValueError("... | [
"Return",
"a",
"new",
"path",
"with",
"the",
"file",
"suffix",
"changed",
"(",
"or",
"added",
"if",
"none",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1028-L1047 | [
"def",
"with_suffix",
"(",
"self",
",",
"suffix",
")",
":",
"# XXX if suffix is None, should the current suffix be removed?",
"f",
"=",
"self",
".",
"_flavour",
"if",
"f",
".",
"sep",
"in",
"suffix",
"or",
"f",
".",
"altsep",
"and",
"f",
".",
"altsep",
"in",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.parts | An object providing sequence-like access to the
components in the filesystem path. | pipenv/vendor/pathlib2/__init__.py | def parts(self):
"""An object providing sequence-like access to the
components in the filesystem path."""
# We cache the tuple to avoid building a new one each time .parts
# is accessed. XXX is this necessary?
try:
return self._pparts
except AttributeError:
... | def parts(self):
"""An object providing sequence-like access to the
components in the filesystem path."""
# We cache the tuple to avoid building a new one each time .parts
# is accessed. XXX is this necessary?
try:
return self._pparts
except AttributeError:
... | [
"An",
"object",
"providing",
"sequence",
"-",
"like",
"access",
"to",
"the",
"components",
"in",
"the",
"filesystem",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1082-L1091 | [
"def",
"parts",
"(",
"self",
")",
":",
"# We cache the tuple to avoid building a new one each time .parts",
"# is accessed. XXX is this necessary?",
"try",
":",
"return",
"self",
".",
"_pparts",
"except",
"AttributeError",
":",
"self",
".",
"_pparts",
"=",
"tuple",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.parent | The logical parent of the path. | pipenv/vendor/pathlib2/__init__.py | def parent(self):
"""The logical parent of the path."""
drv = self._drv
root = self._root
parts = self._parts
if len(parts) == 1 and (drv or root):
return self
return self._from_parsed_parts(drv, root, parts[:-1]) | def parent(self):
"""The logical parent of the path."""
drv = self._drv
root = self._root
parts = self._parts
if len(parts) == 1 and (drv or root):
return self
return self._from_parsed_parts(drv, root, parts[:-1]) | [
"The",
"logical",
"parent",
"of",
"the",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1112-L1119 | [
"def",
"parent",
"(",
"self",
")",
":",
"drv",
"=",
"self",
".",
"_drv",
"root",
"=",
"self",
".",
"_root",
"parts",
"=",
"self",
".",
"_parts",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"and",
"(",
"drv",
"or",
"root",
")",
":",
"return",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.is_absolute | True if the path is absolute (has both a root and, if applicable,
a drive). | pipenv/vendor/pathlib2/__init__.py | def is_absolute(self):
"""True if the path is absolute (has both a root and, if applicable,
a drive)."""
if not self._root:
return False
return not self._flavour.has_drv or bool(self._drv) | def is_absolute(self):
"""True if the path is absolute (has both a root and, if applicable,
a drive)."""
if not self._root:
return False
return not self._flavour.has_drv or bool(self._drv) | [
"True",
"if",
"the",
"path",
"is",
"absolute",
"(",
"has",
"both",
"a",
"root",
"and",
"if",
"applicable",
"a",
"drive",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1126-L1131 | [
"def",
"is_absolute",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_root",
":",
"return",
"False",
"return",
"not",
"self",
".",
"_flavour",
".",
"has_drv",
"or",
"bool",
"(",
"self",
".",
"_drv",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PurePath.match | Return True if this path matches the given pattern. | pipenv/vendor/pathlib2/__init__.py | def match(self, path_pattern):
"""
Return True if this path matches the given pattern.
"""
cf = self._flavour.casefold
path_pattern = cf(path_pattern)
drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
if not pat_parts:
raise ValueError(... | def match(self, path_pattern):
"""
Return True if this path matches the given pattern.
"""
cf = self._flavour.casefold
path_pattern = cf(path_pattern)
drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
if not pat_parts:
raise ValueError(... | [
"Return",
"True",
"if",
"this",
"path",
"matches",
"the",
"given",
"pattern",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1138-L1161 | [
"def",
"match",
"(",
"self",
",",
"path_pattern",
")",
":",
"cf",
"=",
"self",
".",
"_flavour",
".",
"casefold",
"path_pattern",
"=",
"cf",
"(",
"path_pattern",
")",
"drv",
",",
"root",
",",
"pat_parts",
"=",
"self",
".",
"_flavour",
".",
"parse_parts",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path._raw_open | Open the file pointed by this path and return a file descriptor,
as os.open() does. | pipenv/vendor/pathlib2/__init__.py | def _raw_open(self, flags, mode=0o777):
"""
Open the file pointed by this path and return a file descriptor,
as os.open() does.
"""
if self._closed:
self._raise_closed()
return self._accessor.open(self, flags, mode) | def _raw_open(self, flags, mode=0o777):
"""
Open the file pointed by this path and return a file descriptor,
as os.open() does.
"""
if self._closed:
self._raise_closed()
return self._accessor.open(self, flags, mode) | [
"Open",
"the",
"file",
"pointed",
"by",
"this",
"path",
"and",
"return",
"a",
"file",
"descriptor",
"as",
"os",
".",
"open",
"()",
"does",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1230-L1237 | [
"def",
"_raw_open",
"(",
"self",
",",
"flags",
",",
"mode",
"=",
"0o777",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"return",
"self",
".",
"_accessor",
".",
"open",
"(",
"self",
",",
"flags",
",",
"mode",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.samefile | Return whether other_path is the same or not as this file
(as returned by os.path.samefile()). | pipenv/vendor/pathlib2/__init__.py | def samefile(self, other_path):
"""Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
"""
if hasattr(os.path, "samestat"):
st = self.stat()
try:
other_st = other_path.stat()
except AttributeEr... | def samefile(self, other_path):
"""Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
"""
if hasattr(os.path, "samestat"):
st = self.stat()
try:
other_st = other_path.stat()
except AttributeEr... | [
"Return",
"whether",
"other_path",
"is",
"the",
"same",
"or",
"not",
"as",
"this",
"file",
"(",
"as",
"returned",
"by",
"os",
".",
"path",
".",
"samefile",
"()",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1255-L1271 | [
"def",
"samefile",
"(",
"self",
",",
"other_path",
")",
":",
"if",
"hasattr",
"(",
"os",
".",
"path",
",",
"\"samestat\"",
")",
":",
"st",
"=",
"self",
".",
"stat",
"(",
")",
"try",
":",
"other_st",
"=",
"other_path",
".",
"stat",
"(",
")",
"except... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.iterdir | Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'. | pipenv/vendor/pathlib2/__init__.py | def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
if self._closed:
self._raise_closed()
for name in self._accessor.listdir(self):
if name in ('.', '..'):
# Yie... | def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
if self._closed:
self._raise_closed()
for name in self._accessor.listdir(self):
if name in ('.', '..'):
# Yie... | [
"Iterate",
"over",
"the",
"files",
"in",
"this",
"directory",
".",
"Does",
"not",
"yield",
"any",
"result",
"for",
"the",
"special",
"paths",
".",
"and",
"..",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1273-L1285 | [
"def",
"iterdir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"for",
"name",
"in",
"self",
".",
"_accessor",
".",
"listdir",
"(",
"self",
")",
":",
"if",
"name",
"in",
"(",
"'.'",
",",
"'..'",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.touch | Create this file with the given access mode, if it doesn't exist. | pipenv/vendor/pathlib2/__init__.py | def touch(self, mode=0o666, exist_ok=True):
"""
Create this file with the given access mode, if it doesn't exist.
"""
if self._closed:
self._raise_closed()
if exist_ok:
# First try to bump modification time
# Implementation note: GNU touch uses... | def touch(self, mode=0o666, exist_ok=True):
"""
Create this file with the given access mode, if it doesn't exist.
"""
if self._closed:
self._raise_closed()
if exist_ok:
# First try to bump modification time
# Implementation note: GNU touch uses... | [
"Create",
"this",
"file",
"with",
"the",
"given",
"access",
"mode",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1424-L1445 | [
"def",
"touch",
"(",
"self",
",",
"mode",
"=",
"0o666",
",",
"exist_ok",
"=",
"True",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"if",
"exist_ok",
":",
"# First try to bump modification time",
"# Implementation note: G... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.mkdir | Create a new directory at this given path. | pipenv/vendor/pathlib2/__init__.py | def mkdir(self, mode=0o777, parents=False, exist_ok=False):
"""
Create a new directory at this given path.
"""
if self._closed:
self._raise_closed()
def _try_func():
self._accessor.mkdir(self, mode)
def _exc_func(exc):
if not parents ... | def mkdir(self, mode=0o777, parents=False, exist_ok=False):
"""
Create a new directory at this given path.
"""
if self._closed:
self._raise_closed()
def _try_func():
self._accessor.mkdir(self, mode)
def _exc_func(exc):
if not parents ... | [
"Create",
"a",
"new",
"directory",
"at",
"this",
"given",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1447-L1467 | [
"def",
"mkdir",
"(",
"self",
",",
"mode",
"=",
"0o777",
",",
"parents",
"=",
"False",
",",
"exist_ok",
"=",
"False",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"def",
"_try_func",
"(",
")",
":",
"self",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.chmod | Change the permissions of the path, like os.chmod(). | pipenv/vendor/pathlib2/__init__.py | def chmod(self, mode):
"""
Change the permissions of the path, like os.chmod().
"""
if self._closed:
self._raise_closed()
self._accessor.chmod(self, mode) | def chmod(self, mode):
"""
Change the permissions of the path, like os.chmod().
"""
if self._closed:
self._raise_closed()
self._accessor.chmod(self, mode) | [
"Change",
"the",
"permissions",
"of",
"the",
"path",
"like",
"os",
".",
"chmod",
"()",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1469-L1475 | [
"def",
"chmod",
"(",
"self",
",",
"mode",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"chmod",
"(",
"self",
",",
"mode",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.lchmod | Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's. | pipenv/vendor/pathlib2/__init__.py | def lchmod(self, mode):
"""
Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's.
"""
if self._closed:
self._raise_closed()
self._accessor.lchmod(self, mode) | def lchmod(self, mode):
"""
Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's.
"""
if self._closed:
self._raise_closed()
self._accessor.lchmod(self, mode) | [
"Like",
"chmod",
"()",
"except",
"if",
"the",
"path",
"points",
"to",
"a",
"symlink",
"the",
"symlink",
"s",
"permissions",
"are",
"changed",
"rather",
"than",
"its",
"target",
"s",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1477-L1484 | [
"def",
"lchmod",
"(",
"self",
",",
"mode",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"lchmod",
"(",
"self",
",",
"mode",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.unlink | Remove this file or link.
If the path is a directory, use rmdir() instead. | pipenv/vendor/pathlib2/__init__.py | def unlink(self):
"""
Remove this file or link.
If the path is a directory, use rmdir() instead.
"""
if self._closed:
self._raise_closed()
self._accessor.unlink(self) | def unlink(self):
"""
Remove this file or link.
If the path is a directory, use rmdir() instead.
"""
if self._closed:
self._raise_closed()
self._accessor.unlink(self) | [
"Remove",
"this",
"file",
"or",
"link",
".",
"If",
"the",
"path",
"is",
"a",
"directory",
"use",
"rmdir",
"()",
"instead",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1486-L1493 | [
"def",
"unlink",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"unlink",
"(",
"self",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.rmdir | Remove this directory. The directory must be empty. | pipenv/vendor/pathlib2/__init__.py | def rmdir(self):
"""
Remove this directory. The directory must be empty.
"""
if self._closed:
self._raise_closed()
self._accessor.rmdir(self) | def rmdir(self):
"""
Remove this directory. The directory must be empty.
"""
if self._closed:
self._raise_closed()
self._accessor.rmdir(self) | [
"Remove",
"this",
"directory",
".",
"The",
"directory",
"must",
"be",
"empty",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1495-L1501 | [
"def",
"rmdir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"rmdir",
"(",
"self",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.lstat | Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's. | pipenv/vendor/pathlib2/__init__.py | def lstat(self):
"""
Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's.
"""
if self._closed:
self._raise_closed()
return self._accessor.lstat(self) | def lstat(self):
"""
Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's.
"""
if self._closed:
self._raise_closed()
return self._accessor.lstat(self) | [
"Like",
"stat",
"()",
"except",
"if",
"the",
"path",
"points",
"to",
"a",
"symlink",
"the",
"symlink",
"s",
"status",
"information",
"is",
"returned",
"rather",
"than",
"its",
"target",
"s",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1503-L1510 | [
"def",
"lstat",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"return",
"self",
".",
"_accessor",
".",
"lstat",
"(",
"self",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.rename | Rename this path to the given path. | pipenv/vendor/pathlib2/__init__.py | def rename(self, target):
"""
Rename this path to the given path.
"""
if self._closed:
self._raise_closed()
self._accessor.rename(self, target) | def rename(self, target):
"""
Rename this path to the given path.
"""
if self._closed:
self._raise_closed()
self._accessor.rename(self, target) | [
"Rename",
"this",
"path",
"to",
"the",
"given",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1512-L1518 | [
"def",
"rename",
"(",
"self",
",",
"target",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"rename",
"(",
"self",
",",
"target",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.replace | Rename this path to the given path, clobbering the existing
destination if it exists. | pipenv/vendor/pathlib2/__init__.py | def replace(self, target):
"""
Rename this path to the given path, clobbering the existing
destination if it exists.
"""
if sys.version_info < (3, 3):
raise NotImplementedError("replace() is only available "
"with Python 3.3 and l... | def replace(self, target):
"""
Rename this path to the given path, clobbering the existing
destination if it exists.
"""
if sys.version_info < (3, 3):
raise NotImplementedError("replace() is only available "
"with Python 3.3 and l... | [
"Rename",
"this",
"path",
"to",
"the",
"given",
"path",
"clobbering",
"the",
"existing",
"destination",
"if",
"it",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1520-L1530 | [
"def",
"replace",
"(",
"self",
",",
"target",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"3",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"replace() is only available \"",
"\"with Python 3.3 and later\"",
")",
"if",
"self",
".",
"_clo... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.symlink_to | Make this path a symlink pointing to the given path.
Note the order of arguments (self, target) is the reverse of
os.symlink's. | pipenv/vendor/pathlib2/__init__.py | def symlink_to(self, target, target_is_directory=False):
"""
Make this path a symlink pointing to the given path.
Note the order of arguments (self, target) is the reverse of
os.symlink's.
"""
if self._closed:
self._raise_closed()
self._accessor.symlin... | def symlink_to(self, target, target_is_directory=False):
"""
Make this path a symlink pointing to the given path.
Note the order of arguments (self, target) is the reverse of
os.symlink's.
"""
if self._closed:
self._raise_closed()
self._accessor.symlin... | [
"Make",
"this",
"path",
"a",
"symlink",
"pointing",
"to",
"the",
"given",
"path",
".",
"Note",
"the",
"order",
"of",
"arguments",
"(",
"self",
"target",
")",
"is",
"the",
"reverse",
"of",
"os",
".",
"symlink",
"s",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1532-L1540 | [
"def",
"symlink_to",
"(",
"self",
",",
"target",
",",
"target_is_directory",
"=",
"False",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"symlink",
"(",
"target",
",",
"self",
",",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.exists | Whether this path exists. | pipenv/vendor/pathlib2/__init__.py | def exists(self):
"""
Whether this path exists.
"""
try:
self.stat()
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
return False
return True | def exists(self):
"""
Whether this path exists.
"""
try:
self.stat()
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
return False
return True | [
"Whether",
"this",
"path",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1544-L1554 | [
"def",
"exists",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"stat",
"(",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"not",
"in",
"(",
"ENOENT",
",",
"ENOTDIR",
")",
":",
"raise",
"return",
"False",
"return",
"True"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.is_dir | Whether this path is a directory. | pipenv/vendor/pathlib2/__init__.py | def is_dir(self):
"""
Whether this path is a directory.
"""
try:
return S_ISDIR(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
# Path doesn't exist or is a broken symlink
# (see ... | def is_dir(self):
"""
Whether this path is a directory.
"""
try:
return S_ISDIR(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
# Path doesn't exist or is a broken symlink
# (see ... | [
"Whether",
"this",
"path",
"is",
"a",
"directory",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1556-L1567 | [
"def",
"is_dir",
"(",
"self",
")",
":",
"try",
":",
"return",
"S_ISDIR",
"(",
"self",
".",
"stat",
"(",
")",
".",
"st_mode",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"not",
"in",
"(",
"ENOENT",
",",
"ENOTDIR",
")",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.is_file | Whether this path is a regular file (also True for symlinks pointing
to regular files). | pipenv/vendor/pathlib2/__init__.py | def is_file(self):
"""
Whether this path is a regular file (also True for symlinks pointing
to regular files).
"""
try:
return S_ISREG(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
... | def is_file(self):
"""
Whether this path is a regular file (also True for symlinks pointing
to regular files).
"""
try:
return S_ISREG(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
... | [
"Whether",
"this",
"path",
"is",
"a",
"regular",
"file",
"(",
"also",
"True",
"for",
"symlinks",
"pointing",
"to",
"regular",
"files",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1569-L1581 | [
"def",
"is_file",
"(",
"self",
")",
":",
"try",
":",
"return",
"S_ISREG",
"(",
"self",
".",
"stat",
"(",
")",
".",
"st_mode",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"not",
"in",
"(",
"ENOENT",
",",
"ENOTDIR",
")",
":",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.is_fifo | Whether this path is a FIFO. | pipenv/vendor/pathlib2/__init__.py | def is_fifo(self):
"""
Whether this path is a FIFO.
"""
try:
return S_ISFIFO(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
# Path doesn't exist or is a broken symlink
# (see htt... | def is_fifo(self):
"""
Whether this path is a FIFO.
"""
try:
return S_ISFIFO(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
# Path doesn't exist or is a broken symlink
# (see htt... | [
"Whether",
"this",
"path",
"is",
"a",
"FIFO",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1621-L1632 | [
"def",
"is_fifo",
"(",
"self",
")",
":",
"try",
":",
"return",
"S_ISFIFO",
"(",
"self",
".",
"stat",
"(",
")",
".",
"st_mode",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"not",
"in",
"(",
"ENOENT",
",",
"ENOTDIR",
")",
":"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.is_socket | Whether this path is a socket. | pipenv/vendor/pathlib2/__init__.py | def is_socket(self):
"""
Whether this path is a socket.
"""
try:
return S_ISSOCK(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
# Path doesn't exist or is a broken symlink
# (see... | def is_socket(self):
"""
Whether this path is a socket.
"""
try:
return S_ISSOCK(self.stat().st_mode)
except OSError as e:
if e.errno not in (ENOENT, ENOTDIR):
raise
# Path doesn't exist or is a broken symlink
# (see... | [
"Whether",
"this",
"path",
"is",
"a",
"socket",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1634-L1645 | [
"def",
"is_socket",
"(",
"self",
")",
":",
"try",
":",
"return",
"S_ISSOCK",
"(",
"self",
".",
"stat",
"(",
")",
".",
"st_mode",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"not",
"in",
"(",
"ENOENT",
",",
"ENOTDIR",
")",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Path.expanduser | Return a new path with expanded ~ and ~user constructs
(as returned by os.path.expanduser) | pipenv/vendor/pathlib2/__init__.py | def expanduser(self):
""" Return a new path with expanded ~ and ~user constructs
(as returned by os.path.expanduser)
"""
if (not (self._drv or self._root)
and self._parts and self._parts[0][:1] == '~'):
homedir = self._flavour.gethomedir(self._parts[0][1:])
... | def expanduser(self):
""" Return a new path with expanded ~ and ~user constructs
(as returned by os.path.expanduser)
"""
if (not (self._drv or self._root)
and self._parts and self._parts[0][:1] == '~'):
homedir = self._flavour.gethomedir(self._parts[0][1:])
... | [
"Return",
"a",
"new",
"path",
"with",
"expanded",
"~",
"and",
"~user",
"constructs",
"(",
"as",
"returned",
"by",
"os",
".",
"path",
".",
"expanduser",
")"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1647-L1656 | [
"def",
"expanduser",
"(",
"self",
")",
":",
"if",
"(",
"not",
"(",
"self",
".",
"_drv",
"or",
"self",
".",
"_root",
")",
"and",
"self",
".",
"_parts",
"and",
"self",
".",
"_parts",
"[",
"0",
"]",
"[",
":",
"1",
"]",
"==",
"'~'",
")",
":",
"ho... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | lookupEncoding | Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding. | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def lookupEncoding(encoding):
"""Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding."""
if isinstance(encoding, binary_type):
try:
encoding = encoding.decode("ascii")
except UnicodeDecodeError:
return... | def lookupEncoding(encoding):
"""Return the python codec name corresponding to an encoding or None if the
string doesn't correspond to a valid encoding."""
if isinstance(encoding, binary_type):
try:
encoding = encoding.decode("ascii")
except UnicodeDecodeError:
return... | [
"Return",
"the",
"python",
"codec",
"name",
"corresponding",
"to",
"an",
"encoding",
"or",
"None",
"if",
"the",
"string",
"doesn",
"t",
"correspond",
"to",
"a",
"valid",
"encoding",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L908-L923 | [
"def",
"lookupEncoding",
"(",
"encoding",
")",
":",
"if",
"isinstance",
"(",
"encoding",
",",
"binary_type",
")",
":",
"try",
":",
"encoding",
"=",
"encoding",
".",
"decode",
"(",
"\"ascii\"",
")",
"except",
"UnicodeDecodeError",
":",
"return",
"None",
"if",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLUnicodeInputStream.openStream | Produces a file object from source.
source can be either a file object, local filename or a string. | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = StringIO(source)
... | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = StringIO(source)
... | [
"Produces",
"a",
"file",
"object",
"from",
"source",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L210-L222 | [
"def",
"openStream",
"(",
"self",
",",
"source",
")",
":",
"# Already a file object",
"if",
"hasattr",
"(",
"source",
",",
"'read'",
")",
":",
"stream",
"=",
"source",
"else",
":",
"stream",
"=",
"StringIO",
"(",
"source",
")",
"return",
"stream"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLUnicodeInputStream.position | Returns (line, col) of the current position in the stream. | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def position(self):
"""Returns (line, col) of the current position in the stream."""
line, col = self._position(self.chunkOffset)
return (line + 1, col) | def position(self):
"""Returns (line, col) of the current position in the stream."""
line, col = self._position(self.chunkOffset)
return (line + 1, col) | [
"Returns",
"(",
"line",
"col",
")",
"of",
"the",
"current",
"position",
"in",
"the",
"stream",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L235-L238 | [
"def",
"position",
"(",
"self",
")",
":",
"line",
",",
"col",
"=",
"self",
".",
"_position",
"(",
"self",
".",
"chunkOffset",
")",
"return",
"(",
"line",
"+",
"1",
",",
"col",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLUnicodeInputStream.char | Read one character from the stream or queue if available. Return
EOF when EOF is reached. | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def char(self):
""" Read one character from the stream or queue if available. Return
EOF when EOF is reached.
"""
# Read a new chunk from the input stream if necessary
if self.chunkOffset >= self.chunkSize:
if not self.readChunk():
return EOF
... | def char(self):
""" Read one character from the stream or queue if available. Return
EOF when EOF is reached.
"""
# Read a new chunk from the input stream if necessary
if self.chunkOffset >= self.chunkSize:
if not self.readChunk():
return EOF
... | [
"Read",
"one",
"character",
"from",
"the",
"stream",
"or",
"queue",
"if",
"available",
".",
"Return",
"EOF",
"when",
"EOF",
"is",
"reached",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L240-L253 | [
"def",
"char",
"(",
"self",
")",
":",
"# Read a new chunk from the input stream if necessary",
"if",
"self",
".",
"chunkOffset",
">=",
"self",
".",
"chunkSize",
":",
"if",
"not",
"self",
".",
"readChunk",
"(",
")",
":",
"return",
"EOF",
"chunkOffset",
"=",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLUnicodeInputStream.charsUntil | Returns a string of characters from the stream up to but not
including any character in 'characters' or EOF. 'characters' must be
a container that supports the 'in' method and iteration over its
characters. | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def charsUntil(self, characters, opposite=False):
""" Returns a string of characters from the stream up to but not
including any character in 'characters' or EOF. 'characters' must be
a container that supports the 'in' method and iteration over its
characters.
"""
# Use ... | def charsUntil(self, characters, opposite=False):
""" Returns a string of characters from the stream up to but not
including any character in 'characters' or EOF. 'characters' must be
a container that supports the 'in' method and iteration over its
characters.
"""
# Use ... | [
"Returns",
"a",
"string",
"of",
"characters",
"from",
"the",
"stream",
"up",
"to",
"but",
"not",
"including",
"any",
"character",
"in",
"characters",
"or",
"EOF",
".",
"characters",
"must",
"be",
"a",
"container",
"that",
"supports",
"the",
"in",
"method",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L320-L365 | [
"def",
"charsUntil",
"(",
"self",
",",
"characters",
",",
"opposite",
"=",
"False",
")",
":",
"# Use a cache of regexps to find the required characters",
"try",
":",
"chars",
"=",
"charsUntilRegEx",
"[",
"(",
"characters",
",",
"opposite",
")",
"]",
"except",
"Key... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLBinaryInputStream.openStream | Produces a file object from source.
source can be either a file object, local filename or a string. | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = BytesIO(source)
t... | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = BytesIO(source)
t... | [
"Produces",
"a",
"file",
"object",
"from",
"source",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L438-L455 | [
"def",
"openStream",
"(",
"self",
",",
"source",
")",
":",
"# Already a file object",
"if",
"hasattr",
"(",
"source",
",",
"'read'",
")",
":",
"stream",
"=",
"source",
"else",
":",
"stream",
"=",
"BytesIO",
"(",
"source",
")",
"try",
":",
"stream",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLBinaryInputStream.detectEncodingMeta | Report the encoding declared by the meta element | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def detectEncodingMeta(self):
"""Report the encoding declared by the meta element
"""
buffer = self.rawStream.read(self.numBytesMeta)
assert isinstance(buffer, bytes)
parser = EncodingParser(buffer)
self.rawStream.seek(0)
encoding = parser.getEncoding()
i... | def detectEncodingMeta(self):
"""Report the encoding declared by the meta element
"""
buffer = self.rawStream.read(self.numBytesMeta)
assert isinstance(buffer, bytes)
parser = EncodingParser(buffer)
self.rawStream.seek(0)
encoding = parser.getEncoding()
i... | [
"Report",
"the",
"encoding",
"declared",
"by",
"the",
"meta",
"element"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L569-L581 | [
"def",
"detectEncodingMeta",
"(",
"self",
")",
":",
"buffer",
"=",
"self",
".",
"rawStream",
".",
"read",
"(",
"self",
".",
"numBytesMeta",
")",
"assert",
"isinstance",
"(",
"buffer",
",",
"bytes",
")",
"parser",
"=",
"EncodingParser",
"(",
"buffer",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EncodingBytes.skip | Skip past a list of characters | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def skip(self, chars=spaceCharactersBytes):
"""Skip past a list of characters"""
p = self.position # use property for the error-checking
while p < len(self):
c = self[p:p + 1]
if c not in chars:
self._position = p
return c
... | def skip(self, chars=spaceCharactersBytes):
"""Skip past a list of characters"""
p = self.position # use property for the error-checking
while p < len(self):
c = self[p:p + 1]
if c not in chars:
self._position = p
return c
... | [
"Skip",
"past",
"a",
"list",
"of",
"characters"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L640-L650 | [
"def",
"skip",
"(",
"self",
",",
"chars",
"=",
"spaceCharactersBytes",
")",
":",
"p",
"=",
"self",
".",
"position",
"# use property for the error-checking",
"while",
"p",
"<",
"len",
"(",
"self",
")",
":",
"c",
"=",
"self",
"[",
"p",
":",
"p",
"+",
"1"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EncodingBytes.matchBytes | Look for a sequence of bytes at the start of a string. If the bytes
are found return True and advance the position to the byte after the
match. Otherwise return False and leave the position alone | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def matchBytes(self, bytes):
"""Look for a sequence of bytes at the start of a string. If the bytes
are found return True and advance the position to the byte after the
match. Otherwise return False and leave the position alone"""
p = self.position
data = self[p:p + len(bytes)]
... | def matchBytes(self, bytes):
"""Look for a sequence of bytes at the start of a string. If the bytes
are found return True and advance the position to the byte after the
match. Otherwise return False and leave the position alone"""
p = self.position
data = self[p:p + len(bytes)]
... | [
"Look",
"for",
"a",
"sequence",
"of",
"bytes",
"at",
"the",
"start",
"of",
"a",
"string",
".",
"If",
"the",
"bytes",
"are",
"found",
"return",
"True",
"and",
"advance",
"the",
"position",
"to",
"the",
"byte",
"after",
"the",
"match",
".",
"Otherwise",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L663-L672 | [
"def",
"matchBytes",
"(",
"self",
",",
"bytes",
")",
":",
"p",
"=",
"self",
".",
"position",
"data",
"=",
"self",
"[",
"p",
":",
"p",
"+",
"len",
"(",
"bytes",
")",
"]",
"rv",
"=",
"data",
".",
"startswith",
"(",
"bytes",
")",
"if",
"rv",
":",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EncodingBytes.jumpTo | Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def jumpTo(self, bytes):
"""Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match"""
newPosition = self[self.position:].find(bytes)
if newPosition > -1:
# XXX: This is ugly, but I can't see a nice... | def jumpTo(self, bytes):
"""Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match"""
newPosition = self[self.position:].find(bytes)
if newPosition > -1:
# XXX: This is ugly, but I can't see a nice... | [
"Look",
"for",
"the",
"next",
"sequence",
"of",
"bytes",
"matching",
"a",
"given",
"sequence",
".",
"If",
"a",
"match",
"is",
"found",
"advance",
"the",
"position",
"to",
"the",
"last",
"byte",
"of",
"the",
"match"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L674-L685 | [
"def",
"jumpTo",
"(",
"self",
",",
"bytes",
")",
":",
"newPosition",
"=",
"self",
"[",
"self",
".",
"position",
":",
"]",
".",
"find",
"(",
"bytes",
")",
"if",
"newPosition",
">",
"-",
"1",
":",
"# XXX: This is ugly, but I can't see a nicer way to fix this.",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EncodingParser.getAttribute | Return a name,value pair for the next attribute in the stream,
if one is found, or None | pipenv/patched/notpip/_vendor/html5lib/_inputstream.py | def getAttribute(self):
"""Return a name,value pair for the next attribute in the stream,
if one is found, or None"""
data = self.data
# Step 1 (skip chars)
c = data.skip(spaceCharactersBytes | frozenset([b"/"]))
assert c is None or len(c) == 1
# Step 2
if... | def getAttribute(self):
"""Return a name,value pair for the next attribute in the stream,
if one is found, or None"""
data = self.data
# Step 1 (skip chars)
c = data.skip(spaceCharactersBytes | frozenset([b"/"]))
assert c is None or len(c) == 1
# Step 2
if... | [
"Return",
"a",
"name",
"value",
"pair",
"for",
"the",
"next",
"attribute",
"in",
"the",
"stream",
"if",
"one",
"is",
"found",
"or",
"None"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_inputstream.py#L792-L866 | [
"def",
"getAttribute",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"data",
"# Step 1 (skip chars)",
"c",
"=",
"data",
".",
"skip",
"(",
"spaceCharactersBytes",
"|",
"frozenset",
"(",
"[",
"b\"/\"",
"]",
")",
")",
"assert",
"c",
"is",
"None",
"or",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _build_backend | Find and load the build backend | pipenv/vendor/pep517/_in_process.py | def _build_backend():
"""Find and load the build backend"""
ep = os.environ['PEP517_BUILD_BACKEND']
mod_path, _, obj_path = ep.partition(':')
try:
obj = import_module(mod_path)
except ImportError:
raise BackendUnavailable
if obj_path:
for path_part in obj_path.split('.'):... | def _build_backend():
"""Find and load the build backend"""
ep = os.environ['PEP517_BUILD_BACKEND']
mod_path, _, obj_path = ep.partition(':')
try:
obj = import_module(mod_path)
except ImportError:
raise BackendUnavailable
if obj_path:
for path_part in obj_path.split('.'):... | [
"Find",
"and",
"load",
"the",
"build",
"backend"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L29-L40 | [
"def",
"_build_backend",
"(",
")",
":",
"ep",
"=",
"os",
".",
"environ",
"[",
"'PEP517_BUILD_BACKEND'",
"]",
"mod_path",
",",
"_",
",",
"obj_path",
"=",
"ep",
".",
"partition",
"(",
"':'",
")",
"try",
":",
"obj",
"=",
"import_module",
"(",
"mod_path",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_requires_for_build_wheel | Invoke the optional get_requires_for_build_wheel hook
Returns [] if the hook is not defined. | pipenv/vendor/pep517/_in_process.py | def get_requires_for_build_wheel(config_settings):
"""Invoke the optional get_requires_for_build_wheel hook
Returns [] if the hook is not defined.
"""
backend = _build_backend()
try:
hook = backend.get_requires_for_build_wheel
except AttributeError:
return []
else:
r... | def get_requires_for_build_wheel(config_settings):
"""Invoke the optional get_requires_for_build_wheel hook
Returns [] if the hook is not defined.
"""
backend = _build_backend()
try:
hook = backend.get_requires_for_build_wheel
except AttributeError:
return []
else:
r... | [
"Invoke",
"the",
"optional",
"get_requires_for_build_wheel",
"hook"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L43-L54 | [
"def",
"get_requires_for_build_wheel",
"(",
"config_settings",
")",
":",
"backend",
"=",
"_build_backend",
"(",
")",
"try",
":",
"hook",
"=",
"backend",
".",
"get_requires_for_build_wheel",
"except",
"AttributeError",
":",
"return",
"[",
"]",
"else",
":",
"return"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | prepare_metadata_for_build_wheel | Invoke optional prepare_metadata_for_build_wheel
Implements a fallback by building a wheel if the hook isn't defined. | pipenv/vendor/pep517/_in_process.py | def prepare_metadata_for_build_wheel(metadata_directory, config_settings):
"""Invoke optional prepare_metadata_for_build_wheel
Implements a fallback by building a wheel if the hook isn't defined.
"""
backend = _build_backend()
try:
hook = backend.prepare_metadata_for_build_wheel
except ... | def prepare_metadata_for_build_wheel(metadata_directory, config_settings):
"""Invoke optional prepare_metadata_for_build_wheel
Implements a fallback by building a wheel if the hook isn't defined.
"""
backend = _build_backend()
try:
hook = backend.prepare_metadata_for_build_wheel
except ... | [
"Invoke",
"optional",
"prepare_metadata_for_build_wheel"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L57-L69 | [
"def",
"prepare_metadata_for_build_wheel",
"(",
"metadata_directory",
",",
"config_settings",
")",
":",
"backend",
"=",
"_build_backend",
"(",
")",
"try",
":",
"hook",
"=",
"backend",
".",
"prepare_metadata_for_build_wheel",
"except",
"AttributeError",
":",
"return",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _dist_info_files | Identify the .dist-info folder inside a wheel ZipFile. | pipenv/vendor/pep517/_in_process.py | def _dist_info_files(whl_zip):
"""Identify the .dist-info folder inside a wheel ZipFile."""
res = []
for path in whl_zip.namelist():
m = re.match(r'[^/\\]+-[^/\\]+\.dist-info/', path)
if m:
res.append(path)
if res:
return res
raise Exception("No .dist-info folder ... | def _dist_info_files(whl_zip):
"""Identify the .dist-info folder inside a wheel ZipFile."""
res = []
for path in whl_zip.namelist():
m = re.match(r'[^/\\]+-[^/\\]+\.dist-info/', path)
if m:
res.append(path)
if res:
return res
raise Exception("No .dist-info folder ... | [
"Identify",
"the",
".",
"dist",
"-",
"info",
"folder",
"inside",
"a",
"wheel",
"ZipFile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/_in_process.py#L75-L84 | [
"def",
"_dist_info_files",
"(",
"whl_zip",
")",
":",
"res",
"=",
"[",
"]",
"for",
"path",
"in",
"whl_zip",
".",
"namelist",
"(",
")",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r'[^/\\\\]+-[^/\\\\]+\\.dist-info/'",
",",
"path",
")",
"if",
"m",
":",
"res"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.