repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
pypa/pipenv | pipenv/vendor/click/_bashcomplete.py | is_incomplete_argument | def is_incomplete_argument(current_params, cmd_param):
"""
:param current_params: the current params and values for this argument as already entered
:param cmd_param: the current command parameter
:return: whether or not the last argument is incomplete and corresponds to this cmd_param. In
other wor... | python | def is_incomplete_argument(current_params, cmd_param):
"""
:param current_params: the current params and values for this argument as already entered
:param cmd_param: the current command parameter
:return: whether or not the last argument is incomplete and corresponds to this cmd_param. In
other wor... | [
"def",
"is_incomplete_argument",
"(",
"current_params",
",",
"cmd_param",
")",
":",
"if",
"not",
"isinstance",
"(",
"cmd_param",
",",
"Argument",
")",
":",
"return",
"False",
"current_param_values",
"=",
"current_params",
"[",
"cmd_param",
".",
"name",
"]",
"if"... | :param current_params: the current params and values for this argument as already entered
:param cmd_param: the current command parameter
:return: whether or not the last argument is incomplete and corresponds to this cmd_param. In
other words whether or not the this cmd_param argument can still accept valu... | [
":",
"param",
"current_params",
":",
"the",
"current",
"params",
"and",
"values",
"for",
"this",
"argument",
"as",
"already",
"entered",
":",
"param",
"cmd_param",
":",
"the",
"current",
"command",
"parameter",
":",
"return",
":",
"whether",
"or",
"not",
"th... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_bashcomplete.py#L152-L169 | train |
pypa/pipenv | pipenv/vendor/click/_bashcomplete.py | get_user_autocompletions | def get_user_autocompletions(ctx, args, incomplete, cmd_param):
"""
:param ctx: context associated with the parsed command
:param args: full list of args
:param incomplete: the incomplete text to autocomplete
:param cmd_param: command definition
:return: all the possible user-specified completio... | python | def get_user_autocompletions(ctx, args, incomplete, cmd_param):
"""
:param ctx: context associated with the parsed command
:param args: full list of args
:param incomplete: the incomplete text to autocomplete
:param cmd_param: command definition
:return: all the possible user-specified completio... | [
"def",
"get_user_autocompletions",
"(",
"ctx",
",",
"args",
",",
"incomplete",
",",
"cmd_param",
")",
":",
"results",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"cmd_param",
".",
"type",
",",
"Choice",
")",
":",
"# Choices don't support descriptions.",
"results",
... | :param ctx: context associated with the parsed command
:param args: full list of args
:param incomplete: the incomplete text to autocomplete
:param cmd_param: command definition
:return: all the possible user-specified completions for the param | [
":",
"param",
"ctx",
":",
"context",
"associated",
"with",
"the",
"parsed",
"command",
":",
"param",
"args",
":",
"full",
"list",
"of",
"args",
":",
"param",
"incomplete",
":",
"the",
"incomplete",
"text",
"to",
"autocomplete",
":",
"param",
"cmd_param",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_bashcomplete.py#L172-L191 | train |
pypa/pipenv | pipenv/vendor/click/_bashcomplete.py | get_visible_commands_starting_with | def get_visible_commands_starting_with(ctx, starts_with):
"""
:param ctx: context associated with the parsed command
:starts_with: string that visible commands must start with.
:return: all visible (not hidden) commands that start with starts_with.
"""
for c in ctx.command.list_commands(ctx):
... | python | def get_visible_commands_starting_with(ctx, starts_with):
"""
:param ctx: context associated with the parsed command
:starts_with: string that visible commands must start with.
:return: all visible (not hidden) commands that start with starts_with.
"""
for c in ctx.command.list_commands(ctx):
... | [
"def",
"get_visible_commands_starting_with",
"(",
"ctx",
",",
"starts_with",
")",
":",
"for",
"c",
"in",
"ctx",
".",
"command",
".",
"list_commands",
"(",
"ctx",
")",
":",
"if",
"c",
".",
"startswith",
"(",
"starts_with",
")",
":",
"command",
"=",
"ctx",
... | :param ctx: context associated with the parsed command
:starts_with: string that visible commands must start with.
:return: all visible (not hidden) commands that start with starts_with. | [
":",
"param",
"ctx",
":",
"context",
"associated",
"with",
"the",
"parsed",
"command",
":",
"starts_with",
":",
"string",
"that",
"visible",
"commands",
"must",
"start",
"with",
".",
":",
"return",
":",
"all",
"visible",
"(",
"not",
"hidden",
")",
"command... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_bashcomplete.py#L194-L204 | train |
pypa/pipenv | pipenv/vendor/click/_bashcomplete.py | get_choices | def get_choices(cli, prog_name, args, incomplete):
"""
:param cli: command definition
:param prog_name: the program that is running
:param args: full list of args
:param incomplete: the incomplete text to autocomplete
:return: all the possible completions for the incomplete
"""
all_args ... | python | def get_choices(cli, prog_name, args, incomplete):
"""
:param cli: command definition
:param prog_name: the program that is running
:param args: full list of args
:param incomplete: the incomplete text to autocomplete
:return: all the possible completions for the incomplete
"""
all_args ... | [
"def",
"get_choices",
"(",
"cli",
",",
"prog_name",
",",
"args",
",",
"incomplete",
")",
":",
"all_args",
"=",
"copy",
".",
"deepcopy",
"(",
"args",
")",
"ctx",
"=",
"resolve_ctx",
"(",
"cli",
",",
"prog_name",
",",
"args",
")",
"if",
"ctx",
"is",
"N... | :param cli: command definition
:param prog_name: the program that is running
:param args: full list of args
:param incomplete: the incomplete text to autocomplete
:return: all the possible completions for the incomplete | [
":",
"param",
"cli",
":",
"command",
"definition",
":",
"param",
"prog_name",
":",
"the",
"program",
"that",
"is",
"running",
":",
"param",
"args",
":",
"full",
"list",
"of",
"args",
":",
"param",
"incomplete",
":",
"the",
"incomplete",
"text",
"to",
"au... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/_bashcomplete.py#L222-L265 | train |
pypa/pipenv | pipenv/vendor/distlib/markers.py | interpret | def interpret(marker, execution_context=None):
"""
Interpret a marker and return a result depending on environment.
:param marker: The marker to interpret.
:type marker: str
:param execution_context: The context used for name lookup.
:type execution_context: mapping
"""
try:
exp... | python | def interpret(marker, execution_context=None):
"""
Interpret a marker and return a result depending on environment.
:param marker: The marker to interpret.
:type marker: str
:param execution_context: The context used for name lookup.
:type execution_context: mapping
"""
try:
exp... | [
"def",
"interpret",
"(",
"marker",
",",
"execution_context",
"=",
"None",
")",
":",
"try",
":",
"expr",
",",
"rest",
"=",
"parse_marker",
"(",
"marker",
")",
"except",
"Exception",
"as",
"e",
":",
"raise",
"SyntaxError",
"(",
"'Unable to interpret marker synta... | Interpret a marker and return a result depending on environment.
:param marker: The marker to interpret.
:type marker: str
:param execution_context: The context used for name lookup.
:type execution_context: mapping | [
"Interpret",
"a",
"marker",
"and",
"return",
"a",
"result",
"depending",
"on",
"environment",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/markers.py#L113-L131 | train |
pypa/pipenv | pipenv/vendor/distlib/markers.py | Evaluator.evaluate | def evaluate(self, expr, context):
"""
Evaluate a marker expression returned by the :func:`parse_requirement`
function in the specified context.
"""
if isinstance(expr, string_types):
if expr[0] in '\'"':
result = expr[1:-1]
else:
... | python | def evaluate(self, expr, context):
"""
Evaluate a marker expression returned by the :func:`parse_requirement`
function in the specified context.
"""
if isinstance(expr, string_types):
if expr[0] in '\'"':
result = expr[1:-1]
else:
... | [
"def",
"evaluate",
"(",
"self",
",",
"expr",
",",
"context",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"string_types",
")",
":",
"if",
"expr",
"[",
"0",
"]",
"in",
"'\\'\"'",
":",
"result",
"=",
"expr",
"[",
"1",
":",
"-",
"1",
"]",
"else",... | Evaluate a marker expression returned by the :func:`parse_requirement`
function in the specified context. | [
"Evaluate",
"a",
"marker",
"expression",
"returned",
"by",
"the",
":",
"func",
":",
"parse_requirement",
"function",
"in",
"the",
"specified",
"context",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/markers.py#L50-L75 | train |
pypa/pipenv | pipenv/vendor/vistir/termcolors.py | colored | def colored(text, color=None, on_color=None, attrs=None):
"""Colorize text using a reimplementation of the colorizer from
https://github.com/pavdmyt/yaspin so that it works on windows.
Available text colors:
red, green, yellow, blue, magenta, cyan, white.
Available text highlights:
on_... | python | def colored(text, color=None, on_color=None, attrs=None):
"""Colorize text using a reimplementation of the colorizer from
https://github.com/pavdmyt/yaspin so that it works on windows.
Available text colors:
red, green, yellow, blue, magenta, cyan, white.
Available text highlights:
on_... | [
"def",
"colored",
"(",
"text",
",",
"color",
"=",
"None",
",",
"on_color",
"=",
"None",
",",
"attrs",
"=",
"None",
")",
":",
"if",
"os",
".",
"getenv",
"(",
"\"ANSI_COLORS_DISABLED\"",
")",
"is",
"None",
":",
"style",
"=",
"\"NORMAL\"",
"if",
"\"bold\"... | Colorize text using a reimplementation of the colorizer from
https://github.com/pavdmyt/yaspin so that it works on windows.
Available text colors:
red, green, yellow, blue, magenta, cyan, white.
Available text highlights:
on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white.... | [
"Colorize",
"text",
"using",
"a",
"reimplementation",
"of",
"the",
"colorizer",
"from",
"https",
":",
"//",
"github",
".",
"com",
"/",
"pavdmyt",
"/",
"yaspin",
"so",
"that",
"it",
"works",
"on",
"windows",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/termcolors.py#L85-L132 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser.inc_n | def inc_n(self, n, exception=None): # type: (int, Optional[ParseError]) -> bool
"""
Increments the parser by n characters
if the end of the input has not been reached.
"""
return self._src.inc_n(n=n, exception=exception) | python | def inc_n(self, n, exception=None): # type: (int, Optional[ParseError]) -> bool
"""
Increments the parser by n characters
if the end of the input has not been reached.
"""
return self._src.inc_n(n=n, exception=exception) | [
"def",
"inc_n",
"(",
"self",
",",
"n",
",",
"exception",
"=",
"None",
")",
":",
"# type: (int, Optional[ParseError]) -> bool",
"return",
"self",
".",
"_src",
".",
"inc_n",
"(",
"n",
"=",
"n",
",",
"exception",
"=",
"exception",
")"
] | Increments the parser by n characters
if the end of the input has not been reached. | [
"Increments",
"the",
"parser",
"by",
"n",
"characters",
"if",
"the",
"end",
"of",
"the",
"input",
"has",
"not",
"been",
"reached",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L91-L96 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser.consume | def consume(self, chars, min=0, max=-1):
"""
Consume chars until min/max is satisfied is valid.
"""
return self._src.consume(chars=chars, min=min, max=max) | python | def consume(self, chars, min=0, max=-1):
"""
Consume chars until min/max is satisfied is valid.
"""
return self._src.consume(chars=chars, min=min, max=max) | [
"def",
"consume",
"(",
"self",
",",
"chars",
",",
"min",
"=",
"0",
",",
"max",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_src",
".",
"consume",
"(",
"chars",
"=",
"chars",
",",
"min",
"=",
"min",
",",
"max",
"=",
"max",
")"
] | Consume chars until min/max is satisfied is valid. | [
"Consume",
"chars",
"until",
"min",
"/",
"max",
"is",
"satisfied",
"is",
"valid",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L98-L102 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser.parse_error | def parse_error(self, exception=ParseError, *args):
"""
Creates a generic "parse error" at the current position.
"""
return self._src.parse_error(exception, *args) | python | def parse_error(self, exception=ParseError, *args):
"""
Creates a generic "parse error" at the current position.
"""
return self._src.parse_error(exception, *args) | [
"def",
"parse_error",
"(",
"self",
",",
"exception",
"=",
"ParseError",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"_src",
".",
"parse_error",
"(",
"exception",
",",
"*",
"args",
")"
] | Creates a generic "parse error" at the current position. | [
"Creates",
"a",
"generic",
"parse",
"error",
"at",
"the",
"current",
"position",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L116-L120 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._merge_ws | def _merge_ws(self, item, container): # type: (Item, Container) -> bool
"""
Merges the given Item with the last one currently in the given Container if
both are whitespace items.
Returns True if the items were merged.
"""
last = container.last_item()
if not last... | python | def _merge_ws(self, item, container): # type: (Item, Container) -> bool
"""
Merges the given Item with the last one currently in the given Container if
both are whitespace items.
Returns True if the items were merged.
"""
last = container.last_item()
if not last... | [
"def",
"_merge_ws",
"(",
"self",
",",
"item",
",",
"container",
")",
":",
"# type: (Item, Container) -> bool",
"last",
"=",
"container",
".",
"last_item",
"(",
")",
"if",
"not",
"last",
":",
"return",
"False",
"if",
"not",
"isinstance",
"(",
"item",
",",
"... | Merges the given Item with the last one currently in the given Container if
both are whitespace items.
Returns True if the items were merged. | [
"Merges",
"the",
"given",
"Item",
"with",
"the",
"last",
"one",
"currently",
"in",
"the",
"given",
"Container",
"if",
"both",
"are",
"whitespace",
"items",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L158-L178 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._is_child | def _is_child(self, parent, child): # type: (str, str) -> bool
"""
Returns whether a key is strictly a child of another key.
AoT siblings are not considered children of one another.
"""
parent_parts = tuple(self._split_table_name(parent))
child_parts = tuple(self._split_... | python | def _is_child(self, parent, child): # type: (str, str) -> bool
"""
Returns whether a key is strictly a child of another key.
AoT siblings are not considered children of one another.
"""
parent_parts = tuple(self._split_table_name(parent))
child_parts = tuple(self._split_... | [
"def",
"_is_child",
"(",
"self",
",",
"parent",
",",
"child",
")",
":",
"# type: (str, str) -> bool",
"parent_parts",
"=",
"tuple",
"(",
"self",
".",
"_split_table_name",
"(",
"parent",
")",
")",
"child_parts",
"=",
"tuple",
"(",
"self",
".",
"_split_table_nam... | Returns whether a key is strictly a child of another key.
AoT siblings are not considered children of one another. | [
"Returns",
"whether",
"a",
"key",
"is",
"strictly",
"a",
"child",
"of",
"another",
"key",
".",
"AoT",
"siblings",
"are",
"not",
"considered",
"children",
"of",
"one",
"another",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L180-L191 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_item | def _parse_item(self): # type: () -> Optional[Tuple[Optional[Key], Item]]
"""
Attempts to parse the next item and returns it, along with its key
if the item is value-like.
"""
self.mark()
with self._state as state:
while True:
c = self._curren... | python | def _parse_item(self): # type: () -> Optional[Tuple[Optional[Key], Item]]
"""
Attempts to parse the next item and returns it, along with its key
if the item is value-like.
"""
self.mark()
with self._state as state:
while True:
c = self._curren... | [
"def",
"_parse_item",
"(",
"self",
")",
":",
"# type: () -> Optional[Tuple[Optional[Key], Item]]",
"self",
".",
"mark",
"(",
")",
"with",
"self",
".",
"_state",
"as",
"state",
":",
"while",
"True",
":",
"c",
"=",
"self",
".",
"_current",
"if",
"c",
"==",
"... | Attempts to parse the next item and returns it, along with its key
if the item is value-like. | [
"Attempts",
"to",
"parse",
"the",
"next",
"item",
"and",
"returns",
"it",
"along",
"with",
"its",
"key",
"if",
"the",
"item",
"is",
"value",
"-",
"like",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L236-L270 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_comment_trail | def _parse_comment_trail(self): # type: () -> Tuple[str, str, str]
"""
Returns (comment_ws, comment, trail)
If there is no comment, comment_ws and comment will
simply be empty.
"""
if self.end():
return "", "", ""
comment = ""
comment_ws = ""... | python | def _parse_comment_trail(self): # type: () -> Tuple[str, str, str]
"""
Returns (comment_ws, comment, trail)
If there is no comment, comment_ws and comment will
simply be empty.
"""
if self.end():
return "", "", ""
comment = ""
comment_ws = ""... | [
"def",
"_parse_comment_trail",
"(",
"self",
")",
":",
"# type: () -> Tuple[str, str, str]",
"if",
"self",
".",
"end",
"(",
")",
":",
"return",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"comment",
"=",
"\"\"",
"comment_ws",
"=",
"\"\"",
"self",
".",
"mark",
"(",
")... | Returns (comment_ws, comment, trail)
If there is no comment, comment_ws and comment will
simply be empty. | [
"Returns",
"(",
"comment_ws",
"comment",
"trail",
")",
"If",
"there",
"is",
"no",
"comment",
"comment_ws",
"and",
"comment",
"will",
"simply",
"be",
"empty",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L272-L325 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_quoted_key | def _parse_quoted_key(self): # type: () -> Key
"""
Parses a key enclosed in either single or double quotes.
"""
quote_style = self._current
key_type = None
dotted = False
for t in KeyType:
if t.value == quote_style:
key_type = t
... | python | def _parse_quoted_key(self): # type: () -> Key
"""
Parses a key enclosed in either single or double quotes.
"""
quote_style = self._current
key_type = None
dotted = False
for t in KeyType:
if t.value == quote_style:
key_type = t
... | [
"def",
"_parse_quoted_key",
"(",
"self",
")",
":",
"# type: () -> Key",
"quote_style",
"=",
"self",
".",
"_current",
"key_type",
"=",
"None",
"dotted",
"=",
"False",
"for",
"t",
"in",
"KeyType",
":",
"if",
"t",
".",
"value",
"==",
"quote_style",
":",
"key_... | Parses a key enclosed in either single or double quotes. | [
"Parses",
"a",
"key",
"enclosed",
"in",
"either",
"single",
"or",
"double",
"quotes",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L381-L412 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_bare_key | def _parse_bare_key(self): # type: () -> Key
"""
Parses a bare key.
"""
key_type = None
dotted = False
self.mark()
while self._current.is_bare_key_char() and self.inc():
pass
key = self.extract()
if self._current == ".":
... | python | def _parse_bare_key(self): # type: () -> Key
"""
Parses a bare key.
"""
key_type = None
dotted = False
self.mark()
while self._current.is_bare_key_char() and self.inc():
pass
key = self.extract()
if self._current == ".":
... | [
"def",
"_parse_bare_key",
"(",
"self",
")",
":",
"# type: () -> Key",
"key_type",
"=",
"None",
"dotted",
"=",
"False",
"self",
".",
"mark",
"(",
")",
"while",
"self",
".",
"_current",
".",
"is_bare_key_char",
"(",
")",
"and",
"self",
".",
"inc",
"(",
")"... | Parses a bare key. | [
"Parses",
"a",
"bare",
"key",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L414-L433 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_value | def _parse_value(self): # type: () -> Item
"""
Attempts to parse a value at the current position.
"""
self.mark()
c = self._current
trivia = Trivia()
if c == StringType.SLB.value:
return self._parse_basic_string()
elif c == StringType.SLL.val... | python | def _parse_value(self): # type: () -> Item
"""
Attempts to parse a value at the current position.
"""
self.mark()
c = self._current
trivia = Trivia()
if c == StringType.SLB.value:
return self._parse_basic_string()
elif c == StringType.SLL.val... | [
"def",
"_parse_value",
"(",
"self",
")",
":",
"# type: () -> Item",
"self",
".",
"mark",
"(",
")",
"c",
"=",
"self",
".",
"_current",
"trivia",
"=",
"Trivia",
"(",
")",
"if",
"c",
"==",
"StringType",
".",
"SLB",
".",
"value",
":",
"return",
"self",
"... | Attempts to parse a value at the current position. | [
"Attempts",
"to",
"parse",
"a",
"value",
"at",
"the",
"current",
"position",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L469-L542 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_table | def _parse_table(
self, parent_name=None
): # type: (Optional[str]) -> Tuple[Key, Union[Table, AoT]]
"""
Parses a table element.
"""
if self._current != "[":
raise self.parse_error(
InternalParserError, "_parse_table() called on non-bracket charac... | python | def _parse_table(
self, parent_name=None
): # type: (Optional[str]) -> Tuple[Key, Union[Table, AoT]]
"""
Parses a table element.
"""
if self._current != "[":
raise self.parse_error(
InternalParserError, "_parse_table() called on non-bracket charac... | [
"def",
"_parse_table",
"(",
"self",
",",
"parent_name",
"=",
"None",
")",
":",
"# type: (Optional[str]) -> Tuple[Key, Union[Table, AoT]]",
"if",
"self",
".",
"_current",
"!=",
"\"[\"",
":",
"raise",
"self",
".",
"parse_error",
"(",
"InternalParserError",
",",
"\"_pa... | Parses a table element. | [
"Parses",
"a",
"table",
"element",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L855-L1005 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._peek_table | def _peek_table(self): # type: () -> Tuple[bool, str]
"""
Peeks ahead non-intrusively by cloning then restoring the
initial state of the parser.
Returns the name of the table about to be parsed,
as well as whether it is part of an AoT.
"""
# we always want to re... | python | def _peek_table(self): # type: () -> Tuple[bool, str]
"""
Peeks ahead non-intrusively by cloning then restoring the
initial state of the parser.
Returns the name of the table about to be parsed,
as well as whether it is part of an AoT.
"""
# we always want to re... | [
"def",
"_peek_table",
"(",
"self",
")",
":",
"# type: () -> Tuple[bool, str]",
"# we always want to restore after exiting this scope",
"with",
"self",
".",
"_state",
"(",
"save_marker",
"=",
"True",
",",
"restore",
"=",
"True",
")",
":",
"if",
"self",
".",
"_current... | Peeks ahead non-intrusively by cloning then restoring the
initial state of the parser.
Returns the name of the table about to be parsed,
as well as whether it is part of an AoT. | [
"Peeks",
"ahead",
"non",
"-",
"intrusively",
"by",
"cloning",
"then",
"restoring",
"the",
"initial",
"state",
"of",
"the",
"parser",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L1007-L1035 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._parse_aot | def _parse_aot(self, first, name_first): # type: (Table, str) -> AoT
"""
Parses all siblings of the provided table first and bundles them into
an AoT.
"""
payload = [first]
self._aot_stack.append(name_first)
while not self.end():
is_aot_next, name_nex... | python | def _parse_aot(self, first, name_first): # type: (Table, str) -> AoT
"""
Parses all siblings of the provided table first and bundles them into
an AoT.
"""
payload = [first]
self._aot_stack.append(name_first)
while not self.end():
is_aot_next, name_nex... | [
"def",
"_parse_aot",
"(",
"self",
",",
"first",
",",
"name_first",
")",
":",
"# type: (Table, str) -> AoT",
"payload",
"=",
"[",
"first",
"]",
"self",
".",
"_aot_stack",
".",
"append",
"(",
"name_first",
")",
"while",
"not",
"self",
".",
"end",
"(",
")",
... | Parses all siblings of the provided table first and bundles them into
an AoT. | [
"Parses",
"all",
"siblings",
"of",
"the",
"provided",
"table",
"first",
"and",
"bundles",
"them",
"into",
"an",
"AoT",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L1037-L1054 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._peek | def _peek(self, n): # type: (int) -> str
"""
Peeks ahead n characters.
n is the max number of characters that will be peeked.
"""
# we always want to restore after exiting this scope
with self._state(restore=True):
buf = ""
for _ in range(n):
... | python | def _peek(self, n): # type: (int) -> str
"""
Peeks ahead n characters.
n is the max number of characters that will be peeked.
"""
# we always want to restore after exiting this scope
with self._state(restore=True):
buf = ""
for _ in range(n):
... | [
"def",
"_peek",
"(",
"self",
",",
"n",
")",
":",
"# type: (int) -> str",
"# we always want to restore after exiting this scope",
"with",
"self",
".",
"_state",
"(",
"restore",
"=",
"True",
")",
":",
"buf",
"=",
"\"\"",
"for",
"_",
"in",
"range",
"(",
"n",
")... | Peeks ahead n characters.
n is the max number of characters that will be peeked. | [
"Peeks",
"ahead",
"n",
"characters",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L1056-L1072 | train |
pypa/pipenv | pipenv/vendor/tomlkit/parser.py | Parser._peek_unicode | def _peek_unicode(
self, is_long
): # type: (bool) -> Tuple[Optional[str], Optional[str]]
"""
Peeks ahead non-intrusively by cloning then restoring the
initial state of the parser.
Returns the unicode value is it's a valid one else None.
"""
# we always want... | python | def _peek_unicode(
self, is_long
): # type: (bool) -> Tuple[Optional[str], Optional[str]]
"""
Peeks ahead non-intrusively by cloning then restoring the
initial state of the parser.
Returns the unicode value is it's a valid one else None.
"""
# we always want... | [
"def",
"_peek_unicode",
"(",
"self",
",",
"is_long",
")",
":",
"# type: (bool) -> Tuple[Optional[str], Optional[str]]",
"# we always want to restore after exiting this scope",
"with",
"self",
".",
"_state",
"(",
"save_marker",
"=",
"True",
",",
"restore",
"=",
"True",
")"... | Peeks ahead non-intrusively by cloning then restoring the
initial state of the parser.
Returns the unicode value is it's a valid one else None. | [
"Peeks",
"ahead",
"non",
"-",
"intrusively",
"by",
"cloning",
"then",
"restoring",
"the",
"initial",
"state",
"of",
"the",
"parser",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L1074-L1111 | train |
pypa/pipenv | pipenv/vendor/urllib3/util/url.py | split_first | def split_first(s, delims):
"""
Given a string and an iterable of delimiters, split on the first found
delimiter. Return two split parts and the matched delimiter.
If not found, then the first part is the full input string.
Example::
>>> split_first('foo/bar?baz', '?/=')
('foo', '... | python | def split_first(s, delims):
"""
Given a string and an iterable of delimiters, split on the first found
delimiter. Return two split parts and the matched delimiter.
If not found, then the first part is the full input string.
Example::
>>> split_first('foo/bar?baz', '?/=')
('foo', '... | [
"def",
"split_first",
"(",
"s",
",",
"delims",
")",
":",
"min_idx",
"=",
"None",
"min_delim",
"=",
"None",
"for",
"d",
"in",
"delims",
":",
"idx",
"=",
"s",
".",
"find",
"(",
"d",
")",
"if",
"idx",
"<",
"0",
":",
"continue",
"if",
"min_idx",
"is"... | Given a string and an iterable of delimiters, split on the first found
delimiter. Return two split parts and the matched delimiter.
If not found, then the first part is the full input string.
Example::
>>> split_first('foo/bar?baz', '?/=')
('foo', 'bar?baz', '/')
>>> split_first('... | [
"Given",
"a",
"string",
"and",
"an",
"iterable",
"of",
"delimiters",
"split",
"on",
"the",
"first",
"found",
"delimiter",
".",
"Return",
"two",
"split",
"parts",
"and",
"the",
"matched",
"delimiter",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/url.py#L99-L129 | train |
pypa/pipenv | pipenv/vendor/urllib3/util/url.py | parse_url | def parse_url(url):
"""
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
performed to parse incomplete urls. Fields not provided will be None.
Partly backwards-compatible with :mod:`urlparse`.
Example::
>>> parse_url('http://google.com/mail/')
Url(scheme='http... | python | def parse_url(url):
"""
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
performed to parse incomplete urls. Fields not provided will be None.
Partly backwards-compatible with :mod:`urlparse`.
Example::
>>> parse_url('http://google.com/mail/')
Url(scheme='http... | [
"def",
"parse_url",
"(",
"url",
")",
":",
"# While this code has overlap with stdlib's urlparse, it is much",
"# simplified for our needs and less annoying.",
"# Additionally, this implementations does silly things to be optimal",
"# on CPython.",
"if",
"not",
"url",
":",
"# Empty",
"r... | Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
performed to parse incomplete urls. Fields not provided will be None.
Partly backwards-compatible with :mod:`urlparse`.
Example::
>>> parse_url('http://google.com/mail/')
Url(scheme='http', host='google.com', port=None,... | [
"Given",
"a",
"url",
"return",
"a",
"parsed",
":",
"class",
":",
".",
"Url",
"namedtuple",
".",
"Best",
"-",
"effort",
"is",
"performed",
"to",
"parse",
"incomplete",
"urls",
".",
"Fields",
"not",
"provided",
"will",
"be",
"None",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/url.py#L132-L222 | train |
pypa/pipenv | pipenv/vendor/urllib3/util/url.py | get_host | def get_host(url):
"""
Deprecated. Use :func:`parse_url` instead.
"""
p = parse_url(url)
return p.scheme or 'http', p.hostname, p.port | python | def get_host(url):
"""
Deprecated. Use :func:`parse_url` instead.
"""
p = parse_url(url)
return p.scheme or 'http', p.hostname, p.port | [
"def",
"get_host",
"(",
"url",
")",
":",
"p",
"=",
"parse_url",
"(",
"url",
")",
"return",
"p",
".",
"scheme",
"or",
"'http'",
",",
"p",
".",
"hostname",
",",
"p",
".",
"port"
] | Deprecated. Use :func:`parse_url` instead. | [
"Deprecated",
".",
"Use",
":",
"func",
":",
"parse_url",
"instead",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/url.py#L225-L230 | train |
pypa/pipenv | pipenv/vendor/urllib3/util/url.py | Url.request_uri | def request_uri(self):
"""Absolute path including the query string."""
uri = self.path or '/'
if self.query is not None:
uri += '?' + self.query
return uri | python | def request_uri(self):
"""Absolute path including the query string."""
uri = self.path or '/'
if self.query is not None:
uri += '?' + self.query
return uri | [
"def",
"request_uri",
"(",
"self",
")",
":",
"uri",
"=",
"self",
".",
"path",
"or",
"'/'",
"if",
"self",
".",
"query",
"is",
"not",
"None",
":",
"uri",
"+=",
"'?'",
"+",
"self",
".",
"query",
"return",
"uri"
] | Absolute path including the query string. | [
"Absolute",
"path",
"including",
"the",
"query",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/url.py#L39-L46 | train |
pypa/pipenv | pipenv/vendor/urllib3/util/url.py | Url.netloc | def netloc(self):
"""Network location including host and port"""
if self.port:
return '%s:%d' % (self.host, self.port)
return self.host | python | def netloc(self):
"""Network location including host and port"""
if self.port:
return '%s:%d' % (self.host, self.port)
return self.host | [
"def",
"netloc",
"(",
"self",
")",
":",
"if",
"self",
".",
"port",
":",
"return",
"'%s:%d'",
"%",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
"return",
"self",
".",
"host"
] | Network location including host and port | [
"Network",
"location",
"including",
"host",
"and",
"port"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/url.py#L49-L53 | train |
pypa/pipenv | pipenv/vendor/urllib3/util/url.py | Url.url | def url(self):
"""
Convert self into a url
This function should more or less round-trip with :func:`.parse_url`. The
returned url may not be exactly the same as the url inputted to
:func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls
with a blank port w... | python | def url(self):
"""
Convert self into a url
This function should more or less round-trip with :func:`.parse_url`. The
returned url may not be exactly the same as the url inputted to
:func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls
with a blank port w... | [
"def",
"url",
"(",
"self",
")",
":",
"scheme",
",",
"auth",
",",
"host",
",",
"port",
",",
"path",
",",
"query",
",",
"fragment",
"=",
"self",
"url",
"=",
"''",
"# We use \"is not None\" we want things to happen with empty strings (or 0 port)",
"if",
"scheme",
"... | Convert self into a url
This function should more or less round-trip with :func:`.parse_url`. The
returned url may not be exactly the same as the url inputted to
:func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls
with a blank port will have : removed).
Examp... | [
"Convert",
"self",
"into",
"a",
"url"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/url.py#L56-L93 | train |
pypa/pipenv | pipenv/vendor/jinja2/loaders.py | split_template_path | def split_template_path(template):
"""Split a path into segments and perform a sanity check. If it detects
'..' in the path it will raise a `TemplateNotFound` error.
"""
pieces = []
for piece in template.split('/'):
if path.sep in piece \
or (path.altsep and path.altsep in piece)... | python | def split_template_path(template):
"""Split a path into segments and perform a sanity check. If it detects
'..' in the path it will raise a `TemplateNotFound` error.
"""
pieces = []
for piece in template.split('/'):
if path.sep in piece \
or (path.altsep and path.altsep in piece)... | [
"def",
"split_template_path",
"(",
"template",
")",
":",
"pieces",
"=",
"[",
"]",
"for",
"piece",
"in",
"template",
".",
"split",
"(",
"'/'",
")",
":",
"if",
"path",
".",
"sep",
"in",
"piece",
"or",
"(",
"path",
".",
"altsep",
"and",
"path",
".",
"... | Split a path into segments and perform a sanity check. If it detects
'..' in the path it will raise a `TemplateNotFound` error. | [
"Split",
"a",
"path",
"into",
"segments",
"and",
"perform",
"a",
"sanity",
"check",
".",
"If",
"it",
"detects",
"..",
"in",
"the",
"path",
"it",
"will",
"raise",
"a",
"TemplateNotFound",
"error",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/loaders.py#L22-L34 | train |
pypa/pipenv | pipenv/vendor/jinja2/loaders.py | BaseLoader.get_source | def get_source(self, environment, template):
"""Get the template source, filename and reload helper for a template.
It's passed the environment and template name and has to return a
tuple in the form ``(source, filename, uptodate)`` or raise a
`TemplateNotFound` error if it can't locate ... | python | def get_source(self, environment, template):
"""Get the template source, filename and reload helper for a template.
It's passed the environment and template name and has to return a
tuple in the form ``(source, filename, uptodate)`` or raise a
`TemplateNotFound` error if it can't locate ... | [
"def",
"get_source",
"(",
"self",
",",
"environment",
",",
"template",
")",
":",
"if",
"not",
"self",
".",
"has_source_access",
":",
"raise",
"RuntimeError",
"(",
"'%s cannot provide access to the source'",
"%",
"self",
".",
"__class__",
".",
"__name__",
")",
"r... | Get the template source, filename and reload helper for a template.
It's passed the environment and template name and has to return a
tuple in the form ``(source, filename, uptodate)`` or raise a
`TemplateNotFound` error if it can't locate the template.
The source part of the returned t... | [
"Get",
"the",
"template",
"source",
"filename",
"and",
"reload",
"helper",
"for",
"a",
"template",
".",
"It",
"s",
"passed",
"the",
"environment",
"and",
"template",
"name",
"and",
"has",
"to",
"return",
"a",
"tuple",
"in",
"the",
"form",
"(",
"source",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/loaders.py#L70-L91 | train |
pypa/pipenv | pipenv/vendor/jinja2/loaders.py | BaseLoader.load | def load(self, environment, name, globals=None):
"""Loads a template. This method looks up the template in the cache
or loads one by calling :meth:`get_source`. Subclasses should not
override this method as loaders working on collections of other
loaders (such as :class:`PrefixLoader` ... | python | def load(self, environment, name, globals=None):
"""Loads a template. This method looks up the template in the cache
or loads one by calling :meth:`get_source`. Subclasses should not
override this method as loaders working on collections of other
loaders (such as :class:`PrefixLoader` ... | [
"def",
"load",
"(",
"self",
",",
"environment",
",",
"name",
",",
"globals",
"=",
"None",
")",
":",
"code",
"=",
"None",
"if",
"globals",
"is",
"None",
":",
"globals",
"=",
"{",
"}",
"# first we try to get the source for this template together",
"# with the file... | Loads a template. This method looks up the template in the cache
or loads one by calling :meth:`get_source`. Subclasses should not
override this method as loaders working on collections of other
loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`)
will not call this method ... | [
"Loads",
"a",
"template",
".",
"This",
"method",
"looks",
"up",
"the",
"template",
"in",
"the",
"cache",
"or",
"loads",
"one",
"by",
"calling",
":",
"meth",
":",
"get_source",
".",
"Subclasses",
"should",
"not",
"override",
"this",
"method",
"as",
"loaders... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/loaders.py#L100-L135 | train |
pypa/pipenv | pipenv/vendor/chardet/cli/chardetect.py | description_of | def description_of(lines, name='stdin'):
"""
Return a string describing the probable encoding of a file or
list of strings.
:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str
"""
u = Univers... | python | def description_of(lines, name='stdin'):
"""
Return a string describing the probable encoding of a file or
list of strings.
:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str
"""
u = Univers... | [
"def",
"description_of",
"(",
"lines",
",",
"name",
"=",
"'stdin'",
")",
":",
"u",
"=",
"UniversalDetector",
"(",
")",
"for",
"line",
"in",
"lines",
":",
"line",
"=",
"bytearray",
"(",
"line",
")",
"u",
".",
"feed",
"(",
"line",
")",
"# shortcut out of... | Return a string describing the probable encoding of a file or
list of strings.
:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str | [
"Return",
"a",
"string",
"describing",
"the",
"probable",
"encoding",
"of",
"a",
"file",
"or",
"list",
"of",
"strings",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/cli/chardetect.py#L26-L51 | train |
pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/treeadapters/genshi.py | to_genshi | def to_genshi(walker):
"""Convert a tree to a genshi tree
:arg walker: the treewalker to use to walk the tree to convert it
:returns: generator of genshi nodes
"""
text = []
for token in walker:
type = token["type"]
if type in ("Characters", "SpaceCharacters"):
tex... | python | def to_genshi(walker):
"""Convert a tree to a genshi tree
:arg walker: the treewalker to use to walk the tree to convert it
:returns: generator of genshi nodes
"""
text = []
for token in walker:
type = token["type"]
if type in ("Characters", "SpaceCharacters"):
tex... | [
"def",
"to_genshi",
"(",
"walker",
")",
":",
"text",
"=",
"[",
"]",
"for",
"token",
"in",
"walker",
":",
"type",
"=",
"token",
"[",
"\"type\"",
"]",
"if",
"type",
"in",
"(",
"\"Characters\"",
",",
"\"SpaceCharacters\"",
")",
":",
"text",
".",
"append",... | Convert a tree to a genshi tree
:arg walker: the treewalker to use to walk the tree to convert it
:returns: generator of genshi nodes | [
"Convert",
"a",
"tree",
"to",
"a",
"genshi",
"tree"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treeadapters/genshi.py#L7-L54 | train |
pypa/pipenv | pipenv/vendor/pipreqs/pipreqs.py | parse_requirements | def parse_requirements(file_):
"""Parse a requirements formatted file.
Traverse a string until a delimiter is detected, then split at said
delimiter, get module name by element index, create a dict consisting of
module:version, and add dict to list of parsed modules.
Args:
file_: File to p... | python | def parse_requirements(file_):
"""Parse a requirements formatted file.
Traverse a string until a delimiter is detected, then split at said
delimiter, get module name by element index, create a dict consisting of
module:version, and add dict to list of parsed modules.
Args:
file_: File to p... | [
"def",
"parse_requirements",
"(",
"file_",
")",
":",
"modules",
"=",
"[",
"]",
"delim",
"=",
"[",
"\"<\"",
",",
"\">\"",
",",
"\"=\"",
",",
"\"!\"",
",",
"\"~\"",
"]",
"# https://www.python.org/dev/peps/pep-0508/#complete-grammar",
"try",
":",
"f",
"=",
"open_... | Parse a requirements formatted file.
Traverse a string until a delimiter is detected, then split at said
delimiter, get module name by element index, create a dict consisting of
module:version, and add dict to list of parsed modules.
Args:
file_: File to parse.
Raises:
OSerror: If... | [
"Parse",
"a",
"requirements",
"formatted",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipreqs/pipreqs.py#L231-L277 | train |
pypa/pipenv | pipenv/vendor/pipreqs/pipreqs.py | compare_modules | def compare_modules(file_, imports):
"""Compare modules in a file to imported modules in a project.
Args:
file_ (str): File to parse for modules to be compared.
imports (tuple): Modules being imported in the project.
Returns:
tuple: The modules not imported in the project, but do e... | python | def compare_modules(file_, imports):
"""Compare modules in a file to imported modules in a project.
Args:
file_ (str): File to parse for modules to be compared.
imports (tuple): Modules being imported in the project.
Returns:
tuple: The modules not imported in the project, but do e... | [
"def",
"compare_modules",
"(",
"file_",
",",
"imports",
")",
":",
"modules",
"=",
"parse_requirements",
"(",
"file_",
")",
"imports",
"=",
"[",
"imports",
"[",
"i",
"]",
"[",
"\"name\"",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"imports",
")",
... | Compare modules in a file to imported modules in a project.
Args:
file_ (str): File to parse for modules to be compared.
imports (tuple): Modules being imported in the project.
Returns:
tuple: The modules not imported in the project, but do exist in the
specified file. | [
"Compare",
"modules",
"in",
"a",
"file",
"to",
"imported",
"modules",
"in",
"a",
"project",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipreqs/pipreqs.py#L280-L297 | train |
pypa/pipenv | pipenv/vendor/pipreqs/pipreqs.py | diff | def diff(file_, imports):
"""Display the difference between modules in a file and imported modules."""
modules_not_imported = compare_modules(file_, imports)
logging.info("The following modules are in {} but do not seem to be imported: "
"{}".format(file_, ", ".join(x for x in modules_not_... | python | def diff(file_, imports):
"""Display the difference between modules in a file and imported modules."""
modules_not_imported = compare_modules(file_, imports)
logging.info("The following modules are in {} but do not seem to be imported: "
"{}".format(file_, ", ".join(x for x in modules_not_... | [
"def",
"diff",
"(",
"file_",
",",
"imports",
")",
":",
"modules_not_imported",
"=",
"compare_modules",
"(",
"file_",
",",
"imports",
")",
"logging",
".",
"info",
"(",
"\"The following modules are in {} but do not seem to be imported: \"",
"\"{}\"",
".",
"format",
"(",... | Display the difference between modules in a file and imported modules. | [
"Display",
"the",
"difference",
"between",
"modules",
"in",
"a",
"file",
"and",
"imported",
"modules",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipreqs/pipreqs.py#L300-L305 | train |
pypa/pipenv | pipenv/vendor/pipreqs/pipreqs.py | clean | def clean(file_, imports):
"""Remove modules that aren't imported in project from file."""
modules_not_imported = compare_modules(file_, imports)
re_remove = re.compile("|".join(modules_not_imported))
to_write = []
try:
f = open_func(file_, "r+")
except OSError:
logging.error("F... | python | def clean(file_, imports):
"""Remove modules that aren't imported in project from file."""
modules_not_imported = compare_modules(file_, imports)
re_remove = re.compile("|".join(modules_not_imported))
to_write = []
try:
f = open_func(file_, "r+")
except OSError:
logging.error("F... | [
"def",
"clean",
"(",
"file_",
",",
"imports",
")",
":",
"modules_not_imported",
"=",
"compare_modules",
"(",
"file_",
",",
"imports",
")",
"re_remove",
"=",
"re",
".",
"compile",
"(",
"\"|\"",
".",
"join",
"(",
"modules_not_imported",
")",
")",
"to_write",
... | Remove modules that aren't imported in project from file. | [
"Remove",
"modules",
"that",
"aren",
"t",
"imported",
"in",
"project",
"from",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipreqs/pipreqs.py#L307-L330 | train |
pypa/pipenv | pipenv/patched/safety/util.py | read_requirements | def read_requirements(fh, resolve=False):
"""
Reads requirements from a file like object and (optionally) from referenced files.
:param fh: file like object to read from
:param resolve: boolean. resolves referenced files.
:return: generator
"""
is_temp_file = not hasattr(fh, 'name')
for ... | python | def read_requirements(fh, resolve=False):
"""
Reads requirements from a file like object and (optionally) from referenced files.
:param fh: file like object to read from
:param resolve: boolean. resolves referenced files.
:return: generator
"""
is_temp_file = not hasattr(fh, 'name')
for ... | [
"def",
"read_requirements",
"(",
"fh",
",",
"resolve",
"=",
"False",
")",
":",
"is_temp_file",
"=",
"not",
"hasattr",
"(",
"fh",
",",
"'name'",
")",
"for",
"num",
",",
"line",
"in",
"enumerate",
"(",
"iter_lines",
"(",
"fh",
")",
")",
":",
"line",
"=... | Reads requirements from a file like object and (optionally) from referenced files.
:param fh: file like object to read from
:param resolve: boolean. resolves referenced files.
:return: generator | [
"Reads",
"requirements",
"from",
"a",
"file",
"like",
"object",
"and",
"(",
"optionally",
")",
"from",
"referenced",
"files",
".",
":",
"param",
"fh",
":",
"file",
"like",
"object",
"to",
"read",
"from",
":",
"param",
"resolve",
":",
"boolean",
".",
"res... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/safety/util.py#L27-L98 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/utils/deprecation.py | deprecated | def deprecated(reason, replacement, gone_in, issue=None):
# type: (str, Optional[str], Optional[str], Optional[int]) -> None
"""Helper to deprecate existing functionality.
reason:
Textual reason shown to the user about why this functionality has
been deprecated.
replacement:
Tex... | python | def deprecated(reason, replacement, gone_in, issue=None):
# type: (str, Optional[str], Optional[str], Optional[int]) -> None
"""Helper to deprecate existing functionality.
reason:
Textual reason shown to the user about why this functionality has
been deprecated.
replacement:
Tex... | [
"def",
"deprecated",
"(",
"reason",
",",
"replacement",
",",
"gone_in",
",",
"issue",
"=",
"None",
")",
":",
"# type: (str, Optional[str], Optional[str], Optional[int]) -> None",
"# Construct a nice message.",
"# This is purposely eagerly formatted as we want it to appear as if someo... | Helper to deprecate existing functionality.
reason:
Textual reason shown to the user about why this functionality has
been deprecated.
replacement:
Textual suggestion shown to the user about what alternative
functionality they can use.
gone_in:
The version of pip doe... | [
"Helper",
"to",
"deprecate",
"existing",
"functionality",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/deprecation.py#L55-L90 | train |
pypa/pipenv | pipenv/vendor/urllib3/packages/ssl_match_hostname/_implementation.py | _ipaddress_match | def _ipaddress_match(ipname, host_ip):
"""Exact matching of IP addresses.
RFC 6125 explicitly doesn't define an algorithm for this
(section 1.7.2 - "Out of Scope").
"""
# OpenSSL may add a trailing newline to a subjectAltName's IP address
# Divergence from upstream: ipaddress can't handle byte ... | python | def _ipaddress_match(ipname, host_ip):
"""Exact matching of IP addresses.
RFC 6125 explicitly doesn't define an algorithm for this
(section 1.7.2 - "Out of Scope").
"""
# OpenSSL may add a trailing newline to a subjectAltName's IP address
# Divergence from upstream: ipaddress can't handle byte ... | [
"def",
"_ipaddress_match",
"(",
"ipname",
",",
"host_ip",
")",
":",
"# OpenSSL may add a trailing newline to a subjectAltName's IP address",
"# Divergence from upstream: ipaddress can't handle byte str",
"ip",
"=",
"ipaddress",
".",
"ip_address",
"(",
"_to_unicode",
"(",
"ipname"... | Exact matching of IP addresses.
RFC 6125 explicitly doesn't define an algorithm for this
(section 1.7.2 - "Out of Scope"). | [
"Exact",
"matching",
"of",
"IP",
"addresses",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/packages/ssl_match_hostname/_implementation.py#L83-L92 | train |
pypa/pipenv | pipenv/vendor/passa/models/metadata.py | set_metadata | def set_metadata(candidates, traces, dependencies, pythons):
"""Add "metadata" to candidates based on the dependency tree.
Metadata for a candidate includes markers and a specifier for Python
version requirements.
:param candidates: A key-candidate mapping. Candidates in the mapping will
have ... | python | def set_metadata(candidates, traces, dependencies, pythons):
"""Add "metadata" to candidates based on the dependency tree.
Metadata for a candidate includes markers and a specifier for Python
version requirements.
:param candidates: A key-candidate mapping. Candidates in the mapping will
have ... | [
"def",
"set_metadata",
"(",
"candidates",
",",
"traces",
",",
"dependencies",
",",
"pythons",
")",
":",
"metasets_mapping",
"=",
"_calculate_metasets_mapping",
"(",
"dependencies",
",",
"pythons",
",",
"copy",
".",
"deepcopy",
"(",
"traces",
")",
",",
")",
"fo... | Add "metadata" to candidates based on the dependency tree.
Metadata for a candidate includes markers and a specifier for Python
version requirements.
:param candidates: A key-candidate mapping. Candidates in the mapping will
have their markers set.
:param traces: A graph trace (produced by `tr... | [
"Add",
"metadata",
"to",
"candidates",
"based",
"on",
"the",
"dependency",
"tree",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/metadata.py#L145-L169 | train |
pypa/pipenv | pipenv/vendor/scandir.py | _walk | def _walk(top, topdown=True, onerror=None, followlinks=False):
"""Like Python 3.5's implementation of os.walk() -- faster than
the pre-Python 3.5 version as it uses scandir() internally.
"""
dirs = []
nondirs = []
# We may not have read permission for top, in which case we can't
# get a lis... | python | def _walk(top, topdown=True, onerror=None, followlinks=False):
"""Like Python 3.5's implementation of os.walk() -- faster than
the pre-Python 3.5 version as it uses scandir() internally.
"""
dirs = []
nondirs = []
# We may not have read permission for top, in which case we can't
# get a lis... | [
"def",
"_walk",
"(",
"top",
",",
"topdown",
"=",
"True",
",",
"onerror",
"=",
"None",
",",
"followlinks",
"=",
"False",
")",
":",
"dirs",
"=",
"[",
"]",
"nondirs",
"=",
"[",
"]",
"# We may not have read permission for top, in which case we can't",
"# get a list ... | Like Python 3.5's implementation of os.walk() -- faster than
the pre-Python 3.5 version as it uses scandir() internally. | [
"Like",
"Python",
"3",
".",
"5",
"s",
"implementation",
"of",
"os",
".",
"walk",
"()",
"--",
"faster",
"than",
"the",
"pre",
"-",
"Python",
"3",
".",
"5",
"version",
"as",
"it",
"uses",
"scandir",
"()",
"internally",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/scandir.py#L600-L677 | train |
pypa/pipenv | pipenv/vendor/urllib3/request.py | RequestMethods.request_encode_url | def request_encode_url(self, method, url, fields=None, headers=None,
**urlopen_kw):
"""
Make a request using :meth:`urlopen` with the ``fields`` encoded in
the url. This is useful for request methods like GET, HEAD, DELETE, etc.
"""
if headers is None:
... | python | def request_encode_url(self, method, url, fields=None, headers=None,
**urlopen_kw):
"""
Make a request using :meth:`urlopen` with the ``fields`` encoded in
the url. This is useful for request methods like GET, HEAD, DELETE, etc.
"""
if headers is None:
... | [
"def",
"request_encode_url",
"(",
"self",
",",
"method",
",",
"url",
",",
"fields",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"urlopen_kw",
")",
":",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"self",
".",
"headers",
"extra_kw",... | Make a request using :meth:`urlopen` with the ``fields`` encoded in
the url. This is useful for request methods like GET, HEAD, DELETE, etc. | [
"Make",
"a",
"request",
"using",
":",
"meth",
":",
"urlopen",
"with",
"the",
"fields",
"encoded",
"in",
"the",
"url",
".",
"This",
"is",
"useful",
"for",
"request",
"methods",
"like",
"GET",
"HEAD",
"DELETE",
"etc",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/request.py#L74-L89 | train |
pypa/pipenv | pipenv/vendor/urllib3/request.py | RequestMethods.request_encode_body | def request_encode_body(self, method, url, fields=None, headers=None,
encode_multipart=True, multipart_boundary=None,
**urlopen_kw):
"""
Make a request using :meth:`urlopen` with the ``fields`` encoded in
the body. This is useful for reques... | python | def request_encode_body(self, method, url, fields=None, headers=None,
encode_multipart=True, multipart_boundary=None,
**urlopen_kw):
"""
Make a request using :meth:`urlopen` with the ``fields`` encoded in
the body. This is useful for reques... | [
"def",
"request_encode_body",
"(",
"self",
",",
"method",
",",
"url",
",",
"fields",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"encode_multipart",
"=",
"True",
",",
"multipart_boundary",
"=",
"None",
",",
"*",
"*",
"urlopen_kw",
")",
":",
"if",
"hea... | Make a request using :meth:`urlopen` with the ``fields`` encoded in
the body. This is useful for request methods like POST, PUT, PATCH, etc.
When ``encode_multipart=True`` (default), then
:meth:`urllib3.filepost.encode_multipart_formdata` is used to encode
the payload with the appropria... | [
"Make",
"a",
"request",
"using",
":",
"meth",
":",
"urlopen",
"with",
"the",
"fields",
"encoded",
"in",
"the",
"body",
".",
"This",
"is",
"useful",
"for",
"request",
"methods",
"like",
"POST",
"PUT",
"PATCH",
"etc",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/request.py#L91-L150 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | pass_context | def pass_context(f):
"""Marks a callback as wanting to receive the current context
object as first argument.
"""
def new_func(*args, **kwargs):
return f(get_current_context(), *args, **kwargs)
return update_wrapper(new_func, f) | python | def pass_context(f):
"""Marks a callback as wanting to receive the current context
object as first argument.
"""
def new_func(*args, **kwargs):
return f(get_current_context(), *args, **kwargs)
return update_wrapper(new_func, f) | [
"def",
"pass_context",
"(",
"f",
")",
":",
"def",
"new_func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"f",
"(",
"get_current_context",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"update_wrapper",
"(",
... | Marks a callback as wanting to receive the current context
object as first argument. | [
"Marks",
"a",
"callback",
"as",
"wanting",
"to",
"receive",
"the",
"current",
"context",
"object",
"as",
"first",
"argument",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L12-L18 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | pass_obj | def pass_obj(f):
"""Similar to :func:`pass_context`, but only pass the object on the
context onwards (:attr:`Context.obj`). This is useful if that object
represents the state of a nested system.
"""
def new_func(*args, **kwargs):
return f(get_current_context().obj, *args, **kwargs)
retu... | python | def pass_obj(f):
"""Similar to :func:`pass_context`, but only pass the object on the
context onwards (:attr:`Context.obj`). This is useful if that object
represents the state of a nested system.
"""
def new_func(*args, **kwargs):
return f(get_current_context().obj, *args, **kwargs)
retu... | [
"def",
"pass_obj",
"(",
"f",
")",
":",
"def",
"new_func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"f",
"(",
"get_current_context",
"(",
")",
".",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"update_wrappe... | Similar to :func:`pass_context`, but only pass the object on the
context onwards (:attr:`Context.obj`). This is useful if that object
represents the state of a nested system. | [
"Similar",
"to",
":",
"func",
":",
"pass_context",
"but",
"only",
"pass",
"the",
"object",
"on",
"the",
"context",
"onwards",
"(",
":",
"attr",
":",
"Context",
".",
"obj",
")",
".",
"This",
"is",
"useful",
"if",
"that",
"object",
"represents",
"the",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L21-L28 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | make_pass_decorator | def make_pass_decorator(object_type, ensure=False):
"""Given an object type this creates a decorator that will work
similar to :func:`pass_obj` but instead of passing the object of the
current context, it will find the innermost context of type
:func:`object_type`.
This generates a decorator that w... | python | def make_pass_decorator(object_type, ensure=False):
"""Given an object type this creates a decorator that will work
similar to :func:`pass_obj` but instead of passing the object of the
current context, it will find the innermost context of type
:func:`object_type`.
This generates a decorator that w... | [
"def",
"make_pass_decorator",
"(",
"object_type",
",",
"ensure",
"=",
"False",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"def",
"new_func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"get_current_context",
"(",
")",
"if",
... | Given an object type this creates a decorator that will work
similar to :func:`pass_obj` but instead of passing the object of the
current context, it will find the innermost context of type
:func:`object_type`.
This generates a decorator that works roughly like this::
from functools import upd... | [
"Given",
"an",
"object",
"type",
"this",
"creates",
"a",
"decorator",
"that",
"will",
"work",
"similar",
"to",
":",
"func",
":",
"pass_obj",
"but",
"instead",
"of",
"passing",
"the",
"object",
"of",
"the",
"current",
"context",
"it",
"will",
"find",
"the",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L31-L66 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | argument | def argument(*param_decls, **attrs):
"""Attaches an argument to the command. All positional arguments are
passed as parameter declarations to :class:`Argument`; all keyword
arguments are forwarded unchanged (except ``cls``).
This is equivalent to creating an :class:`Argument` instance manually
and ... | python | def argument(*param_decls, **attrs):
"""Attaches an argument to the command. All positional arguments are
passed as parameter declarations to :class:`Argument`; all keyword
arguments are forwarded unchanged (except ``cls``).
This is equivalent to creating an :class:`Argument` instance manually
and ... | [
"def",
"argument",
"(",
"*",
"param_decls",
",",
"*",
"*",
"attrs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"ArgumentClass",
"=",
"attrs",
".",
"pop",
"(",
"'cls'",
",",
"Argument",
")",
"_param_memo",
"(",
"f",
",",
"ArgumentClass",
"(",
"... | Attaches an argument to the command. All positional arguments are
passed as parameter declarations to :class:`Argument`; all keyword
arguments are forwarded unchanged (except ``cls``).
This is equivalent to creating an :class:`Argument` instance manually
and attaching it to the :attr:`Command.params` l... | [
"Attaches",
"an",
"argument",
"to",
"the",
"command",
".",
"All",
"positional",
"arguments",
"are",
"passed",
"as",
"parameter",
"declarations",
"to",
":",
"class",
":",
"Argument",
";",
"all",
"keyword",
"arguments",
"are",
"forwarded",
"unchanged",
"(",
"exc... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L139-L153 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | option | def option(*param_decls, **attrs):
"""Attaches an option to the command. All positional arguments are
passed as parameter declarations to :class:`Option`; all keyword
arguments are forwarded unchanged (except ``cls``).
This is equivalent to creating an :class:`Option` instance manually
and attachin... | python | def option(*param_decls, **attrs):
"""Attaches an option to the command. All positional arguments are
passed as parameter declarations to :class:`Option`; all keyword
arguments are forwarded unchanged (except ``cls``).
This is equivalent to creating an :class:`Option` instance manually
and attachin... | [
"def",
"option",
"(",
"*",
"param_decls",
",",
"*",
"*",
"attrs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"# Issue 926, copy attrs, so pre-defined options can re-use the same cls=",
"option_attrs",
"=",
"attrs",
".",
"copy",
"(",
")",
"if",
"'help'",
"... | Attaches an option to the command. All positional arguments are
passed as parameter declarations to :class:`Option`; all keyword
arguments are forwarded unchanged (except ``cls``).
This is equivalent to creating an :class:`Option` instance manually
and attaching it to the :attr:`Command.params` list.
... | [
"Attaches",
"an",
"option",
"to",
"the",
"command",
".",
"All",
"positional",
"arguments",
"are",
"passed",
"as",
"parameter",
"declarations",
"to",
":",
"class",
":",
"Option",
";",
"all",
"keyword",
"arguments",
"are",
"forwarded",
"unchanged",
"(",
"except"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L156-L175 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | confirmation_option | def confirmation_option(*param_decls, **attrs):
"""Shortcut for confirmation prompts that can be ignored by passing
``--yes`` as parameter.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
def callback(ctx, param, value):
if not value:... | python | def confirmation_option(*param_decls, **attrs):
"""Shortcut for confirmation prompts that can be ignored by passing
``--yes`` as parameter.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
def callback(ctx, param, value):
if not value:... | [
"def",
"confirmation_option",
"(",
"*",
"param_decls",
",",
"*",
"*",
"attrs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"def",
"callback",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"ctx",
".",
"abort",
"(... | Shortcut for confirmation prompts that can be ignored by passing
``--yes`` as parameter.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
def callback(ctx, param, value):
if not value:
ctx.abort()
@click.command()
... | [
"Shortcut",
"for",
"confirmation",
"prompts",
"that",
"can",
"be",
"ignored",
"by",
"passing",
"--",
"yes",
"as",
"parameter",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L178-L205 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | password_option | def password_option(*param_decls, **attrs):
"""Shortcut for password prompts.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
@click.command()
@click.option('--password', prompt=True, confirmation_prompt=True,
hide_input... | python | def password_option(*param_decls, **attrs):
"""Shortcut for password prompts.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
@click.command()
@click.option('--password', prompt=True, confirmation_prompt=True,
hide_input... | [
"def",
"password_option",
"(",
"*",
"param_decls",
",",
"*",
"*",
"attrs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"attrs",
".",
"setdefault",
"(",
"'prompt'",
",",
"True",
")",
"attrs",
".",
"setdefault",
"(",
"'confirmation_prompt'",
",",
"Tr... | Shortcut for password prompts.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
@click.command()
@click.option('--password', prompt=True, confirmation_prompt=True,
hide_input=True)
def changeadmin(password):
... | [
"Shortcut",
"for",
"password",
"prompts",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L208-L225 | train |
pypa/pipenv | pipenv/vendor/click/decorators.py | help_option | def help_option(*param_decls, **attrs):
"""Adds a ``--help`` option which immediately ends the program
printing out the help page. This is usually unnecessary to add as
this is added by default to all commands unless suppressed.
Like :func:`version_option`, this is implemented as eager option that
... | python | def help_option(*param_decls, **attrs):
"""Adds a ``--help`` option which immediately ends the program
printing out the help page. This is usually unnecessary to add as
this is added by default to all commands unless suppressed.
Like :func:`version_option`, this is implemented as eager option that
... | [
"def",
"help_option",
"(",
"*",
"param_decls",
",",
"*",
"*",
"attrs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"def",
"callback",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"value",
"and",
"not",
"ctx",
".",
"resilient_parsing"... | Adds a ``--help`` option which immediately ends the program
printing out the help page. This is usually unnecessary to add as
this is added by default to all commands unless suppressed.
Like :func:`version_option`, this is implemented as eager option that
prints in the callback and exits.
All arg... | [
"Adds",
"a",
"--",
"help",
"option",
"which",
"immediately",
"ends",
"the",
"program",
"printing",
"out",
"the",
"help",
"page",
".",
"This",
"is",
"usually",
"unnecessary",
"to",
"add",
"as",
"this",
"is",
"added",
"by",
"default",
"to",
"all",
"commands"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/decorators.py#L286-L307 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/utils/outdated.py | was_installed_by_pip | def was_installed_by_pip(pkg):
# type: (str) -> bool
"""Checks whether pkg was installed by pip
This is used not to display the upgrade message when pip is in fact
installed by system package manager, such as dnf on Fedora.
"""
try:
dist = pkg_resources.get_distribution(pkg)
ret... | python | def was_installed_by_pip(pkg):
# type: (str) -> bool
"""Checks whether pkg was installed by pip
This is used not to display the upgrade message when pip is in fact
installed by system package manager, such as dnf on Fedora.
"""
try:
dist = pkg_resources.get_distribution(pkg)
ret... | [
"def",
"was_installed_by_pip",
"(",
"pkg",
")",
":",
"# type: (str) -> bool",
"try",
":",
"dist",
"=",
"pkg_resources",
".",
"get_distribution",
"(",
"pkg",
")",
"return",
"(",
"dist",
".",
"has_metadata",
"(",
"'INSTALLER'",
")",
"and",
"'pip'",
"in",
"dist",... | Checks whether pkg was installed by pip
This is used not to display the upgrade message when pip is in fact
installed by system package manager, such as dnf on Fedora. | [
"Checks",
"whether",
"pkg",
"was",
"installed",
"by",
"pip"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/outdated.py#L79-L91 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/utils/outdated.py | pip_version_check | def pip_version_check(session, options):
# type: (PipSession, optparse.Values) -> None
"""Check for an update for pip.
Limit the frequency of checks to once per week. State is stored either in
the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
of the pip script path.
"""... | python | def pip_version_check(session, options):
# type: (PipSession, optparse.Values) -> None
"""Check for an update for pip.
Limit the frequency of checks to once per week. State is stored either in
the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
of the pip script path.
"""... | [
"def",
"pip_version_check",
"(",
"session",
",",
"options",
")",
":",
"# type: (PipSession, optparse.Values) -> None",
"installed_version",
"=",
"get_installed_version",
"(",
"\"pip\"",
")",
"if",
"not",
"installed_version",
":",
"return",
"pip_version",
"=",
"packaging_v... | Check for an update for pip.
Limit the frequency of checks to once per week. State is stored either in
the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
of the pip script path. | [
"Check",
"for",
"an",
"update",
"for",
"pip",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/outdated.py#L94-L164 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/pep425tags.py | get_abbr_impl | def get_abbr_impl():
# type: () -> str
"""Return abbreviated implementation name."""
if hasattr(sys, 'pypy_version_info'):
pyimpl = 'pp'
elif sys.platform.startswith('java'):
pyimpl = 'jy'
elif sys.platform == 'cli':
pyimpl = 'ip'
else:
pyimpl = 'cp'
return py... | python | def get_abbr_impl():
# type: () -> str
"""Return abbreviated implementation name."""
if hasattr(sys, 'pypy_version_info'):
pyimpl = 'pp'
elif sys.platform.startswith('java'):
pyimpl = 'jy'
elif sys.platform == 'cli':
pyimpl = 'ip'
else:
pyimpl = 'cp'
return py... | [
"def",
"get_abbr_impl",
"(",
")",
":",
"# type: () -> str",
"if",
"hasattr",
"(",
"sys",
",",
"'pypy_version_info'",
")",
":",
"pyimpl",
"=",
"'pp'",
"elif",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'java'",
")",
":",
"pyimpl",
"=",
"'jy'",
"elif",... | Return abbreviated implementation name. | [
"Return",
"abbreviated",
"implementation",
"name",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pep425tags.py#L41-L52 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/pep425tags.py | get_impl_ver | def get_impl_ver():
# type: () -> str
"""Return implementation version."""
impl_ver = get_config_var("py_version_nodot")
if not impl_ver or get_abbr_impl() == 'pp':
impl_ver = ''.join(map(str, get_impl_version_info()))
return impl_ver | python | def get_impl_ver():
# type: () -> str
"""Return implementation version."""
impl_ver = get_config_var("py_version_nodot")
if not impl_ver or get_abbr_impl() == 'pp':
impl_ver = ''.join(map(str, get_impl_version_info()))
return impl_ver | [
"def",
"get_impl_ver",
"(",
")",
":",
"# type: () -> str",
"impl_ver",
"=",
"get_config_var",
"(",
"\"py_version_nodot\"",
")",
"if",
"not",
"impl_ver",
"or",
"get_abbr_impl",
"(",
")",
"==",
"'pp'",
":",
"impl_ver",
"=",
"''",
".",
"join",
"(",
"map",
"(",
... | Return implementation version. | [
"Return",
"implementation",
"version",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pep425tags.py#L55-L61 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/pep425tags.py | get_impl_version_info | def get_impl_version_info():
# type: () -> Tuple[int, ...]
"""Return sys.version_info-like tuple for use in decrementing the minor
version."""
if get_abbr_impl() == 'pp':
# as per https://github.com/pypa/pip/issues/2882
# attrs exist only on pypy
return (sys.version_info[0],
... | python | def get_impl_version_info():
# type: () -> Tuple[int, ...]
"""Return sys.version_info-like tuple for use in decrementing the minor
version."""
if get_abbr_impl() == 'pp':
# as per https://github.com/pypa/pip/issues/2882
# attrs exist only on pypy
return (sys.version_info[0],
... | [
"def",
"get_impl_version_info",
"(",
")",
":",
"# type: () -> Tuple[int, ...]",
"if",
"get_abbr_impl",
"(",
")",
"==",
"'pp'",
":",
"# as per https://github.com/pypa/pip/issues/2882",
"# attrs exist only on pypy",
"return",
"(",
"sys",
".",
"version_info",
"[",
"0",
"]",
... | Return sys.version_info-like tuple for use in decrementing the minor
version. | [
"Return",
"sys",
".",
"version_info",
"-",
"like",
"tuple",
"for",
"use",
"in",
"decrementing",
"the",
"minor",
"version",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pep425tags.py#L64-L75 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/pep425tags.py | get_platform | def get_platform():
# type: () -> str
"""Return our platform name 'win32', 'linux_x86_64'"""
if sys.platform == 'darwin':
# distutils.util.get_platform() returns the release based on the value
# of MACOSX_DEPLOYMENT_TARGET on which Python was built, which may
# be significantly older... | python | def get_platform():
# type: () -> str
"""Return our platform name 'win32', 'linux_x86_64'"""
if sys.platform == 'darwin':
# distutils.util.get_platform() returns the release based on the value
# of MACOSX_DEPLOYMENT_TARGET on which Python was built, which may
# be significantly older... | [
"def",
"get_platform",
"(",
")",
":",
"# type: () -> str",
"if",
"sys",
".",
"platform",
"==",
"'darwin'",
":",
"# distutils.util.get_platform() returns the release based on the value",
"# of MACOSX_DEPLOYMENT_TARGET on which Python was built, which may",
"# be significantly older than... | Return our platform name 'win32', 'linux_x86_64 | [
"Return",
"our",
"platform",
"name",
"win32",
"linux_x86_64"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pep425tags.py#L139-L163 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/pep425tags.py | get_supported | def get_supported(
versions=None, # type: Optional[List[str]]
noarch=False, # type: bool
platform=None, # type: Optional[str]
impl=None, # type: Optional[str]
abi=None # type: Optional[str]
):
# type: (...) -> List[Pep425Tag]
"""Return a list of supported tags for each version specified... | python | def get_supported(
versions=None, # type: Optional[List[str]]
noarch=False, # type: bool
platform=None, # type: Optional[str]
impl=None, # type: Optional[str]
abi=None # type: Optional[str]
):
# type: (...) -> List[Pep425Tag]
"""Return a list of supported tags for each version specified... | [
"def",
"get_supported",
"(",
"versions",
"=",
"None",
",",
"# type: Optional[List[str]]",
"noarch",
"=",
"False",
",",
"# type: bool",
"platform",
"=",
"None",
",",
"# type: Optional[str]",
"impl",
"=",
"None",
",",
"# type: Optional[str]",
"abi",
"=",
"None",
"# ... | Return a list of supported tags for each version specified in
`versions`.
:param versions: a list of string versions, of the form ["33", "32"],
or None. The first version will be assumed to support our ABI.
:param platform: specify the exact platform you want valid
tags for, or None. If Non... | [
"Return",
"a",
"list",
"of",
"supported",
"tags",
"for",
"each",
"version",
"specified",
"in",
"versions",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pep425tags.py#L275-L381 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | get_netrc_auth | def get_netrc_auth(url, raise_errors=False):
"""Returns the Requests tuple auth for a given url from netrc."""
try:
from netrc import netrc, NetrcParseError
netrc_path = None
for f in NETRC_FILES:
try:
loc = os.path.expanduser('~/{}'.format(f))
... | python | def get_netrc_auth(url, raise_errors=False):
"""Returns the Requests tuple auth for a given url from netrc."""
try:
from netrc import netrc, NetrcParseError
netrc_path = None
for f in NETRC_FILES:
try:
loc = os.path.expanduser('~/{}'.format(f))
... | [
"def",
"get_netrc_auth",
"(",
"url",
",",
"raise_errors",
"=",
"False",
")",
":",
"try",
":",
"from",
"netrc",
"import",
"netrc",
",",
"NetrcParseError",
"netrc_path",
"=",
"None",
"for",
"f",
"in",
"NETRC_FILES",
":",
"try",
":",
"loc",
"=",
"os",
".",
... | Returns the Requests tuple auth for a given url from netrc. | [
"Returns",
"the",
"Requests",
"tuple",
"auth",
"for",
"a",
"given",
"url",
"from",
"netrc",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L168-L216 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | guess_filename | def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if (name and isinstance(name, basestring) and name[0] != '<' and
name[-1] != '>'):
return os.path.basename(name) | python | def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if (name and isinstance(name, basestring) and name[0] != '<' and
name[-1] != '>'):
return os.path.basename(name) | [
"def",
"guess_filename",
"(",
"obj",
")",
":",
"name",
"=",
"getattr",
"(",
"obj",
",",
"'name'",
",",
"None",
")",
"if",
"(",
"name",
"and",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"and",
"name",
"[",
"0",
"]",
"!=",
"'<'",
"and",
"name... | Tries to guess the filename of the given object. | [
"Tries",
"to",
"guess",
"the",
"filename",
"of",
"the",
"given",
"object",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L219-L224 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | extract_zipped_paths | def extract_zipped_paths(path):
"""Replace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged.
"""
if os.path.exists(path):
# this is already a valid path, no need to d... | python | def extract_zipped_paths(path):
"""Replace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged.
"""
if os.path.exists(path):
# this is already a valid path, no need to d... | [
"def",
"extract_zipped_paths",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"# this is already a valid path, no need to do anything further",
"return",
"path",
"# find the first valid part of the provided path and treat that as a zip arc... | Replace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged. | [
"Replace",
"nonexistent",
"paths",
"that",
"look",
"like",
"they",
"refer",
"to",
"a",
"member",
"of",
"a",
"zip",
"archive",
"with",
"the",
"location",
"of",
"an",
"extracted",
"copy",
"of",
"the",
"target",
"or",
"else",
"just",
"return",
"the",
"provide... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L227-L256 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | from_key_val_list | def from_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('strin... | python | def from_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('strin... | [
"def",
"from_key_val_list",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"bytes",
",",
"bool",
",",
"int",
")",
")",
":",
"raise",
"ValueError",
"(",
"'cannot encode... | Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('string')
ValueError: cannot encode... | [
"Take",
"an",
"object",
"and",
"test",
"to",
"see",
"if",
"it",
"can",
"be",
"represented",
"as",
"a",
"dictionary",
".",
"Unless",
"it",
"can",
"not",
"be",
"represented",
"as",
"such",
"return",
"an",
"OrderedDict",
"e",
".",
"g",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L259-L281 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | parse_list_header | def parse_list_header(value):
"""Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed au... | python | def parse_list_header(value):
"""Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed au... | [
"def",
"parse_list_header",
"(",
"value",
")",
":",
"result",
"=",
"[",
"]",
"for",
"item",
"in",
"_parse_list_header",
"(",
"value",
")",
":",
"if",
"item",
"[",
":",
"1",
"]",
"==",
"item",
"[",
"-",
"1",
":",
"]",
"==",
"'\"'",
":",
"item",
"=... | Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed automatically after parsing.
It ba... | [
"Parse",
"lists",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L312-L340 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | parse_dict_header | def parse_dict_header(value):
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
... | python | def parse_dict_header(value):
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
... | [
"def",
"parse_dict_header",
"(",
"value",
")",
":",
"result",
"=",
"{",
"}",
"for",
"item",
"in",
"_parse_list_header",
"(",
"value",
")",
":",
"if",
"'='",
"not",
"in",
"item",
":",
"result",
"[",
"item",
"]",
"=",
"None",
"continue",
"name",
",",
"... | Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
If there is no value for a key it wi... | [
"Parse",
"lists",
"of",
"key",
"value",
"pairs",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"and",
"convert",
"them",
"into",
"a",
"python",
"dict",
":"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L344-L375 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | dict_from_cookiejar | def dict_from_cookiejar(cj):
"""Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict
"""
cookie_dict = {}
for cookie in cj:
cookie_dict[cookie.name] = cookie.value
return cookie_dict | python | def dict_from_cookiejar(cj):
"""Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict
"""
cookie_dict = {}
for cookie in cj:
cookie_dict[cookie.name] = cookie.value
return cookie_dict | [
"def",
"dict_from_cookiejar",
"(",
"cj",
")",
":",
"cookie_dict",
"=",
"{",
"}",
"for",
"cookie",
"in",
"cj",
":",
"cookie_dict",
"[",
"cookie",
".",
"name",
"]",
"=",
"cookie",
".",
"value",
"return",
"cookie_dict"
] | Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict | [
"Returns",
"a",
"key",
"/",
"value",
"dictionary",
"from",
"a",
"CookieJar",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L404-L416 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | _parse_content_type_header | def _parse_content_type_header(header):
"""Returns content type and parameters from given header
:param header: string
:return: tuple containing content type and dictionary of
parameters
"""
tokens = header.split(';')
content_type, params = tokens[0].strip(), tokens[1:]
params_dic... | python | def _parse_content_type_header(header):
"""Returns content type and parameters from given header
:param header: string
:return: tuple containing content type and dictionary of
parameters
"""
tokens = header.split(';')
content_type, params = tokens[0].strip(), tokens[1:]
params_dic... | [
"def",
"_parse_content_type_header",
"(",
"header",
")",
":",
"tokens",
"=",
"header",
".",
"split",
"(",
"';'",
")",
"content_type",
",",
"params",
"=",
"tokens",
"[",
"0",
"]",
".",
"strip",
"(",
")",
",",
"tokens",
"[",
"1",
":",
"]",
"params_dict",... | Returns content type and parameters from given header
:param header: string
:return: tuple containing content type and dictionary of
parameters | [
"Returns",
"content",
"type",
"and",
"parameters",
"from",
"given",
"header"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L450-L472 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | get_encoding_from_headers | def get_encoding_from_headers(headers):
"""Returns encodings from given HTTP Header Dict.
:param headers: dictionary to extract encoding from.
:rtype: str
"""
content_type = headers.get('content-type')
if not content_type:
return None
content_type, params = _parse_content_type_he... | python | def get_encoding_from_headers(headers):
"""Returns encodings from given HTTP Header Dict.
:param headers: dictionary to extract encoding from.
:rtype: str
"""
content_type = headers.get('content-type')
if not content_type:
return None
content_type, params = _parse_content_type_he... | [
"def",
"get_encoding_from_headers",
"(",
"headers",
")",
":",
"content_type",
"=",
"headers",
".",
"get",
"(",
"'content-type'",
")",
"if",
"not",
"content_type",
":",
"return",
"None",
"content_type",
",",
"params",
"=",
"_parse_content_type_header",
"(",
"conten... | Returns encodings from given HTTP Header Dict.
:param headers: dictionary to extract encoding from.
:rtype: str | [
"Returns",
"encodings",
"from",
"given",
"HTTP",
"Header",
"Dict",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L475-L493 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | iter_slices | def iter_slices(string, slice_length):
"""Iterate over slices of a string."""
pos = 0
if slice_length is None or slice_length <= 0:
slice_length = len(string)
while pos < len(string):
yield string[pos:pos + slice_length]
pos += slice_length | python | def iter_slices(string, slice_length):
"""Iterate over slices of a string."""
pos = 0
if slice_length is None or slice_length <= 0:
slice_length = len(string)
while pos < len(string):
yield string[pos:pos + slice_length]
pos += slice_length | [
"def",
"iter_slices",
"(",
"string",
",",
"slice_length",
")",
":",
"pos",
"=",
"0",
"if",
"slice_length",
"is",
"None",
"or",
"slice_length",
"<=",
"0",
":",
"slice_length",
"=",
"len",
"(",
"string",
")",
"while",
"pos",
"<",
"len",
"(",
"string",
")... | Iterate over slices of a string. | [
"Iterate",
"over",
"slices",
"of",
"a",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L514-L521 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | get_unicode_from_response | def get_unicode_from_response(r):
"""Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters
:rtype: str
"""
warnings.warn((
'In requests 3.0, get... | python | def get_unicode_from_response(r):
"""Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters
:rtype: str
"""
warnings.warn((
'In requests 3.0, get... | [
"def",
"get_unicode_from_response",
"(",
"r",
")",
":",
"warnings",
".",
"warn",
"(",
"(",
"'In requests 3.0, get_unicode_from_response will be removed. For '",
"'more information, please see the discussion on issue #2266. (This'",
"' warning should only appear once.)'",
")",
",",
"D... | Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters
:rtype: str | [
"Returns",
"the",
"requested",
"content",
"back",
"in",
"unicode",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L524-L557 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | requote_uri | def requote_uri(uri):
"""Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str
"""
safe_with_percent = "!#$%&'()*+,/:;=?@[]~"
safe_without_percent = "!#$&'()*+,/:;=?@[]~"
try:
# ... | python | def requote_uri(uri):
"""Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str
"""
safe_with_percent = "!#$%&'()*+,/:;=?@[]~"
safe_without_percent = "!#$&'()*+,/:;=?@[]~"
try:
# ... | [
"def",
"requote_uri",
"(",
"uri",
")",
":",
"safe_with_percent",
"=",
"\"!#$%&'()*+,/:;=?@[]~\"",
"safe_without_percent",
"=",
"\"!#$&'()*+,/:;=?@[]~\"",
"try",
":",
"# Unquote only the unreserved characters",
"# Then quote only illegal characters (do not quote reserved,",
"# unreser... | Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str | [
"Re",
"-",
"quote",
"the",
"given",
"URI",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L589-L608 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | address_in_network | def address_in_network(ip, net):
"""This function allows you to check if an IP belongs to a network subnet
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
:rtype: bool
"""
ipaddr = struct.unpack('=L', sock... | python | def address_in_network(ip, net):
"""This function allows you to check if an IP belongs to a network subnet
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
:rtype: bool
"""
ipaddr = struct.unpack('=L', sock... | [
"def",
"address_in_network",
"(",
"ip",
",",
"net",
")",
":",
"ipaddr",
"=",
"struct",
".",
"unpack",
"(",
"'=L'",
",",
"socket",
".",
"inet_aton",
"(",
"ip",
")",
")",
"[",
"0",
"]",
"netaddr",
",",
"bits",
"=",
"net",
".",
"split",
"(",
"'/'",
... | This function allows you to check if an IP belongs to a network subnet
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
:rtype: bool | [
"This",
"function",
"allows",
"you",
"to",
"check",
"if",
"an",
"IP",
"belongs",
"to",
"a",
"network",
"subnet"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L611-L623 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | is_valid_cidr | def is_valid_cidr(string_network):
"""
Very simple check of the cidr format in no_proxy variable.
:rtype: bool
"""
if string_network.count('/') == 1:
try:
mask = int(string_network.split('/')[1])
except ValueError:
return False
if mask < 1 or mask > ... | python | def is_valid_cidr(string_network):
"""
Very simple check of the cidr format in no_proxy variable.
:rtype: bool
"""
if string_network.count('/') == 1:
try:
mask = int(string_network.split('/')[1])
except ValueError:
return False
if mask < 1 or mask > ... | [
"def",
"is_valid_cidr",
"(",
"string_network",
")",
":",
"if",
"string_network",
".",
"count",
"(",
"'/'",
")",
"==",
"1",
":",
"try",
":",
"mask",
"=",
"int",
"(",
"string_network",
".",
"split",
"(",
"'/'",
")",
"[",
"1",
"]",
")",
"except",
"Value... | Very simple check of the cidr format in no_proxy variable.
:rtype: bool | [
"Very",
"simple",
"check",
"of",
"the",
"cidr",
"format",
"in",
"no_proxy",
"variable",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L648-L669 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | set_environ | def set_environ(env_name, value):
"""Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing"""
value_changed = value is not None
if value_changed:
o... | python | def set_environ(env_name, value):
"""Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing"""
value_changed = value is not None
if value_changed:
o... | [
"def",
"set_environ",
"(",
"env_name",
",",
"value",
")",
":",
"value_changed",
"=",
"value",
"is",
"not",
"None",
"if",
"value_changed",
":",
"old_value",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"env_name",
")",
"os",
".",
"environ",
"[",
"env_name"... | Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing | [
"Set",
"the",
"environment",
"variable",
"env_name",
"to",
"value"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L673-L691 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | should_bypass_proxies | def should_bypass_proxies(url, no_proxy):
"""
Returns whether we should bypass proxies or not.
:rtype: bool
"""
# Prioritize lowercase environment variables over uppercase
# to keep a consistent behaviour with other http projects (curl, wget).
get_proxy = lambda k: os.environ.get(k) or os.e... | python | def should_bypass_proxies(url, no_proxy):
"""
Returns whether we should bypass proxies or not.
:rtype: bool
"""
# Prioritize lowercase environment variables over uppercase
# to keep a consistent behaviour with other http projects (curl, wget).
get_proxy = lambda k: os.environ.get(k) or os.e... | [
"def",
"should_bypass_proxies",
"(",
"url",
",",
"no_proxy",
")",
":",
"# Prioritize lowercase environment variables over uppercase",
"# to keep a consistent behaviour with other http projects (curl, wget).",
"get_proxy",
"=",
"lambda",
"k",
":",
"os",
".",
"environ",
".",
"get... | Returns whether we should bypass proxies or not.
:rtype: bool | [
"Returns",
"whether",
"we",
"should",
"bypass",
"proxies",
"or",
"not",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L694-L752 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | select_proxy | def select_proxy(url, proxies):
"""Select a proxy for the url, if applicable.
:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
"""
proxies = proxies or {}
urlparts = urlparse(url)
if urlparts.hostname is None:
retur... | python | def select_proxy(url, proxies):
"""Select a proxy for the url, if applicable.
:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
"""
proxies = proxies or {}
urlparts = urlparse(url)
if urlparts.hostname is None:
retur... | [
"def",
"select_proxy",
"(",
"url",
",",
"proxies",
")",
":",
"proxies",
"=",
"proxies",
"or",
"{",
"}",
"urlparts",
"=",
"urlparse",
"(",
"url",
")",
"if",
"urlparts",
".",
"hostname",
"is",
"None",
":",
"return",
"proxies",
".",
"get",
"(",
"urlparts"... | Select a proxy for the url, if applicable.
:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs | [
"Select",
"a",
"proxy",
"for",
"the",
"url",
"if",
"applicable",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L767-L790 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | prepend_scheme_if_needed | def prepend_scheme_if_needed(url, new_scheme):
"""Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
# urlpars... | python | def prepend_scheme_if_needed(url, new_scheme):
"""Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
# urlpars... | [
"def",
"prepend_scheme_if_needed",
"(",
"url",
",",
"new_scheme",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"fragment",
"=",
"urlparse",
"(",
"url",
",",
"new_scheme",
")",
"# urlparse is a finicky beast, and sometimes decid... | Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str | [
"Given",
"a",
"URL",
"that",
"may",
"or",
"may",
"not",
"have",
"a",
"scheme",
"prepend",
"the",
"given",
"scheme",
".",
"Does",
"not",
"replace",
"a",
"present",
"scheme",
"with",
"the",
"one",
"provided",
"as",
"an",
"argument",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L889-L903 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | get_auth_from_url | def get_auth_from_url(url):
"""Given a url with authentication components, extract them into a tuple of
username,password.
:rtype: (str,str)
"""
parsed = urlparse(url)
try:
auth = (unquote(parsed.username), unquote(parsed.password))
except (AttributeError, TypeError):
auth ... | python | def get_auth_from_url(url):
"""Given a url with authentication components, extract them into a tuple of
username,password.
:rtype: (str,str)
"""
parsed = urlparse(url)
try:
auth = (unquote(parsed.username), unquote(parsed.password))
except (AttributeError, TypeError):
auth ... | [
"def",
"get_auth_from_url",
"(",
"url",
")",
":",
"parsed",
"=",
"urlparse",
"(",
"url",
")",
"try",
":",
"auth",
"=",
"(",
"unquote",
"(",
"parsed",
".",
"username",
")",
",",
"unquote",
"(",
"parsed",
".",
"password",
")",
")",
"except",
"(",
"Attr... | Given a url with authentication components, extract them into a tuple of
username,password.
:rtype: (str,str) | [
"Given",
"a",
"url",
"with",
"authentication",
"components",
"extract",
"them",
"into",
"a",
"tuple",
"of",
"username",
"password",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L906-L919 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | check_header_validity | def check_header_validity(header):
"""Verifies that header value is a string which doesn't contain
leading whitespace or return characters. This prevents unintended
header injection.
:param header: tuple, in the format (name, value).
"""
name, value = header
if isinstance(value, bytes):
... | python | def check_header_validity(header):
"""Verifies that header value is a string which doesn't contain
leading whitespace or return characters. This prevents unintended
header injection.
:param header: tuple, in the format (name, value).
"""
name, value = header
if isinstance(value, bytes):
... | [
"def",
"check_header_validity",
"(",
"header",
")",
":",
"name",
",",
"value",
"=",
"header",
"if",
"isinstance",
"(",
"value",
",",
"bytes",
")",
":",
"pat",
"=",
"_CLEAN_HEADER_REGEX_BYTE",
"else",
":",
"pat",
"=",
"_CLEAN_HEADER_REGEX_STR",
"try",
":",
"i... | Verifies that header value is a string which doesn't contain
leading whitespace or return characters. This prevents unintended
header injection.
:param header: tuple, in the format (name, value). | [
"Verifies",
"that",
"header",
"value",
"is",
"a",
"string",
"which",
"doesn",
"t",
"contain",
"leading",
"whitespace",
"or",
"return",
"characters",
".",
"This",
"prevents",
"unintended",
"header",
"injection",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L927-L945 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | urldefragauth | def urldefragauth(url):
"""
Given a url remove the fragment and the authentication part.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url)
# see func:`prepend_scheme_if_needed`
if not netloc:
netloc, path = path, netloc
netloc = netloc.rsplit('@', 1... | python | def urldefragauth(url):
"""
Given a url remove the fragment and the authentication part.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url)
# see func:`prepend_scheme_if_needed`
if not netloc:
netloc, path = path, netloc
netloc = netloc.rsplit('@', 1... | [
"def",
"urldefragauth",
"(",
"url",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"fragment",
"=",
"urlparse",
"(",
"url",
")",
"# see func:`prepend_scheme_if_needed`",
"if",
"not",
"netloc",
":",
"netloc",
",",
"path",
... | Given a url remove the fragment and the authentication part.
:rtype: str | [
"Given",
"a",
"url",
"remove",
"the",
"fragment",
"and",
"the",
"authentication",
"part",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L948-L962 | train |
pypa/pipenv | pipenv/vendor/requests/utils.py | rewind_body | def rewind_body(prepared_request):
"""Move file pointer back to its recorded starting position
so it can be read again on redirect.
"""
body_seek = getattr(prepared_request.body, 'seek', None)
if body_seek is not None and isinstance(prepared_request._body_position, integer_types):
try:
... | python | def rewind_body(prepared_request):
"""Move file pointer back to its recorded starting position
so it can be read again on redirect.
"""
body_seek = getattr(prepared_request.body, 'seek', None)
if body_seek is not None and isinstance(prepared_request._body_position, integer_types):
try:
... | [
"def",
"rewind_body",
"(",
"prepared_request",
")",
":",
"body_seek",
"=",
"getattr",
"(",
"prepared_request",
".",
"body",
",",
"'seek'",
",",
"None",
")",
"if",
"body_seek",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"prepared_request",
".",
"_body_posit... | Move file pointer back to its recorded starting position
so it can be read again on redirect. | [
"Move",
"file",
"pointer",
"back",
"to",
"its",
"recorded",
"starting",
"position",
"so",
"it",
"can",
"be",
"read",
"again",
"on",
"redirect",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/utils.py#L965-L977 | train |
pypa/pipenv | pipenv/vendor/packaging/utils.py | canonicalize_version | def canonicalize_version(version):
"""
This is very similar to Version.__str__, but has one subtle differences
with the way it handles the release segment.
"""
try:
version = Version(version)
except InvalidVersion:
# Legacy versions cannot be normalized
return version
... | python | def canonicalize_version(version):
"""
This is very similar to Version.__str__, but has one subtle differences
with the way it handles the release segment.
"""
try:
version = Version(version)
except InvalidVersion:
# Legacy versions cannot be normalized
return version
... | [
"def",
"canonicalize_version",
"(",
"version",
")",
":",
"try",
":",
"version",
"=",
"Version",
"(",
"version",
")",
"except",
"InvalidVersion",
":",
"# Legacy versions cannot be normalized",
"return",
"version",
"parts",
"=",
"[",
"]",
"# Epoch",
"if",
"version",... | This is very similar to Version.__str__, but has one subtle differences
with the way it handles the release segment. | [
"This",
"is",
"very",
"similar",
"to",
"Version",
".",
"__str__",
"but",
"has",
"one",
"subtle",
"differences",
"with",
"the",
"way",
"it",
"handles",
"the",
"release",
"segment",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/packaging/utils.py#L19-L57 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | generate | def generate(node, environment, name, filename, stream=None,
defer_init=False, optimized=True):
"""Generate the python source for a node tree."""
if not isinstance(node, nodes.Template):
raise TypeError('Can\'t compile non template nodes')
generator = environment.code_generator_class(en... | python | def generate(node, environment, name, filename, stream=None,
defer_init=False, optimized=True):
"""Generate the python source for a node tree."""
if not isinstance(node, nodes.Template):
raise TypeError('Can\'t compile non template nodes')
generator = environment.code_generator_class(en... | [
"def",
"generate",
"(",
"node",
",",
"environment",
",",
"name",
",",
"filename",
",",
"stream",
"=",
"None",
",",
"defer_init",
"=",
"False",
",",
"optimized",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"nodes",
".",
"Template... | Generate the python source for a node tree. | [
"Generate",
"the",
"python",
"source",
"for",
"a",
"node",
"tree",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L74-L84 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | has_safe_repr | def has_safe_repr(value):
"""Does the node have a safe representation?"""
if value is None or value is NotImplemented or value is Ellipsis:
return True
if type(value) in (bool, int, float, complex, range_type, Markup) + string_types:
return True
if type(value) in (tuple, list, set, froze... | python | def has_safe_repr(value):
"""Does the node have a safe representation?"""
if value is None or value is NotImplemented or value is Ellipsis:
return True
if type(value) in (bool, int, float, complex, range_type, Markup) + string_types:
return True
if type(value) in (tuple, list, set, froze... | [
"def",
"has_safe_repr",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
"or",
"value",
"is",
"NotImplemented",
"or",
"value",
"is",
"Ellipsis",
":",
"return",
"True",
"if",
"type",
"(",
"value",
")",
"in",
"(",
"bool",
",",
"int",
",",
"float",
... | Does the node have a safe representation? | [
"Does",
"the",
"node",
"have",
"a",
"safe",
"representation?"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L87-L105 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | find_undeclared | def find_undeclared(nodes, names):
"""Check if the names passed are accessed undeclared. The return value
is a set of all the undeclared names from the sequence of names found.
"""
visitor = UndeclaredNameVisitor(names)
try:
for node in nodes:
visitor.visit(node)
except Visi... | python | def find_undeclared(nodes, names):
"""Check if the names passed are accessed undeclared. The return value
is a set of all the undeclared names from the sequence of names found.
"""
visitor = UndeclaredNameVisitor(names)
try:
for node in nodes:
visitor.visit(node)
except Visi... | [
"def",
"find_undeclared",
"(",
"nodes",
",",
"names",
")",
":",
"visitor",
"=",
"UndeclaredNameVisitor",
"(",
"names",
")",
"try",
":",
"for",
"node",
"in",
"nodes",
":",
"visitor",
".",
"visit",
"(",
"node",
")",
"except",
"VisitorExit",
":",
"pass",
"r... | Check if the names passed are accessed undeclared. The return value
is a set of all the undeclared names from the sequence of names found. | [
"Check",
"if",
"the",
"names",
"passed",
"are",
"accessed",
"undeclared",
".",
"The",
"return",
"value",
"is",
"a",
"set",
"of",
"all",
"the",
"undeclared",
"names",
"from",
"the",
"sequence",
"of",
"names",
"found",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L108-L118 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | Frame.copy | def copy(self):
"""Create a copy of the current one."""
rv = object.__new__(self.__class__)
rv.__dict__.update(self.__dict__)
rv.symbols = self.symbols.copy()
return rv | python | def copy(self):
"""Create a copy of the current one."""
rv = object.__new__(self.__class__)
rv.__dict__.update(self.__dict__)
rv.symbols = self.symbols.copy()
return rv | [
"def",
"copy",
"(",
"self",
")",
":",
"rv",
"=",
"object",
".",
"__new__",
"(",
"self",
".",
"__class__",
")",
"rv",
".",
"__dict__",
".",
"update",
"(",
"self",
".",
"__dict__",
")",
"rv",
".",
"symbols",
"=",
"self",
".",
"symbols",
".",
"copy",
... | Create a copy of the current one. | [
"Create",
"a",
"copy",
"of",
"the",
"current",
"one",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L165-L170 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | Frame.inner | def inner(self, isolated=False):
"""Return an inner frame."""
if isolated:
return Frame(self.eval_ctx, level=self.symbols.level + 1)
return Frame(self.eval_ctx, self) | python | def inner(self, isolated=False):
"""Return an inner frame."""
if isolated:
return Frame(self.eval_ctx, level=self.symbols.level + 1)
return Frame(self.eval_ctx, self) | [
"def",
"inner",
"(",
"self",
",",
"isolated",
"=",
"False",
")",
":",
"if",
"isolated",
":",
"return",
"Frame",
"(",
"self",
".",
"eval_ctx",
",",
"level",
"=",
"self",
".",
"symbols",
".",
"level",
"+",
"1",
")",
"return",
"Frame",
"(",
"self",
".... | Return an inner frame. | [
"Return",
"an",
"inner",
"frame",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L172-L176 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.fail | def fail(self, msg, lineno):
"""Fail with a :exc:`TemplateAssertionError`."""
raise TemplateAssertionError(msg, lineno, self.name, self.filename) | python | def fail(self, msg, lineno):
"""Fail with a :exc:`TemplateAssertionError`."""
raise TemplateAssertionError(msg, lineno, self.name, self.filename) | [
"def",
"fail",
"(",
"self",
",",
"msg",
",",
"lineno",
")",
":",
"raise",
"TemplateAssertionError",
"(",
"msg",
",",
"lineno",
",",
"self",
".",
"name",
",",
"self",
".",
"filename",
")"
] | Fail with a :exc:`TemplateAssertionError`. | [
"Fail",
"with",
"a",
":",
"exc",
":",
"TemplateAssertionError",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L313-L315 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.buffer | def buffer(self, frame):
"""Enable buffering for the frame from that point onwards."""
frame.buffer = self.temporary_identifier()
self.writeline('%s = []' % frame.buffer) | python | def buffer(self, frame):
"""Enable buffering for the frame from that point onwards."""
frame.buffer = self.temporary_identifier()
self.writeline('%s = []' % frame.buffer) | [
"def",
"buffer",
"(",
"self",
",",
"frame",
")",
":",
"frame",
".",
"buffer",
"=",
"self",
".",
"temporary_identifier",
"(",
")",
"self",
".",
"writeline",
"(",
"'%s = []'",
"%",
"frame",
".",
"buffer",
")"
] | Enable buffering for the frame from that point onwards. | [
"Enable",
"buffering",
"for",
"the",
"frame",
"from",
"that",
"point",
"onwards",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L322-L325 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.return_buffer_contents | def return_buffer_contents(self, frame, force_unescaped=False):
"""Return the buffer contents of the frame."""
if not force_unescaped:
if frame.eval_ctx.volatile:
self.writeline('if context.eval_ctx.autoescape:')
self.indent()
self.writeline('r... | python | def return_buffer_contents(self, frame, force_unescaped=False):
"""Return the buffer contents of the frame."""
if not force_unescaped:
if frame.eval_ctx.volatile:
self.writeline('if context.eval_ctx.autoescape:')
self.indent()
self.writeline('r... | [
"def",
"return_buffer_contents",
"(",
"self",
",",
"frame",
",",
"force_unescaped",
"=",
"False",
")",
":",
"if",
"not",
"force_unescaped",
":",
"if",
"frame",
".",
"eval_ctx",
".",
"volatile",
":",
"self",
".",
"writeline",
"(",
"'if context.eval_ctx.autoescape... | Return the buffer contents of the frame. | [
"Return",
"the",
"buffer",
"contents",
"of",
"the",
"frame",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L327-L343 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.start_write | def start_write(self, frame, node=None):
"""Yield or write into the frame buffer."""
if frame.buffer is None:
self.writeline('yield ', node)
else:
self.writeline('%s.append(' % frame.buffer, node) | python | def start_write(self, frame, node=None):
"""Yield or write into the frame buffer."""
if frame.buffer is None:
self.writeline('yield ', node)
else:
self.writeline('%s.append(' % frame.buffer, node) | [
"def",
"start_write",
"(",
"self",
",",
"frame",
",",
"node",
"=",
"None",
")",
":",
"if",
"frame",
".",
"buffer",
"is",
"None",
":",
"self",
".",
"writeline",
"(",
"'yield '",
",",
"node",
")",
"else",
":",
"self",
".",
"writeline",
"(",
"'%s.append... | Yield or write into the frame buffer. | [
"Yield",
"or",
"write",
"into",
"the",
"frame",
"buffer",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L353-L358 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.simple_write | def simple_write(self, s, frame, node=None):
"""Simple shortcut for start_write + write + end_write."""
self.start_write(frame, node)
self.write(s)
self.end_write(frame) | python | def simple_write(self, s, frame, node=None):
"""Simple shortcut for start_write + write + end_write."""
self.start_write(frame, node)
self.write(s)
self.end_write(frame) | [
"def",
"simple_write",
"(",
"self",
",",
"s",
",",
"frame",
",",
"node",
"=",
"None",
")",
":",
"self",
".",
"start_write",
"(",
"frame",
",",
"node",
")",
"self",
".",
"write",
"(",
"s",
")",
"self",
".",
"end_write",
"(",
"frame",
")"
] | Simple shortcut for start_write + write + end_write. | [
"Simple",
"shortcut",
"for",
"start_write",
"+",
"write",
"+",
"end_write",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L365-L369 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.write | def write(self, x):
"""Write a string into the output stream."""
if self._new_lines:
if not self._first_write:
self.stream.write('\n' * self._new_lines)
self.code_lineno += self._new_lines
if self._write_debug_info is not None:
... | python | def write(self, x):
"""Write a string into the output stream."""
if self._new_lines:
if not self._first_write:
self.stream.write('\n' * self._new_lines)
self.code_lineno += self._new_lines
if self._write_debug_info is not None:
... | [
"def",
"write",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"_new_lines",
":",
"if",
"not",
"self",
".",
"_first_write",
":",
"self",
".",
"stream",
".",
"write",
"(",
"'\\n'",
"*",
"self",
".",
"_new_lines",
")",
"self",
".",
"code_lineno",
... | Write a string into the output stream. | [
"Write",
"a",
"string",
"into",
"the",
"output",
"stream",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L382-L395 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.writeline | def writeline(self, x, node=None, extra=0):
"""Combination of newline and write."""
self.newline(node, extra)
self.write(x) | python | def writeline(self, x, node=None, extra=0):
"""Combination of newline and write."""
self.newline(node, extra)
self.write(x) | [
"def",
"writeline",
"(",
"self",
",",
"x",
",",
"node",
"=",
"None",
",",
"extra",
"=",
"0",
")",
":",
"self",
".",
"newline",
"(",
"node",
",",
"extra",
")",
"self",
".",
"write",
"(",
"x",
")"
] | Combination of newline and write. | [
"Combination",
"of",
"newline",
"and",
"write",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L397-L400 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.newline | def newline(self, node=None, extra=0):
"""Add one or more newlines before the next write."""
self._new_lines = max(self._new_lines, 1 + extra)
if node is not None and node.lineno != self._last_line:
self._write_debug_info = node.lineno
self._last_line = node.lineno | python | def newline(self, node=None, extra=0):
"""Add one or more newlines before the next write."""
self._new_lines = max(self._new_lines, 1 + extra)
if node is not None and node.lineno != self._last_line:
self._write_debug_info = node.lineno
self._last_line = node.lineno | [
"def",
"newline",
"(",
"self",
",",
"node",
"=",
"None",
",",
"extra",
"=",
"0",
")",
":",
"self",
".",
"_new_lines",
"=",
"max",
"(",
"self",
".",
"_new_lines",
",",
"1",
"+",
"extra",
")",
"if",
"node",
"is",
"not",
"None",
"and",
"node",
".",
... | Add one or more newlines before the next write. | [
"Add",
"one",
"or",
"more",
"newlines",
"before",
"the",
"next",
"write",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L402-L407 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.signature | def signature(self, node, frame, extra_kwargs=None):
"""Writes a function call to the stream for the current node.
A leading comma is added automatically. The extra keyword
arguments may not include python keywords otherwise a syntax
error could occour. The extra keyword arguments shou... | python | def signature(self, node, frame, extra_kwargs=None):
"""Writes a function call to the stream for the current node.
A leading comma is added automatically. The extra keyword
arguments may not include python keywords otherwise a syntax
error could occour. The extra keyword arguments shou... | [
"def",
"signature",
"(",
"self",
",",
"node",
",",
"frame",
",",
"extra_kwargs",
"=",
"None",
")",
":",
"# if any of the given keyword arguments is a python keyword",
"# we have to make sure that no invalid call is created.",
"kwarg_workaround",
"=",
"False",
"for",
"kwarg",
... | Writes a function call to the stream for the current node.
A leading comma is added automatically. The extra keyword
arguments may not include python keywords otherwise a syntax
error could occour. The extra keyword arguments should be given
as python dict. | [
"Writes",
"a",
"function",
"call",
"to",
"the",
"stream",
"for",
"the",
"current",
"node",
".",
"A",
"leading",
"comma",
"is",
"added",
"automatically",
".",
"The",
"extra",
"keyword",
"arguments",
"may",
"not",
"include",
"python",
"keywords",
"otherwise",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L409-L460 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.pull_dependencies | def pull_dependencies(self, nodes):
"""Pull all the dependencies."""
visitor = DependencyFinderVisitor()
for node in nodes:
visitor.visit(node)
for dependency in 'filters', 'tests':
mapping = getattr(self, dependency)
for name in getattr(visitor, depen... | python | def pull_dependencies(self, nodes):
"""Pull all the dependencies."""
visitor = DependencyFinderVisitor()
for node in nodes:
visitor.visit(node)
for dependency in 'filters', 'tests':
mapping = getattr(self, dependency)
for name in getattr(visitor, depen... | [
"def",
"pull_dependencies",
"(",
"self",
",",
"nodes",
")",
":",
"visitor",
"=",
"DependencyFinderVisitor",
"(",
")",
"for",
"node",
"in",
"nodes",
":",
"visitor",
".",
"visit",
"(",
"node",
")",
"for",
"dependency",
"in",
"'filters'",
",",
"'tests'",
":",... | Pull all the dependencies. | [
"Pull",
"all",
"the",
"dependencies",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L462-L473 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.macro_body | def macro_body(self, node, frame):
"""Dump the function def of a macro or call block."""
frame = frame.inner()
frame.symbols.analyze_node(node)
macro_ref = MacroRef(node)
explicit_caller = None
skip_special_params = set()
args = []
for idx, arg in enumera... | python | def macro_body(self, node, frame):
"""Dump the function def of a macro or call block."""
frame = frame.inner()
frame.symbols.analyze_node(node)
macro_ref = MacroRef(node)
explicit_caller = None
skip_special_params = set()
args = []
for idx, arg in enumera... | [
"def",
"macro_body",
"(",
"self",
",",
"node",
",",
"frame",
")",
":",
"frame",
"=",
"frame",
".",
"inner",
"(",
")",
"frame",
".",
"symbols",
".",
"analyze_node",
"(",
"node",
")",
"macro_ref",
"=",
"MacroRef",
"(",
"node",
")",
"explicit_caller",
"="... | Dump the function def of a macro or call block. | [
"Dump",
"the",
"function",
"def",
"of",
"a",
"macro",
"or",
"call",
"block",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L505-L580 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.macro_def | def macro_def(self, macro_ref, frame):
"""Dump the macro definition for the def created by macro_body."""
arg_tuple = ', '.join(repr(x.name) for x in macro_ref.node.args)
name = getattr(macro_ref.node, 'name', None)
if len(macro_ref.node.args) == 1:
arg_tuple += ','
s... | python | def macro_def(self, macro_ref, frame):
"""Dump the macro definition for the def created by macro_body."""
arg_tuple = ', '.join(repr(x.name) for x in macro_ref.node.args)
name = getattr(macro_ref.node, 'name', None)
if len(macro_ref.node.args) == 1:
arg_tuple += ','
s... | [
"def",
"macro_def",
"(",
"self",
",",
"macro_ref",
",",
"frame",
")",
":",
"arg_tuple",
"=",
"', '",
".",
"join",
"(",
"repr",
"(",
"x",
".",
"name",
")",
"for",
"x",
"in",
"macro_ref",
".",
"node",
".",
"args",
")",
"name",
"=",
"getattr",
"(",
... | Dump the macro definition for the def created by macro_body. | [
"Dump",
"the",
"macro",
"definition",
"for",
"the",
"def",
"created",
"by",
"macro_body",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L582-L591 | train |
pypa/pipenv | pipenv/vendor/jinja2/compiler.py | CodeGenerator.position | def position(self, node):
"""Return a human readable position for the node."""
rv = 'line %d' % node.lineno
if self.name is not None:
rv += ' in ' + repr(self.name)
return rv | python | def position(self, node):
"""Return a human readable position for the node."""
rv = 'line %d' % node.lineno
if self.name is not None:
rv += ' in ' + repr(self.name)
return rv | [
"def",
"position",
"(",
"self",
",",
"node",
")",
":",
"rv",
"=",
"'line %d'",
"%",
"node",
".",
"lineno",
"if",
"self",
".",
"name",
"is",
"not",
"None",
":",
"rv",
"+=",
"' in '",
"+",
"repr",
"(",
"self",
".",
"name",
")",
"return",
"rv"
] | Return a human readable position for the node. | [
"Return",
"a",
"human",
"readable",
"position",
"for",
"the",
"node",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/compiler.py#L593-L598 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.