id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,800 | pypa/pipenv | pipenv/patched/notpip/_internal/commands/show.py | print_results | def print_results(distributions, list_files=False, verbose=False):
"""
Print the informations from installed distributions found.
"""
results_printed = False
for i, dist in enumerate(distributions):
results_printed = True
if i > 0:
logger.info("---")
name = dist.... | python | def print_results(distributions, list_files=False, verbose=False):
"""
Print the informations from installed distributions found.
"""
results_printed = False
for i, dist in enumerate(distributions):
results_printed = True
if i > 0:
logger.info("---")
name = dist.... | [
"def",
"print_results",
"(",
"distributions",
",",
"list_files",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"results_printed",
"=",
"False",
"for",
"i",
",",
"dist",
"in",
"enumerate",
"(",
"distributions",
")",
":",
"results_printed",
"=",
"True"... | Print the informations from installed distributions found. | [
"Print",
"the",
"informations",
"from",
"installed",
"distributions",
"found",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/show.py#L125-L168 |
24,801 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.fail | def fail(self, msg, lineno=None, exc=TemplateSyntaxError):
"""Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename.
"""
if lineno is None:
lineno = self.stream.current.lineno
rai... | python | def fail(self, msg, lineno=None, exc=TemplateSyntaxError):
"""Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename.
"""
if lineno is None:
lineno = self.stream.current.lineno
rai... | [
"def",
"fail",
"(",
"self",
",",
"msg",
",",
"lineno",
"=",
"None",
",",
"exc",
"=",
"TemplateSyntaxError",
")",
":",
"if",
"lineno",
"is",
"None",
":",
"lineno",
"=",
"self",
".",
"stream",
".",
"current",
".",
"lineno",
"raise",
"exc",
"(",
"msg",
... | Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename. | [
"Convenience",
"method",
"that",
"raises",
"exc",
"with",
"the",
"message",
"passed",
"line",
"number",
"or",
"last",
"line",
"number",
"as",
"well",
"as",
"the",
"current",
"name",
"and",
"filename",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L52-L59 |
24,802 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.fail_unknown_tag | def fail_unknown_tag(self, name, lineno=None):
"""Called if the parser encounters an unknown tag. Tries to fail
with a human readable error message that could help to identify
the problem.
"""
return self._fail_ut_eof(name, self._end_token_stack, lineno) | python | def fail_unknown_tag(self, name, lineno=None):
"""Called if the parser encounters an unknown tag. Tries to fail
with a human readable error message that could help to identify
the problem.
"""
return self._fail_ut_eof(name, self._end_token_stack, lineno) | [
"def",
"fail_unknown_tag",
"(",
"self",
",",
"name",
",",
"lineno",
"=",
"None",
")",
":",
"return",
"self",
".",
"_fail_ut_eof",
"(",
"name",
",",
"self",
".",
"_end_token_stack",
",",
"lineno",
")"
] | Called if the parser encounters an unknown tag. Tries to fail
with a human readable error message that could help to identify
the problem. | [
"Called",
"if",
"the",
"parser",
"encounters",
"an",
"unknown",
"tag",
".",
"Tries",
"to",
"fail",
"with",
"a",
"human",
"readable",
"error",
"message",
"that",
"could",
"help",
"to",
"identify",
"the",
"problem",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L92-L97 |
24,803 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.fail_eof | def fail_eof(self, end_tokens=None, lineno=None):
"""Like fail_unknown_tag but for end of template situations."""
stack = list(self._end_token_stack)
if end_tokens is not None:
stack.append(end_tokens)
return self._fail_ut_eof(None, stack, lineno) | python | def fail_eof(self, end_tokens=None, lineno=None):
"""Like fail_unknown_tag but for end of template situations."""
stack = list(self._end_token_stack)
if end_tokens is not None:
stack.append(end_tokens)
return self._fail_ut_eof(None, stack, lineno) | [
"def",
"fail_eof",
"(",
"self",
",",
"end_tokens",
"=",
"None",
",",
"lineno",
"=",
"None",
")",
":",
"stack",
"=",
"list",
"(",
"self",
".",
"_end_token_stack",
")",
"if",
"end_tokens",
"is",
"not",
"None",
":",
"stack",
".",
"append",
"(",
"end_token... | Like fail_unknown_tag but for end of template situations. | [
"Like",
"fail_unknown_tag",
"but",
"for",
"end",
"of",
"template",
"situations",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L99-L104 |
24,804 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.is_tuple_end | def is_tuple_end(self, extra_end_rules=None):
"""Are we at the end of a tuple?"""
if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
return True
elif extra_end_rules is not None:
return self.stream.current.test_any(extra_end_rules)
return Fals... | python | def is_tuple_end(self, extra_end_rules=None):
"""Are we at the end of a tuple?"""
if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
return True
elif extra_end_rules is not None:
return self.stream.current.test_any(extra_end_rules)
return Fals... | [
"def",
"is_tuple_end",
"(",
"self",
",",
"extra_end_rules",
"=",
"None",
")",
":",
"if",
"self",
".",
"stream",
".",
"current",
".",
"type",
"in",
"(",
"'variable_end'",
",",
"'block_end'",
",",
"'rparen'",
")",
":",
"return",
"True",
"elif",
"extra_end_ru... | Are we at the end of a tuple? | [
"Are",
"we",
"at",
"the",
"end",
"of",
"a",
"tuple?"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L106-L112 |
24,805 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.parse_statement | def parse_statement(self):
"""Parse a single statement."""
token = self.stream.current
if token.type != 'name':
self.fail('tag name expected', token.lineno)
self._tag_stack.append(token.value)
pop_tag = True
try:
if token.value in _statement_keywor... | python | def parse_statement(self):
"""Parse a single statement."""
token = self.stream.current
if token.type != 'name':
self.fail('tag name expected', token.lineno)
self._tag_stack.append(token.value)
pop_tag = True
try:
if token.value in _statement_keywor... | [
"def",
"parse_statement",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"stream",
".",
"current",
"if",
"token",
".",
"type",
"!=",
"'name'",
":",
"self",
".",
"fail",
"(",
"'tag name expected'",
",",
"token",
".",
"lineno",
")",
"self",
".",
"_tag... | Parse a single statement. | [
"Parse",
"a",
"single",
"statement",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L121-L147 |
24,806 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.parse_statements | def parse_statements(self, end_tokens, drop_needle=False):
"""Parse multiple statements into a list until one of the end tokens
is reached. This is used to parse the body of statements as it also
parses template data if appropriate. The parser checks first if the
current token is a col... | python | def parse_statements(self, end_tokens, drop_needle=False):
"""Parse multiple statements into a list until one of the end tokens
is reached. This is used to parse the body of statements as it also
parses template data if appropriate. The parser checks first if the
current token is a col... | [
"def",
"parse_statements",
"(",
"self",
",",
"end_tokens",
",",
"drop_needle",
"=",
"False",
")",
":",
"# the first token may be a colon for python compatibility",
"self",
".",
"stream",
".",
"skip_if",
"(",
"'colon'",
")",
"# in the future it would be possible to add whole... | Parse multiple statements into a list until one of the end tokens
is reached. This is used to parse the body of statements as it also
parses template data if appropriate. The parser checks first if the
current token is a colon and skips it if there is one. Then it checks
for the block... | [
"Parse",
"multiple",
"statements",
"into",
"a",
"list",
"until",
"one",
"of",
"the",
"end",
"tokens",
"is",
"reached",
".",
"This",
"is",
"used",
"to",
"parse",
"the",
"body",
"of",
"statements",
"as",
"it",
"also",
"parses",
"template",
"data",
"if",
"a... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L149-L174 |
24,807 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.parse_for | def parse_for(self):
"""Parse a for loop."""
lineno = self.stream.expect('name:for').lineno
target = self.parse_assign_target(extra_end_rules=('name:in',))
self.stream.expect('name:in')
iter = self.parse_tuple(with_condexpr=False,
extra_end_rules=(... | python | def parse_for(self):
"""Parse a for loop."""
lineno = self.stream.expect('name:for').lineno
target = self.parse_assign_target(extra_end_rules=('name:in',))
self.stream.expect('name:in')
iter = self.parse_tuple(with_condexpr=False,
extra_end_rules=(... | [
"def",
"parse_for",
"(",
"self",
")",
":",
"lineno",
"=",
"self",
".",
"stream",
".",
"expect",
"(",
"'name:for'",
")",
".",
"lineno",
"target",
"=",
"self",
".",
"parse_assign_target",
"(",
"extra_end_rules",
"=",
"(",
"'name:in'",
",",
")",
")",
"self"... | Parse a for loop. | [
"Parse",
"a",
"for",
"loop",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L188-L205 |
24,808 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.parse_if | def parse_if(self):
"""Parse an if construct."""
node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
while 1:
node.test = self.parse_tuple(with_condexpr=False)
node.body = self.parse_statements(('name:elif', 'name:else',
... | python | def parse_if(self):
"""Parse an if construct."""
node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
while 1:
node.test = self.parse_tuple(with_condexpr=False)
node.body = self.parse_statements(('name:elif', 'name:else',
... | [
"def",
"parse_if",
"(",
"self",
")",
":",
"node",
"=",
"result",
"=",
"nodes",
".",
"If",
"(",
"lineno",
"=",
"self",
".",
"stream",
".",
"expect",
"(",
"'name:if'",
")",
".",
"lineno",
")",
"while",
"1",
":",
"node",
".",
"test",
"=",
"self",
".... | Parse an if construct. | [
"Parse",
"an",
"if",
"construct",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L207-L225 |
24,809 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.parse_assign_target | def parse_assign_target(self, with_tuple=True, name_only=False,
extra_end_rules=None, with_namespace=False):
"""Parse an assignment target. As Jinja2 allows assignments to
tuples, this function can parse all allowed assignment targets. Per
default assignments to tup... | python | def parse_assign_target(self, with_tuple=True, name_only=False,
extra_end_rules=None, with_namespace=False):
"""Parse an assignment target. As Jinja2 allows assignments to
tuples, this function can parse all allowed assignment targets. Per
default assignments to tup... | [
"def",
"parse_assign_target",
"(",
"self",
",",
"with_tuple",
"=",
"True",
",",
"name_only",
"=",
"False",
",",
"extra_end_rules",
"=",
"None",
",",
"with_namespace",
"=",
"False",
")",
":",
"if",
"with_namespace",
"and",
"self",
".",
"stream",
".",
"look",
... | Parse an assignment target. As Jinja2 allows assignments to
tuples, this function can parse all allowed assignment targets. Per
default assignments to tuples are parsed, that can be disable however
by setting `with_tuple` to `False`. If only assignments to names are
wanted `name_only`... | [
"Parse",
"an",
"assignment",
"target",
".",
"As",
"Jinja2",
"allows",
"assignments",
"to",
"tuples",
"this",
"function",
"can",
"parse",
"all",
"allowed",
"assignment",
"targets",
".",
"Per",
"default",
"assignments",
"to",
"tuples",
"are",
"parsed",
"that",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L396-L424 |
24,810 | pypa/pipenv | pipenv/vendor/jinja2/parser.py | Parser.parse | def parse(self):
"""Parse the whole template into a `Template` node."""
result = nodes.Template(self.subparse(), lineno=1)
result.set_environment(self.environment)
return result | python | def parse(self):
"""Parse the whole template into a `Template` node."""
result = nodes.Template(self.subparse(), lineno=1)
result.set_environment(self.environment)
return result | [
"def",
"parse",
"(",
"self",
")",
":",
"result",
"=",
"nodes",
".",
"Template",
"(",
"self",
".",
"subparse",
"(",
")",
",",
"lineno",
"=",
"1",
")",
"result",
".",
"set_environment",
"(",
"self",
".",
"environment",
")",
"return",
"result"
] | Parse the whole template into a `Template` node. | [
"Parse",
"the",
"whole",
"template",
"into",
"a",
"Template",
"node",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L899-L903 |
24,811 | pypa/pipenv | pipenv/vendor/pexpect/exceptions.py | ExceptionPexpect.get_trace | def get_trace(self):
'''This returns an abbreviated stack trace with lines that only concern
the caller. In other words, the stack trace inside the Pexpect module
is not included. '''
tblist = traceback.extract_tb(sys.exc_info()[2])
tblist = [item for item in tblist if ('pexpect... | python | def get_trace(self):
'''This returns an abbreviated stack trace with lines that only concern
the caller. In other words, the stack trace inside the Pexpect module
is not included. '''
tblist = traceback.extract_tb(sys.exc_info()[2])
tblist = [item for item in tblist if ('pexpect... | [
"def",
"get_trace",
"(",
"self",
")",
":",
"tblist",
"=",
"traceback",
".",
"extract_tb",
"(",
"sys",
".",
"exc_info",
"(",
")",
"[",
"2",
"]",
")",
"tblist",
"=",
"[",
"item",
"for",
"item",
"in",
"tblist",
"if",
"(",
"'pexpect/__init__'",
"not",
"i... | This returns an abbreviated stack trace with lines that only concern
the caller. In other words, the stack trace inside the Pexpect module
is not included. | [
"This",
"returns",
"an",
"abbreviated",
"stack",
"trace",
"with",
"lines",
"that",
"only",
"concern",
"the",
"caller",
".",
"In",
"other",
"words",
"the",
"stack",
"trace",
"inside",
"the",
"Pexpect",
"module",
"is",
"not",
"included",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/exceptions.py#L17-L26 |
24,812 | pypa/pipenv | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | parse_uri | def parse_uri(uri):
"""Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri)
"""
groups = URI.match(uri).groups()
return (groups[1], groups[3], groups[4], groups[6], groups[8]) | python | def parse_uri(uri):
"""Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri)
"""
groups = URI.match(uri).groups()
return (groups[1], groups[3], groups[4], groups[6], groups[8]) | [
"def",
"parse_uri",
"(",
"uri",
")",
":",
"groups",
"=",
"URI",
".",
"match",
"(",
"uri",
")",
".",
"groups",
"(",
")",
"return",
"(",
"groups",
"[",
"1",
"]",
",",
"groups",
"[",
"3",
"]",
",",
"groups",
"[",
"4",
"]",
",",
"groups",
"[",
"6... | Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri) | [
"Parses",
"a",
"URI",
"using",
"the",
"regex",
"given",
"in",
"Appendix",
"B",
"of",
"RFC",
"3986",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L21-L27 |
24,813 | pypa/pipenv | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | CacheController._urlnorm | def _urlnorm(cls, uri):
"""Normalize the URL to create a safe key for the cache"""
(scheme, authority, path, query, fragment) = parse_uri(uri)
if not scheme or not authority:
raise Exception("Only absolute URIs are allowed. uri = %s" % uri)
scheme = scheme.lower()
au... | python | def _urlnorm(cls, uri):
"""Normalize the URL to create a safe key for the cache"""
(scheme, authority, path, query, fragment) = parse_uri(uri)
if not scheme or not authority:
raise Exception("Only absolute URIs are allowed. uri = %s" % uri)
scheme = scheme.lower()
au... | [
"def",
"_urlnorm",
"(",
"cls",
",",
"uri",
")",
":",
"(",
"scheme",
",",
"authority",
",",
"path",
",",
"query",
",",
"fragment",
")",
"=",
"parse_uri",
"(",
"uri",
")",
"if",
"not",
"scheme",
"or",
"not",
"authority",
":",
"raise",
"Exception",
"(",... | Normalize the URL to create a safe key for the cache | [
"Normalize",
"the",
"URL",
"to",
"create",
"a",
"safe",
"key",
"for",
"the",
"cache"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L43-L60 |
24,814 | pypa/pipenv | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | CacheController.cached_request | def cached_request(self, request):
"""
Return a cached response if it exists in the cache, otherwise
return False.
"""
cache_url = self.cache_url(request.url)
logger.debug('Looking up "%s" in the cache', cache_url)
cc = self.parse_cache_control(request.headers)
... | python | def cached_request(self, request):
"""
Return a cached response if it exists in the cache, otherwise
return False.
"""
cache_url = self.cache_url(request.url)
logger.debug('Looking up "%s" in the cache', cache_url)
cc = self.parse_cache_control(request.headers)
... | [
"def",
"cached_request",
"(",
"self",
",",
"request",
")",
":",
"cache_url",
"=",
"self",
".",
"cache_url",
"(",
"request",
".",
"url",
")",
"logger",
".",
"debug",
"(",
"'Looking up \"%s\" in the cache'",
",",
"cache_url",
")",
"cc",
"=",
"self",
".",
"pa... | Return a cached response if it exists in the cache, otherwise
return False. | [
"Return",
"a",
"cached",
"response",
"if",
"it",
"exists",
"in",
"the",
"cache",
"otherwise",
"return",
"False",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L120-L229 |
24,815 | pypa/pipenv | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | CacheController.cache_response | def cache_response(self, request, response, body=None, status_codes=None):
"""
Algorithm for caching requests.
This assumes a requests Response object.
"""
# From httplib2: Don't cache 206's since we aren't going to
# handle byte range requests
cac... | python | def cache_response(self, request, response, body=None, status_codes=None):
"""
Algorithm for caching requests.
This assumes a requests Response object.
"""
# From httplib2: Don't cache 206's since we aren't going to
# handle byte range requests
cac... | [
"def",
"cache_response",
"(",
"self",
",",
"request",
",",
"response",
",",
"body",
"=",
"None",
",",
"status_codes",
"=",
"None",
")",
":",
"# From httplib2: Don't cache 206's since we aren't going to",
"# handle byte range requests",
"cacheable_status_codes",... | Algorithm for caching requests.
This assumes a requests Response object. | [
"Algorithm",
"for",
"caching",
"requests",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L247-L327 |
24,816 | pypa/pipenv | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | CacheController.update_cached_response | def update_cached_response(self, request, response):
"""On a 304 we will get a new set of headers that we want to
update our cached value with, assuming we have one.
This should only ever be called when we've sent an ETag and
gotten a 304 as the response.
"""
cache_url =... | python | def update_cached_response(self, request, response):
"""On a 304 we will get a new set of headers that we want to
update our cached value with, assuming we have one.
This should only ever be called when we've sent an ETag and
gotten a 304 as the response.
"""
cache_url =... | [
"def",
"update_cached_response",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"cache_url",
"=",
"self",
".",
"cache_url",
"(",
"request",
".",
"url",
")",
"cached_response",
"=",
"self",
".",
"serializer",
".",
"loads",
"(",
"request",
",",
"sel... | On a 304 we will get a new set of headers that we want to
update our cached value with, assuming we have one.
This should only ever be called when we've sent an ETag and
gotten a 304 as the response. | [
"On",
"a",
"304",
"we",
"will",
"get",
"a",
"new",
"set",
"of",
"headers",
"that",
"we",
"want",
"to",
"update",
"our",
"cached",
"value",
"with",
"assuming",
"we",
"have",
"one",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L329-L367 |
24,817 | pypa/pipenv | pipenv/vendor/pexpect/fdpexpect.py | fdspawn.close | def close (self):
"""Close the file descriptor.
Calling this method a second time does nothing, but if the file
descriptor was closed elsewhere, :class:`OSError` will be raised.
"""
if self.child_fd == -1:
return
self.flush()
os.close(self.child_fd)
... | python | def close (self):
"""Close the file descriptor.
Calling this method a second time does nothing, but if the file
descriptor was closed elsewhere, :class:`OSError` will be raised.
"""
if self.child_fd == -1:
return
self.flush()
os.close(self.child_fd)
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"child_fd",
"==",
"-",
"1",
":",
"return",
"self",
".",
"flush",
"(",
")",
"os",
".",
"close",
"(",
"self",
".",
"child_fd",
")",
"self",
".",
"child_fd",
"=",
"-",
"1",
"self",
".",
"cl... | Close the file descriptor.
Calling this method a second time does nothing, but if the file
descriptor was closed elsewhere, :class:`OSError` will be raised. | [
"Close",
"the",
"file",
"descriptor",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L63-L75 |
24,818 | pypa/pipenv | pipenv/vendor/pexpect/fdpexpect.py | fdspawn.read_nonblocking | def read_nonblocking(self, size=1, timeout=-1):
"""
Read from the file descriptor and return the result as a string.
The read_nonblocking method of :class:`SpawnBase` assumes that a call
to os.read will not block (timeout parameter is ignored). This is not
the case for POSIX fil... | python | def read_nonblocking(self, size=1, timeout=-1):
"""
Read from the file descriptor and return the result as a string.
The read_nonblocking method of :class:`SpawnBase` assumes that a call
to os.read will not block (timeout parameter is ignored). This is not
the case for POSIX fil... | [
"def",
"read_nonblocking",
"(",
"self",
",",
"size",
"=",
"1",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"os",
".",
"name",
"==",
"'posix'",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self",
".",
"timeout",
"rlist",
"=",
"["... | Read from the file descriptor and return the result as a string.
The read_nonblocking method of :class:`SpawnBase` assumes that a call
to os.read will not block (timeout parameter is ignored). This is not
the case for POSIX file-like objects such as sockets and serial ports.
Use :func:... | [
"Read",
"from",
"the",
"file",
"descriptor",
"and",
"return",
"the",
"result",
"as",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L118-L148 |
24,819 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | clear_caches | def clear_caches():
"""Jinja2 keeps internal caches for environments and lexers. These are
used so that Jinja2 doesn't have to recreate environments and lexers all
the time. Normally you don't have to care about that but if you are
measuring memory consumption you may want to clean the caches.
"""... | python | def clear_caches():
"""Jinja2 keeps internal caches for environments and lexers. These are
used so that Jinja2 doesn't have to recreate environments and lexers all
the time. Normally you don't have to care about that but if you are
measuring memory consumption you may want to clean the caches.
"""... | [
"def",
"clear_caches",
"(",
")",
":",
"from",
"jinja2",
".",
"environment",
"import",
"_spontaneous_environments",
"from",
"jinja2",
".",
"lexer",
"import",
"_lexer_cache",
"_spontaneous_environments",
".",
"clear",
"(",
")",
"_lexer_cache",
".",
"clear",
"(",
")"... | Jinja2 keeps internal caches for environments and lexers. These are
used so that Jinja2 doesn't have to recreate environments and lexers all
the time. Normally you don't have to care about that but if you are
measuring memory consumption you may want to clean the caches. | [
"Jinja2",
"keeps",
"internal",
"caches",
"for",
"environments",
"and",
"lexers",
".",
"These",
"are",
"used",
"so",
"that",
"Jinja2",
"doesn",
"t",
"have",
"to",
"recreate",
"environments",
"and",
"lexers",
"all",
"the",
"time",
".",
"Normally",
"you",
"don"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L111-L120 |
24,820 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | pformat | def pformat(obj, verbose=False):
"""Prettyprint an object. Either use the `pretty` library or the
builtin `pprint`.
"""
try:
from pretty import pretty
return pretty(obj, verbose=verbose)
except ImportError:
from pprint import pformat
return pformat(obj) | python | def pformat(obj, verbose=False):
"""Prettyprint an object. Either use the `pretty` library or the
builtin `pprint`.
"""
try:
from pretty import pretty
return pretty(obj, verbose=verbose)
except ImportError:
from pprint import pformat
return pformat(obj) | [
"def",
"pformat",
"(",
"obj",
",",
"verbose",
"=",
"False",
")",
":",
"try",
":",
"from",
"pretty",
"import",
"pretty",
"return",
"pretty",
"(",
"obj",
",",
"verbose",
"=",
"verbose",
")",
"except",
"ImportError",
":",
"from",
"pprint",
"import",
"pforma... | Prettyprint an object. Either use the `pretty` library or the
builtin `pprint`. | [
"Prettyprint",
"an",
"object",
".",
"Either",
"use",
"the",
"pretty",
"library",
"or",
"the",
"builtin",
"pprint",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L177-L186 |
24,821 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | unicode_urlencode | def unicode_urlencode(obj, charset='utf-8', for_qs=False):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to thei... | python | def unicode_urlencode(obj, charset='utf-8', for_qs=False):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to thei... | [
"def",
"unicode_urlencode",
"(",
"obj",
",",
"charset",
"=",
"'utf-8'",
",",
"for_qs",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"string_types",
")",
":",
"obj",
"=",
"text_type",
"(",
"obj",
")",
"if",
"isinstance",
"(",
"obj... | URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to their unicode
representation first. | [
"URL",
"escapes",
"a",
"single",
"bytestring",
"or",
"unicode",
"string",
"with",
"the",
"given",
"charset",
"if",
"applicable",
"to",
"URL",
"safe",
"quoting",
"under",
"all",
"rules",
"that",
"need",
"to",
"be",
"considered",
"under",
"all",
"supported",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L287-L303 |
24,822 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | select_autoescape | def select_autoescape(enabled_extensions=('html', 'htm', 'xml'),
disabled_extensions=(),
default_for_string=True,
default=False):
"""Intelligently sets the initial value of autoescaping based on the
filename of the template. This is the recommen... | python | def select_autoescape(enabled_extensions=('html', 'htm', 'xml'),
disabled_extensions=(),
default_for_string=True,
default=False):
"""Intelligently sets the initial value of autoescaping based on the
filename of the template. This is the recommen... | [
"def",
"select_autoescape",
"(",
"enabled_extensions",
"=",
"(",
"'html'",
",",
"'htm'",
",",
"'xml'",
")",
",",
"disabled_extensions",
"=",
"(",
")",
",",
"default_for_string",
"=",
"True",
",",
"default",
"=",
"False",
")",
":",
"enabled_patterns",
"=",
"t... | Intelligently sets the initial value of autoescaping based on the
filename of the template. This is the recommended way to configure
autoescaping if you do not want to write a custom function yourself.
If you want to enable it for all templates created from strings or
for all templates with `.html` an... | [
"Intelligently",
"sets",
"the",
"initial",
"value",
"of",
"autoescaping",
"based",
"on",
"the",
"filename",
"of",
"the",
"template",
".",
"This",
"is",
"the",
"recommended",
"way",
"to",
"configure",
"autoescaping",
"if",
"you",
"do",
"not",
"want",
"to",
"w... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L491-L542 |
24,823 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | LRUCache.copy | def copy(self):
"""Return a shallow copy of the instance."""
rv = self.__class__(self.capacity)
rv._mapping.update(self._mapping)
rv._queue = deque(self._queue)
return rv | python | def copy(self):
"""Return a shallow copy of the instance."""
rv = self.__class__(self.capacity)
rv._mapping.update(self._mapping)
rv._queue = deque(self._queue)
return rv | [
"def",
"copy",
"(",
"self",
")",
":",
"rv",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"capacity",
")",
"rv",
".",
"_mapping",
".",
"update",
"(",
"self",
".",
"_mapping",
")",
"rv",
".",
"_queue",
"=",
"deque",
"(",
"self",
".",
"_queue",
... | Return a shallow copy of the instance. | [
"Return",
"a",
"shallow",
"copy",
"of",
"the",
"instance",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L341-L346 |
24,824 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | LRUCache.setdefault | def setdefault(self, key, default=None):
"""Set `default` if the key is not in the cache otherwise
leave unchanged. Return the value of this key.
"""
self._wlock.acquire()
try:
try:
return self[key]
except KeyError:
self[key... | python | def setdefault(self, key, default=None):
"""Set `default` if the key is not in the cache otherwise
leave unchanged. Return the value of this key.
"""
self._wlock.acquire()
try:
try:
return self[key]
except KeyError:
self[key... | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_wlock",
".",
"acquire",
"(",
")",
"try",
":",
"try",
":",
"return",
"self",
"[",
"key",
"]",
"except",
"KeyError",
":",
"self",
"[",
"key",
"]",
"... | Set `default` if the key is not in the cache otherwise
leave unchanged. Return the value of this key. | [
"Set",
"default",
"if",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"otherwise",
"leave",
"unchanged",
".",
"Return",
"the",
"value",
"of",
"this",
"key",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L355-L367 |
24,825 | pypa/pipenv | pipenv/vendor/jinja2/utils.py | LRUCache.items | def items(self):
"""Return a list of items."""
result = [(key, self._mapping[key]) for key in list(self._queue)]
result.reverse()
return result | python | def items(self):
"""Return a list of items."""
result = [(key, self._mapping[key]) for key in list(self._queue)]
result.reverse()
return result | [
"def",
"items",
"(",
"self",
")",
":",
"result",
"=",
"[",
"(",
"key",
",",
"self",
".",
"_mapping",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"list",
"(",
"self",
".",
"_queue",
")",
"]",
"result",
".",
"reverse",
"(",
")",
"return",
"result"
] | Return a list of items. | [
"Return",
"a",
"list",
"of",
"items",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L444-L448 |
24,826 | pypa/pipenv | tasks/vendoring/__init__.py | license_fallback | def license_fallback(vendor_dir, sdist_name):
"""Hardcoded license URLs. Check when updating if those are still needed"""
libname = libname_from_dir(sdist_name)
if libname not in HARDCODED_LICENSE_URLS:
raise ValueError('No hardcoded URL for {} license'.format(libname))
url = HARDCODED_LICENSE_... | python | def license_fallback(vendor_dir, sdist_name):
"""Hardcoded license URLs. Check when updating if those are still needed"""
libname = libname_from_dir(sdist_name)
if libname not in HARDCODED_LICENSE_URLS:
raise ValueError('No hardcoded URL for {} license'.format(libname))
url = HARDCODED_LICENSE_... | [
"def",
"license_fallback",
"(",
"vendor_dir",
",",
"sdist_name",
")",
":",
"libname",
"=",
"libname_from_dir",
"(",
"sdist_name",
")",
"if",
"libname",
"not",
"in",
"HARDCODED_LICENSE_URLS",
":",
"raise",
"ValueError",
"(",
"'No hardcoded URL for {} license'",
".",
... | Hardcoded license URLs. Check when updating if those are still needed | [
"Hardcoded",
"license",
"URLs",
".",
"Check",
"when",
"updating",
"if",
"those",
"are",
"still",
"needed"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L588-L600 |
24,827 | pypa/pipenv | tasks/vendoring/__init__.py | libname_from_dir | def libname_from_dir(dirname):
"""Reconstruct the library name without it's version"""
parts = []
for part in dirname.split('-'):
if part[0].isdigit():
break
parts.append(part)
return '-'.join(parts) | python | def libname_from_dir(dirname):
"""Reconstruct the library name without it's version"""
parts = []
for part in dirname.split('-'):
if part[0].isdigit():
break
parts.append(part)
return '-'.join(parts) | [
"def",
"libname_from_dir",
"(",
"dirname",
")",
":",
"parts",
"=",
"[",
"]",
"for",
"part",
"in",
"dirname",
".",
"split",
"(",
"'-'",
")",
":",
"if",
"part",
"[",
"0",
"]",
".",
"isdigit",
"(",
")",
":",
"break",
"parts",
".",
"append",
"(",
"pa... | Reconstruct the library name without it's version | [
"Reconstruct",
"the",
"library",
"name",
"without",
"it",
"s",
"version"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L603-L610 |
24,828 | pypa/pipenv | pipenv/vendor/passa/internals/_pip.py | _convert_hashes | def _convert_hashes(values):
"""Convert Pipfile.lock hash lines into InstallRequirement option format.
The option format uses a str-list mapping. Keys are hash algorithms, and
the list contains all values of that algorithm.
"""
hashes = {}
if not values:
return hashes
for value in v... | python | def _convert_hashes(values):
"""Convert Pipfile.lock hash lines into InstallRequirement option format.
The option format uses a str-list mapping. Keys are hash algorithms, and
the list contains all values of that algorithm.
"""
hashes = {}
if not values:
return hashes
for value in v... | [
"def",
"_convert_hashes",
"(",
"values",
")",
":",
"hashes",
"=",
"{",
"}",
"if",
"not",
"values",
":",
"return",
"hashes",
"for",
"value",
"in",
"values",
":",
"try",
":",
"name",
",",
"value",
"=",
"value",
".",
"split",
"(",
"\":\"",
",",
"1",
"... | Convert Pipfile.lock hash lines into InstallRequirement option format.
The option format uses a str-list mapping. Keys are hash algorithms, and
the list contains all values of that algorithm. | [
"Convert",
"Pipfile",
".",
"lock",
"hash",
"lines",
"into",
"InstallRequirement",
"option",
"format",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L113-L130 |
24,829 | pypa/pipenv | pipenv/vendor/passa/internals/_pip.py | _suppress_distutils_logs | def _suppress_distutils_logs():
"""Hack to hide noise generated by `setup.py develop`.
There isn't a good way to suppress them now, so let's monky-patch.
See https://bugs.python.org/issue25392.
"""
f = distutils.log.Log._log
def _log(log, level, msg, args):
if level >= distutils.log.ER... | python | def _suppress_distutils_logs():
"""Hack to hide noise generated by `setup.py develop`.
There isn't a good way to suppress them now, so let's monky-patch.
See https://bugs.python.org/issue25392.
"""
f = distutils.log.Log._log
def _log(log, level, msg, args):
if level >= distutils.log.ER... | [
"def",
"_suppress_distutils_logs",
"(",
")",
":",
"f",
"=",
"distutils",
".",
"log",
".",
"Log",
".",
"_log",
"def",
"_log",
"(",
"log",
",",
"level",
",",
"msg",
",",
"args",
")",
":",
"if",
"level",
">=",
"distutils",
".",
"log",
".",
"ERROR",
":... | Hack to hide noise generated by `setup.py develop`.
There isn't a good way to suppress them now, so let's monky-patch.
See https://bugs.python.org/issue25392. | [
"Hack",
"to",
"hide",
"noise",
"generated",
"by",
"setup",
".",
"py",
"develop",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L258-L272 |
24,830 | pypa/pipenv | pipenv/vendor/passa/internals/_pip.py | _find_egg_info | def _find_egg_info(ireq):
"""Find this package's .egg-info directory.
Due to how sdists are designed, the .egg-info directory cannot be reliably
found without running setup.py to aggregate all configurations. This
function instead uses some heuristics to locate the egg-info directory
that most like... | python | def _find_egg_info(ireq):
"""Find this package's .egg-info directory.
Due to how sdists are designed, the .egg-info directory cannot be reliably
found without running setup.py to aggregate all configurations. This
function instead uses some heuristics to locate the egg-info directory
that most like... | [
"def",
"_find_egg_info",
"(",
"ireq",
")",
":",
"root",
"=",
"ireq",
".",
"setup_py_dir",
"directory_iterator",
"=",
"_iter_egg_info_directories",
"(",
"root",
",",
"ireq",
".",
"name",
")",
"try",
":",
"top_egg_info",
"=",
"next",
"(",
"directory_iterator",
"... | Find this package's .egg-info directory.
Due to how sdists are designed, the .egg-info directory cannot be reliably
found without running setup.py to aggregate all configurations. This
function instead uses some heuristics to locate the egg-info directory
that most likely represents this package.
... | [
"Find",
"this",
"package",
"s",
".",
"egg",
"-",
"info",
"directory",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L355-L389 |
24,831 | pypa/pipenv | pipenv/vendor/vistir/compat.py | fs_str | def fs_str(string):
"""Encodes a string into the proper filesystem encoding
Borrowed from pip-tools
"""
if isinstance(string, str):
return string
assert not isinstance(string, bytes)
return string.encode(_fs_encoding) | python | def fs_str(string):
"""Encodes a string into the proper filesystem encoding
Borrowed from pip-tools
"""
if isinstance(string, str):
return string
assert not isinstance(string, bytes)
return string.encode(_fs_encoding) | [
"def",
"fs_str",
"(",
"string",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"str",
")",
":",
"return",
"string",
"assert",
"not",
"isinstance",
"(",
"string",
",",
"bytes",
")",
"return",
"string",
".",
"encode",
"(",
"_fs_encoding",
")"
] | Encodes a string into the proper filesystem encoding
Borrowed from pip-tools | [
"Encodes",
"a",
"string",
"into",
"the",
"proper",
"filesystem",
"encoding"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L208-L217 |
24,832 | pypa/pipenv | pipenv/vendor/vistir/compat.py | _get_path | def _get_path(path):
"""
Fetch the string value from a path-like object
Returns **None** if there is no string value.
"""
if isinstance(path, (six.string_types, bytes)):
return path
path_type = type(path)
try:
path_repr = path_type.__fspath__(path)
except AttributeError... | python | def _get_path(path):
"""
Fetch the string value from a path-like object
Returns **None** if there is no string value.
"""
if isinstance(path, (six.string_types, bytes)):
return path
path_type = type(path)
try:
path_repr = path_type.__fspath__(path)
except AttributeError... | [
"def",
"_get_path",
"(",
"path",
")",
":",
"if",
"isinstance",
"(",
"path",
",",
"(",
"six",
".",
"string_types",
",",
"bytes",
")",
")",
":",
"return",
"path",
"path_type",
"=",
"type",
"(",
"path",
")",
"try",
":",
"path_repr",
"=",
"path_type",
".... | Fetch the string value from a path-like object
Returns **None** if there is no string value. | [
"Fetch",
"the",
"string",
"value",
"from",
"a",
"path",
"-",
"like",
"object"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L220-L236 |
24,833 | pypa/pipenv | pipenv/vendor/passa/internals/traces.py | trace_graph | def trace_graph(graph):
"""Build a collection of "traces" for each package.
A trace is a list of names that eventually leads to the package. For
example, if A and B are root dependencies, A depends on C and D, B
depends on C, and C depends on D, the return value would be like::
{
N... | python | def trace_graph(graph):
"""Build a collection of "traces" for each package.
A trace is a list of names that eventually leads to the package. For
example, if A and B are root dependencies, A depends on C and D, B
depends on C, and C depends on D, the return value would be like::
{
N... | [
"def",
"trace_graph",
"(",
"graph",
")",
":",
"result",
"=",
"{",
"None",
":",
"[",
"]",
"}",
"for",
"vertex",
"in",
"graph",
":",
"result",
"[",
"vertex",
"]",
"=",
"[",
"]",
"for",
"root",
"in",
"graph",
".",
"iter_children",
"(",
"None",
")",
... | Build a collection of "traces" for each package.
A trace is a list of names that eventually leads to the package. For
example, if A and B are root dependencies, A depends on C and D, B
depends on C, and C depends on D, the return value would be like::
{
None: [],
"A": [None... | [
"Build",
"a",
"collection",
"of",
"traces",
"for",
"each",
"package",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/traces.py#L18-L40 |
24,834 | pypa/pipenv | pipenv/vendor/urllib3/util/timeout.py | Timeout._validate_timeout | def _validate_timeout(cls, value, name):
""" Check that a timeout attribute is valid.
:param value: The timeout value to validate
:param name: The name of the timeout attribute to validate. This is
used to specify in error messages.
:return: The validated and casted version ... | python | def _validate_timeout(cls, value, name):
""" Check that a timeout attribute is valid.
:param value: The timeout value to validate
:param name: The name of the timeout attribute to validate. This is
used to specify in error messages.
:return: The validated and casted version ... | [
"def",
"_validate_timeout",
"(",
"cls",
",",
"value",
",",
"name",
")",
":",
"if",
"value",
"is",
"_Default",
":",
"return",
"cls",
".",
"DEFAULT_TIMEOUT",
"if",
"value",
"is",
"None",
"or",
"value",
"is",
"cls",
".",
"DEFAULT_TIMEOUT",
":",
"return",
"v... | Check that a timeout attribute is valid.
:param value: The timeout value to validate
:param name: The name of the timeout attribute to validate. This is
used to specify in error messages.
:return: The validated and casted version of the given value.
:raises ValueError: If it... | [
"Check",
"that",
"a",
"timeout",
"attribute",
"is",
"valid",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L104-L138 |
24,835 | pypa/pipenv | pipenv/vendor/urllib3/util/timeout.py | Timeout.clone | def clone(self):
""" Create a copy of the timeout object
Timeout properties are stored per-pool but each request needs a fresh
Timeout object to ensure each one has its own start/stop configured.
:return: a copy of the timeout object
:rtype: :class:`Timeout`
"""
... | python | def clone(self):
""" Create a copy of the timeout object
Timeout properties are stored per-pool but each request needs a fresh
Timeout object to ensure each one has its own start/stop configured.
:return: a copy of the timeout object
:rtype: :class:`Timeout`
"""
... | [
"def",
"clone",
"(",
"self",
")",
":",
"# We can't use copy.deepcopy because that will also create a new object",
"# for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to",
"# detect the user default.",
"return",
"Timeout",
"(",
"connect",
"=",
"self",
".",
"_connect",
... | Create a copy of the timeout object
Timeout properties are stored per-pool but each request needs a fresh
Timeout object to ensure each one has its own start/stop configured.
:return: a copy of the timeout object
:rtype: :class:`Timeout` | [
"Create",
"a",
"copy",
"of",
"the",
"timeout",
"object"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L156-L169 |
24,836 | pypa/pipenv | pipenv/vendor/urllib3/util/timeout.py | Timeout.connect_timeout | def connect_timeout(self):
""" Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
... | python | def connect_timeout(self):
""" Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
... | [
"def",
"connect_timeout",
"(",
"self",
")",
":",
"if",
"self",
".",
"total",
"is",
"None",
":",
"return",
"self",
".",
"_connect",
"if",
"self",
".",
"_connect",
"is",
"None",
"or",
"self",
".",
"_connect",
"is",
"self",
".",
"DEFAULT_TIMEOUT",
":",
"r... | Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None | [
"Get",
"the",
"value",
"to",
"use",
"when",
"setting",
"a",
"connection",
"timeout",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L196-L211 |
24,837 | pypa/pipenv | pipenv/vendor/urllib3/util/timeout.py | Timeout.read_timeout | def read_timeout(self):
""" Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If t... | python | def read_timeout(self):
""" Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If t... | [
"def",
"read_timeout",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"total",
"is",
"not",
"None",
"and",
"self",
".",
"total",
"is",
"not",
"self",
".",
"DEFAULT_TIMEOUT",
"and",
"self",
".",
"_read",
"is",
"not",
"None",
"and",
"self",
".",
"_read... | Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If the connection time has not been
... | [
"Get",
"the",
"value",
"for",
"the",
"read",
"timeout",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L214-L242 |
24,838 | pypa/pipenv | pipenv/vendor/urllib3/contrib/socks.py | SOCKSConnection._new_conn | def _new_conn(self):
"""
Establish a new connection via the SOCKS proxy.
"""
extra_kw = {}
if self.source_address:
extra_kw['source_address'] = self.source_address
if self.socket_options:
extra_kw['socket_options'] = self.socket_options
t... | python | def _new_conn(self):
"""
Establish a new connection via the SOCKS proxy.
"""
extra_kw = {}
if self.source_address:
extra_kw['source_address'] = self.source_address
if self.socket_options:
extra_kw['socket_options'] = self.socket_options
t... | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"extra_kw",
"=",
"{",
"}",
"if",
"self",
".",
"source_address",
":",
"extra_kw",
"[",
"'source_address'",
"]",
"=",
"self",
".",
"source_address",
"if",
"self",
".",
"socket_options",
":",
"extra_kw",
"[",
"'socke... | Establish a new connection via the SOCKS proxy. | [
"Establish",
"a",
"new",
"connection",
"via",
"the",
"SOCKS",
"proxy",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/socks.py#L67-L122 |
24,839 | pypa/pipenv | pipenv/vendor/click/core.py | fast_exit | def fast_exit(code):
"""Exit without garbage collection, this speeds up exit by about 10ms for
things like bash completion.
"""
sys.stdout.flush()
sys.stderr.flush()
os._exit(code) | python | def fast_exit(code):
"""Exit without garbage collection, this speeds up exit by about 10ms for
things like bash completion.
"""
sys.stdout.flush()
sys.stderr.flush()
os._exit(code) | [
"def",
"fast_exit",
"(",
"code",
")",
":",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"sys",
".",
"stderr",
".",
"flush",
"(",
")",
"os",
".",
"_exit",
"(",
"code",
")"
] | Exit without garbage collection, this speeds up exit by about 10ms for
things like bash completion. | [
"Exit",
"without",
"garbage",
"collection",
"this",
"speeds",
"up",
"exit",
"by",
"about",
"10ms",
"for",
"things",
"like",
"bash",
"completion",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L39-L45 |
24,840 | pypa/pipenv | pipenv/vendor/click/core.py | augment_usage_errors | def augment_usage_errors(ctx, param=None):
"""Context manager that attaches extra information to exceptions that
fly.
"""
try:
yield
except BadParameter as e:
if e.ctx is None:
e.ctx = ctx
if param is not None and e.param is None:
e.param = param
... | python | def augment_usage_errors(ctx, param=None):
"""Context manager that attaches extra information to exceptions that
fly.
"""
try:
yield
except BadParameter as e:
if e.ctx is None:
e.ctx = ctx
if param is not None and e.param is None:
e.param = param
... | [
"def",
"augment_usage_errors",
"(",
"ctx",
",",
"param",
"=",
"None",
")",
":",
"try",
":",
"yield",
"except",
"BadParameter",
"as",
"e",
":",
"if",
"e",
".",
"ctx",
"is",
"None",
":",
"e",
".",
"ctx",
"=",
"ctx",
"if",
"param",
"is",
"not",
"None"... | Context manager that attaches extra information to exceptions that
fly. | [
"Context",
"manager",
"that",
"attaches",
"extra",
"information",
"to",
"exceptions",
"that",
"fly",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L100-L115 |
24,841 | pypa/pipenv | pipenv/vendor/click/core.py | iter_params_for_processing | def iter_params_for_processing(invocation_order, declaration_order):
"""Given a sequence of parameters in the order as should be considered
for processing and an iterable of parameters that exist, this returns
a list in the correct order as they should be processed.
"""
def sort_key(item):
t... | python | def iter_params_for_processing(invocation_order, declaration_order):
"""Given a sequence of parameters in the order as should be considered
for processing and an iterable of parameters that exist, this returns
a list in the correct order as they should be processed.
"""
def sort_key(item):
t... | [
"def",
"iter_params_for_processing",
"(",
"invocation_order",
",",
"declaration_order",
")",
":",
"def",
"sort_key",
"(",
"item",
")",
":",
"try",
":",
"idx",
"=",
"invocation_order",
".",
"index",
"(",
"item",
")",
"except",
"ValueError",
":",
"idx",
"=",
"... | Given a sequence of parameters in the order as should be considered
for processing and an iterable of parameters that exist, this returns
a list in the correct order as they should be processed. | [
"Given",
"a",
"sequence",
"of",
"parameters",
"in",
"the",
"order",
"as",
"should",
"be",
"considered",
"for",
"processing",
"and",
"an",
"iterable",
"of",
"parameters",
"that",
"exist",
"this",
"returns",
"a",
"list",
"in",
"the",
"correct",
"order",
"as",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L118-L130 |
24,842 | pypa/pipenv | pipenv/vendor/click/core.py | Context.command_path | def command_path(self):
"""The computed command path. This is used for the ``usage``
information on the help page. It's automatically created by
combining the info names of the chain of contexts to the root.
"""
rv = ''
if self.info_name is not None:
rv = se... | python | def command_path(self):
"""The computed command path. This is used for the ``usage``
information on the help page. It's automatically created by
combining the info names of the chain of contexts to the root.
"""
rv = ''
if self.info_name is not None:
rv = se... | [
"def",
"command_path",
"(",
"self",
")",
":",
"rv",
"=",
"''",
"if",
"self",
".",
"info_name",
"is",
"not",
"None",
":",
"rv",
"=",
"self",
".",
"info_name",
"if",
"self",
".",
"parent",
"is",
"not",
"None",
":",
"rv",
"=",
"self",
".",
"parent",
... | The computed command path. This is used for the ``usage``
information on the help page. It's automatically created by
combining the info names of the chain of contexts to the root. | [
"The",
"computed",
"command",
"path",
".",
"This",
"is",
"used",
"for",
"the",
"usage",
"information",
"on",
"the",
"help",
"page",
".",
"It",
"s",
"automatically",
"created",
"by",
"combining",
"the",
"info",
"names",
"of",
"the",
"chain",
"of",
"contexts... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L444-L454 |
24,843 | pypa/pipenv | pipenv/vendor/click/core.py | Context.find_root | def find_root(self):
"""Finds the outermost context."""
node = self
while node.parent is not None:
node = node.parent
return node | python | def find_root(self):
"""Finds the outermost context."""
node = self
while node.parent is not None:
node = node.parent
return node | [
"def",
"find_root",
"(",
"self",
")",
":",
"node",
"=",
"self",
"while",
"node",
".",
"parent",
"is",
"not",
"None",
":",
"node",
"=",
"node",
".",
"parent",
"return",
"node"
] | Finds the outermost context. | [
"Finds",
"the",
"outermost",
"context",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L456-L461 |
24,844 | pypa/pipenv | pipenv/vendor/click/core.py | Context.find_object | def find_object(self, object_type):
"""Finds the closest object of a given type."""
node = self
while node is not None:
if isinstance(node.obj, object_type):
return node.obj
node = node.parent | python | def find_object(self, object_type):
"""Finds the closest object of a given type."""
node = self
while node is not None:
if isinstance(node.obj, object_type):
return node.obj
node = node.parent | [
"def",
"find_object",
"(",
"self",
",",
"object_type",
")",
":",
"node",
"=",
"self",
"while",
"node",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"node",
".",
"obj",
",",
"object_type",
")",
":",
"return",
"node",
".",
"obj",
"node",
"=",
"no... | Finds the closest object of a given type. | [
"Finds",
"the",
"closest",
"object",
"of",
"a",
"given",
"type",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L463-L469 |
24,845 | pypa/pipenv | pipenv/vendor/click/core.py | Command.format_usage | def format_usage(self, ctx, formatter):
"""Writes the usage line into the formatter."""
pieces = self.collect_usage_pieces(ctx)
formatter.write_usage(ctx.command_path, ' '.join(pieces)) | python | def format_usage(self, ctx, formatter):
"""Writes the usage line into the formatter."""
pieces = self.collect_usage_pieces(ctx)
formatter.write_usage(ctx.command_path, ' '.join(pieces)) | [
"def",
"format_usage",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"pieces",
"=",
"self",
".",
"collect_usage_pieces",
"(",
"ctx",
")",
"formatter",
".",
"write_usage",
"(",
"ctx",
".",
"command_path",
",",
"' '",
".",
"join",
"(",
"pieces",
")"... | Writes the usage line into the formatter. | [
"Writes",
"the",
"usage",
"line",
"into",
"the",
"formatter",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L830-L833 |
24,846 | pypa/pipenv | pipenv/vendor/click/core.py | Command.collect_usage_pieces | def collect_usage_pieces(self, ctx):
"""Returns all the pieces that go into the usage line and returns
it as a list of strings.
"""
rv = [self.options_metavar]
for param in self.get_params(ctx):
rv.extend(param.get_usage_pieces(ctx))
return rv | python | def collect_usage_pieces(self, ctx):
"""Returns all the pieces that go into the usage line and returns
it as a list of strings.
"""
rv = [self.options_metavar]
for param in self.get_params(ctx):
rv.extend(param.get_usage_pieces(ctx))
return rv | [
"def",
"collect_usage_pieces",
"(",
"self",
",",
"ctx",
")",
":",
"rv",
"=",
"[",
"self",
".",
"options_metavar",
"]",
"for",
"param",
"in",
"self",
".",
"get_params",
"(",
"ctx",
")",
":",
"rv",
".",
"extend",
"(",
"param",
".",
"get_usage_pieces",
"(... | Returns all the pieces that go into the usage line and returns
it as a list of strings. | [
"Returns",
"all",
"the",
"pieces",
"that",
"go",
"into",
"the",
"usage",
"line",
"and",
"returns",
"it",
"as",
"a",
"list",
"of",
"strings",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L835-L842 |
24,847 | pypa/pipenv | pipenv/vendor/click/core.py | Command.get_help_option_names | def get_help_option_names(self, ctx):
"""Returns the names for the help option."""
all_names = set(ctx.help_option_names)
for param in self.params:
all_names.difference_update(param.opts)
all_names.difference_update(param.secondary_opts)
return all_names | python | def get_help_option_names(self, ctx):
"""Returns the names for the help option."""
all_names = set(ctx.help_option_names)
for param in self.params:
all_names.difference_update(param.opts)
all_names.difference_update(param.secondary_opts)
return all_names | [
"def",
"get_help_option_names",
"(",
"self",
",",
"ctx",
")",
":",
"all_names",
"=",
"set",
"(",
"ctx",
".",
"help_option_names",
")",
"for",
"param",
"in",
"self",
".",
"params",
":",
"all_names",
".",
"difference_update",
"(",
"param",
".",
"opts",
")",
... | Returns the names for the help option. | [
"Returns",
"the",
"names",
"for",
"the",
"help",
"option",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L844-L850 |
24,848 | pypa/pipenv | pipenv/vendor/click/core.py | Command.get_short_help_str | def get_short_help_str(self, limit=45):
"""Gets short help for the command or makes it by shortening the long help string."""
return self.short_help or self.help and make_default_short_help(self.help, limit) or '' | python | def get_short_help_str(self, limit=45):
"""Gets short help for the command or makes it by shortening the long help string."""
return self.short_help or self.help and make_default_short_help(self.help, limit) or '' | [
"def",
"get_short_help_str",
"(",
"self",
",",
"limit",
"=",
"45",
")",
":",
"return",
"self",
".",
"short_help",
"or",
"self",
".",
"help",
"and",
"make_default_short_help",
"(",
"self",
".",
"help",
",",
"limit",
")",
"or",
"''"
] | Gets short help for the command or makes it by shortening the long help string. | [
"Gets",
"short",
"help",
"for",
"the",
"command",
"or",
"makes",
"it",
"by",
"shortening",
"the",
"long",
"help",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L882-L884 |
24,849 | pypa/pipenv | pipenv/vendor/click/core.py | Command.format_help | def format_help(self, ctx, formatter):
"""Writes the help into the formatter if it exists.
This calls into the following methods:
- :meth:`format_usage`
- :meth:`format_help_text`
- :meth:`format_options`
- :meth:`format_epilog`
"""
self.format_u... | python | def format_help(self, ctx, formatter):
"""Writes the help into the formatter if it exists.
This calls into the following methods:
- :meth:`format_usage`
- :meth:`format_help_text`
- :meth:`format_options`
- :meth:`format_epilog`
"""
self.format_u... | [
"def",
"format_help",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"self",
".",
"format_usage",
"(",
"ctx",
",",
"formatter",
")",
"self",
".",
"format_help_text",
"(",
"ctx",
",",
"formatter",
")",
"self",
".",
"format_options",
"(",
"ctx",
",",... | Writes the help into the formatter if it exists.
This calls into the following methods:
- :meth:`format_usage`
- :meth:`format_help_text`
- :meth:`format_options`
- :meth:`format_epilog` | [
"Writes",
"the",
"help",
"into",
"the",
"formatter",
"if",
"it",
"exists",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L886-L899 |
24,850 | pypa/pipenv | pipenv/vendor/click/core.py | Command.format_options | def format_options(self, ctx, formatter):
"""Writes all the options into the formatter if they exist."""
opts = []
for param in self.get_params(ctx):
rv = param.get_help_record(ctx)
if rv is not None:
opts.append(rv)
if opts:
with form... | python | def format_options(self, ctx, formatter):
"""Writes all the options into the formatter if they exist."""
opts = []
for param in self.get_params(ctx):
rv = param.get_help_record(ctx)
if rv is not None:
opts.append(rv)
if opts:
with form... | [
"def",
"format_options",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"opts",
"=",
"[",
"]",
"for",
"param",
"in",
"self",
".",
"get_params",
"(",
"ctx",
")",
":",
"rv",
"=",
"param",
".",
"get_help_record",
"(",
"ctx",
")",
"if",
"rv",
"is... | Writes all the options into the formatter if they exist. | [
"Writes",
"all",
"the",
"options",
"into",
"the",
"formatter",
"if",
"they",
"exist",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L915-L925 |
24,851 | pypa/pipenv | pipenv/vendor/click/core.py | Command.format_epilog | def format_epilog(self, ctx, formatter):
"""Writes the epilog into the formatter if it exists."""
if self.epilog:
formatter.write_paragraph()
with formatter.indentation():
formatter.write_text(self.epilog) | python | def format_epilog(self, ctx, formatter):
"""Writes the epilog into the formatter if it exists."""
if self.epilog:
formatter.write_paragraph()
with formatter.indentation():
formatter.write_text(self.epilog) | [
"def",
"format_epilog",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"if",
"self",
".",
"epilog",
":",
"formatter",
".",
"write_paragraph",
"(",
")",
"with",
"formatter",
".",
"indentation",
"(",
")",
":",
"formatter",
".",
"write_text",
"(",
"se... | Writes the epilog into the formatter if it exists. | [
"Writes",
"the",
"epilog",
"into",
"the",
"formatter",
"if",
"it",
"exists",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L927-L932 |
24,852 | pypa/pipenv | pipenv/vendor/click/core.py | Parameter.get_default | def get_default(self, ctx):
"""Given a context variable this calculates the default value."""
# Otherwise go with the regular default.
if callable(self.default):
rv = self.default()
else:
rv = self.default
return self.type_cast_value(ctx, rv) | python | def get_default(self, ctx):
"""Given a context variable this calculates the default value."""
# Otherwise go with the regular default.
if callable(self.default):
rv = self.default()
else:
rv = self.default
return self.type_cast_value(ctx, rv) | [
"def",
"get_default",
"(",
"self",
",",
"ctx",
")",
":",
"# Otherwise go with the regular default.",
"if",
"callable",
"(",
"self",
".",
"default",
")",
":",
"rv",
"=",
"self",
".",
"default",
"(",
")",
"else",
":",
"rv",
"=",
"self",
".",
"default",
"re... | Given a context variable this calculates the default value. | [
"Given",
"a",
"context",
"variable",
"this",
"calculates",
"the",
"default",
"value",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1378-L1385 |
24,853 | pypa/pipenv | pipenv/vendor/click/core.py | Parameter.type_cast_value | def type_cast_value(self, ctx, value):
"""Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types.
"""
if self.type.is_composite:
if self.nargs <= 1:
raise Ty... | python | def type_cast_value(self, ctx, value):
"""Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types.
"""
if self.type.is_composite:
if self.nargs <= 1:
raise Ty... | [
"def",
"type_cast_value",
"(",
"self",
",",
"ctx",
",",
"value",
")",
":",
"if",
"self",
".",
"type",
".",
"is_composite",
":",
"if",
"self",
".",
"nargs",
"<=",
"1",
":",
"raise",
"TypeError",
"(",
"'Attempted to invoke composite type '",
"'but nargs has been... | Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types. | [
"Given",
"a",
"value",
"this",
"runs",
"it",
"properly",
"through",
"the",
"type",
"system",
".",
"This",
"automatically",
"handles",
"things",
"like",
"nargs",
"and",
"multiple",
"as",
"well",
"as",
"composite",
"types",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1398-L1417 |
24,854 | pypa/pipenv | pipenv/vendor/click/core.py | Parameter.get_error_hint | def get_error_hint(self, ctx):
"""Get a stringified version of the param for use in error messages to
indicate which param caused the error.
"""
hint_list = self.opts or [self.human_readable_name]
return ' / '.join('"%s"' % x for x in hint_list) | python | def get_error_hint(self, ctx):
"""Get a stringified version of the param for use in error messages to
indicate which param caused the error.
"""
hint_list = self.opts or [self.human_readable_name]
return ' / '.join('"%s"' % x for x in hint_list) | [
"def",
"get_error_hint",
"(",
"self",
",",
"ctx",
")",
":",
"hint_list",
"=",
"self",
".",
"opts",
"or",
"[",
"self",
".",
"human_readable_name",
"]",
"return",
"' / '",
".",
"join",
"(",
"'\"%s\"'",
"%",
"x",
"for",
"x",
"in",
"hint_list",
")"
] | Get a stringified version of the param for use in error messages to
indicate which param caused the error. | [
"Get",
"a",
"stringified",
"version",
"of",
"the",
"param",
"for",
"use",
"in",
"error",
"messages",
"to",
"indicate",
"which",
"param",
"caused",
"the",
"error",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1492-L1497 |
24,855 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | find_all_matches | def find_all_matches(finder, ireq, pre=False):
# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]
"""Find all matching dependencies using the supplied finder and the
given ireq.
:param finder: A package finder for discovering matching candidates.
:type finder: :class:`... | python | def find_all_matches(finder, ireq, pre=False):
# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]
"""Find all matching dependencies using the supplied finder and the
given ireq.
:param finder: A package finder for discovering matching candidates.
:type finder: :class:`... | [
"def",
"find_all_matches",
"(",
"finder",
",",
"ireq",
",",
"pre",
"=",
"False",
")",
":",
"# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]",
"candidates",
"=",
"clean_requires_python",
"(",
"finder",
".",
"find_all_candidates",
"(",
"ireq",... | Find all matching dependencies using the supplied finder and the
given ireq.
:param finder: A package finder for discovering matching candidates.
:type finder: :class:`~pip._internal.index.PackageFinder`
:param ireq: An install requirement.
:type ireq: :class:`~pip._internal.req.req_install.Install... | [
"Find",
"all",
"matching",
"dependencies",
"using",
"the",
"supplied",
"finder",
"and",
"the",
"given",
"ireq",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L57-L77 |
24,856 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_abstract_dependencies | def get_abstract_dependencies(reqs, sources=None, parent=None):
"""Get all abstract dependencies for a given list of requirements.
Given a set of requirements, convert each requirement to an Abstract Dependency.
:param reqs: A list of Requirements
:type reqs: list[:class:`~requirementslib.models.requi... | python | def get_abstract_dependencies(reqs, sources=None, parent=None):
"""Get all abstract dependencies for a given list of requirements.
Given a set of requirements, convert each requirement to an Abstract Dependency.
:param reqs: A list of Requirements
:type reqs: list[:class:`~requirementslib.models.requi... | [
"def",
"get_abstract_dependencies",
"(",
"reqs",
",",
"sources",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"deps",
"=",
"[",
"]",
"from",
".",
"requirements",
"import",
"Requirement",
"for",
"req",
"in",
"reqs",
":",
"if",
"isinstance",
"(",
"re... | Get all abstract dependencies for a given list of requirements.
Given a set of requirements, convert each requirement to an Abstract Dependency.
:param reqs: A list of Requirements
:type reqs: list[:class:`~requirementslib.models.requirements.Requirement`]
:param sources: Pipfile-formatted sources, de... | [
"Get",
"all",
"abstract",
"dependencies",
"for",
"a",
"given",
"list",
"of",
"requirements",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L262-L297 |
24,857 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_dependencies_from_wheel_cache | def get_dependencies_from_wheel_cache(ireq):
"""Retrieves dependencies for the given install requirement from the wheel cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallReq... | python | def get_dependencies_from_wheel_cache(ireq):
"""Retrieves dependencies for the given install requirement from the wheel cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallReq... | [
"def",
"get_dependencies_from_wheel_cache",
"(",
"ireq",
")",
":",
"if",
"ireq",
".",
"editable",
"or",
"not",
"is_pinned_requirement",
"(",
"ireq",
")",
":",
"return",
"matches",
"=",
"WHEEL_CACHE",
".",
"get",
"(",
"ireq",
".",
"link",
",",
"name_from_req",
... | Retrieves dependencies for the given install requirement from the wheel cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.
:rtype: set(str) or None | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"wheel",
"cache",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L337-L354 |
24,858 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_dependencies_from_json | def get_dependencies_from_json(ireq):
"""Retrieves dependencies for the given install requirement from the json api.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.... | python | def get_dependencies_from_json(ireq):
"""Retrieves dependencies for the given install requirement from the json api.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.... | [
"def",
"get_dependencies_from_json",
"(",
"ireq",
")",
":",
"if",
"ireq",
".",
"editable",
"or",
"not",
"is_pinned_requirement",
"(",
"ireq",
")",
":",
"return",
"# It is technically possible to parse extras out of the JSON API's",
"# requirement format, but it is such a chore ... | Retrieves dependencies for the given install requirement from the json api.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.
:rtype: set(str) or None | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"json",
"api",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L362-L408 |
24,859 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_dependencies_from_cache | def get_dependencies_from_cache(ireq):
"""Retrieves dependencies for the given install requirement from the dependency cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequ... | python | def get_dependencies_from_cache(ireq):
"""Retrieves dependencies for the given install requirement from the dependency cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequ... | [
"def",
"get_dependencies_from_cache",
"(",
"ireq",
")",
":",
"if",
"ireq",
".",
"editable",
"or",
"not",
"is_pinned_requirement",
"(",
"ireq",
")",
":",
"return",
"if",
"ireq",
"not",
"in",
"DEPENDENCY_CACHE",
":",
"return",
"cached",
"=",
"set",
"(",
"DEPEN... | Retrieves dependencies for the given install requirement from the dependency cache.
:param ireq: A single InstallRequirement
:type ireq: :class:`~pip._internal.req.req_install.InstallRequirement`
:return: A set of dependency lines for generating new InstallRequirements.
:rtype: set(str) or None | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"dependency",
"cache",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L411-L445 |
24,860 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_dependencies_from_index | def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None):
"""Retrieves dependencies for the given install requirement from the pip resolver.
:param dep: A single InstallRequirement
:type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfil... | python | def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None):
"""Retrieves dependencies for the given install requirement from the pip resolver.
:param dep: A single InstallRequirement
:type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfil... | [
"def",
"get_dependencies_from_index",
"(",
"dep",
",",
"sources",
"=",
"None",
",",
"pip_options",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"finder",
"=",
"get_finder",
"(",
"sources",
"=",
"sources",
",",
"pip_options",
"=",
"pip_options",
")... | Retrieves dependencies for the given install requirement from the pip resolver.
:param dep: A single InstallRequirement
:type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
:param sources: Pipfile-formatted sources, defaults to None
:type sources: list[dict], optional
:return: A se... | [
"Retrieves",
"dependencies",
"for",
"the",
"given",
"install",
"requirement",
"from",
"the",
"pip",
"resolver",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L452-L544 |
24,861 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_pip_options | def get_pip_options(args=[], sources=None, pip_command=None):
"""Build a pip command from a list of sources
:param args: positional arguments passed through to the pip parser
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_comman... | python | def get_pip_options(args=[], sources=None, pip_command=None):
"""Build a pip command from a list of sources
:param args: positional arguments passed through to the pip parser
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_comman... | [
"def",
"get_pip_options",
"(",
"args",
"=",
"[",
"]",
",",
"sources",
"=",
"None",
",",
"pip_command",
"=",
"None",
")",
":",
"if",
"not",
"pip_command",
":",
"pip_command",
"=",
"get_pip_command",
"(",
")",
"if",
"not",
"sources",
":",
"sources",
"=",
... | Build a pip command from a list of sources
:param args: positional arguments passed through to the pip parser
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_command: A pre-built pip command instance
:type pip_command: :class:`~p... | [
"Build",
"a",
"pip",
"command",
"from",
"a",
"list",
"of",
"sources"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L547-L570 |
24,862 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | get_finder | def get_finder(sources=None, pip_command=None, pip_options=None):
# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder
"""Get a package finder for looking up candidates to install
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict... | python | def get_finder(sources=None, pip_command=None, pip_options=None):
# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder
"""Get a package finder for looking up candidates to install
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict... | [
"def",
"get_finder",
"(",
"sources",
"=",
"None",
",",
"pip_command",
"=",
"None",
",",
"pip_options",
"=",
"None",
")",
":",
"# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder",
"if",
"not",
"pip_command",
":",
"pip_command",
"=",
"get_pi... | Get a package finder for looking up candidates to install
:param sources: A list of pipfile-formatted sources, defaults to None
:param sources: list[dict], optional
:param pip_command: A pip command instance, defaults to None
:type pip_command: :class:`~pip._internal.cli.base_command.Command`
:para... | [
"Get",
"a",
"package",
"finder",
"for",
"looking",
"up",
"candidates",
"to",
"install"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L573-L604 |
24,863 | pypa/pipenv | pipenv/vendor/requirementslib/models/dependencies.py | start_resolver | def start_resolver(finder=None, wheel_cache=None):
"""Context manager to produce a resolver.
:param finder: A package finder to use for searching the index
:type finder: :class:`~pip._internal.index.PackageFinder`
:return: A 3-tuple of finder, preparer, resolver
:rtype: (:class:`~pip._internal.oper... | python | def start_resolver(finder=None, wheel_cache=None):
"""Context manager to produce a resolver.
:param finder: A package finder to use for searching the index
:type finder: :class:`~pip._internal.index.PackageFinder`
:return: A 3-tuple of finder, preparer, resolver
:rtype: (:class:`~pip._internal.oper... | [
"def",
"start_resolver",
"(",
"finder",
"=",
"None",
",",
"wheel_cache",
"=",
"None",
")",
":",
"pip_command",
"=",
"get_pip_command",
"(",
")",
"pip_options",
"=",
"get_pip_options",
"(",
"pip_command",
"=",
"pip_command",
")",
"if",
"not",
"finder",
":",
"... | Context manager to produce a resolver.
:param finder: A package finder to use for searching the index
:type finder: :class:`~pip._internal.index.PackageFinder`
:return: A 3-tuple of finder, preparer, resolver
:rtype: (:class:`~pip._internal.operations.prepare.RequirementPreparer`, :class:`~pip._interna... | [
"Context",
"manager",
"to",
"produce",
"a",
"resolver",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L608-L663 |
24,864 | pypa/pipenv | pipenv/vendor/requirementslib/models/cache.py | DependencyCache.write_cache | def write_cache(self):
"""Writes the cache to disk as JSON."""
doc = {
'__format__': 1,
'dependencies': self._cache,
}
with open(self._cache_file, 'w') as f:
json.dump(doc, f, sort_keys=True) | python | def write_cache(self):
"""Writes the cache to disk as JSON."""
doc = {
'__format__': 1,
'dependencies': self._cache,
}
with open(self._cache_file, 'w') as f:
json.dump(doc, f, sort_keys=True) | [
"def",
"write_cache",
"(",
"self",
")",
":",
"doc",
"=",
"{",
"'__format__'",
":",
"1",
",",
"'dependencies'",
":",
"self",
".",
"_cache",
",",
"}",
"with",
"open",
"(",
"self",
".",
"_cache_file",
",",
"'w'",
")",
"as",
"f",
":",
"json",
".",
"dum... | Writes the cache to disk as JSON. | [
"Writes",
"the",
"cache",
"to",
"disk",
"as",
"JSON",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L112-L119 |
24,865 | pypa/pipenv | pipenv/vendor/requirementslib/models/cache.py | DependencyCache.reverse_dependencies | def reverse_dependencies(self, ireqs):
"""
Returns a lookup table of reverse dependencies for all the given ireqs.
Since this is all static, it only works if the dependency cache
contains the complete data, otherwise you end up with a partial view.
This is typically no problem i... | python | def reverse_dependencies(self, ireqs):
"""
Returns a lookup table of reverse dependencies for all the given ireqs.
Since this is all static, it only works if the dependency cache
contains the complete data, otherwise you end up with a partial view.
This is typically no problem i... | [
"def",
"reverse_dependencies",
"(",
"self",
",",
"ireqs",
")",
":",
"ireqs_as_cache_values",
"=",
"[",
"self",
".",
"as_cache_key",
"(",
"ireq",
")",
"for",
"ireq",
"in",
"ireqs",
"]",
"return",
"self",
".",
"_reverse_dependencies",
"(",
"ireqs_as_cache_values",... | Returns a lookup table of reverse dependencies for all the given ireqs.
Since this is all static, it only works if the dependency cache
contains the complete data, otherwise you end up with a partial view.
This is typically no problem if you use this function after the entire
dependency... | [
"Returns",
"a",
"lookup",
"table",
"of",
"reverse",
"dependencies",
"for",
"all",
"the",
"given",
"ireqs",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L151-L161 |
24,866 | pypa/pipenv | pipenv/vendor/requirementslib/models/cache.py | DependencyCache._reverse_dependencies | def _reverse_dependencies(self, cache_keys):
"""
Returns a lookup table of reverse dependencies for all the given cache keys.
Example input:
[('pep8', '1.5.7'),
('flake8', '2.4.0'),
('mccabe', '0.3'),
('pyflakes', '0.8.1')]
Example ou... | python | def _reverse_dependencies(self, cache_keys):
"""
Returns a lookup table of reverse dependencies for all the given cache keys.
Example input:
[('pep8', '1.5.7'),
('flake8', '2.4.0'),
('mccabe', '0.3'),
('pyflakes', '0.8.1')]
Example ou... | [
"def",
"_reverse_dependencies",
"(",
"self",
",",
"cache_keys",
")",
":",
"# First, collect all the dependencies into a sequence of (parent, child) tuples, like [('flake8', 'pep8'),",
"# ('flake8', 'mccabe'), ...]",
"return",
"lookup_table",
"(",
"(",
"key_from_req",
"(",
"Requiremen... | Returns a lookup table of reverse dependencies for all the given cache keys.
Example input:
[('pep8', '1.5.7'),
('flake8', '2.4.0'),
('mccabe', '0.3'),
('pyflakes', '0.8.1')]
Example output:
{'pep8': ['flake8'],
'flake8': []... | [
"Returns",
"a",
"lookup",
"table",
"of",
"reverse",
"dependencies",
"for",
"all",
"the",
"given",
"cache",
"keys",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L163-L186 |
24,867 | pypa/pipenv | pipenv/vendor/requirementslib/models/cache.py | _JSONCache.as_cache_key | def as_cache_key(self, ireq):
"""Given a requirement, return its cache key.
This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this
will return, for example::
("ipython", "2.1.0")
For a requ... | python | def as_cache_key(self, ireq):
"""Given a requirement, return its cache key.
This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this
will return, for example::
("ipython", "2.1.0")
For a requ... | [
"def",
"as_cache_key",
"(",
"self",
",",
"ireq",
")",
":",
"extras",
"=",
"tuple",
"(",
"sorted",
"(",
"ireq",
".",
"extras",
")",
")",
"if",
"not",
"extras",
":",
"extras_string",
"=",
"\"\"",
"else",
":",
"extras_string",
"=",
"\"[{}]\"",
".",
"forma... | Given a requirement, return its cache key.
This behavior is a little weird in order to allow backwards
compatibility with cache files. For a requirement without extras, this
will return, for example::
("ipython", "2.1.0")
For a requirement with extras, the extras will be c... | [
"Given",
"a",
"requirement",
"return",
"its",
"cache",
"key",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L266-L287 |
24,868 | pypa/pipenv | pipenv/patched/notpip/_vendor/lockfile/__init__.py | locked | def locked(path, timeout=None):
"""Decorator which enables locks for decorated function.
Arguments:
- path: path for lockfile.
- timeout (optional): Timeout for acquiring lock.
Usage:
@locked('/var/run/myname', timeout=0)
def myname(...):
...
"""
def decor... | python | def locked(path, timeout=None):
"""Decorator which enables locks for decorated function.
Arguments:
- path: path for lockfile.
- timeout (optional): Timeout for acquiring lock.
Usage:
@locked('/var/run/myname', timeout=0)
def myname(...):
...
"""
def decor... | [
"def",
"locked",
"(",
"path",
",",
"timeout",
"=",
"None",
")",
":",
"def",
"decor",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"lock",
"=",
"F... | Decorator which enables locks for decorated function.
Arguments:
- path: path for lockfile.
- timeout (optional): Timeout for acquiring lock.
Usage:
@locked('/var/run/myname', timeout=0)
def myname(...):
... | [
"Decorator",
"which",
"enables",
"locks",
"for",
"decorated",
"function",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/__init__.py#L315-L337 |
24,869 | pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py | getTreeWalker | def getTreeWalker(treeType, implementation=None, **kwargs):
"""Get a TreeWalker class for various types of tree with built-in support
:arg str treeType: the name of the tree type required (case-insensitive).
Supported values are:
* "dom": The xml.dom.minidom DOM implementation
* "etree... | python | def getTreeWalker(treeType, implementation=None, **kwargs):
"""Get a TreeWalker class for various types of tree with built-in support
:arg str treeType: the name of the tree type required (case-insensitive).
Supported values are:
* "dom": The xml.dom.minidom DOM implementation
* "etree... | [
"def",
"getTreeWalker",
"(",
"treeType",
",",
"implementation",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"treeType",
"=",
"treeType",
".",
"lower",
"(",
")",
"if",
"treeType",
"not",
"in",
"treeWalkerCache",
":",
"if",
"treeType",
"==",
"\"dom\"",
... | Get a TreeWalker class for various types of tree with built-in support
:arg str treeType: the name of the tree type required (case-insensitive).
Supported values are:
* "dom": The xml.dom.minidom DOM implementation
* "etree": A generic walker for tree implementations exposing an
... | [
"Get",
"a",
"TreeWalker",
"class",
"for",
"various",
"types",
"of",
"tree",
"with",
"built",
"-",
"in",
"support"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py#L21-L62 |
24,870 | pypa/pipenv | pipenv/vendor/yaspin/core.py | Yaspin.hide | def hide(self):
"""Hide the spinner to allow for custom writing to the terminal."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and not self._hide_spin.is_set():
# set the hidden spinner flag
self._hide_spin.set()
# clea... | python | def hide(self):
"""Hide the spinner to allow for custom writing to the terminal."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and not self._hide_spin.is_set():
# set the hidden spinner flag
self._hide_spin.set()
# clea... | [
"def",
"hide",
"(",
"self",
")",
":",
"thr_is_alive",
"=",
"self",
".",
"_spin_thread",
"and",
"self",
".",
"_spin_thread",
".",
"is_alive",
"(",
")",
"if",
"thr_is_alive",
"and",
"not",
"self",
".",
"_hide_spin",
".",
"is_set",
"(",
")",
":",
"# set the... | Hide the spinner to allow for custom writing to the terminal. | [
"Hide",
"the",
"spinner",
"to",
"allow",
"for",
"custom",
"writing",
"to",
"the",
"terminal",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L251-L264 |
24,871 | pypa/pipenv | pipenv/vendor/yaspin/core.py | Yaspin.show | def show(self):
"""Show the hidden spinner."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and self._hide_spin.is_set():
# clear the hidden spinner flag
self._hide_spin.clear()
# clear the current line so the spinner is ... | python | def show(self):
"""Show the hidden spinner."""
thr_is_alive = self._spin_thread and self._spin_thread.is_alive()
if thr_is_alive and self._hide_spin.is_set():
# clear the hidden spinner flag
self._hide_spin.clear()
# clear the current line so the spinner is ... | [
"def",
"show",
"(",
"self",
")",
":",
"thr_is_alive",
"=",
"self",
".",
"_spin_thread",
"and",
"self",
".",
"_spin_thread",
".",
"is_alive",
"(",
")",
"if",
"thr_is_alive",
"and",
"self",
".",
"_hide_spin",
".",
"is_set",
"(",
")",
":",
"# clear the hidden... | Show the hidden spinner. | [
"Show",
"the",
"hidden",
"spinner",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L266-L276 |
24,872 | pypa/pipenv | pipenv/vendor/yaspin/core.py | Yaspin.write | def write(self, text):
"""Write text in the terminal without breaking the spinner."""
# similar to tqdm.write()
# https://pypi.python.org/pypi/tqdm#writing-messages
sys.stdout.write("\r")
self._clear_line()
_text = to_unicode(text)
if PY2:
_text = _te... | python | def write(self, text):
"""Write text in the terminal without breaking the spinner."""
# similar to tqdm.write()
# https://pypi.python.org/pypi/tqdm#writing-messages
sys.stdout.write("\r")
self._clear_line()
_text = to_unicode(text)
if PY2:
_text = _te... | [
"def",
"write",
"(",
"self",
",",
"text",
")",
":",
"# similar to tqdm.write()",
"# https://pypi.python.org/pypi/tqdm#writing-messages",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"\\r\"",
")",
"self",
".",
"_clear_line",
"(",
")",
"_text",
"=",
"to_unicode",
"(",... | Write text in the terminal without breaking the spinner. | [
"Write",
"text",
"in",
"the",
"terminal",
"without",
"breaking",
"the",
"spinner",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L278-L292 |
24,873 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | RevOptions.to_args | def to_args(self):
# type: () -> List[str]
"""
Return the VCS-specific command arguments.
"""
args = [] # type: List[str]
rev = self.arg_rev
if rev is not None:
args += self.vcs.get_base_rev_args(rev)
args += self.extra_args
return ar... | python | def to_args(self):
# type: () -> List[str]
"""
Return the VCS-specific command arguments.
"""
args = [] # type: List[str]
rev = self.arg_rev
if rev is not None:
args += self.vcs.get_base_rev_args(rev)
args += self.extra_args
return ar... | [
"def",
"to_args",
"(",
"self",
")",
":",
"# type: () -> List[str]",
"args",
"=",
"[",
"]",
"# type: List[str]",
"rev",
"=",
"self",
".",
"arg_rev",
"if",
"rev",
"is",
"not",
"None",
":",
"args",
"+=",
"self",
".",
"vcs",
".",
"get_base_rev_args",
"(",
"r... | Return the VCS-specific command arguments. | [
"Return",
"the",
"VCS",
"-",
"specific",
"command",
"arguments",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L71-L82 |
24,874 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | RevOptions.make_new | def make_new(self, rev):
# type: (str) -> RevOptions
"""
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
"""
return self.vcs.make_rev_options(rev, extra_args=self.extra_args) | python | def make_new(self, rev):
# type: (str) -> RevOptions
"""
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
"""
return self.vcs.make_rev_options(rev, extra_args=self.extra_args) | [
"def",
"make_new",
"(",
"self",
",",
"rev",
")",
":",
"# type: (str) -> RevOptions",
"return",
"self",
".",
"vcs",
".",
"make_rev_options",
"(",
"rev",
",",
"extra_args",
"=",
"self",
".",
"extra_args",
")"
] | Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object. | [
"Make",
"a",
"copy",
"of",
"the",
"current",
"instance",
"but",
"with",
"a",
"new",
"rev",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L91-L99 |
24,875 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | VersionControl.get_url_rev_and_auth | def get_url_rev_and_auth(self, url):
# type: (str) -> Tuple[str, Optional[str], AuthInfo]
"""
Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)).
"""
scheme, netloc, path, query, frag = u... | python | def get_url_rev_and_auth(self, url):
# type: (str) -> Tuple[str, Optional[str], AuthInfo]
"""
Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)).
"""
scheme, netloc, path, query, frag = u... | [
"def",
"get_url_rev_and_auth",
"(",
"self",
",",
"url",
")",
":",
"# type: (str) -> Tuple[str, Optional[str], AuthInfo]",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"frag",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"'+'",
"not",
... | Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)). | [
"Parse",
"the",
"repository",
"URL",
"to",
"use",
"and",
"return",
"the",
"URL",
"revision",
"and",
"auth",
"info",
"to",
"use",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L248-L270 |
24,876 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | VersionControl.compare_urls | def compare_urls(self, url1, url2):
# type: (str, str) -> bool
"""
Compare two repo URLs for identity, ignoring incidental differences.
"""
return (self.normalize_url(url1) == self.normalize_url(url2)) | python | def compare_urls(self, url1, url2):
# type: (str, str) -> bool
"""
Compare two repo URLs for identity, ignoring incidental differences.
"""
return (self.normalize_url(url1) == self.normalize_url(url2)) | [
"def",
"compare_urls",
"(",
"self",
",",
"url1",
",",
"url2",
")",
":",
"# type: (str, str) -> bool",
"return",
"(",
"self",
".",
"normalize_url",
"(",
"url1",
")",
"==",
"self",
".",
"normalize_url",
"(",
"url2",
")",
")"
] | Compare two repo URLs for identity, ignoring incidental differences. | [
"Compare",
"two",
"repo",
"URLs",
"for",
"identity",
"ignoring",
"incidental",
"differences",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L299-L304 |
24,877 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | VersionControl.obtain | def obtain(self, dest):
# type: (str) -> None
"""
Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update.
"""
url, rev_options = self.get_url_rev_optio... | python | def obtain(self, dest):
# type: (str) -> None
"""
Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update.
"""
url, rev_options = self.get_url_rev_optio... | [
"def",
"obtain",
"(",
"self",
",",
"dest",
")",
":",
"# type: (str) -> None",
"url",
",",
"rev_options",
"=",
"self",
".",
"get_url_rev_options",
"(",
"self",
".",
"url",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"self"... | Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update. | [
"Install",
"or",
"update",
"in",
"editable",
"mode",
"the",
"package",
"represented",
"by",
"this",
"VersionControl",
"object",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L345-L436 |
24,878 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | VersionControl.run_command | def run_command(
cls,
cmd, # type: List[str]
show_stdout=True, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
extra_e... | python | def run_command(
cls,
cmd, # type: List[str]
show_stdout=True, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
extra_e... | [
"def",
"run_command",
"(",
"cls",
",",
"cmd",
",",
"# type: List[str]",
"show_stdout",
"=",
"True",
",",
"# type: bool",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"on_returncode",
"=",
"'raise'",
",",
"# type: str",
"extra_ok_returncodes",
"=",
"None",
","... | Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the VCS
command name, and checks that the VCS is available | [
"Run",
"a",
"VCS",
"subcommand",
"This",
"is",
"simply",
"a",
"wrapper",
"around",
"call_subprocess",
"that",
"adds",
"the",
"VCS",
"command",
"name",
"and",
"checks",
"that",
"the",
"VCS",
"is",
"available"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L476-L511 |
24,879 | pypa/pipenv | pipenv/patched/notpip/_internal/vcs/__init__.py | VersionControl.is_repository_directory | def is_repository_directory(cls, path):
# type: (str) -> bool
"""
Return whether a directory path is a repository directory.
"""
logger.debug('Checking in %s for %s (%s)...',
path, cls.dirname, cls.name)
return os.path.exists(os.path.join(path, cls.di... | python | def is_repository_directory(cls, path):
# type: (str) -> bool
"""
Return whether a directory path is a repository directory.
"""
logger.debug('Checking in %s for %s (%s)...',
path, cls.dirname, cls.name)
return os.path.exists(os.path.join(path, cls.di... | [
"def",
"is_repository_directory",
"(",
"cls",
",",
"path",
")",
":",
"# type: (str) -> bool",
"logger",
".",
"debug",
"(",
"'Checking in %s for %s (%s)...'",
",",
"path",
",",
"cls",
".",
"dirname",
",",
"cls",
".",
"name",
")",
"return",
"os",
".",
"path",
... | Return whether a directory path is a repository directory. | [
"Return",
"whether",
"a",
"directory",
"path",
"is",
"a",
"repository",
"directory",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L514-L521 |
24,880 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | compress_for_rename | def compress_for_rename(paths):
"""Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk.
"""
case_map = dict((os.path.normcase(p), p) for p in paths)
remaining = set(case_map)
unchecked =... | python | def compress_for_rename(paths):
"""Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk.
"""
case_map = dict((os.path.normcase(p), p) for p in paths)
remaining = set(case_map)
unchecked =... | [
"def",
"compress_for_rename",
"(",
"paths",
")",
":",
"case_map",
"=",
"dict",
"(",
"(",
"os",
".",
"path",
".",
"normcase",
"(",
"p",
")",
",",
"p",
")",
"for",
"p",
"in",
"paths",
")",
"remaining",
"=",
"set",
"(",
"case_map",
")",
"unchecked",
"... | Returns a set containing the paths that need to be renamed.
This set may include directories when the original sequence of paths
included every file on disk. | [
"Returns",
"a",
"set",
"containing",
"the",
"paths",
"that",
"need",
"to",
"be",
"renamed",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L99-L134 |
24,881 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | compress_for_output_listing | def compress_for_output_listing(paths):
"""Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are remov... | python | def compress_for_output_listing(paths):
"""Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are remov... | [
"def",
"compress_for_output_listing",
"(",
"paths",
")",
":",
"will_remove",
"=",
"list",
"(",
"paths",
")",
"will_skip",
"=",
"set",
"(",
")",
"# Determine folders and files",
"folders",
"=",
"set",
"(",
")",
"files",
"=",
"set",
"(",
")",
"for",
"path",
... | Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are removed.
The second set contains files that wou... | [
"Returns",
"a",
"tuple",
"of",
"2",
"sets",
"of",
"which",
"paths",
"to",
"display",
"to",
"user"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L137-L183 |
24,882 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | StashedUninstallPathSet._get_directory_stash | def _get_directory_stash(self, path):
"""Stashes a directory.
Directories are stashed adjacent to their original location if
possible, or else moved/copied into the user's temp dir."""
try:
save_dir = AdjacentTempDirectory(path)
save_dir.create()
except ... | python | def _get_directory_stash(self, path):
"""Stashes a directory.
Directories are stashed adjacent to their original location if
possible, or else moved/copied into the user's temp dir."""
try:
save_dir = AdjacentTempDirectory(path)
save_dir.create()
except ... | [
"def",
"_get_directory_stash",
"(",
"self",
",",
"path",
")",
":",
"try",
":",
"save_dir",
"=",
"AdjacentTempDirectory",
"(",
"path",
")",
"save_dir",
".",
"create",
"(",
")",
"except",
"OSError",
":",
"save_dir",
"=",
"TempDirectory",
"(",
"kind",
"=",
"\... | Stashes a directory.
Directories are stashed adjacent to their original location if
possible, or else moved/copied into the user's temp dir. | [
"Stashes",
"a",
"directory",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L197-L211 |
24,883 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | StashedUninstallPathSet._get_file_stash | def _get_file_stash(self, path):
"""Stashes a file.
If no root has been provided, one will be created for the directory
in the user's temp directory."""
path = os.path.normcase(path)
head, old_head = os.path.dirname(path), None
save_dir = None
while head != old_... | python | def _get_file_stash(self, path):
"""Stashes a file.
If no root has been provided, one will be created for the directory
in the user's temp directory."""
path = os.path.normcase(path)
head, old_head = os.path.dirname(path), None
save_dir = None
while head != old_... | [
"def",
"_get_file_stash",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"path",
")",
"head",
",",
"old_head",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
",",
"None",
"save_dir",
"=",
"None"... | Stashes a file.
If no root has been provided, one will be created for the directory
in the user's temp directory. | [
"Stashes",
"a",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L213-L239 |
24,884 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | StashedUninstallPathSet.stash | def stash(self, path):
"""Stashes the directory or file and returns its new location.
"""
if os.path.isdir(path):
new_path = self._get_directory_stash(path)
else:
new_path = self._get_file_stash(path)
self._moves.append((path, new_path))
if os.pat... | python | def stash(self, path):
"""Stashes the directory or file and returns its new location.
"""
if os.path.isdir(path):
new_path = self._get_directory_stash(path)
else:
new_path = self._get_file_stash(path)
self._moves.append((path, new_path))
if os.pat... | [
"def",
"stash",
"(",
"self",
",",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"new_path",
"=",
"self",
".",
"_get_directory_stash",
"(",
"path",
")",
"else",
":",
"new_path",
"=",
"self",
".",
"_get_file_stash",
"(... | Stashes the directory or file and returns its new location. | [
"Stashes",
"the",
"directory",
"or",
"file",
"and",
"returns",
"its",
"new",
"location",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L241-L258 |
24,885 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | StashedUninstallPathSet.commit | def commit(self):
"""Commits the uninstall by removing stashed files."""
for _, save_dir in self._save_dirs.items():
save_dir.cleanup()
self._moves = []
self._save_dirs = {} | python | def commit(self):
"""Commits the uninstall by removing stashed files."""
for _, save_dir in self._save_dirs.items():
save_dir.cleanup()
self._moves = []
self._save_dirs = {} | [
"def",
"commit",
"(",
"self",
")",
":",
"for",
"_",
",",
"save_dir",
"in",
"self",
".",
"_save_dirs",
".",
"items",
"(",
")",
":",
"save_dir",
".",
"cleanup",
"(",
")",
"self",
".",
"_moves",
"=",
"[",
"]",
"self",
".",
"_save_dirs",
"=",
"{",
"}... | Commits the uninstall by removing stashed files. | [
"Commits",
"the",
"uninstall",
"by",
"removing",
"stashed",
"files",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L260-L265 |
24,886 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | StashedUninstallPathSet.rollback | def rollback(self):
"""Undoes the uninstall by moving stashed files back."""
for p in self._moves:
logging.info("Moving to %s\n from %s", *p)
for new_path, path in self._moves:
try:
logger.debug('Replacing %s from %s', new_path, path)
if o... | python | def rollback(self):
"""Undoes the uninstall by moving stashed files back."""
for p in self._moves:
logging.info("Moving to %s\n from %s", *p)
for new_path, path in self._moves:
try:
logger.debug('Replacing %s from %s', new_path, path)
if o... | [
"def",
"rollback",
"(",
"self",
")",
":",
"for",
"p",
"in",
"self",
".",
"_moves",
":",
"logging",
".",
"info",
"(",
"\"Moving to %s\\n from %s\"",
",",
"*",
"p",
")",
"for",
"new_path",
",",
"path",
"in",
"self",
".",
"_moves",
":",
"try",
":",
"log... | Undoes the uninstall by moving stashed files back. | [
"Undoes",
"the",
"uninstall",
"by",
"moving",
"stashed",
"files",
"back",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L267-L284 |
24,887 | pypa/pipenv | pipenv/patched/notpip/_internal/req/req_uninstall.py | UninstallPathSet._allowed_to_proceed | def _allowed_to_proceed(self, verbose):
"""Display which files would be deleted and prompt for confirmation
"""
def _display(msg, paths):
if not paths:
return
logger.info(msg)
with indent_log():
for path in sorted(compact(path... | python | def _allowed_to_proceed(self, verbose):
"""Display which files would be deleted and prompt for confirmation
"""
def _display(msg, paths):
if not paths:
return
logger.info(msg)
with indent_log():
for path in sorted(compact(path... | [
"def",
"_allowed_to_proceed",
"(",
"self",
",",
"verbose",
")",
":",
"def",
"_display",
"(",
"msg",
",",
"paths",
")",
":",
"if",
"not",
"paths",
":",
"return",
"logger",
".",
"info",
"(",
"msg",
")",
"with",
"indent_log",
"(",
")",
":",
"for",
"path... | Display which files would be deleted and prompt for confirmation | [
"Display",
"which",
"files",
"would",
"be",
"deleted",
"and",
"prompt",
"for",
"confirmation"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L368-L395 |
24,888 | pypa/pipenv | pipenv/vendor/pexpect/utils.py | is_executable_file | def is_executable_file(path):
"""Checks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
"""
# follow symlinks,
fpath = os.path.realpath(path)
if not os.path.isfile(fpath):
# non-files (directories... | python | def is_executable_file(path):
"""Checks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
"""
# follow symlinks,
fpath = os.path.realpath(path)
if not os.path.isfile(fpath):
# non-files (directories... | [
"def",
"is_executable_file",
"(",
"path",
")",
":",
"# follow symlinks,",
"fpath",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"fpath",
")",
":",
"# non-files (directories, fifo, etc.)",
"ret... | Checks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``. | [
"Checks",
"that",
"path",
"is",
"an",
"executable",
"regular",
"file",
"or",
"a",
"symlink",
"towards",
"one",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L20-L45 |
24,889 | pypa/pipenv | pipenv/vendor/pexpect/utils.py | split_command_line | def split_command_line(command_line):
'''This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command li... | python | def split_command_line(command_line):
'''This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command li... | [
"def",
"split_command_line",
"(",
"command_line",
")",
":",
"arg_list",
"=",
"[",
"]",
"arg",
"=",
"''",
"# Constants to name the states we can be in.",
"state_basic",
"=",
"0",
"state_esc",
"=",
"1",
"state_singlequote",
"=",
"2",
"state_doublequote",
"=",
"3",
"... | This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command line. | [
"This",
"splits",
"a",
"command",
"line",
"into",
"a",
"list",
"of",
"arguments",
".",
"It",
"splits",
"arguments",
"on",
"spaces",
"but",
"handles",
"embedded",
"quotes",
"doublequotes",
"and",
"escaped",
"characters",
".",
"It",
"s",
"impossible",
"to",
"d... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L69-L127 |
24,890 | pypa/pipenv | pipenv/vendor/pexpect/utils.py | poll_ignore_interrupts | def poll_ignore_interrupts(fds, timeout=None):
'''Simple wrapper around poll to register file descriptors and
ignore signals.'''
if timeout is not None:
end_time = time.time() + timeout
poller = select.poll()
for fd in fds:
poller.register(fd, select.POLLIN | select.POLLPRI | selec... | python | def poll_ignore_interrupts(fds, timeout=None):
'''Simple wrapper around poll to register file descriptors and
ignore signals.'''
if timeout is not None:
end_time = time.time() + timeout
poller = select.poll()
for fd in fds:
poller.register(fd, select.POLLIN | select.POLLPRI | selec... | [
"def",
"poll_ignore_interrupts",
"(",
"fds",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
"is",
"not",
"None",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"timeout",
"poller",
"=",
"select",
".",
"poll",
"(",
")",
"for",
"fd"... | Simple wrapper around poll to register file descriptors and
ignore signals. | [
"Simple",
"wrapper",
"around",
"poll",
"to",
"register",
"file",
"descriptors",
"and",
"ignore",
"signals",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L159-L187 |
24,891 | pypa/pipenv | pipenv/vendor/distlib/version.py | _suggest_semantic_version | def _suggest_semantic_version(s):
"""
Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything.
"""
result = s.strip().lower()
for pat, repl in _REPLACEMENTS:
result = pat.sub(repl, result)
if not result:
result = '0.0.... | python | def _suggest_semantic_version(s):
"""
Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything.
"""
result = s.strip().lower()
for pat, repl in _REPLACEMENTS:
result = pat.sub(repl, result)
if not result:
result = '0.0.... | [
"def",
"_suggest_semantic_version",
"(",
"s",
")",
":",
"result",
"=",
"s",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"for",
"pat",
",",
"repl",
"in",
"_REPLACEMENTS",
":",
"result",
"=",
"pat",
".",
"sub",
"(",
"repl",
",",
"result",
")",
"i... | Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything. | [
"Try",
"to",
"suggest",
"a",
"semantic",
"form",
"for",
"a",
"version",
"for",
"which",
"_suggest_normalized_version",
"couldn",
"t",
"come",
"up",
"with",
"anything",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L406-L449 |
24,892 | pypa/pipenv | pipenv/vendor/distlib/version.py | _suggest_normalized_version | def _suggest_normalized_version(s):
"""Suggest a normalized version close to the given version string.
If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.
This does a n... | python | def _suggest_normalized_version(s):
"""Suggest a normalized version close to the given version string.
If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.
This does a n... | [
"def",
"_suggest_normalized_version",
"(",
"s",
")",
":",
"try",
":",
"_normalized_key",
"(",
"s",
")",
"return",
"s",
"# already rational",
"except",
"UnsupportedVersionError",
":",
"pass",
"rs",
"=",
"s",
".",
"lower",
"(",
")",
"# part of this could use maketra... | Suggest a normalized version close to the given version string.
If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.
This does a number of simple normalizations to the given... | [
"Suggest",
"a",
"normalized",
"version",
"close",
"to",
"the",
"given",
"version",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L452-L560 |
24,893 | pypa/pipenv | pipenv/vendor/distlib/version.py | Matcher.match | def match(self, version):
"""
Check if the provided version matches the constraints.
:param version: The version to match against this instance.
:type version: String or :class:`Version` instance.
"""
if isinstance(version, string_types):
version = self.versi... | python | def match(self, version):
"""
Check if the provided version matches the constraints.
:param version: The version to match against this instance.
:type version: String or :class:`Version` instance.
"""
if isinstance(version, string_types):
version = self.versi... | [
"def",
"match",
"(",
"self",
",",
"version",
")",
":",
"if",
"isinstance",
"(",
"version",
",",
"string_types",
")",
":",
"version",
"=",
"self",
".",
"version_class",
"(",
"version",
")",
"for",
"operator",
",",
"constraint",
",",
"prefix",
"in",
"self"... | Check if the provided version matches the constraints.
:param version: The version to match against this instance.
:type version: String or :class:`Version` instance. | [
"Check",
"if",
"the",
"provided",
"version",
"matches",
"the",
"constraints",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L129-L148 |
24,894 | pypa/pipenv | pipenv/vendor/dotenv/main.py | _walk_to_root | def _walk_to_root(path):
"""
Yield directories starting from the given directory up to the root
"""
if not os.path.exists(path):
raise IOError('Starting path not found')
if os.path.isfile(path):
path = os.path.dirname(path)
last_dir = None
current_dir = os.path.abspath(path... | python | def _walk_to_root(path):
"""
Yield directories starting from the given directory up to the root
"""
if not os.path.exists(path):
raise IOError('Starting path not found')
if os.path.isfile(path):
path = os.path.dirname(path)
last_dir = None
current_dir = os.path.abspath(path... | [
"def",
"_walk_to_root",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"IOError",
"(",
"'Starting path not found'",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"path",
"="... | Yield directories starting from the given directory up to the root | [
"Yield",
"directories",
"starting",
"from",
"the",
"given",
"directory",
"up",
"to",
"the",
"root"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L260-L275 |
24,895 | pypa/pipenv | pipenv/vendor/dotenv/main.py | run_command | def run_command(command, env):
"""Run command in sub process.
Runs the command in a sub process with the variables from `env`
added in the current environment variables.
Parameters
----------
command: List[str]
The command and it's parameters
env: Dict
The additional enviro... | python | def run_command(command, env):
"""Run command in sub process.
Runs the command in a sub process with the variables from `env`
added in the current environment variables.
Parameters
----------
command: List[str]
The command and it's parameters
env: Dict
The additional enviro... | [
"def",
"run_command",
"(",
"command",
",",
"env",
")",
":",
"# copy the current environment variables and add the vales from",
"# `env`",
"cmd_env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"cmd_env",
".",
"update",
"(",
"env",
")",
"p",
"=",
"Popen",
... | Run command in sub process.
Runs the command in a sub process with the variables from `env`
added in the current environment variables.
Parameters
----------
command: List[str]
The command and it's parameters
env: Dict
The additional environment variables
Returns
-----... | [
"Run",
"command",
"in",
"sub",
"process",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L317-L348 |
24,896 | pypa/pipenv | pipenv/vendor/dotenv/main.py | DotEnv.dict | def dict(self):
"""Return dotenv as dict"""
if self._dict:
return self._dict
values = OrderedDict(self.parse())
self._dict = resolve_nested_variables(values)
return self._dict | python | def dict(self):
"""Return dotenv as dict"""
if self._dict:
return self._dict
values = OrderedDict(self.parse())
self._dict = resolve_nested_variables(values)
return self._dict | [
"def",
"dict",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dict",
":",
"return",
"self",
".",
"_dict",
"values",
"=",
"OrderedDict",
"(",
"self",
".",
"parse",
"(",
")",
")",
"self",
".",
"_dict",
"=",
"resolve_nested_variables",
"(",
"values",
")",
... | Return dotenv as dict | [
"Return",
"dotenv",
"as",
"dict"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L110-L117 |
24,897 | pypa/pipenv | pipenv/vendor/dotenv/main.py | DotEnv.set_as_environment_variables | def set_as_environment_variables(self, override=False):
"""
Load the current dotenv as system environemt variable.
"""
for k, v in self.dict().items():
if k in os.environ and not override:
continue
# With Python2 on Windows, force environment varia... | python | def set_as_environment_variables(self, override=False):
"""
Load the current dotenv as system environemt variable.
"""
for k, v in self.dict().items():
if k in os.environ and not override:
continue
# With Python2 on Windows, force environment varia... | [
"def",
"set_as_environment_variables",
"(",
"self",
",",
"override",
"=",
"False",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"dict",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"os",
".",
"environ",
"and",
"not",
"override",
":... | Load the current dotenv as system environemt variable. | [
"Load",
"the",
"current",
"dotenv",
"as",
"system",
"environemt",
"variable",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L125-L140 |
24,898 | pypa/pipenv | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | inject_into_urllib3 | def inject_into_urllib3():
'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.'
_validate_dependencies_met()
util.ssl_.SSLContext = PyOpenSSLContext
util.HAS_SNI = HAS_SNI
util.ssl_.HAS_SNI = HAS_SNI
util.IS_PYOPENSSL = True
util.ssl_.IS_PYOPENSSL = True | python | def inject_into_urllib3():
'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.'
_validate_dependencies_met()
util.ssl_.SSLContext = PyOpenSSLContext
util.HAS_SNI = HAS_SNI
util.ssl_.HAS_SNI = HAS_SNI
util.IS_PYOPENSSL = True
util.ssl_.IS_PYOPENSSL = True | [
"def",
"inject_into_urllib3",
"(",
")",
":",
"_validate_dependencies_met",
"(",
")",
"util",
".",
"ssl_",
".",
"SSLContext",
"=",
"PyOpenSSLContext",
"util",
".",
"HAS_SNI",
"=",
"HAS_SNI",
"util",
".",
"ssl_",
".",
"HAS_SNI",
"=",
"HAS_SNI",
"util",
".",
"I... | Monkey-patch urllib3 with PyOpenSSL-backed SSL-support. | [
"Monkey",
"-",
"patch",
"urllib3",
"with",
"PyOpenSSL",
"-",
"backed",
"SSL",
"-",
"support",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L115-L124 |
24,899 | pypa/pipenv | pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py | _validate_dependencies_met | def _validate_dependencies_met():
"""
Verifies that PyOpenSSL's package-level dependencies have been met.
Throws `ImportError` if they are not met.
"""
# Method added in `cryptography==1.1`; not available in older versions
from cryptography.x509.extensions import Extensions
if getattr(Extens... | python | def _validate_dependencies_met():
"""
Verifies that PyOpenSSL's package-level dependencies have been met.
Throws `ImportError` if they are not met.
"""
# Method added in `cryptography==1.1`; not available in older versions
from cryptography.x509.extensions import Extensions
if getattr(Extens... | [
"def",
"_validate_dependencies_met",
"(",
")",
":",
"# Method added in `cryptography==1.1`; not available in older versions",
"from",
"cryptography",
".",
"x509",
".",
"extensions",
"import",
"Extensions",
"if",
"getattr",
"(",
"Extensions",
",",
"\"get_extension_for_class\"",
... | Verifies that PyOpenSSL's package-level dependencies have been met.
Throws `ImportError` if they are not met. | [
"Verifies",
"that",
"PyOpenSSL",
"s",
"package",
"-",
"level",
"dependencies",
"have",
"been",
"met",
".",
"Throws",
"ImportError",
"if",
"they",
"are",
"not",
"met",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L137-L154 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.