partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | ParseBaseException.markInputline | Extracts the exception line from the input string, and marks
the location of the exception with a special symbol. | pipenv/vendor/pyparsing.py | def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "".join(... | def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "".join(... | [
"Extracts",
"the",
"exception",
"line",
"from",
"the",
"input",
"string",
"and",
"marks",
"the",
"location",
"of",
"the",
"exception",
"with",
"a",
"special",
"symbol",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L279-L288 | [
"def",
"markInputline",
"(",
"self",
",",
"markerString",
"=",
"\">!<\"",
")",
":",
"line_str",
"=",
"self",
".",
"line",
"line_column",
"=",
"self",
".",
"column",
"-",
"1",
"if",
"markerString",
":",
"line_str",
"=",
"\"\"",
".",
"join",
"(",
"(",
"l... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseException.explain | Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in support
of Python exceptions that might be ... | pipenv/vendor/pyparsing.py | def explain(exc, depth=16):
"""
Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in suppor... | def explain(exc, depth=16):
"""
Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in suppor... | [
"Method",
"to",
"take",
"an",
"exception",
"and",
"translate",
"the",
"Python",
"internal",
"traceback",
"into",
"a",
"list",
"of",
"the",
"pyparsing",
"expressions",
"that",
"caused",
"the",
"exception",
"to",
"be",
"raised",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L316-L382 | [
"def",
"explain",
"(",
"exc",
",",
"depth",
"=",
"16",
")",
":",
"import",
"inspect",
"if",
"depth",
"is",
"None",
":",
"depth",
"=",
"sys",
".",
"getrecursionlimit",
"(",
")",
"ret",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"exc",
",",
"ParseBaseExce... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.pop | Removes and returns item at specified index (default= ``last``).
Supports both ``list`` and ``dict`` semantics for ``pop()``. If
passed no argument or an integer argument, it will use ``list``
semantics and pop tokens from the list of parsed tokens. If passed
a non-integer argument (most... | pipenv/vendor/pyparsing.py | def pop( self, *args, **kwargs):
"""
Removes and returns item at specified index (default= ``last``).
Supports both ``list`` and ``dict`` semantics for ``pop()``. If
passed no argument or an integer argument, it will use ``list``
semantics and pop tokens from the list of parsed t... | def pop( self, *args, **kwargs):
"""
Removes and returns item at specified index (default= ``last``).
Supports both ``list`` and ``dict`` semantics for ``pop()``. If
passed no argument or an integer argument, it will use ``list``
semantics and pop tokens from the list of parsed t... | [
"Removes",
"and",
"returns",
"item",
"at",
"specified",
"index",
"(",
"default",
"=",
"last",
")",
".",
"Supports",
"both",
"list",
"and",
"dict",
"semantics",
"for",
"pop",
"()",
".",
"If",
"passed",
"no",
"argument",
"or",
"an",
"integer",
"argument",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L622-L675 | [
"def",
"pop",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"args",
":",
"args",
"=",
"[",
"-",
"1",
"]",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'default'",
":",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.extend | Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
tokens.extend(reversed([t[::-1] f... | pipenv/vendor/pyparsing.py | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
... | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
... | [
"Add",
"sequence",
"of",
"elements",
"to",
"end",
"of",
"ParseResults",
"list",
"of",
"elements",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L736-L753 | [
"def",
"extend",
"(",
"self",
",",
"itemseq",
")",
":",
"if",
"isinstance",
"(",
"itemseq",
",",
"ParseResults",
")",
":",
"self",
"+=",
"itemseq",
"else",
":",
"self",
".",
"__toklist",
".",
"extend",
"(",
"itemseq",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.asList | Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing ParseResults
... | pipenv/vendor/pyparsing.py | def asList( self ):
"""
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it i... | def asList( self ):
"""
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it i... | [
"Returns",
"the",
"parse",
"results",
"as",
"a",
"nested",
"list",
"of",
"matching",
"tokens",
"all",
"converted",
"to",
"strings",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L822-L837 | [
"def",
"asList",
"(",
"self",
")",
":",
"return",
"[",
"res",
".",
"asList",
"(",
")",
"if",
"isinstance",
"(",
"res",
",",
"ParseResults",
")",
"else",
"res",
"for",
"res",
"in",
"self",
".",
"__toklist",
"]"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.asDict | Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(result), repr(result)) # -> <class 'pyparsin... | pipenv/vendor/pyparsing.py | def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(resu... | def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(resu... | [
"Returns",
"the",
"named",
"parse",
"results",
"as",
"a",
"nested",
"dictionary",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L839-L873 | [
"def",
"asDict",
"(",
"self",
")",
":",
"if",
"PY_3",
":",
"item_fn",
"=",
"self",
".",
"items",
"else",
":",
"item_fn",
"=",
"self",
".",
"iteritems",
"def",
"toItem",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"ParseResults",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.getName | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(nums, a... | pipenv/vendor/pyparsing.py | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = S... | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = S... | [
"r",
"Returns",
"the",
"results",
"name",
"for",
"this",
"token",
"expression",
".",
"Useful",
"when",
"several",
"different",
"expressions",
"might",
"match",
"at",
"a",
"particular",
"location",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L954-L992 | [
"def",
"getName",
"(",
"self",
")",
":",
"if",
"self",
".",
"__name",
":",
"return",
"self",
".",
"__name",
"elif",
"self",
".",
"__parent",
":",
"par",
"=",
"self",
".",
"__parent",
"(",
")",
"if",
"par",
":",
"return",
"par",
".",
"__lookup",
"("... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.dump | Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") +... | pipenv/vendor/pyparsing.py | def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
integer = Word(nums... | def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
integer = Word(nums... | [
"Diagnostic",
"method",
"for",
"listing",
"out",
"the",
"contents",
"of",
"a",
":",
"class",
":",
"ParseResults",
".",
"Accepts",
"an",
"optional",
"indent",
"argument",
"so",
"that",
"this",
"string",
"can",
"be",
"embedded",
"in",
"a",
"nested",
"display",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L994-L1040 | [
"def",
"dump",
"(",
"self",
",",
"indent",
"=",
"''",
",",
"depth",
"=",
"0",
",",
"full",
"=",
"True",
")",
":",
"out",
"=",
"[",
"]",
"NL",
"=",
"'\\n'",
"out",
".",
"append",
"(",
"indent",
"+",
"_ustr",
"(",
"self",
".",
"asList",
"(",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseResults.pprint | Pretty-printer for parsed results as a list, using the
`pprint <https://docs.python.org/3/library/pprint.html>`_ module.
Accepts additional positional or keyword args as defined for
`pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ .
Example::
i... | pipenv/vendor/pyparsing.py | def pprint(self, *args, **kwargs):
"""
Pretty-printer for parsed results as a list, using the
`pprint <https://docs.python.org/3/library/pprint.html>`_ module.
Accepts additional positional or keyword args as defined for
`pprint.pprint <https://docs.python.org/3/library/pprint.ht... | def pprint(self, *args, **kwargs):
"""
Pretty-printer for parsed results as a list, using the
`pprint <https://docs.python.org/3/library/pprint.html>`_ module.
Accepts additional positional or keyword args as defined for
`pprint.pprint <https://docs.python.org/3/library/pprint.ht... | [
"Pretty",
"-",
"printer",
"for",
"parsed",
"results",
"as",
"a",
"list",
"using",
"the",
"pprint",
"<https",
":",
"//",
"docs",
".",
"python",
".",
"org",
"/",
"3",
"/",
"library",
"/",
"pprint",
".",
"html",
">",
"_",
"module",
".",
"Accepts",
"addi... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1042-L1067 | [
"def",
"pprint",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pprint",
".",
"pprint",
"(",
"self",
".",
"asList",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.copy | Make a copy of this :class:`ParserElement`. Useful for defining
different parse actions for the same parsing pattern, using copies of
the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().addParse... | pipenv/vendor/pyparsing.py | def copy( self ):
"""
Make a copy of this :class:`ParserElement`. Useful for defining
different parse actions for the same parsing pattern, using copies of
the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
... | def copy( self ):
"""
Make a copy of this :class:`ParserElement`. Useful for defining
different parse actions for the same parsing pattern, using copies of
the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
... | [
"Make",
"a",
"copy",
"of",
"this",
":",
"class",
":",
"ParserElement",
".",
"Useful",
"for",
"defining",
"different",
"parse",
"actions",
"for",
"the",
"same",
"parsing",
"pattern",
"using",
"copies",
"of",
"the",
"original",
"parse",
"element",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1300-L1327 | [
"def",
"copy",
"(",
"self",
")",
":",
"cpy",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"cpy",
".",
"parseAction",
"=",
"self",
".",
"parseAction",
"[",
":",
"]",
"cpy",
".",
"ignoreExprs",
"=",
"self",
".",
"ignoreExprs",
"[",
":",
"]",
"if",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.setName | Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (l... | pipenv/vendor/pyparsing.py | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") #... | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") #... | [
"Define",
"name",
"for",
"this",
"expression",
"makes",
"debugging",
"and",
"exception",
"messages",
"clearer",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1329-L1342 | [
"def",
"setName",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"errmsg",
"=",
"\"Expected \"",
"+",
"self",
".",
"name",
"if",
"hasattr",
"(",
"self",
",",
"\"exception\"",
")",
":",
"self",
".",
"exception",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.setResultsName | Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original :class:`ParserElement` object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple places with ... | pipenv/vendor/pyparsing.py | def setResultsName( self, name, listAllMatches=False ):
"""
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original :class:`ParserElement` object;
this is so that the client can define a basic el... | def setResultsName( self, name, listAllMatches=False ):
"""
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original :class:`ParserElement` object;
this is so that the client can define a basic el... | [
"Define",
"name",
"for",
"referencing",
"matching",
"tokens",
"as",
"a",
"nested",
"attribute",
"of",
"the",
"returned",
"parse",
"results",
".",
"NOTE",
":",
"this",
"returns",
"a",
"*",
"copy",
"*",
"of",
"the",
"original",
":",
"class",
":",
"ParserElem... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1344-L1371 | [
"def",
"setResultsName",
"(",
"self",
",",
"name",
",",
"listAllMatches",
"=",
"False",
")",
":",
"newself",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"name",
".",
"endswith",
"(",
"\"*\"",
")",
":",
"name",
"=",
"name",
"[",
":",
"-",
"1",
"]",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.addCondition | Add a boolean predicate function to expression's list of parse actions. See
:class:`setParseAction` for function call signatures. Unlike ``setParseAction``,
functions passed to ``addCondition`` need to return boolean success/fail of the condition.
Optional keyword arguments:
- message =... | pipenv/vendor/pyparsing.py | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
:class:`setParseAction` for function call signatures. Unlike ``setParseAction``,
functions passed to ``addCondition`` need to return boolean success/fail of the condition.
... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
:class:`setParseAction` for function call signatures. Unlike ``setParseAction``,
functions passed to ``addCondition`` need to return boolean success/fail of the condition.
... | [
"Add",
"a",
"boolean",
"predicate",
"function",
"to",
"expression",
"s",
"list",
"of",
"parse",
"actions",
".",
"See",
":",
"class",
":",
"setParseAction",
"for",
"function",
"call",
"signatures",
".",
"Unlike",
"setParseAction",
"functions",
"passed",
"to",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1442-L1469 | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.enablePackrat | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | pipenv/vendor/pyparsing.py | def enablePackrat(cache_size_limit=128):
"""Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing par... | def enablePackrat(cache_size_limit=128):
"""Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing par... | [
"Enables",
"packrat",
"parsing",
"which",
"adds",
"memoizing",
"to",
"the",
"parsing",
"logic",
".",
"Repeated",
"parse",
"attempts",
"at",
"the",
"same",
"string",
"location",
"(",
"which",
"happens",
"often",
"in",
"many",
"complex",
"grammars",
")",
"can",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1732-L1764 | [
"def",
"enablePackrat",
"(",
"cache_size_limit",
"=",
"128",
")",
":",
"if",
"not",
"ParserElement",
".",
"_packratEnabled",
":",
"ParserElement",
".",
"_packratEnabled",
"=",
"True",
"if",
"cache_size_limit",
"is",
"None",
":",
"ParserElement",
".",
"packrat_cach... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.parseString | Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
successfully parsed, then set ``parseAll`` to True (equivalent to ending
... | pipenv/vendor/pyparsing.py | def parseString( self, instring, parseAll=False ):
"""
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
succe... | def parseString( self, instring, parseAll=False ):
"""
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
succe... | [
"Execute",
"the",
"parse",
"expression",
"with",
"the",
"given",
"string",
".",
"This",
"is",
"the",
"main",
"interface",
"to",
"the",
"client",
"code",
"once",
"the",
"complete",
"expression",
"has",
"been",
"built",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1766-L1816 | [
"def",
"parseString",
"(",
"self",
",",
"instring",
",",
"parseAll",
"=",
"False",
")",
":",
"ParserElement",
".",
"resetCache",
"(",
")",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"#~ self.saveAsList = True",
"for",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.searchString | Another extension to :class:`scanString`, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
``maxMatches`` argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts with an uppercase let... | pipenv/vendor/pyparsing.py | def searchString( self, instring, maxMatches=_MAX_INT ):
"""
Another extension to :class:`scanString`, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
``maxMatches`` argument, to clip searching after 'n' matches are found.
... | def searchString( self, instring, maxMatches=_MAX_INT ):
"""
Another extension to :class:`scanString`, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
``maxMatches`` argument, to clip searching after 'n' matches are found.
... | [
"Another",
"extension",
"to",
":",
"class",
":",
"scanString",
"simplifying",
"the",
"access",
"to",
"the",
"tokens",
"found",
"to",
"match",
"the",
"given",
"parse",
"expression",
".",
"May",
"be",
"called",
"with",
"optional",
"maxMatches",
"argument",
"to",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1936-L1964 | [
"def",
"searchString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
")",
":",
"try",
":",
"return",
"ParseResults",
"(",
"[",
"t",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
",",
"maxMatches",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.split | Generator method to split a string using the given expression as a separator.
May be called with optional ``maxsplit`` argument, to limit the number of splits;
and the optional ``includeSeparators`` argument (default= ``False``), if the separating
matching text should be included in the split re... | pipenv/vendor/pyparsing.py | def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
"""
Generator method to split a string using the given expression as a separator.
May be called with optional ``maxsplit`` argument, to limit the number of splits;
and the optional ``includeSeparators`` argument (defa... | def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
"""
Generator method to split a string using the given expression as a separator.
May be called with optional ``maxsplit`` argument, to limit the number of splits;
and the optional ``includeSeparators`` argument (defa... | [
"Generator",
"method",
"to",
"split",
"a",
"string",
"using",
"the",
"given",
"expression",
"as",
"a",
"separator",
".",
"May",
"be",
"called",
"with",
"optional",
"maxsplit",
"argument",
"to",
"limit",
"the",
"number",
"of",
"splits",
";",
"and",
"the",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1966-L1989 | [
"def",
"split",
"(",
"self",
",",
"instring",
",",
"maxsplit",
"=",
"_MAX_INT",
",",
"includeSeparators",
"=",
"False",
")",
":",
"splits",
"=",
"0",
"last",
"=",
"0",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.setWhitespaceChars | Overrides the default whitespace chars | pipenv/vendor/pyparsing.py | def setWhitespaceChars( self, chars ):
"""
Overrides the default whitespace chars
"""
self.skipWhitespace = True
self.whiteChars = chars
self.copyDefaultWhiteChars = False
return self | def setWhitespaceChars( self, chars ):
"""
Overrides the default whitespace chars
"""
self.skipWhitespace = True
self.whiteChars = chars
self.copyDefaultWhiteChars = False
return self | [
"Overrides",
"the",
"default",
"whitespace",
"chars"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2235-L2242 | [
"def",
"setWhitespaceChars",
"(",
"self",
",",
"chars",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"True",
"self",
".",
"whiteChars",
"=",
"chars",
"self",
".",
"copyDefaultWhiteChars",
"=",
"False",
"return",
"self"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.ignore | Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
... | pipenv/vendor/pyparsing.py | def ignore( self, other ):
"""
Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('abl... | def ignore( self, other ):
"""
Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('abl... | [
"Define",
"expression",
"to",
"be",
"ignored",
"(",
"e",
".",
"g",
".",
"comments",
")",
"while",
"doing",
"pattern",
"matching",
";",
"may",
"be",
"called",
"repeatedly",
"to",
"define",
"multiple",
"comment",
"or",
"other",
"ignorable",
"patterns",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2253-L2275 | [
"def",
"ignore",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"Suppress",
"(",
"other",
")",
"if",
"isinstance",
"(",
"other",
",",
"Suppress",
")",
":",
"if",
"other",
"not",
"in",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.setDebugActions | Enable display of debugging messages while doing pattern matching. | pipenv/vendor/pyparsing.py | def setDebugActions( self, startAction, successAction, exceptionAction ):
"""
Enable display of debugging messages while doing pattern matching.
"""
self.debugActions = (startAction or _defaultStartDebugAction,
successAction or _defaultSuccessDebugAction,
... | def setDebugActions( self, startAction, successAction, exceptionAction ):
"""
Enable display of debugging messages while doing pattern matching.
"""
self.debugActions = (startAction or _defaultStartDebugAction,
successAction or _defaultSuccessDebugAction,
... | [
"Enable",
"display",
"of",
"debugging",
"messages",
"while",
"doing",
"pattern",
"matching",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2277-L2285 | [
"def",
"setDebugActions",
"(",
"self",
",",
"startAction",
",",
"successAction",
",",
"exceptionAction",
")",
":",
"self",
".",
"debugActions",
"=",
"(",
"startAction",
"or",
"_defaultStartDebugAction",
",",
"successAction",
"or",
"_defaultSuccessDebugAction",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.setDebug | Enable display of debugging messages while doing pattern matching.
Set ``flag`` to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = wd | integer
# turn on debugging for wd
... | pipenv/vendor/pyparsing.py | def setDebug( self, flag=True ):
"""
Enable display of debugging messages while doing pattern matching.
Set ``flag`` to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = ... | def setDebug( self, flag=True ):
"""
Enable display of debugging messages while doing pattern matching.
Set ``flag`` to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = ... | [
"Enable",
"display",
"of",
"debugging",
"messages",
"while",
"doing",
"pattern",
"matching",
".",
"Set",
"flag",
"to",
"True",
"to",
"enable",
"False",
"to",
"disable",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2287-L2328 | [
"def",
"setDebug",
"(",
"self",
",",
"flag",
"=",
"True",
")",
":",
"if",
"flag",
":",
"self",
".",
"setDebugActions",
"(",
"_defaultStartDebugAction",
",",
"_defaultSuccessDebugAction",
",",
"_defaultExceptionDebugAction",
")",
"else",
":",
"self",
".",
"debug"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParserElement.parseFile | Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing. | pipenv/vendor/pyparsing.py | def parseFile( self, file_or_filename, parseAll=False ):
"""
Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.
"""
try:
file_contents =... | def parseFile( self, file_or_filename, parseAll=False ):
"""
Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.
"""
try:
file_contents =... | [
"Execute",
"the",
"parse",
"expression",
"on",
"the",
"given",
"file",
"or",
"filename",
".",
"If",
"a",
"filename",
"is",
"specified",
"(",
"instead",
"of",
"a",
"file",
"object",
")",
"the",
"entire",
"file",
"is",
"opened",
"read",
"and",
"closed",
"b... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2350-L2368 | [
"def",
"parseFile",
"(",
"self",
",",
"file_or_filename",
",",
"parseAll",
"=",
"False",
")",
":",
"try",
":",
"file_contents",
"=",
"file_or_filename",
".",
"read",
"(",
")",
"except",
"AttributeError",
":",
"with",
"open",
"(",
"file_or_filename",
",",
"\"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Regex.sub | Return Regex with an attached parse action to transform the parsed
result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_.
Example::
make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>")
print(make_html.transformString("h1:ma... | pipenv/vendor/pyparsing.py | def sub(self, repl):
"""
Return Regex with an attached parse action to transform the parsed
result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_.
Example::
make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>")
... | def sub(self, repl):
"""
Return Regex with an attached parse action to transform the parsed
result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_.
Example::
make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>")
... | [
"Return",
"Regex",
"with",
"an",
"attached",
"parse",
"action",
"to",
"transform",
"the",
"parsed",
"result",
"as",
"if",
"called",
"using",
"re",
".",
"sub",
"(",
"expr",
"repl",
"string",
")",
"<https",
":",
"//",
"docs",
".",
"python",
".",
"org",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L3067-L3094 | [
"def",
"sub",
"(",
"self",
",",
"repl",
")",
":",
"if",
"self",
".",
"asGroupList",
":",
"warnings",
".",
"warn",
"(",
"\"cannot use sub() with Regex(asGroupList=True)\"",
",",
"SyntaxWarning",
",",
"stacklevel",
"=",
"2",
")",
"raise",
"SyntaxError",
"(",
")"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ParseExpression.leaveWhitespace | Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
all contained expressions. | pipenv/vendor/pyparsing.py | def leaveWhitespace( self ):
"""Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
all contained expressions."""
self.skipWhitespace = False
self.exprs = [ e.copy() for e in self.exprs ]
for e in self.exprs:
e.leaveWhitespace... | def leaveWhitespace( self ):
"""Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
all contained expressions."""
self.skipWhitespace = False
self.exprs = [ e.copy() for e in self.exprs ]
for e in self.exprs:
e.leaveWhitespace... | [
"Extends",
"leaveWhitespace",
"defined",
"in",
"base",
"class",
"and",
"also",
"invokes",
"leaveWhitespace",
"on",
"all",
"contained",
"expressions",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L3586-L3593 | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"self",
".",
"exprs",
"=",
"[",
"e",
".",
"copy",
"(",
")",
"for",
"e",
"in",
"self",
".",
"exprs",
"]",
"for",
"e",
"in",
"self",
".",
"exprs",
":",
"e... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pyparsing_common.convertToDate | Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
Example::
date_expr = pyparsing_common.iso8601_date.copy()
date_expr.setParseAction(pyparsing_... | pipenv/vendor/pyparsing.py | def convertToDate(fmt="%Y-%m-%d"):
"""
Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
Example::
date_expr = pyparsing_common.iso8601_date... | def convertToDate(fmt="%Y-%m-%d"):
"""
Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
Example::
date_expr = pyparsing_common.iso8601_date... | [
"Helper",
"to",
"create",
"a",
"parse",
"action",
"for",
"converting",
"parsed",
"date",
"string",
"to",
"Python",
"datetime",
".",
"date"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L6136-L6158 | [
"def",
"convertToDate",
"(",
"fmt",
"=",
"\"%Y-%m-%d\"",
")",
":",
"def",
"cvt_fn",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"try",
":",
"return",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"0",
"]",
",",
"fmt",
")",
".",
"date",
"(",
")",
"exc... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pyparsing_common.convertToDatetime | Helper to create a parse action for converting parsed
datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
Example::
dt_expr = pyparsing_common.iso8601_datetime.copy()
dt_ex... | pipenv/vendor/pyparsing.py | def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"):
"""Helper to create a parse action for converting parsed
datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
Example::
dt_exp... | def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"):
"""Helper to create a parse action for converting parsed
datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
Example::
dt_exp... | [
"Helper",
"to",
"create",
"a",
"parse",
"action",
"for",
"converting",
"parsed",
"datetime",
"string",
"to",
"Python",
"datetime",
".",
"datetime"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L6161-L6183 | [
"def",
"convertToDatetime",
"(",
"fmt",
"=",
"\"%Y-%m-%dT%H:%M:%S.%f\"",
")",
":",
"def",
"cvt_fn",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"try",
":",
"return",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"0",
"]",
",",
"fmt",
")",
"except",
"ValueE... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _match_vcs_scheme | Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match. | pipenv/patched/notpip/_internal/index.py | def _match_vcs_scheme(url):
# type: (str) -> Optional[str]
"""Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match.
"""
from pipenv.patched.notpip._internal.vcs import VcsSupport
for scheme in VcsSupport.schemes:
if url.lower().startswith(scheme) ... | def _match_vcs_scheme(url):
# type: (str) -> Optional[str]
"""Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match.
"""
from pipenv.patched.notpip._internal.vcs import VcsSupport
for scheme in VcsSupport.schemes:
if url.lower().startswith(scheme) ... | [
"Look",
"for",
"VCS",
"schemes",
"in",
"the",
"URL",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L77-L87 | [
"def",
"_match_vcs_scheme",
"(",
"url",
")",
":",
"# type: (str) -> Optional[str]",
"from",
"pipenv",
".",
"patched",
".",
"notpip",
".",
"_internal",
".",
"vcs",
"import",
"VcsSupport",
"for",
"scheme",
"in",
"VcsSupport",
".",
"schemes",
":",
"if",
"url",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _is_url_like_archive | Return whether the URL looks like an archive. | pipenv/patched/notpip/_internal/index.py | def _is_url_like_archive(url):
# type: (str) -> bool
"""Return whether the URL looks like an archive.
"""
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False | def _is_url_like_archive(url):
# type: (str) -> bool
"""Return whether the URL looks like an archive.
"""
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False | [
"Return",
"whether",
"the",
"URL",
"looks",
"like",
"an",
"archive",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L90-L98 | [
"def",
"_is_url_like_archive",
"(",
"url",
")",
":",
"# type: (str) -> bool",
"filename",
"=",
"Link",
"(",
"url",
")",
".",
"filename",
"for",
"bad_ext",
"in",
"ARCHIVE_EXTENSIONS",
":",
"if",
"filename",
".",
"endswith",
"(",
"bad_ext",
")",
":",
"return",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _ensure_html_header | Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html. | pipenv/patched/notpip/_internal/index.py | def _ensure_html_header(response):
# type: (Response) -> None
"""Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html.
"""
content_type = response.headers.get("Content-Type", "")
if not content_type.lower().startswith("text/h... | def _ensure_html_header(response):
# type: (Response) -> None
"""Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html.
"""
content_type = response.headers.get("Content-Type", "")
if not content_type.lower().startswith("text/h... | [
"Check",
"the",
"Content",
"-",
"Type",
"header",
"to",
"ensure",
"the",
"response",
"contains",
"HTML",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L109-L117 | [
"def",
"_ensure_html_header",
"(",
"response",
")",
":",
"# type: (Response) -> None",
"content_type",
"=",
"response",
".",
"headers",
".",
"get",
"(",
"\"Content-Type\"",
",",
"\"\"",
")",
"if",
"not",
"content_type",
".",
"lower",
"(",
")",
".",
"startswith",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _ensure_html_response | Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html. | pipenv/patched/notpip/_internal/index.py | def _ensure_html_response(url, session):
# type: (str, PipSession) -> None
"""Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html.
"""
scheme, netloc, path, qu... | def _ensure_html_response(url, session):
# type: (str, PipSession) -> None
"""Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html.
"""
scheme, netloc, path, qu... | [
"Send",
"a",
"HEAD",
"request",
"to",
"the",
"URL",
"and",
"ensure",
"the",
"response",
"contains",
"HTML",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L124-L138 | [
"def",
"_ensure_html_response",
"(",
"url",
",",
"session",
")",
":",
"# type: (str, PipSession) -> None",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"fragment",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"scheme",
"not",
"in",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _get_html_response | Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large file.
Raise `_NotHTTP` if the content type cannot be determined, or
`_No... | pipenv/patched/notpip/_internal/index.py | def _get_html_response(url, session):
# type: (str, PipSession) -> Response
"""Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large... | def _get_html_response(url, session):
# type: (str, PipSession) -> Response
"""Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large... | [
"Access",
"an",
"HTML",
"page",
"with",
"GET",
"and",
"return",
"the",
"response",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L141-L189 | [
"def",
"_get_html_response",
"(",
"url",
",",
"session",
")",
":",
"# type: (str, PipSession) -> Response",
"if",
"_is_url_like_archive",
"(",
"url",
")",
":",
"_ensure_html_response",
"(",
"url",
",",
"session",
"=",
"session",
")",
"logger",
".",
"debug",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _find_name_version_sep | Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since the canonicalized name does not necessarily
have the same length as the egg info's nam... | pipenv/patched/notpip/_internal/index.py | def _find_name_version_sep(egg_info, canonical_name):
# type: (str, str) -> int
"""Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since... | def _find_name_version_sep(egg_info, canonical_name):
# type: (str, str) -> int
"""Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since... | [
"Find",
"the",
"separator",
"s",
"index",
"based",
"on",
"the",
"package",
"s",
"canonical",
"name",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L896-L919 | [
"def",
"_find_name_version_sep",
"(",
"egg_info",
",",
"canonical_name",
")",
":",
"# type: (str, str) -> int",
"# Project name and version must be separated by one single dash. Find all",
"# occurrences of dashes; if the string in front of it matches the canonical",
"# name, this is the one s... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _egg_info_matches | Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param canonical_name: The canonicalized name of the package this
belongs to. | pipenv/patched/notpip/_internal/index.py | def _egg_info_matches(egg_info, canonical_name):
# type: (str, str) -> Optional[str]
"""Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param canonical_name: The canonicalized name of the package this
belongs to.
"""
try:
version_start ... | def _egg_info_matches(egg_info, canonical_name):
# type: (str, str) -> Optional[str]
"""Pull the version part out of a string.
:param egg_info: The string to parse. E.g. foo-2.1
:param canonical_name: The canonicalized name of the package this
belongs to.
"""
try:
version_start ... | [
"Pull",
"the",
"version",
"part",
"out",
"of",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L922-L937 | [
"def",
"_egg_info_matches",
"(",
"egg_info",
",",
"canonical_name",
")",
":",
"# type: (str, str) -> Optional[str]",
"try",
":",
"version_start",
"=",
"_find_name_version_sep",
"(",
"egg_info",
",",
"canonical_name",
")",
"+",
"1",
"except",
"ValueError",
":",
"return... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _determine_base_url | Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the HTML
file's URL is used as the base URL.
:p... | pipenv/patched/notpip/_internal/index.py | def _determine_base_url(document, page_url):
"""Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the ... | def _determine_base_url(document, page_url):
"""Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the ... | [
"Determine",
"the",
"HTML",
"document",
"s",
"base",
"URL",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L940-L956 | [
"def",
"_determine_base_url",
"(",
"document",
",",
"page_url",
")",
":",
"for",
"base",
"in",
"document",
".",
"findall",
"(",
"\".//base\"",
")",
":",
"href",
"=",
"base",
".",
"get",
"(",
"\"href\"",
")",
"if",
"href",
"is",
"not",
"None",
":",
"ret... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _get_encoding_from_headers | Determine if we have any encoding information in our headers. | pipenv/patched/notpip/_internal/index.py | def _get_encoding_from_headers(headers):
"""Determine if we have any encoding information in our headers.
"""
if headers and "Content-Type" in headers:
content_type, params = cgi.parse_header(headers["Content-Type"])
if "charset" in params:
return params['charset']
return Non... | def _get_encoding_from_headers(headers):
"""Determine if we have any encoding information in our headers.
"""
if headers and "Content-Type" in headers:
content_type, params = cgi.parse_header(headers["Content-Type"])
if "charset" in params:
return params['charset']
return Non... | [
"Determine",
"if",
"we",
"have",
"any",
"encoding",
"information",
"in",
"our",
"headers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L959-L966 | [
"def",
"_get_encoding_from_headers",
"(",
"headers",
")",
":",
"if",
"headers",
"and",
"\"Content-Type\"",
"in",
"headers",
":",
"content_type",
",",
"params",
"=",
"cgi",
".",
"parse_header",
"(",
"headers",
"[",
"\"Content-Type\"",
"]",
")",
"if",
"\"charset\"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageFinder._candidate_sort_key | Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorted by version only.
If finding wheels, then the sort order is by version, then:
1. existing installs
2. wheels ordered via Wheel.su... | pipenv/patched/notpip/_internal/index.py | def _candidate_sort_key(self, candidate, ignore_compatibility=True):
# type: (InstallationCandidate, bool) -> CandidateSortingKey
"""
Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorte... | def _candidate_sort_key(self, candidate, ignore_compatibility=True):
# type: (InstallationCandidate, bool) -> CandidateSortingKey
"""
Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorte... | [
"Function",
"used",
"to",
"generate",
"link",
"sort",
"key",
"for",
"link",
"tuples",
".",
"The",
"greater",
"the",
"return",
"value",
"the",
"more",
"preferred",
"it",
"is",
".",
"If",
"not",
"finding",
"wheels",
"then",
"sorted",
"by",
"version",
"only",... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L450-L489 | [
"def",
"_candidate_sort_key",
"(",
"self",
",",
"candidate",
",",
"ignore_compatibility",
"=",
"True",
")",
":",
"# type: (InstallationCandidate, bool) -> CandidateSortingKey",
"support_num",
"=",
"len",
"(",
"self",
".",
"valid_tags",
")",
"build_tag",
"=",
"tuple",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageFinder._get_index_urls_locations | Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations | pipenv/patched/notpip/_internal/index.py | def _get_index_urls_locations(self, project_name):
# type: (str) -> List[str]
"""Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations
"""
def mkurl_pypi_url(url):
... | def _get_index_urls_locations(self, project_name):
# type: (str) -> List[str]
"""Returns the locations found via self.index_urls
Checks the url_name on the main (first in the list) index and
use this url_name to produce all locations
"""
def mkurl_pypi_url(url):
... | [
"Returns",
"the",
"locations",
"found",
"via",
"self",
".",
"index_urls"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L565-L586 | [
"def",
"_get_index_urls_locations",
"(",
"self",
",",
"project_name",
")",
":",
"# type: (str) -> List[str]",
"def",
"mkurl_pypi_url",
"(",
"url",
")",
":",
"loc",
"=",
"posixpath",
".",
"join",
"(",
"url",
",",
"urllib_parse",
".",
"quote",
"(",
"canonicalize_n... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageFinder.find_all_candidates | Find all available InstallationCandidate for project_name
This checks index_urls and find_links.
All versions found are returned as an InstallationCandidate list.
See _link_package_versions for details on which files are accepted | pipenv/patched/notpip/_internal/index.py | def find_all_candidates(self, project_name):
# type: (str) -> List[Optional[InstallationCandidate]]
"""Find all available InstallationCandidate for project_name
This checks index_urls and find_links.
All versions found are returned as an InstallationCandidate list.
See _link_pa... | def find_all_candidates(self, project_name):
# type: (str) -> List[Optional[InstallationCandidate]]
"""Find all available InstallationCandidate for project_name
This checks index_urls and find_links.
All versions found are returned as an InstallationCandidate list.
See _link_pa... | [
"Find",
"all",
"available",
"InstallationCandidate",
"for",
"project_name"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L588-L656 | [
"def",
"find_all_candidates",
"(",
"self",
",",
"project_name",
")",
":",
"# type: (str) -> List[Optional[InstallationCandidate]]",
"index_locations",
"=",
"self",
".",
"_get_index_urls_locations",
"(",
"project_name",
")",
"index_file_loc",
",",
"index_url_loc",
"=",
"self... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageFinder.find_requirement | Try to find a Link matching req
Expects req, an InstallRequirement and upgrade, a boolean
Returns a Link if found,
Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise | pipenv/patched/notpip/_internal/index.py | def find_requirement(self, req, upgrade, ignore_compatibility=False):
# type: (InstallRequirement, bool, bool) -> Optional[Link]
"""Try to find a Link matching req
Expects req, an InstallRequirement and upgrade, a boolean
Returns a Link if found,
Raises DistributionNotFound or B... | def find_requirement(self, req, upgrade, ignore_compatibility=False):
# type: (InstallRequirement, bool, bool) -> Optional[Link]
"""Try to find a Link matching req
Expects req, an InstallRequirement and upgrade, a boolean
Returns a Link if found,
Raises DistributionNotFound or B... | [
"Try",
"to",
"find",
"a",
"Link",
"matching",
"req"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L658-L756 | [
"def",
"find_requirement",
"(",
"self",
",",
"req",
",",
"upgrade",
",",
"ignore_compatibility",
"=",
"False",
")",
":",
"# type: (InstallRequirement, bool, bool) -> Optional[Link]",
"all_candidates",
"=",
"self",
".",
"find_all_candidates",
"(",
"req",
".",
"name",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageFinder._get_pages | Yields (page, page_url) from the given locations, skipping
locations that have errors. | pipenv/patched/notpip/_internal/index.py | def _get_pages(self, locations, project_name):
# type: (Iterable[Link], str) -> Iterable[HTMLPage]
"""
Yields (page, page_url) from the given locations, skipping
locations that have errors.
"""
seen = set() # type: Set[Link]
for location in locations:
... | def _get_pages(self, locations, project_name):
# type: (Iterable[Link], str) -> Iterable[HTMLPage]
"""
Yields (page, page_url) from the given locations, skipping
locations that have errors.
"""
seen = set() # type: Set[Link]
for location in locations:
... | [
"Yields",
"(",
"page",
"page_url",
")",
"from",
"the",
"given",
"locations",
"skipping",
"locations",
"that",
"have",
"errors",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L758-L774 | [
"def",
"_get_pages",
"(",
"self",
",",
"locations",
",",
"project_name",
")",
":",
"# type: (Iterable[Link], str) -> Iterable[HTMLPage]",
"seen",
"=",
"set",
"(",
")",
"# type: Set[Link]",
"for",
"location",
"in",
"locations",
":",
"if",
"location",
"in",
"seen",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PackageFinder._link_package_versions | Return an InstallationCandidate or None | pipenv/patched/notpip/_internal/index.py | def _link_package_versions(self, link, search, ignore_compatibility=True):
# type: (Link, Search, bool) -> Optional[InstallationCandidate]
"""Return an InstallationCandidate or None"""
version = None
if link.egg_fragment:
egg_info = link.egg_fragment
ext = link.ex... | def _link_package_versions(self, link, search, ignore_compatibility=True):
# type: (Link, Search, bool) -> Optional[InstallationCandidate]
"""Return an InstallationCandidate or None"""
version = None
if link.egg_fragment:
egg_info = link.egg_fragment
ext = link.ex... | [
"Return",
"an",
"InstallationCandidate",
"or",
"None"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L814-L893 | [
"def",
"_link_package_versions",
"(",
"self",
",",
"link",
",",
"search",
",",
"ignore_compatibility",
"=",
"True",
")",
":",
"# type: (Link, Search, bool) -> Optional[InstallationCandidate]",
"version",
"=",
"None",
"if",
"link",
".",
"egg_fragment",
":",
"egg_info",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTMLPage.iter_links | Yields all links in the page | pipenv/patched/notpip/_internal/index.py | def iter_links(self):
# type: () -> Iterable[Link]
"""Yields all links in the page"""
document = html5lib.parse(
self.content,
transport_encoding=_get_encoding_from_headers(self.headers),
namespaceHTMLElements=False,
)
base_url = _determine_bas... | def iter_links(self):
# type: () -> Iterable[Link]
"""Yields all links in the page"""
document = html5lib.parse(
self.content,
transport_encoding=_get_encoding_from_headers(self.headers),
namespaceHTMLElements=False,
)
base_url = _determine_bas... | [
"Yields",
"all",
"links",
"in",
"the",
"page"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L992-L1007 | [
"def",
"iter_links",
"(",
"self",
")",
":",
"# type: () -> Iterable[Link]",
"document",
"=",
"html5lib",
".",
"parse",
"(",
"self",
".",
"content",
",",
"transport_encoding",
"=",
"_get_encoding_from_headers",
"(",
"self",
".",
"headers",
")",
",",
"namespaceHTMLE... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | run | This function runs the given command; waits for it to finish; then
returns all output as a string. STDERR is included in output. If the full
path to the command is not given then the path is searched.
Note that lines are terminated by CR/LF (\\r\\n) combination even on
UNIX-like systems because this is... | pipenv/vendor/pexpect/run.py | def run(command, timeout=30, withexitstatus=False, events=None,
extra_args=None, logfile=None, cwd=None, env=None, **kwargs):
'''
This function runs the given command; waits for it to finish; then
returns all output as a string. STDERR is included in output. If the full
path to the command is n... | def run(command, timeout=30, withexitstatus=False, events=None,
extra_args=None, logfile=None, cwd=None, env=None, **kwargs):
'''
This function runs the given command; waits for it to finish; then
returns all output as a string. STDERR is included in output. If the full
path to the command is n... | [
"This",
"function",
"runs",
"the",
"given",
"command",
";",
"waits",
"for",
"it",
"to",
"finish",
";",
"then",
"returns",
"all",
"output",
"as",
"a",
"string",
".",
"STDERR",
"is",
"included",
"in",
"output",
".",
"If",
"the",
"full",
"path",
"to",
"th... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/run.py#L7-L148 | [
"def",
"run",
"(",
"command",
",",
"timeout",
"=",
"30",
",",
"withexitstatus",
"=",
"False",
",",
"events",
"=",
"None",
",",
"extra_args",
"=",
"None",
",",
"logfile",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"*",
"*",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | runu | Deprecated: pass encoding to run() instead. | pipenv/vendor/pexpect/run.py | def runu(command, timeout=30, withexitstatus=False, events=None,
extra_args=None, logfile=None, cwd=None, env=None, **kwargs):
"""Deprecated: pass encoding to run() instead.
"""
kwargs.setdefault('encoding', 'utf-8')
return run(command, timeout=timeout, withexitstatus=withexitstatus,
... | def runu(command, timeout=30, withexitstatus=False, events=None,
extra_args=None, logfile=None, cwd=None, env=None, **kwargs):
"""Deprecated: pass encoding to run() instead.
"""
kwargs.setdefault('encoding', 'utf-8')
return run(command, timeout=timeout, withexitstatus=withexitstatus,
... | [
"Deprecated",
":",
"pass",
"encoding",
"to",
"run",
"()",
"instead",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/run.py#L150-L157 | [
"def",
"runu",
"(",
"command",
",",
"timeout",
"=",
"30",
",",
"withexitstatus",
"=",
"False",
",",
"events",
"=",
"None",
",",
"extra_args",
"=",
"None",
",",
"logfile",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"*",
"*",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_process_mapping | Try to look up the process tree via the output of `ps`. | pipenv/vendor/shellingham/posix/_default.py | def get_process_mapping():
"""Try to look up the process tree via the output of `ps`.
"""
output = subprocess.check_output([
'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=',
])
if not isinstance(output, str):
output = output.decode(sys.stdout.encoding)
processes = {}
... | def get_process_mapping():
"""Try to look up the process tree via the output of `ps`.
"""
output = subprocess.check_output([
'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=',
])
if not isinstance(output, str):
output = output.decode(sys.stdout.encoding)
processes = {}
... | [
"Try",
"to",
"look",
"up",
"the",
"process",
"tree",
"via",
"the",
"output",
"of",
"ps",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/_default.py#L10-L27 | [
"def",
"get_process_mapping",
"(",
")",
":",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'ps'",
",",
"'-ww'",
",",
"'-o'",
",",
"'pid='",
",",
"'-o'",
",",
"'ppid='",
",",
"'-o'",
",",
"'args='",
",",
"]",
")",
"if",
"not",
"isinstance... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequestEncodingMixin.path_url | Build the path URL to use. | pipenv/vendor/requests/models.py | def path_url(self):
"""Build the path URL to use."""
url = []
p = urlsplit(self.url)
path = p.path
if not path:
path = '/'
url.append(path)
query = p.query
if query:
url.append('?')
url.append(query)
return... | def path_url(self):
"""Build the path URL to use."""
url = []
p = urlsplit(self.url)
path = p.path
if not path:
path = '/'
url.append(path)
query = p.query
if query:
url.append('?')
url.append(query)
return... | [
"Build",
"the",
"path",
"URL",
"to",
"use",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L62-L80 | [
"def",
"path_url",
"(",
"self",
")",
":",
"url",
"=",
"[",
"]",
"p",
"=",
"urlsplit",
"(",
"self",
".",
"url",
")",
"path",
"=",
"p",
".",
"path",
"if",
"not",
"path",
":",
"path",
"=",
"'/'",
"url",
".",
"append",
"(",
"path",
")",
"query",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequestEncodingMixin._encode_params | Encode parameters in a piece of data.
Will successfully encode parameters when passed as a dict or a list of
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
if parameters are supplied as a dict. | pipenv/vendor/requests/models.py | def _encode_params(data):
"""Encode parameters in a piece of data.
Will successfully encode parameters when passed as a dict or a list of
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
if parameters are supplied as a dict.
"""
if isinstance(data... | def _encode_params(data):
"""Encode parameters in a piece of data.
Will successfully encode parameters when passed as a dict or a list of
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
if parameters are supplied as a dict.
"""
if isinstance(data... | [
"Encode",
"parameters",
"in",
"a",
"piece",
"of",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L83-L107 | [
"def",
"_encode_params",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"(",
"str",
",",
"bytes",
")",
")",
":",
"return",
"data",
"elif",
"hasattr",
"(",
"data",
",",
"'read'",
")",
":",
"return",
"data",
"elif",
"hasattr",
"(",
"data"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequestEncodingMixin._encode_files | Build the body for a multipart/form-data request.
Will successfully encode files when passed as a dict or a list of
tuples. Order is retained if data is a list of tuples but arbitrary
if parameters are supplied as a dict.
The tuples may be 2-tuples (filename, fileobj), 3-tuples (filenam... | pipenv/vendor/requests/models.py | def _encode_files(files, data):
"""Build the body for a multipart/form-data request.
Will successfully encode files when passed as a dict or a list of
tuples. Order is retained if data is a list of tuples but arbitrary
if parameters are supplied as a dict.
The tuples may be 2-tu... | def _encode_files(files, data):
"""Build the body for a multipart/form-data request.
Will successfully encode files when passed as a dict or a list of
tuples. Order is retained if data is a list of tuples but arbitrary
if parameters are supplied as a dict.
The tuples may be 2-tu... | [
"Build",
"the",
"body",
"for",
"a",
"multipart",
"/",
"form",
"-",
"data",
"request",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L110-L171 | [
"def",
"_encode_files",
"(",
"files",
",",
"data",
")",
":",
"if",
"(",
"not",
"files",
")",
":",
"raise",
"ValueError",
"(",
"\"Files must be provided.\"",
")",
"elif",
"isinstance",
"(",
"data",
",",
"basestring",
")",
":",
"raise",
"ValueError",
"(",
"\... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequestHooksMixin.register_hook | Properly register a hook. | pipenv/vendor/requests/models.py | def register_hook(self, event, hook):
"""Properly register a hook."""
if event not in self.hooks:
raise ValueError('Unsupported event specified, with event name "%s"' % (event))
if isinstance(hook, Callable):
self.hooks[event].append(hook)
elif hasattr(hook, '__... | def register_hook(self, event, hook):
"""Properly register a hook."""
if event not in self.hooks:
raise ValueError('Unsupported event specified, with event name "%s"' % (event))
if isinstance(hook, Callable):
self.hooks[event].append(hook)
elif hasattr(hook, '__... | [
"Properly",
"register",
"a",
"hook",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L175-L184 | [
"def",
"register_hook",
"(",
"self",
",",
"event",
",",
"hook",
")",
":",
"if",
"event",
"not",
"in",
"self",
".",
"hooks",
":",
"raise",
"ValueError",
"(",
"'Unsupported event specified, with event name \"%s\"'",
"%",
"(",
"event",
")",
")",
"if",
"isinstance... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | RequestHooksMixin.deregister_hook | Deregister a previously registered hook.
Returns True if the hook existed, False if not. | pipenv/vendor/requests/models.py | def deregister_hook(self, event, hook):
"""Deregister a previously registered hook.
Returns True if the hook existed, False if not.
"""
try:
self.hooks[event].remove(hook)
return True
except ValueError:
return False | def deregister_hook(self, event, hook):
"""Deregister a previously registered hook.
Returns True if the hook existed, False if not.
"""
try:
self.hooks[event].remove(hook)
return True
except ValueError:
return False | [
"Deregister",
"a",
"previously",
"registered",
"hook",
".",
"Returns",
"True",
"if",
"the",
"hook",
"existed",
"False",
"if",
"not",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L186-L195 | [
"def",
"deregister_hook",
"(",
"self",
",",
"event",
",",
"hook",
")",
":",
"try",
":",
"self",
".",
"hooks",
"[",
"event",
"]",
".",
"remove",
"(",
"hook",
")",
"return",
"True",
"except",
"ValueError",
":",
"return",
"False"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PreparedRequest.prepare | Prepares the entire request with the given parameters. | pipenv/vendor/requests/models.py | def prepare(self,
method=None, url=None, headers=None, files=None, data=None,
params=None, auth=None, cookies=None, hooks=None, json=None):
"""Prepares the entire request with the given parameters."""
self.prepare_method(method)
self.prepare_url(url, params)
self... | def prepare(self,
method=None, url=None, headers=None, files=None, data=None,
params=None, auth=None, cookies=None, hooks=None, json=None):
"""Prepares the entire request with the given parameters."""
self.prepare_method(method)
self.prepare_url(url, params)
self... | [
"Prepares",
"the",
"entire",
"request",
"with",
"the",
"given",
"parameters",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L307-L323 | [
"def",
"prepare",
"(",
"self",
",",
"method",
"=",
"None",
",",
"url",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"files",
"=",
"None",
",",
"data",
"=",
"None",
",",
"params",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"cookies",
"=",
"None... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PreparedRequest.prepare_body | Prepares the given HTTP body data. | pipenv/vendor/requests/models.py | def prepare_body(self, data, files, json=None):
"""Prepares the given HTTP body data."""
# Check if file, fo, generator, iterator.
# If not, run through normal process.
# Nottin' on you.
body = None
content_type = None
if not data and json is not None:
... | def prepare_body(self, data, files, json=None):
"""Prepares the given HTTP body data."""
# Check if file, fo, generator, iterator.
# If not, run through normal process.
# Nottin' on you.
body = None
content_type = None
if not data and json is not None:
... | [
"Prepares",
"the",
"given",
"HTTP",
"body",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L452-L519 | [
"def",
"prepare_body",
"(",
"self",
",",
"data",
",",
"files",
",",
"json",
"=",
"None",
")",
":",
"# Check if file, fo, generator, iterator.",
"# If not, run through normal process.",
"# Nottin' on you.",
"body",
"=",
"None",
"content_type",
"=",
"None",
"if",
"not",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PreparedRequest.prepare_content_length | Prepare Content-Length header based on request method and body | pipenv/vendor/requests/models.py | def prepare_content_length(self, body):
"""Prepare Content-Length header based on request method and body"""
if body is not None:
length = super_len(body)
if length:
# If length exists, set it. Otherwise, we fallback
# to Transfer-Encoding: chunked... | def prepare_content_length(self, body):
"""Prepare Content-Length header based on request method and body"""
if body is not None:
length = super_len(body)
if length:
# If length exists, set it. Otherwise, we fallback
# to Transfer-Encoding: chunked... | [
"Prepare",
"Content",
"-",
"Length",
"header",
"based",
"on",
"request",
"method",
"and",
"body"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L521-L532 | [
"def",
"prepare_content_length",
"(",
"self",
",",
"body",
")",
":",
"if",
"body",
"is",
"not",
"None",
":",
"length",
"=",
"super_len",
"(",
"body",
")",
"if",
"length",
":",
"# If length exists, set it. Otherwise, we fallback",
"# to Transfer-Encoding: chunked.",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PreparedRequest.prepare_auth | Prepares the given HTTP auth data. | pipenv/vendor/requests/models.py | def prepare_auth(self, auth, url=''):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
... | def prepare_auth(self, auth, url=''):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
... | [
"Prepares",
"the",
"given",
"HTTP",
"auth",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L534-L554 | [
"def",
"prepare_auth",
"(",
"self",
",",
"auth",
",",
"url",
"=",
"''",
")",
":",
"# If no Auth is explicitly provided, extract it from the URL first.",
"if",
"auth",
"is",
"None",
":",
"url_auth",
"=",
"get_auth_from_url",
"(",
"self",
".",
"url",
")",
"auth",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PreparedRequest.prepare_cookies | Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
can only be called once for the life of the
... | pipenv/vendor/requests/models.py | def prepare_cookies(self, cookies):
"""Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
ca... | def prepare_cookies(self, cookies):
"""Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
ca... | [
"Prepares",
"the",
"given",
"HTTP",
"cookie",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L556-L574 | [
"def",
"prepare_cookies",
"(",
"self",
",",
"cookies",
")",
":",
"if",
"isinstance",
"(",
"cookies",
",",
"cookielib",
".",
"CookieJar",
")",
":",
"self",
".",
"_cookies",
"=",
"cookies",
"else",
":",
"self",
".",
"_cookies",
"=",
"cookiejar_from_dict",
"(... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PreparedRequest.prepare_hooks | Prepares the given hooks. | pipenv/vendor/requests/models.py | def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
sel... | def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
sel... | [
"Prepares",
"the",
"given",
"hooks",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L576-L583 | [
"def",
"prepare_hooks",
"(",
"self",
",",
"hooks",
")",
":",
"# hooks can be passed as None to the prepare method and to this",
"# method. To prevent iterating over None, simply use an empty list",
"# if hooks is False-y",
"hooks",
"=",
"hooks",
"or",
"[",
"]",
"for",
"event",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Response.is_permanent_redirect | True if this Response one of the permanent versions of redirect. | pipenv/vendor/requests/models.py | def is_permanent_redirect(self):
"""True if this Response one of the permanent versions of redirect."""
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect)) | def is_permanent_redirect(self):
"""True if this Response one of the permanent versions of redirect."""
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect)) | [
"True",
"if",
"this",
"Response",
"one",
"of",
"the",
"permanent",
"versions",
"of",
"redirect",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L715-L717 | [
"def",
"is_permanent_redirect",
"(",
"self",
")",
":",
"return",
"(",
"'location'",
"in",
"self",
".",
"headers",
"and",
"self",
".",
"status_code",
"in",
"(",
"codes",
".",
"moved_permanently",
",",
"codes",
".",
"permanent_redirect",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Response.text | Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
non-HTTP knowledge to m... | pipenv/vendor/requests/models.py | def text(self):
"""Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
... | def text(self):
"""Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
... | [
"Content",
"of",
"the",
"response",
"in",
"unicode",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L836-L871 | [
"def",
"text",
"(",
"self",
")",
":",
"# Try charset from content-type",
"content",
"=",
"None",
"encoding",
"=",
"self",
".",
"encoding",
"if",
"not",
"self",
".",
"content",
":",
"return",
"str",
"(",
"''",
")",
"# Fallback to auto-detected encoding.",
"if",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Response.raise_for_status | Raises stored :class:`HTTPError`, if one occurred. | pipenv/vendor/requests/models.py | def raise_for_status(self):
"""Raises stored :class:`HTTPError`, if one occurred."""
http_error_msg = ''
if isinstance(self.reason, bytes):
# We attempt to decode utf-8 first because some servers
# choose to localize their reason strings. If the string
# isn'... | def raise_for_status(self):
"""Raises stored :class:`HTTPError`, if one occurred."""
http_error_msg = ''
if isinstance(self.reason, bytes):
# We attempt to decode utf-8 first because some servers
# choose to localize their reason strings. If the string
# isn'... | [
"Raises",
"stored",
":",
"class",
":",
"HTTPError",
"if",
"one",
"occurred",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L917-L940 | [
"def",
"raise_for_status",
"(",
"self",
")",
":",
"http_error_msg",
"=",
"''",
"if",
"isinstance",
"(",
"self",
".",
"reason",
",",
"bytes",
")",
":",
"# We attempt to decode utf-8 first because some servers",
"# choose to localize their reason strings. If the string",
"# i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Response.close | Releases the connection back to the pool. Once this method has been
called the underlying ``raw`` object must not be accessed again.
*Note: Should not normally need to be called explicitly.* | pipenv/vendor/requests/models.py | def close(self):
"""Releases the connection back to the pool. Once this method has been
called the underlying ``raw`` object must not be accessed again.
*Note: Should not normally need to be called explicitly.*
"""
if not self._content_consumed:
self.raw.close()
... | def close(self):
"""Releases the connection back to the pool. Once this method has been
called the underlying ``raw`` object must not be accessed again.
*Note: Should not normally need to be called explicitly.*
"""
if not self._content_consumed:
self.raw.close()
... | [
"Releases",
"the",
"connection",
"back",
"to",
"the",
"pool",
".",
"Once",
"this",
"method",
"has",
"been",
"called",
"the",
"underlying",
"raw",
"object",
"must",
"not",
"be",
"accessed",
"again",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L942-L953 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_content_consumed",
":",
"self",
".",
"raw",
".",
"close",
"(",
")",
"release_conn",
"=",
"getattr",
"(",
"self",
".",
"raw",
",",
"'release_conn'",
",",
"None",
")",
"if",
"release_conn... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | create_env_error_message | Format an error message for an EnvironmentError
It may occur anytime during the execution of the install command. | pipenv/patched/notpip/_internal/commands/install.py | def create_env_error_message(error, show_traceback, using_user_site):
"""Format an error message for an EnvironmentError
It may occur anytime during the execution of the install command.
"""
parts = []
# Mention the error if we are not going to show a traceback
parts.append("Could not install ... | def create_env_error_message(error, show_traceback, using_user_site):
"""Format an error message for an EnvironmentError
It may occur anytime during the execution of the install command.
"""
parts = []
# Mention the error if we are not going to show a traceback
parts.append("Could not install ... | [
"Format",
"an",
"error",
"message",
"for",
"an",
"EnvironmentError"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/install.py#L533-L566 | [
"def",
"create_env_error_message",
"(",
"error",
",",
"show_traceback",
",",
"using_user_site",
")",
":",
"parts",
"=",
"[",
"]",
"# Mention the error if we are not going to show a traceback",
"parts",
".",
"append",
"(",
"\"Could not install packages due to an EnvironmentError... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _ipv6_host | Process IPv6 address literals | pipenv/vendor/urllib3/connectionpool.py | def _ipv6_host(host, scheme):
"""
Process IPv6 address literals
"""
# httplib doesn't like it when we include brackets in IPv6 addresses
# Specifically, if we include brackets but also pass the port then
# httplib crazily doubles up the square brackets on the Host header.
# Instead, we need... | def _ipv6_host(host, scheme):
"""
Process IPv6 address literals
"""
# httplib doesn't like it when we include brackets in IPv6 addresses
# Specifically, if we include brackets but also pass the port then
# httplib crazily doubles up the square brackets on the Host header.
# Instead, we need... | [
"Process",
"IPv6",
"address",
"literals"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L878-L896 | [
"def",
"_ipv6_host",
"(",
"host",
",",
"scheme",
")",
":",
"# httplib doesn't like it when we include brackets in IPv6 addresses",
"# Specifically, if we include brackets but also pass the port then",
"# httplib crazily doubles up the square brackets on the Host header.",
"# Instead, we need t... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPConnectionPool._get_conn | Get a connection. Will return a pooled connection if one is available.
If no connections are available and :prop:`.block` is ``False``, then a
fresh connection is returned.
:param timeout:
Seconds to wait before giving up and raising
:class:`urllib3.exceptions.EmptyPool... | pipenv/vendor/urllib3/connectionpool.py | def _get_conn(self, timeout=None):
"""
Get a connection. Will return a pooled connection if one is available.
If no connections are available and :prop:`.block` is ``False``, then a
fresh connection is returned.
:param timeout:
Seconds to wait before giving up and r... | def _get_conn(self, timeout=None):
"""
Get a connection. Will return a pooled connection if one is available.
If no connections are available and :prop:`.block` is ``False``, then a
fresh connection is returned.
:param timeout:
Seconds to wait before giving up and r... | [
"Get",
"a",
"connection",
".",
"Will",
"return",
"a",
"pooled",
"connection",
"if",
"one",
"is",
"available",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L212-L248 | [
"def",
"_get_conn",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"conn",
"=",
"None",
"try",
":",
"conn",
"=",
"self",
".",
"pool",
".",
"get",
"(",
"block",
"=",
"self",
".",
"block",
",",
"timeout",
"=",
"timeout",
")",
"except",
"Attribut... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPConnectionPool._get_timeout | Helper that always returns a :class:`urllib3.util.Timeout` | pipenv/vendor/urllib3/connectionpool.py | def _get_timeout(self, timeout):
""" Helper that always returns a :class:`urllib3.util.Timeout` """
if timeout is _Default:
return self.timeout.clone()
if isinstance(timeout, Timeout):
return timeout.clone()
else:
# User passed us an int/float. This i... | def _get_timeout(self, timeout):
""" Helper that always returns a :class:`urllib3.util.Timeout` """
if timeout is _Default:
return self.timeout.clone()
if isinstance(timeout, Timeout):
return timeout.clone()
else:
# User passed us an int/float. This i... | [
"Helper",
"that",
"always",
"returns",
"a",
":",
"class",
":",
"urllib3",
".",
"util",
".",
"Timeout"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L290-L300 | [
"def",
"_get_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"timeout",
"is",
"_Default",
":",
"return",
"self",
".",
"timeout",
".",
"clone",
"(",
")",
"if",
"isinstance",
"(",
"timeout",
",",
"Timeout",
")",
":",
"return",
"timeout",
".",
"clo... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPConnectionPool._raise_timeout | Is the error actually a timeout? Will raise a ReadTimeout or pass | pipenv/vendor/urllib3/connectionpool.py | def _raise_timeout(self, err, url, timeout_value):
"""Is the error actually a timeout? Will raise a ReadTimeout or pass"""
if isinstance(err, SocketTimeout):
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
# See the above comment about EAGAIN ... | def _raise_timeout(self, err, url, timeout_value):
"""Is the error actually a timeout? Will raise a ReadTimeout or pass"""
if isinstance(err, SocketTimeout):
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
# See the above comment about EAGAIN ... | [
"Is",
"the",
"error",
"actually",
"a",
"timeout?",
"Will",
"raise",
"a",
"ReadTimeout",
"or",
"pass"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L302-L317 | [
"def",
"_raise_timeout",
"(",
"self",
",",
"err",
",",
"url",
",",
"timeout_value",
")",
":",
"if",
"isinstance",
"(",
"err",
",",
"SocketTimeout",
")",
":",
"raise",
"ReadTimeoutError",
"(",
"self",
",",
"url",
",",
"\"Read timed out. (read timeout=%s)\"",
"%... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPConnectionPool.urlopen | Get a connection from the pool and perform an HTTP request. This is the
lowest level call for making a request, so you'll need to specify all
the raw details.
.. note::
More commonly, it's appropriate to use a convenience method provided
by :class:`.RequestMethods`, such ... | pipenv/vendor/urllib3/connectionpool.py | def urlopen(self, method, url, body=None, headers=None, retries=None,
redirect=True, assert_same_host=True, timeout=_Default,
pool_timeout=None, release_conn=None, chunked=False,
body_pos=None, **response_kw):
"""
Get a connection from the pool and perform... | def urlopen(self, method, url, body=None, headers=None, retries=None,
redirect=True, assert_same_host=True, timeout=_Default,
pool_timeout=None, release_conn=None, chunked=False,
body_pos=None, **response_kw):
"""
Get a connection from the pool and perform... | [
"Get",
"a",
"connection",
"from",
"the",
"pool",
"and",
"perform",
"an",
"HTTP",
"request",
".",
"This",
"is",
"the",
"lowest",
"level",
"call",
"for",
"making",
"a",
"request",
"so",
"you",
"ll",
"need",
"to",
"specify",
"all",
"the",
"raw",
"details",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L446-L733 | [
"def",
"urlopen",
"(",
"self",
",",
"method",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"retries",
"=",
"None",
",",
"redirect",
"=",
"True",
",",
"assert_same_host",
"=",
"True",
",",
"timeout",
"=",
"_Default",
",",
"p... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPSConnectionPool._prepare_conn | Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket`
and establish the tunnel if proxy is used. | pipenv/vendor/urllib3/connectionpool.py | def _prepare_conn(self, conn):
"""
Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket`
and establish the tunnel if proxy is used.
"""
if isinstance(conn, VerifiedHTTPSConnection):
conn.set_cert(key_file=self.key_file,
cert_fi... | def _prepare_conn(self, conn):
"""
Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket`
and establish the tunnel if proxy is used.
"""
if isinstance(conn, VerifiedHTTPSConnection):
conn.set_cert(key_file=self.key_file,
cert_fi... | [
"Prepare",
"the",
"connection",
"for",
":",
"meth",
":",
"urllib3",
".",
"util",
".",
"ssl_wrap_socket",
"and",
"establish",
"the",
"tunnel",
"if",
"proxy",
"is",
"used",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L782-L797 | [
"def",
"_prepare_conn",
"(",
"self",
",",
"conn",
")",
":",
"if",
"isinstance",
"(",
"conn",
",",
"VerifiedHTTPSConnection",
")",
":",
"conn",
".",
"set_cert",
"(",
"key_file",
"=",
"self",
".",
"key_file",
",",
"cert_file",
"=",
"self",
".",
"cert_file",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HTTPSConnectionPool._prepare_proxy | Establish tunnel connection early, because otherwise httplib
would improperly set Host: header to proxy's IP:port. | pipenv/vendor/urllib3/connectionpool.py | def _prepare_proxy(self, conn):
"""
Establish tunnel connection early, because otherwise httplib
would improperly set Host: header to proxy's IP:port.
"""
conn.set_tunnel(self._proxy_host, self.port, self.proxy_headers)
conn.connect() | def _prepare_proxy(self, conn):
"""
Establish tunnel connection early, because otherwise httplib
would improperly set Host: header to proxy's IP:port.
"""
conn.set_tunnel(self._proxy_host, self.port, self.proxy_headers)
conn.connect() | [
"Establish",
"tunnel",
"connection",
"early",
"because",
"otherwise",
"httplib",
"would",
"improperly",
"set",
"Host",
":",
"header",
"to",
"proxy",
"s",
"IP",
":",
"port",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L799-L805 | [
"def",
"_prepare_proxy",
"(",
"self",
",",
"conn",
")",
":",
"conn",
".",
"set_tunnel",
"(",
"self",
".",
"_proxy_host",
",",
"self",
".",
"port",
",",
"self",
".",
"proxy_headers",
")",
"conn",
".",
"connect",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Finder.reload_system_path | Rebuilds the base system path and all of the contained finders within it.
This will re-apply any changes to the environment or any version changes on the system. | pipenv/vendor/pythonfinder/pythonfinder.py | def reload_system_path(self):
# type: () -> None
"""
Rebuilds the base system path and all of the contained finders within it.
This will re-apply any changes to the environment or any version changes on the system.
"""
if self._system_path is not None:
self.... | def reload_system_path(self):
# type: () -> None
"""
Rebuilds the base system path and all of the contained finders within it.
This will re-apply any changes to the environment or any version changes on the system.
"""
if self._system_path is not None:
self.... | [
"Rebuilds",
"the",
"base",
"system",
"path",
"and",
"all",
"of",
"the",
"contained",
"finders",
"within",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pythonfinder/pythonfinder.py#L78-L90 | [
"def",
"reload_system_path",
"(",
"self",
")",
":",
"# type: () -> None",
"if",
"self",
".",
"_system_path",
"is",
"not",
"None",
":",
"self",
".",
"_system_path",
".",
"clear_caches",
"(",
")",
"self",
".",
"_system_path",
"=",
"None",
"six",
".",
"moves",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Finder.find_python_version | Find the python version which corresponds most closely to the version requested.
:param Union[str, int] major: The major version to look for, or the full version, or the name of the target version.
:param Optional[int] minor: The minor version. If provided, disables string-based lookups from the major ... | pipenv/vendor/pythonfinder/pythonfinder.py | def find_python_version(
self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None
):
# type: (Optional[Union[str, int]], Optional[int], Optional[int], Optional[bool], Optional[bool], Optional[str], Optional[str]) -> PathEntry
"""
Find the python version whic... | def find_python_version(
self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None
):
# type: (Optional[Union[str, int]], Optional[int], Optional[int], Optional[bool], Optional[bool], Optional[str], Optional[str]) -> PathEntry
"""
Find the python version whic... | [
"Find",
"the",
"python",
"version",
"which",
"corresponds",
"most",
"closely",
"to",
"the",
"version",
"requested",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pythonfinder/pythonfinder.py#L122-L223 | [
"def",
"find_python_version",
"(",
"self",
",",
"major",
"=",
"None",
",",
"minor",
"=",
"None",
",",
"patch",
"=",
"None",
",",
"pre",
"=",
"None",
",",
"dev",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"# type: (Op... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_shell | Get the shell that the supplied pid or os.getpid() is running in. | pipenv/vendor/shellingham/posix.py | def get_shell(pid=None, max_depth=6):
"""Get the shell that the supplied pid or os.getpid() is running in.
"""
pid = str(pid or os.getpid())
mapping = _get_process_mapping()
login_shell = os.environ.get('SHELL', '')
for _ in range(max_depth):
try:
proc = mapping[pid]
... | def get_shell(pid=None, max_depth=6):
"""Get the shell that the supplied pid or os.getpid() is running in.
"""
pid = str(pid or os.getpid())
mapping = _get_process_mapping()
login_shell = os.environ.get('SHELL', '')
for _ in range(max_depth):
try:
proc = mapping[pid]
... | [
"Get",
"the",
"shell",
"that",
"the",
"supplied",
"pid",
"or",
"os",
".",
"getpid",
"()",
"is",
"running",
"in",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix.py#L33-L56 | [
"def",
"get_shell",
"(",
"pid",
"=",
"None",
",",
"max_depth",
"=",
"6",
")",
":",
"pid",
"=",
"str",
"(",
"pid",
"or",
"os",
".",
"getpid",
"(",
")",
")",
"mapping",
"=",
"_get_process_mapping",
"(",
")",
"login_shell",
"=",
"os",
".",
"environ",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _make_class_unpicklable | Make the given class un-picklable. | pipenv/vendor/backports/enum/__init__.py | def _make_class_unpicklable(cls):
"""Make the given class un-picklable."""
def _break_on_call_reduce(self, protocol=None):
raise TypeError('%r cannot be pickled' % self)
cls.__reduce_ex__ = _break_on_call_reduce
cls.__module__ = '<unknown>' | def _make_class_unpicklable(cls):
"""Make the given class un-picklable."""
def _break_on_call_reduce(self, protocol=None):
raise TypeError('%r cannot be pickled' % self)
cls.__reduce_ex__ = _break_on_call_reduce
cls.__module__ = '<unknown>' | [
"Make",
"the",
"given",
"class",
"un",
"-",
"picklable",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L86-L91 | [
"def",
"_make_class_unpicklable",
"(",
"cls",
")",
":",
"def",
"_break_on_call_reduce",
"(",
"self",
",",
"protocol",
"=",
"None",
")",
":",
"raise",
"TypeError",
"(",
"'%r cannot be pickled'",
"%",
"self",
")",
"cls",
".",
"__reduce_ex__",
"=",
"_break_on_call_... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _convert | Create a new Enum subclass that replaces a collection of global constants | pipenv/vendor/backports/enum/__init__.py | def _convert(cls, name, module, filter, source=None):
"""
Create a new Enum subclass that replaces a collection of global constants
"""
# convert all constants from source (or module) that pass filter() to
# a new Enum called name, and export the enum and its members back to
# module;
# also... | def _convert(cls, name, module, filter, source=None):
"""
Create a new Enum subclass that replaces a collection of global constants
"""
# convert all constants from source (or module) that pass filter() to
# a new Enum called name, and export the enum and its members back to
# module;
# also... | [
"Create",
"a",
"new",
"Enum",
"subclass",
"that",
"replaces",
"a",
"collection",
"of",
"global",
"constants"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L789-L808 | [
"def",
"_convert",
"(",
"cls",
",",
"name",
",",
"module",
",",
"filter",
",",
"source",
"=",
"None",
")",
":",
"# convert all constants from source (or module) that pass filter() to",
"# a new Enum called name, and export the enum and its members back to",
"# module;",
"# also... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | unique | Class decorator that ensures only unique members exist in an enumeration. | pipenv/vendor/backports/enum/__init__.py | def unique(enumeration):
"""Class decorator that ensures only unique members exist in an enumeration."""
duplicates = []
for name, member in enumeration.__members__.items():
if name != member.name:
duplicates.append((name, member.name))
if duplicates:
duplicate_names = ', '.j... | def unique(enumeration):
"""Class decorator that ensures only unique members exist in an enumeration."""
duplicates = []
for name, member in enumeration.__members__.items():
if name != member.name:
duplicates.append((name, member.name))
if duplicates:
duplicate_names = ', '.j... | [
"Class",
"decorator",
"that",
"ensures",
"only",
"unique",
"members",
"exist",
"in",
"an",
"enumeration",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L824-L837 | [
"def",
"unique",
"(",
"enumeration",
")",
":",
"duplicates",
"=",
"[",
"]",
"for",
"name",
",",
"member",
"in",
"enumeration",
".",
"__members__",
".",
"items",
"(",
")",
":",
"if",
"name",
"!=",
"member",
".",
"name",
":",
"duplicates",
".",
"append",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EnumMeta._create_ | Convenience method to create a new Enum class.
`names` can be:
* A string containing member names, separated either with spaces or
commas. Values are auto-numbered from 1.
* An iterable of member names. Values are auto-numbered from 1.
* An iterable of (member name, value) ... | pipenv/vendor/backports/enum/__init__.py | def _create_(cls, class_name, names=None, module=None, type=None, start=1):
"""Convenience method to create a new Enum class.
`names` can be:
* A string containing member names, separated either with spaces or
commas. Values are auto-numbered from 1.
* An iterable of member ... | def _create_(cls, class_name, names=None, module=None, type=None, start=1):
"""Convenience method to create a new Enum class.
`names` can be:
* A string containing member names, separated either with spaces or
commas. Values are auto-numbered from 1.
* An iterable of member ... | [
"Convenience",
"method",
"to",
"create",
"a",
"new",
"Enum",
"class",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L422-L481 | [
"def",
"_create_",
"(",
"cls",
",",
"class_name",
",",
"names",
"=",
"None",
",",
"module",
"=",
"None",
",",
"type",
"=",
"None",
",",
"start",
"=",
"1",
")",
":",
"if",
"pyver",
"<",
"3.0",
":",
"# if class_name is unicode, attempt a conversion to ASCII",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | EnumMeta._get_mixins_ | Returns the type for creating enum members, and the first inherited
enum class.
bases: the tuple of bases that was given to __new__ | pipenv/vendor/backports/enum/__init__.py | def _get_mixins_(bases):
"""Returns the type for creating enum members, and the first inherited
enum class.
bases: the tuple of bases that was given to __new__
"""
if not bases or Enum is None:
return object, Enum
# double check that we are not subclassing... | def _get_mixins_(bases):
"""Returns the type for creating enum members, and the first inherited
enum class.
bases: the tuple of bases that was given to __new__
"""
if not bases or Enum is None:
return object, Enum
# double check that we are not subclassing... | [
"Returns",
"the",
"type",
"for",
"creating",
"enum",
"members",
"and",
"the",
"first",
"inherited",
"enum",
"class",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L484-L527 | [
"def",
"_get_mixins_",
"(",
"bases",
")",
":",
"if",
"not",
"bases",
"or",
"Enum",
"is",
"None",
":",
"return",
"object",
",",
"Enum",
"# double check that we are not subclassing a class with existing",
"# enumeration members; while we're at it, see if any other data",
"# typ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _basic_auth_str | Returns a Basic Auth string. | pipenv/vendor/requests/auth.py | def _basic_auth_str(username, password):
"""Returns a Basic Auth string."""
# "I want us to put a big-ol' comment on top of it that
# says that this behaviour is dumb but we need to preserve
# it because people are relying on it."
# - Lukasa
#
# These are here solely to maintain backward... | def _basic_auth_str(username, password):
"""Returns a Basic Auth string."""
# "I want us to put a big-ol' comment on top of it that
# says that this behaviour is dumb but we need to preserve
# it because people are relying on it."
# - Lukasa
#
# These are here solely to maintain backward... | [
"Returns",
"a",
"Basic",
"Auth",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/auth.py#L28-L69 | [
"def",
"_basic_auth_str",
"(",
"username",
",",
"password",
")",
":",
"# \"I want us to put a big-ol' comment on top of it that",
"# says that this behaviour is dumb but we need to preserve",
"# it because people are relying on it.\"",
"# - Lukasa",
"#",
"# These are here solely to main... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | format_for_columns | Convert the package data into something usable
by output_package_listing_columns. | pipenv/patched/notpip/_internal/commands/list.py | def format_for_columns(pkgs, options):
"""
Convert the package data into something usable
by output_package_listing_columns.
"""
running_outdated = options.outdated
# Adjust the header for the `pip list --outdated` case.
if running_outdated:
header = ["Package", "Version", "Latest", ... | def format_for_columns(pkgs, options):
"""
Convert the package data into something usable
by output_package_listing_columns.
"""
running_outdated = options.outdated
# Adjust the header for the `pip list --outdated` case.
if running_outdated:
header = ["Package", "Version", "Latest", ... | [
"Convert",
"the",
"package",
"data",
"into",
"something",
"usable",
"by",
"output_package_listing_columns",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/list.py#L250-L284 | [
"def",
"format_for_columns",
"(",
"pkgs",
",",
"options",
")",
":",
"running_outdated",
"=",
"options",
".",
"outdated",
"# Adjust the header for the `pip list --outdated` case.",
"if",
"running_outdated",
":",
"header",
"=",
"[",
"\"Package\"",
",",
"\"Version\"",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ListCommand._build_package_finder | Create a package finder appropriate to this list command. | pipenv/patched/notpip/_internal/commands/list.py | def _build_package_finder(self, options, index_urls, session):
"""
Create a package finder appropriate to this list command.
"""
return PackageFinder(
find_links=options.find_links,
index_urls=index_urls,
allow_all_prereleases=options.pre,
... | def _build_package_finder(self, options, index_urls, session):
"""
Create a package finder appropriate to this list command.
"""
return PackageFinder(
find_links=options.find_links,
index_urls=index_urls,
allow_all_prereleases=options.pre,
... | [
"Create",
"a",
"package",
"finder",
"appropriate",
"to",
"this",
"list",
"command",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/list.py#L112-L122 | [
"def",
"_build_package_finder",
"(",
"self",
",",
"options",
",",
"index_urls",
",",
"session",
")",
":",
"return",
"PackageFinder",
"(",
"find_links",
"=",
"options",
".",
"find_links",
",",
"index_urls",
"=",
"index_urls",
",",
"allow_all_prereleases",
"=",
"o... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ScriptMaker._build_shebang | Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang which allows the script to run either under Python or sh, using
s... | pipenv/vendor/distlib/scripts.py | def _build_shebang(self, executable, post_interp):
"""
Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang wh... | def _build_shebang(self, executable, post_interp):
"""
Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang wh... | [
"Build",
"a",
"shebang",
"line",
".",
"In",
"the",
"simple",
"case",
"(",
"on",
"Windows",
"or",
"a",
"shebang",
"line",
"which",
"is",
"not",
"too",
"long",
"or",
"contains",
"spaces",
")",
"use",
"a",
"simple",
"formulation",
"for",
"the",
"shebang",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/scripts.py#L139-L168 | [
"def",
"_build_shebang",
"(",
"self",
",",
"executable",
",",
"post_interp",
")",
":",
"if",
"os",
".",
"name",
"!=",
"'posix'",
":",
"simple_shebang",
"=",
"True",
"else",
":",
"# Add 3 for '#!' prefix and newline suffix.",
"shebang_length",
"=",
"len",
"(",
"e... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ScriptMaker.make | Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
copying from a source location).
:pa... | pipenv/vendor/distlib/scripts.py | def make(self, specification, options=None):
"""
Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
... | def make(self, specification, options=None):
"""
Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
... | [
"Make",
"a",
"script",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/scripts.py#L389-L406 | [
"def",
"make",
"(",
"self",
",",
"specification",
",",
"options",
"=",
"None",
")",
":",
"filenames",
"=",
"[",
"]",
"entry",
"=",
"get_export_entry",
"(",
"specification",
")",
"if",
"entry",
"is",
"None",
":",
"self",
".",
"_copy_script",
"(",
"specifi... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ScriptMaker.make_multiple | Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to, | pipenv/vendor/distlib/scripts.py | def make_multiple(self, specifications, options=None):
"""
Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to,
"""
filenames = []
for specification in spec... | def make_multiple(self, specifications, options=None):
"""
Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to,
"""
filenames = []
for specification in spec... | [
"Take",
"a",
"list",
"of",
"specifications",
"and",
"make",
"scripts",
"from",
"them",
":",
"param",
"specifications",
":",
"A",
"list",
"of",
"specifications",
".",
":",
"return",
":",
"A",
"list",
"of",
"all",
"absolute",
"pathnames",
"written",
"to"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/scripts.py#L408-L417 | [
"def",
"make_multiple",
"(",
"self",
",",
"specifications",
",",
"options",
"=",
"None",
")",
":",
"filenames",
"=",
"[",
"]",
"for",
"specification",
"in",
"specifications",
":",
"filenames",
".",
"extend",
"(",
"self",
".",
"make",
"(",
"specification",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | iter_find_files | Returns a generator that yields file paths under a *directory*,
matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
search. Yielded paths will include this as a prefix.
patterns ... | pipenv/patched/piptools/io.py | def iter_find_files(directory, patterns, ignored=None):
"""Returns a generator that yields file paths under a *directory*,
matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
search.... | def iter_find_files(directory, patterns, ignored=None):
"""Returns a generator that yields file paths under a *directory*,
matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
search.... | [
"Returns",
"a",
"generator",
"that",
"yields",
"file",
"paths",
"under",
"a",
"*",
"directory",
"*",
"matching",
"*",
"patterns",
"*",
"using",
"glob",
"_",
"syntax",
"(",
"e",
".",
"g",
".",
"*",
".",
"txt",
")",
".",
"Also",
"supports",
"*",
"ignor... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L457-L497 | [
"def",
"iter_find_files",
"(",
"directory",
",",
"patterns",
",",
"ignored",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"patterns",
",",
"basestring",
")",
":",
"patterns",
"=",
"[",
"patterns",
"]",
"pats_re",
"=",
"re",
".",
"compile",
"(",
"'|'",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | FilePerms.from_int | Create a :class:`FilePerms` object from an integer.
>>> FilePerms.from_int(0o644) # note the leading zero-oh for octal
FilePerms(user='rw', group='r', other='r') | pipenv/patched/piptools/io.py | def from_int(cls, i):
"""Create a :class:`FilePerms` object from an integer.
>>> FilePerms.from_int(0o644) # note the leading zero-oh for octal
FilePerms(user='rw', group='r', other='r')
"""
i &= FULL_PERMS
key = ('', 'x', 'w', 'xw', 'r', 'rx', 'rw', 'rwx')
part... | def from_int(cls, i):
"""Create a :class:`FilePerms` object from an integer.
>>> FilePerms.from_int(0o644) # note the leading zero-oh for octal
FilePerms(user='rw', group='r', other='r')
"""
i &= FULL_PERMS
key = ('', 'x', 'w', 'xw', 'r', 'rx', 'rw', 'rwx')
part... | [
"Create",
"a",
":",
"class",
":",
"FilePerms",
"object",
"from",
"an",
"integer",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L145-L158 | [
"def",
"from_int",
"(",
"cls",
",",
"i",
")",
":",
"i",
"&=",
"FULL_PERMS",
"key",
"=",
"(",
"''",
",",
"'x'",
",",
"'w'",
",",
"'xw'",
",",
"'r'",
",",
"'rx'",
",",
"'rw'",
",",
"'rwx'",
")",
"parts",
"=",
"[",
"]",
"while",
"i",
":",
"parts... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | FilePerms.from_path | Make a new :class:`FilePerms` object based on the permissions
assigned to the file or directory at *path*.
Args:
path (str): Filesystem path of the target file.
>>> from os.path import expanduser
>>> 'r' in FilePerms.from_path(expanduser('~')).user # probably
True | pipenv/patched/piptools/io.py | def from_path(cls, path):
"""Make a new :class:`FilePerms` object based on the permissions
assigned to the file or directory at *path*.
Args:
path (str): Filesystem path of the target file.
>>> from os.path import expanduser
>>> 'r' in FilePerms.from_path(expanduser... | def from_path(cls, path):
"""Make a new :class:`FilePerms` object based on the permissions
assigned to the file or directory at *path*.
Args:
path (str): Filesystem path of the target file.
>>> from os.path import expanduser
>>> 'r' in FilePerms.from_path(expanduser... | [
"Make",
"a",
"new",
":",
"class",
":",
"FilePerms",
"object",
"based",
"on",
"the",
"permissions",
"assigned",
"to",
"the",
"file",
"or",
"directory",
"at",
"*",
"path",
"*",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L161-L173 | [
"def",
"from_path",
"(",
"cls",
",",
"path",
")",
":",
"stat_res",
"=",
"os",
".",
"stat",
"(",
"path",
")",
"return",
"cls",
".",
"from_int",
"(",
"stat",
".",
"S_IMODE",
"(",
"stat_res",
".",
"st_mode",
")",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | AtomicSaver.setup | Called on context manager entry (the :keyword:`with` statement),
the ``setup()`` method creates the temporary file in the same
directory as the destination file.
``setup()`` tests for a writable directory with rename permissions
early, as the part file may not be written to immediately ... | pipenv/patched/piptools/io.py | def setup(self):
"""Called on context manager entry (the :keyword:`with` statement),
the ``setup()`` method creates the temporary file in the same
directory as the destination file.
``setup()`` tests for a writable directory with rename permissions
early, as the part file may no... | def setup(self):
"""Called on context manager entry (the :keyword:`with` statement),
the ``setup()`` method creates the temporary file in the same
directory as the destination file.
``setup()`` tests for a writable directory with rename permissions
early, as the part file may no... | [
"Called",
"on",
"context",
"manager",
"entry",
"(",
"the",
":",
"keyword",
":",
"with",
"statement",
")",
"the",
"setup",
"()",
"method",
"creates",
"the",
"temporary",
"file",
"in",
"the",
"same",
"directory",
"as",
"the",
"destination",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L407-L429 | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"lexists",
"(",
"self",
".",
"dest_path",
")",
":",
"if",
"not",
"self",
".",
"overwrite",
":",
"raise",
"OSError",
"(",
"errno",
".",
"EEXIST",
",",
"'Overwrite disabled and file alrea... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | load | Loads a pipfile from a given path.
If none is provided, one will try to be found. | pipenv/patched/pipfile/api.py | def load(pipfile_path=None, inject_env=True):
"""Loads a pipfile from a given path.
If none is provided, one will try to be found.
"""
if pipfile_path is None:
pipfile_path = Pipfile.find()
return Pipfile.load(filename=pipfile_path, inject_env=inject_env) | def load(pipfile_path=None, inject_env=True):
"""Loads a pipfile from a given path.
If none is provided, one will try to be found.
"""
if pipfile_path is None:
pipfile_path = Pipfile.find()
return Pipfile.load(filename=pipfile_path, inject_env=inject_env) | [
"Loads",
"a",
"pipfile",
"from",
"a",
"given",
"path",
".",
"If",
"none",
"is",
"provided",
"one",
"will",
"try",
"to",
"be",
"found",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L222-L230 | [
"def",
"load",
"(",
"pipfile_path",
"=",
"None",
",",
"inject_env",
"=",
"True",
")",
":",
"if",
"pipfile_path",
"is",
"None",
":",
"pipfile_path",
"=",
"Pipfile",
".",
"find",
"(",
")",
"return",
"Pipfile",
".",
"load",
"(",
"filename",
"=",
"pipfile_pa... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PipfileParser.inject_environment_variables | Recursively injects environment variables into TOML values | pipenv/patched/pipfile/api.py | def inject_environment_variables(self, d):
"""
Recursively injects environment variables into TOML values
"""
if not d:
return d
if isinstance(d, six.string_types):
return os.path.expandvars(d)
for k, v in d.items():
if isinstance(v, s... | def inject_environment_variables(self, d):
"""
Recursively injects environment variables into TOML values
"""
if not d:
return d
if isinstance(d, six.string_types):
return os.path.expandvars(d)
for k, v in d.items():
if isinstance(v, s... | [
"Recursively",
"injects",
"environment",
"variables",
"into",
"TOML",
"values"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L73-L90 | [
"def",
"inject_environment_variables",
"(",
"self",
",",
"d",
")",
":",
"if",
"not",
"d",
":",
"return",
"d",
"if",
"isinstance",
"(",
"d",
",",
"six",
".",
"string_types",
")",
":",
"return",
"os",
".",
"path",
".",
"expandvars",
"(",
"d",
")",
"for... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Pipfile.find | Returns the path of a Pipfile in parent directories. | pipenv/patched/pipfile/api.py | def find(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if 'Pipfile':
p = os.path.join(c, 'Pipfile')
if os.path.isfile(p)... | def find(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if 'Pipfile':
p = os.path.join(c, 'Pipfile')
if os.path.isfile(p)... | [
"Returns",
"the",
"path",
"of",
"a",
"Pipfile",
"in",
"parent",
"directories",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L143-L154 | [
"def",
"find",
"(",
"max_depth",
"=",
"3",
")",
":",
"i",
"=",
"0",
"for",
"c",
",",
"d",
",",
"f",
"in",
"walk_up",
"(",
"os",
".",
"getcwd",
"(",
")",
")",
":",
"i",
"+=",
"1",
"if",
"i",
"<",
"max_depth",
":",
"if",
"'Pipfile'",
":",
"p"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Pipfile.load | Load a Pipfile from a given filename. | pipenv/patched/pipfile/api.py | def load(klass, filename, inject_env=True):
"""Load a Pipfile from a given filename."""
p = PipfileParser(filename=filename)
pipfile = klass(filename=filename)
pipfile.data = p.parse(inject_env=inject_env)
return pipfile | def load(klass, filename, inject_env=True):
"""Load a Pipfile from a given filename."""
p = PipfileParser(filename=filename)
pipfile = klass(filename=filename)
pipfile.data = p.parse(inject_env=inject_env)
return pipfile | [
"Load",
"a",
"Pipfile",
"from",
"a",
"given",
"filename",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L157-L162 | [
"def",
"load",
"(",
"klass",
",",
"filename",
",",
"inject_env",
"=",
"True",
")",
":",
"p",
"=",
"PipfileParser",
"(",
"filename",
"=",
"filename",
")",
"pipfile",
"=",
"klass",
"(",
"filename",
"=",
"filename",
")",
"pipfile",
".",
"data",
"=",
"p",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Pipfile.hash | Returns the SHA256 of the pipfile's data. | pipenv/patched/pipfile/api.py | def hash(self):
"""Returns the SHA256 of the pipfile's data."""
content = json.dumps(self.data, sort_keys=True, separators=(",", ":"))
return hashlib.sha256(content.encode("utf8")).hexdigest() | def hash(self):
"""Returns the SHA256 of the pipfile's data."""
content = json.dumps(self.data, sort_keys=True, separators=(",", ":"))
return hashlib.sha256(content.encode("utf8")).hexdigest() | [
"Returns",
"the",
"SHA256",
"of",
"the",
"pipfile",
"s",
"data",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L165-L168 | [
"def",
"hash",
"(",
"self",
")",
":",
"content",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"data",
",",
"sort_keys",
"=",
"True",
",",
"separators",
"=",
"(",
"\",\"",
",",
"\":\"",
")",
")",
"return",
"hashlib",
".",
"sha256",
"(",
"content",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Pipfile.lock | Returns a JSON representation of the Pipfile. | pipenv/patched/pipfile/api.py | def lock(self):
"""Returns a JSON representation of the Pipfile."""
data = self.data
data['_meta']['hash'] = {"sha256": self.hash}
data['_meta']['pipfile-spec'] = 6
return json.dumps(data, indent=4, separators=(',', ': ')) | def lock(self):
"""Returns a JSON representation of the Pipfile."""
data = self.data
data['_meta']['hash'] = {"sha256": self.hash}
data['_meta']['pipfile-spec'] = 6
return json.dumps(data, indent=4, separators=(',', ': ')) | [
"Returns",
"a",
"JSON",
"representation",
"of",
"the",
"Pipfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L176-L181 | [
"def",
"lock",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"data",
"data",
"[",
"'_meta'",
"]",
"[",
"'hash'",
"]",
"=",
"{",
"\"sha256\"",
":",
"self",
".",
"hash",
"}",
"data",
"[",
"'_meta'",
"]",
"[",
"'pipfile-spec'",
"]",
"=",
"6",
"re... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Pipfile.assert_requirements | Asserts PEP 508 specifiers. | pipenv/patched/pipfile/api.py | def assert_requirements(self):
""""Asserts PEP 508 specifiers."""
# Support for 508's implementation_version.
if hasattr(sys, 'implementation'):
implementation_version = format_full_version(sys.implementation.version)
else:
implementation_version = "0"
#... | def assert_requirements(self):
""""Asserts PEP 508 specifiers."""
# Support for 508's implementation_version.
if hasattr(sys, 'implementation'):
implementation_version = format_full_version(sys.implementation.version)
else:
implementation_version = "0"
#... | [
"Asserts",
"PEP",
"508",
"specifiers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L183-L219 | [
"def",
"assert_requirements",
"(",
"self",
")",
":",
"# Support for 508's implementation_version.",
"if",
"hasattr",
"(",
"sys",
",",
"'implementation'",
")",
":",
"implementation_version",
"=",
"format_full_version",
"(",
"sys",
".",
"implementation",
".",
"version",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copyfileobj | copy data from file-like object fsrc to file-like object fdst | pipenv/vendor/distlib/_backport/shutil.py | def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst"""
while 1:
buf = fsrc.read(length)
if not buf:
break
fdst.write(buf) | def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst"""
while 1:
buf = fsrc.read(length)
if not buf:
break
fdst.write(buf) | [
"copy",
"data",
"from",
"file",
"-",
"like",
"object",
"fsrc",
"to",
"file",
"-",
"like",
"object",
"fdst"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L67-L73 | [
"def",
"copyfileobj",
"(",
"fsrc",
",",
"fdst",
",",
"length",
"=",
"16",
"*",
"1024",
")",
":",
"while",
"1",
":",
"buf",
"=",
"fsrc",
".",
"read",
"(",
"length",
")",
"if",
"not",
"buf",
":",
"break",
"fdst",
".",
"write",
"(",
"buf",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copyfile | Copy data from src to dst | pipenv/vendor/distlib/_backport/shutil.py | def copyfile(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
st = os.stat(fn)
except OSError:
# File most likely does not exist
pass
... | def copyfile(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
st = os.stat(fn)
except OSError:
# File most likely does not exist
pass
... | [
"Copy",
"data",
"from",
"src",
"to",
"dst"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L87-L105 | [
"def",
"copyfile",
"(",
"src",
",",
"dst",
")",
":",
"if",
"_samefile",
"(",
"src",
",",
"dst",
")",
":",
"raise",
"Error",
"(",
"\"`%s` and `%s` are the same file\"",
"%",
"(",
"src",
",",
"dst",
")",
")",
"for",
"fn",
"in",
"[",
"src",
",",
"dst",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copymode | Copy mode bits from src to dst | pipenv/vendor/distlib/_backport/shutil.py | def copymode(src, dst):
"""Copy mode bits from src to dst"""
if hasattr(os, 'chmod'):
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
os.chmod(dst, mode) | def copymode(src, dst):
"""Copy mode bits from src to dst"""
if hasattr(os, 'chmod'):
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
os.chmod(dst, mode) | [
"Copy",
"mode",
"bits",
"from",
"src",
"to",
"dst"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L107-L112 | [
"def",
"copymode",
"(",
"src",
",",
"dst",
")",
":",
"if",
"hasattr",
"(",
"os",
",",
"'chmod'",
")",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"src",
")",
"mode",
"=",
"stat",
".",
"S_IMODE",
"(",
"st",
".",
"st_mode",
")",
"os",
".",
"chmod",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copystat | Copy all stat info (mode bits, atime, mtime, flags) from src to dst | pipenv/vendor/distlib/_backport/shutil.py | def copystat(src, dst):
"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
if hasattr(os, 'utime'):
os.utime(dst, (st.st_atime, st.st_mtime))
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chfl... | def copystat(src, dst):
"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
if hasattr(os, 'utime'):
os.utime(dst, (st.st_atime, st.st_mtime))
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chfl... | [
"Copy",
"all",
"stat",
"info",
"(",
"mode",
"bits",
"atime",
"mtime",
"flags",
")",
"from",
"src",
"to",
"dst"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L114-L128 | [
"def",
"copystat",
"(",
"src",
",",
"dst",
")",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"src",
")",
"mode",
"=",
"stat",
".",
"S_IMODE",
"(",
"st",
".",
"st_mode",
")",
"if",
"hasattr",
"(",
"os",
",",
"'utime'",
")",
":",
"os",
".",
"utime",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copy | Copy data and mode bits ("cp src dst").
The destination may be a directory. | pipenv/vendor/distlib/_backport/shutil.py | def copy(src, dst):
"""Copy data and mode bits ("cp src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copymode(src, dst) | def copy(src, dst):
"""Copy data and mode bits ("cp src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copymode(src, dst) | [
"Copy",
"data",
"and",
"mode",
"bits",
"(",
"cp",
"src",
"dst",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L130-L139 | [
"def",
"copy",
"(",
"src",
",",
"dst",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"os",
".",
"path",
".",
"basename",
"(",
"src",
")",
")",
"copyfile",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copy2 | Copy data and all stat info ("cp -p src dst").
The destination may be a directory. | pipenv/vendor/distlib/_backport/shutil.py | def copy2(src, dst):
"""Copy data and all stat info ("cp -p src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copystat(src, dst) | def copy2(src, dst):
"""Copy data and all stat info ("cp -p src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copystat(src, dst) | [
"Copy",
"data",
"and",
"all",
"stat",
"info",
"(",
"cp",
"-",
"p",
"src",
"dst",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L141-L150 | [
"def",
"copy2",
"(",
"src",
",",
"dst",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"os",
".",
"path",
".",
"basename",
"(",
"src",
")",
")",
"copyfile",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | rmtree | Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is the argument to that function that caused it to fail; and
... | pipenv/vendor/distlib/_backport/shutil.py | def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is th... | def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is th... | [
"Recursively",
"delete",
"a",
"directory",
"tree",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L246-L292 | [
"def",
"rmtree",
"(",
"path",
",",
"ignore_errors",
"=",
"False",
",",
"onerror",
"=",
"None",
")",
":",
"if",
"ignore_errors",
":",
"def",
"onerror",
"(",
"*",
"args",
")",
":",
"pass",
"elif",
"onerror",
"is",
"None",
":",
"def",
"onerror",
"(",
"*... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.