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/requests/auth.py | _basic_auth_str | def _basic_auth_str(username, password):
"""Returns a Basic Auth string."""
# "I want us to put a big-ol' comment on top of it that
# says that this behaviour is dumb but we need to preserve
# it because people are relying on it."
# - Lukasa
#
# These are here solely to maintain backward... | python | def _basic_auth_str(username, password):
"""Returns a Basic Auth string."""
# "I want us to put a big-ol' comment on top of it that
# says that this behaviour is dumb but we need to preserve
# it because people are relying on it."
# - Lukasa
#
# These are here solely to maintain backward... | [
"def",
"_basic_auth_str",
"(",
"username",
",",
"password",
")",
":",
"# \"I want us to put a big-ol' comment on top of it that",
"# says that this behaviour is dumb but we need to preserve",
"# it because people are relying on it.\"",
"# - Lukasa",
"#",
"# These are here solely to main... | Returns a Basic Auth string. | [
"Returns",
"a",
"Basic",
"Auth",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/auth.py#L28-L69 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/commands/list.py | format_for_columns | def format_for_columns(pkgs, options):
"""
Convert the package data into something usable
by output_package_listing_columns.
"""
running_outdated = options.outdated
# Adjust the header for the `pip list --outdated` case.
if running_outdated:
header = ["Package", "Version", "Latest", ... | python | def format_for_columns(pkgs, options):
"""
Convert the package data into something usable
by output_package_listing_columns.
"""
running_outdated = options.outdated
# Adjust the header for the `pip list --outdated` case.
if running_outdated:
header = ["Package", "Version", "Latest", ... | [
"def",
"format_for_columns",
"(",
"pkgs",
",",
"options",
")",
":",
"running_outdated",
"=",
"options",
".",
"outdated",
"# Adjust the header for the `pip list --outdated` case.",
"if",
"running_outdated",
":",
"header",
"=",
"[",
"\"Package\"",
",",
"\"Version\"",
",",... | Convert the package data into something usable
by output_package_listing_columns. | [
"Convert",
"the",
"package",
"data",
"into",
"something",
"usable",
"by",
"output_package_listing_columns",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/list.py#L250-L284 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/commands/list.py | ListCommand._build_package_finder | def _build_package_finder(self, options, index_urls, session):
"""
Create a package finder appropriate to this list command.
"""
return PackageFinder(
find_links=options.find_links,
index_urls=index_urls,
allow_all_prereleases=options.pre,
... | python | def _build_package_finder(self, options, index_urls, session):
"""
Create a package finder appropriate to this list command.
"""
return PackageFinder(
find_links=options.find_links,
index_urls=index_urls,
allow_all_prereleases=options.pre,
... | [
"def",
"_build_package_finder",
"(",
"self",
",",
"options",
",",
"index_urls",
",",
"session",
")",
":",
"return",
"PackageFinder",
"(",
"find_links",
"=",
"options",
".",
"find_links",
",",
"index_urls",
"=",
"index_urls",
",",
"allow_all_prereleases",
"=",
"o... | Create a package finder appropriate to this list command. | [
"Create",
"a",
"package",
"finder",
"appropriate",
"to",
"this",
"list",
"command",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/list.py#L112-L122 | train |
pypa/pipenv | pipenv/vendor/distlib/scripts.py | ScriptMaker._build_shebang | def _build_shebang(self, executable, post_interp):
"""
Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang wh... | python | def _build_shebang(self, executable, post_interp):
"""
Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang wh... | [
"def",
"_build_shebang",
"(",
"self",
",",
"executable",
",",
"post_interp",
")",
":",
"if",
"os",
".",
"name",
"!=",
"'posix'",
":",
"simple_shebang",
"=",
"True",
"else",
":",
"# Add 3 for '#!' prefix and newline suffix.",
"shebang_length",
"=",
"len",
"(",
"e... | Build a shebang line. In the simple case (on Windows, or a shebang line
which is not too long or contains spaces) use a simple formulation for
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
shebang which allows the script to run either under Python or sh, using
s... | [
"Build",
"a",
"shebang",
"line",
".",
"In",
"the",
"simple",
"case",
"(",
"on",
"Windows",
"or",
"a",
"shebang",
"line",
"which",
"is",
"not",
"too",
"long",
"or",
"contains",
"spaces",
")",
"use",
"a",
"simple",
"formulation",
"for",
"the",
"shebang",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/scripts.py#L139-L168 | train |
pypa/pipenv | pipenv/vendor/distlib/scripts.py | ScriptMaker.make | def make(self, specification, options=None):
"""
Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
... | python | def make(self, specification, options=None):
"""
Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
... | [
"def",
"make",
"(",
"self",
",",
"specification",
",",
"options",
"=",
"None",
")",
":",
"filenames",
"=",
"[",
"]",
"entry",
"=",
"get_export_entry",
"(",
"specification",
")",
"if",
"entry",
"is",
"None",
":",
"self",
".",
"_copy_script",
"(",
"specifi... | Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
copying from a source location).
:pa... | [
"Make",
"a",
"script",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/scripts.py#L389-L406 | train |
pypa/pipenv | pipenv/vendor/distlib/scripts.py | ScriptMaker.make_multiple | def make_multiple(self, specifications, options=None):
"""
Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to,
"""
filenames = []
for specification in spec... | python | def make_multiple(self, specifications, options=None):
"""
Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to,
"""
filenames = []
for specification in spec... | [
"def",
"make_multiple",
"(",
"self",
",",
"specifications",
",",
"options",
"=",
"None",
")",
":",
"filenames",
"=",
"[",
"]",
"for",
"specification",
"in",
"specifications",
":",
"filenames",
".",
"extend",
"(",
"self",
".",
"make",
"(",
"specification",
... | Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to, | [
"Take",
"a",
"list",
"of",
"specifications",
"and",
"make",
"scripts",
"from",
"them",
":",
"param",
"specifications",
":",
"A",
"list",
"of",
"specifications",
".",
":",
"return",
":",
"A",
"list",
"of",
"all",
"absolute",
"pathnames",
"written",
"to"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/scripts.py#L408-L417 | train |
pypa/pipenv | pipenv/patched/piptools/io.py | iter_find_files | def iter_find_files(directory, patterns, ignored=None):
"""Returns a generator that yields file paths under a *directory*,
matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
search.... | python | def iter_find_files(directory, patterns, ignored=None):
"""Returns a generator that yields file paths under a *directory*,
matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
search.... | [
"def",
"iter_find_files",
"(",
"directory",
",",
"patterns",
",",
"ignored",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"patterns",
",",
"basestring",
")",
":",
"patterns",
"=",
"[",
"patterns",
"]",
"pats_re",
"=",
"re",
".",
"compile",
"(",
"'|'",... | Returns a generator that yields file paths under a *directory*,
matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
search. Yielded paths will include this as a prefix.
patterns ... | [
"Returns",
"a",
"generator",
"that",
"yields",
"file",
"paths",
"under",
"a",
"*",
"directory",
"*",
"matching",
"*",
"patterns",
"*",
"using",
"glob",
"_",
"syntax",
"(",
"e",
".",
"g",
".",
"*",
".",
"txt",
")",
".",
"Also",
"supports",
"*",
"ignor... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L457-L497 | train |
pypa/pipenv | pipenv/patched/piptools/io.py | FilePerms.from_int | def from_int(cls, i):
"""Create a :class:`FilePerms` object from an integer.
>>> FilePerms.from_int(0o644) # note the leading zero-oh for octal
FilePerms(user='rw', group='r', other='r')
"""
i &= FULL_PERMS
key = ('', 'x', 'w', 'xw', 'r', 'rx', 'rw', 'rwx')
part... | python | def from_int(cls, i):
"""Create a :class:`FilePerms` object from an integer.
>>> FilePerms.from_int(0o644) # note the leading zero-oh for octal
FilePerms(user='rw', group='r', other='r')
"""
i &= FULL_PERMS
key = ('', 'x', 'w', 'xw', 'r', 'rx', 'rw', 'rwx')
part... | [
"def",
"from_int",
"(",
"cls",
",",
"i",
")",
":",
"i",
"&=",
"FULL_PERMS",
"key",
"=",
"(",
"''",
",",
"'x'",
",",
"'w'",
",",
"'xw'",
",",
"'r'",
",",
"'rx'",
",",
"'rw'",
",",
"'rwx'",
")",
"parts",
"=",
"[",
"]",
"while",
"i",
":",
"parts... | Create a :class:`FilePerms` object from an integer.
>>> FilePerms.from_int(0o644) # note the leading zero-oh for octal
FilePerms(user='rw', group='r', other='r') | [
"Create",
"a",
":",
"class",
":",
"FilePerms",
"object",
"from",
"an",
"integer",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L145-L158 | train |
pypa/pipenv | pipenv/patched/piptools/io.py | FilePerms.from_path | def from_path(cls, path):
"""Make a new :class:`FilePerms` object based on the permissions
assigned to the file or directory at *path*.
Args:
path (str): Filesystem path of the target file.
>>> from os.path import expanduser
>>> 'r' in FilePerms.from_path(expanduser... | python | def from_path(cls, path):
"""Make a new :class:`FilePerms` object based on the permissions
assigned to the file or directory at *path*.
Args:
path (str): Filesystem path of the target file.
>>> from os.path import expanduser
>>> 'r' in FilePerms.from_path(expanduser... | [
"def",
"from_path",
"(",
"cls",
",",
"path",
")",
":",
"stat_res",
"=",
"os",
".",
"stat",
"(",
"path",
")",
"return",
"cls",
".",
"from_int",
"(",
"stat",
".",
"S_IMODE",
"(",
"stat_res",
".",
"st_mode",
")",
")"
] | Make a new :class:`FilePerms` object based on the permissions
assigned to the file or directory at *path*.
Args:
path (str): Filesystem path of the target file.
>>> from os.path import expanduser
>>> 'r' in FilePerms.from_path(expanduser('~')).user # probably
True | [
"Make",
"a",
"new",
":",
"class",
":",
"FilePerms",
"object",
"based",
"on",
"the",
"permissions",
"assigned",
"to",
"the",
"file",
"or",
"directory",
"at",
"*",
"path",
"*",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L161-L173 | train |
pypa/pipenv | pipenv/patched/piptools/io.py | AtomicSaver.setup | def setup(self):
"""Called on context manager entry (the :keyword:`with` statement),
the ``setup()`` method creates the temporary file in the same
directory as the destination file.
``setup()`` tests for a writable directory with rename permissions
early, as the part file may no... | python | def setup(self):
"""Called on context manager entry (the :keyword:`with` statement),
the ``setup()`` method creates the temporary file in the same
directory as the destination file.
``setup()`` tests for a writable directory with rename permissions
early, as the part file may no... | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"lexists",
"(",
"self",
".",
"dest_path",
")",
":",
"if",
"not",
"self",
".",
"overwrite",
":",
"raise",
"OSError",
"(",
"errno",
".",
"EEXIST",
",",
"'Overwrite disabled and file alrea... | Called on context manager entry (the :keyword:`with` statement),
the ``setup()`` method creates the temporary file in the same
directory as the destination file.
``setup()`` tests for a writable directory with rename permissions
early, as the part file may not be written to immediately ... | [
"Called",
"on",
"context",
"manager",
"entry",
"(",
"the",
":",
"keyword",
":",
"with",
"statement",
")",
"the",
"setup",
"()",
"method",
"creates",
"the",
"temporary",
"file",
"in",
"the",
"same",
"directory",
"as",
"the",
"destination",
"file",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/io.py#L407-L429 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | load | def load(pipfile_path=None, inject_env=True):
"""Loads a pipfile from a given path.
If none is provided, one will try to be found.
"""
if pipfile_path is None:
pipfile_path = Pipfile.find()
return Pipfile.load(filename=pipfile_path, inject_env=inject_env) | python | def load(pipfile_path=None, inject_env=True):
"""Loads a pipfile from a given path.
If none is provided, one will try to be found.
"""
if pipfile_path is None:
pipfile_path = Pipfile.find()
return Pipfile.load(filename=pipfile_path, inject_env=inject_env) | [
"def",
"load",
"(",
"pipfile_path",
"=",
"None",
",",
"inject_env",
"=",
"True",
")",
":",
"if",
"pipfile_path",
"is",
"None",
":",
"pipfile_path",
"=",
"Pipfile",
".",
"find",
"(",
")",
"return",
"Pipfile",
".",
"load",
"(",
"filename",
"=",
"pipfile_pa... | Loads a pipfile from a given path.
If none is provided, one will try to be found. | [
"Loads",
"a",
"pipfile",
"from",
"a",
"given",
"path",
".",
"If",
"none",
"is",
"provided",
"one",
"will",
"try",
"to",
"be",
"found",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L222-L230 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | PipfileParser.inject_environment_variables | def inject_environment_variables(self, d):
"""
Recursively injects environment variables into TOML values
"""
if not d:
return d
if isinstance(d, six.string_types):
return os.path.expandvars(d)
for k, v in d.items():
if isinstance(v, s... | python | def inject_environment_variables(self, d):
"""
Recursively injects environment variables into TOML values
"""
if not d:
return d
if isinstance(d, six.string_types):
return os.path.expandvars(d)
for k, v in d.items():
if isinstance(v, s... | [
"def",
"inject_environment_variables",
"(",
"self",
",",
"d",
")",
":",
"if",
"not",
"d",
":",
"return",
"d",
"if",
"isinstance",
"(",
"d",
",",
"six",
".",
"string_types",
")",
":",
"return",
"os",
".",
"path",
".",
"expandvars",
"(",
"d",
")",
"for... | Recursively injects environment variables into TOML values | [
"Recursively",
"injects",
"environment",
"variables",
"into",
"TOML",
"values"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L73-L90 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | Pipfile.find | def find(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if 'Pipfile':
p = os.path.join(c, 'Pipfile')
if os.path.isfile(p)... | python | def find(max_depth=3):
"""Returns the path of a Pipfile in parent directories."""
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
if 'Pipfile':
p = os.path.join(c, 'Pipfile')
if os.path.isfile(p)... | [
"def",
"find",
"(",
"max_depth",
"=",
"3",
")",
":",
"i",
"=",
"0",
"for",
"c",
",",
"d",
",",
"f",
"in",
"walk_up",
"(",
"os",
".",
"getcwd",
"(",
")",
")",
":",
"i",
"+=",
"1",
"if",
"i",
"<",
"max_depth",
":",
"if",
"'Pipfile'",
":",
"p"... | Returns the path of a Pipfile in parent directories. | [
"Returns",
"the",
"path",
"of",
"a",
"Pipfile",
"in",
"parent",
"directories",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L143-L154 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | Pipfile.load | def load(klass, filename, inject_env=True):
"""Load a Pipfile from a given filename."""
p = PipfileParser(filename=filename)
pipfile = klass(filename=filename)
pipfile.data = p.parse(inject_env=inject_env)
return pipfile | python | def load(klass, filename, inject_env=True):
"""Load a Pipfile from a given filename."""
p = PipfileParser(filename=filename)
pipfile = klass(filename=filename)
pipfile.data = p.parse(inject_env=inject_env)
return pipfile | [
"def",
"load",
"(",
"klass",
",",
"filename",
",",
"inject_env",
"=",
"True",
")",
":",
"p",
"=",
"PipfileParser",
"(",
"filename",
"=",
"filename",
")",
"pipfile",
"=",
"klass",
"(",
"filename",
"=",
"filename",
")",
"pipfile",
".",
"data",
"=",
"p",
... | Load a Pipfile from a given filename. | [
"Load",
"a",
"Pipfile",
"from",
"a",
"given",
"filename",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L157-L162 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | Pipfile.hash | def hash(self):
"""Returns the SHA256 of the pipfile's data."""
content = json.dumps(self.data, sort_keys=True, separators=(",", ":"))
return hashlib.sha256(content.encode("utf8")).hexdigest() | python | def hash(self):
"""Returns the SHA256 of the pipfile's data."""
content = json.dumps(self.data, sort_keys=True, separators=(",", ":"))
return hashlib.sha256(content.encode("utf8")).hexdigest() | [
"def",
"hash",
"(",
"self",
")",
":",
"content",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"data",
",",
"sort_keys",
"=",
"True",
",",
"separators",
"=",
"(",
"\",\"",
",",
"\":\"",
")",
")",
"return",
"hashlib",
".",
"sha256",
"(",
"content",
"... | Returns the SHA256 of the pipfile's data. | [
"Returns",
"the",
"SHA256",
"of",
"the",
"pipfile",
"s",
"data",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L165-L168 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | Pipfile.lock | def lock(self):
"""Returns a JSON representation of the Pipfile."""
data = self.data
data['_meta']['hash'] = {"sha256": self.hash}
data['_meta']['pipfile-spec'] = 6
return json.dumps(data, indent=4, separators=(',', ': ')) | python | def lock(self):
"""Returns a JSON representation of the Pipfile."""
data = self.data
data['_meta']['hash'] = {"sha256": self.hash}
data['_meta']['pipfile-spec'] = 6
return json.dumps(data, indent=4, separators=(',', ': ')) | [
"def",
"lock",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"data",
"data",
"[",
"'_meta'",
"]",
"[",
"'hash'",
"]",
"=",
"{",
"\"sha256\"",
":",
"self",
".",
"hash",
"}",
"data",
"[",
"'_meta'",
"]",
"[",
"'pipfile-spec'",
"]",
"=",
"6",
"re... | Returns a JSON representation of the Pipfile. | [
"Returns",
"a",
"JSON",
"representation",
"of",
"the",
"Pipfile",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L176-L181 | train |
pypa/pipenv | pipenv/patched/pipfile/api.py | Pipfile.assert_requirements | def assert_requirements(self):
""""Asserts PEP 508 specifiers."""
# Support for 508's implementation_version.
if hasattr(sys, 'implementation'):
implementation_version = format_full_version(sys.implementation.version)
else:
implementation_version = "0"
#... | python | def assert_requirements(self):
""""Asserts PEP 508 specifiers."""
# Support for 508's implementation_version.
if hasattr(sys, 'implementation'):
implementation_version = format_full_version(sys.implementation.version)
else:
implementation_version = "0"
#... | [
"def",
"assert_requirements",
"(",
"self",
")",
":",
"# Support for 508's implementation_version.",
"if",
"hasattr",
"(",
"sys",
",",
"'implementation'",
")",
":",
"implementation_version",
"=",
"format_full_version",
"(",
"sys",
".",
"implementation",
".",
"version",
... | Asserts PEP 508 specifiers. | [
"Asserts",
"PEP",
"508",
"specifiers",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/pipfile/api.py#L183-L219 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | copyfileobj | def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst"""
while 1:
buf = fsrc.read(length)
if not buf:
break
fdst.write(buf) | python | def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst"""
while 1:
buf = fsrc.read(length)
if not buf:
break
fdst.write(buf) | [
"def",
"copyfileobj",
"(",
"fsrc",
",",
"fdst",
",",
"length",
"=",
"16",
"*",
"1024",
")",
":",
"while",
"1",
":",
"buf",
"=",
"fsrc",
".",
"read",
"(",
"length",
")",
"if",
"not",
"buf",
":",
"break",
"fdst",
".",
"write",
"(",
"buf",
")"
] | copy data from file-like object fsrc to file-like object fdst | [
"copy",
"data",
"from",
"file",
"-",
"like",
"object",
"fsrc",
"to",
"file",
"-",
"like",
"object",
"fdst"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L67-L73 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | copyfile | def copyfile(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
st = os.stat(fn)
except OSError:
# File most likely does not exist
pass
... | python | def copyfile(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
st = os.stat(fn)
except OSError:
# File most likely does not exist
pass
... | [
"def",
"copyfile",
"(",
"src",
",",
"dst",
")",
":",
"if",
"_samefile",
"(",
"src",
",",
"dst",
")",
":",
"raise",
"Error",
"(",
"\"`%s` and `%s` are the same file\"",
"%",
"(",
"src",
",",
"dst",
")",
")",
"for",
"fn",
"in",
"[",
"src",
",",
"dst",
... | Copy data from src to dst | [
"Copy",
"data",
"from",
"src",
"to",
"dst"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L87-L105 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | copymode | def copymode(src, dst):
"""Copy mode bits from src to dst"""
if hasattr(os, 'chmod'):
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
os.chmod(dst, mode) | python | def copymode(src, dst):
"""Copy mode bits from src to dst"""
if hasattr(os, 'chmod'):
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
os.chmod(dst, mode) | [
"def",
"copymode",
"(",
"src",
",",
"dst",
")",
":",
"if",
"hasattr",
"(",
"os",
",",
"'chmod'",
")",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"src",
")",
"mode",
"=",
"stat",
".",
"S_IMODE",
"(",
"st",
".",
"st_mode",
")",
"os",
".",
"chmod",
... | Copy mode bits from src to dst | [
"Copy",
"mode",
"bits",
"from",
"src",
"to",
"dst"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L107-L112 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | copystat | def copystat(src, dst):
"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
if hasattr(os, 'utime'):
os.utime(dst, (st.st_atime, st.st_mtime))
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chfl... | python | def copystat(src, dst):
"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
if hasattr(os, 'utime'):
os.utime(dst, (st.st_atime, st.st_mtime))
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chfl... | [
"def",
"copystat",
"(",
"src",
",",
"dst",
")",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"src",
")",
"mode",
"=",
"stat",
".",
"S_IMODE",
"(",
"st",
".",
"st_mode",
")",
"if",
"hasattr",
"(",
"os",
",",
"'utime'",
")",
":",
"os",
".",
"utime",
... | Copy all stat info (mode bits, atime, mtime, flags) from src to dst | [
"Copy",
"all",
"stat",
"info",
"(",
"mode",
"bits",
"atime",
"mtime",
"flags",
")",
"from",
"src",
"to",
"dst"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L114-L128 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | copy | def copy(src, dst):
"""Copy data and mode bits ("cp src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copymode(src, dst) | python | def copy(src, dst):
"""Copy data and mode bits ("cp src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copymode(src, dst) | [
"def",
"copy",
"(",
"src",
",",
"dst",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"os",
".",
"path",
".",
"basename",
"(",
"src",
")",
")",
"copyfile",
... | Copy data and mode bits ("cp src dst").
The destination may be a directory. | [
"Copy",
"data",
"and",
"mode",
"bits",
"(",
"cp",
"src",
"dst",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L130-L139 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | copy2 | def copy2(src, dst):
"""Copy data and all stat info ("cp -p src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copystat(src, dst) | python | def copy2(src, dst):
"""Copy data and all stat info ("cp -p src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copystat(src, dst) | [
"def",
"copy2",
"(",
"src",
",",
"dst",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"os",
".",
"path",
".",
"basename",
"(",
"src",
")",
")",
"copyfile",
... | Copy data and all stat info ("cp -p src dst").
The destination may be a directory. | [
"Copy",
"data",
"and",
"all",
"stat",
"info",
"(",
"cp",
"-",
"p",
"src",
"dst",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L141-L150 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | rmtree | def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is th... | python | def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is th... | [
"def",
"rmtree",
"(",
"path",
",",
"ignore_errors",
"=",
"False",
",",
"onerror",
"=",
"None",
")",
":",
"if",
"ignore_errors",
":",
"def",
"onerror",
"(",
"*",
"args",
")",
":",
"pass",
"elif",
"onerror",
"is",
"None",
":",
"def",
"onerror",
"(",
"*... | Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is the argument to that function that caused it to fail; and
... | [
"Recursively",
"delete",
"a",
"directory",
"tree",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L246-L292 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | move | def move(src, dst):
"""Recursively move a file or directory to another location. This is
similar to the Unix "mv" command.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
If the destination al... | python | def move(src, dst):
"""Recursively move a file or directory to another location. This is
similar to the Unix "mv" command.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
If the destination al... | [
"def",
"move",
"(",
"src",
",",
"dst",
")",
":",
"real_dst",
"=",
"dst",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"if",
"_samefile",
"(",
"src",
",",
"dst",
")",
":",
"# We might be on a case insensitive filesystem,",
"# perform the ren... | Recursively move a file or directory to another location. This is
similar to the Unix "mv" command.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
If the destination already exists but is not a d... | [
"Recursively",
"move",
"a",
"file",
"or",
"directory",
"to",
"another",
"location",
".",
"This",
"is",
"similar",
"to",
"the",
"Unix",
"mv",
"command",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L300-L338 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _get_gid | def _get_gid(name):
"""Returns a gid, given a group name."""
if getgrnam is None or name is None:
return None
try:
result = getgrnam(name)
except KeyError:
result = None
if result is not None:
return result[2]
return None | python | def _get_gid(name):
"""Returns a gid, given a group name."""
if getgrnam is None or name is None:
return None
try:
result = getgrnam(name)
except KeyError:
result = None
if result is not None:
return result[2]
return None | [
"def",
"_get_gid",
"(",
"name",
")",
":",
"if",
"getgrnam",
"is",
"None",
"or",
"name",
"is",
"None",
":",
"return",
"None",
"try",
":",
"result",
"=",
"getgrnam",
"(",
"name",
")",
"except",
"KeyError",
":",
"result",
"=",
"None",
"if",
"result",
"i... | Returns a gid, given a group name. | [
"Returns",
"a",
"gid",
"given",
"a",
"group",
"name",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L349-L359 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _get_uid | def _get_uid(name):
"""Returns an uid, given a user name."""
if getpwnam is None or name is None:
return None
try:
result = getpwnam(name)
except KeyError:
result = None
if result is not None:
return result[2]
return None | python | def _get_uid(name):
"""Returns an uid, given a user name."""
if getpwnam is None or name is None:
return None
try:
result = getpwnam(name)
except KeyError:
result = None
if result is not None:
return result[2]
return None | [
"def",
"_get_uid",
"(",
"name",
")",
":",
"if",
"getpwnam",
"is",
"None",
"or",
"name",
"is",
"None",
":",
"return",
"None",
"try",
":",
"result",
"=",
"getpwnam",
"(",
"name",
")",
"except",
"KeyError",
":",
"result",
"=",
"None",
"if",
"result",
"i... | Returns an uid, given a user name. | [
"Returns",
"an",
"uid",
"given",
"a",
"user",
"name",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L361-L371 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _make_tarball | def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
owner=None, group=None, logger=None):
"""Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", or None.
'owner' and 'group' can be us... | python | def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
owner=None, group=None, logger=None):
"""Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", or None.
'owner' and 'group' can be us... | [
"def",
"_make_tarball",
"(",
"base_name",
",",
"base_dir",
",",
"compress",
"=",
"\"gzip\"",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"owner",
"=",
"None",
",",
"group",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"tar_compressio... | Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", or None.
'owner' and 'group' can be used to define an owner and a group for the
archive that is being built. If not provided, the current owner and group
will be used.
... | [
"Create",
"a",
"(",
"possibly",
"compressed",
")",
"tar",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L373-L433 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _make_zipfile | def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
"""Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on th... | python | def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
"""Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on th... | [
"def",
"_make_zipfile",
"(",
"base_name",
",",
"base_dir",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"logger",
"=",
"None",
")",
":",
"zip_filename",
"=",
"base_name",
"+",
"\".zip\"",
"archive_dir",
"=",
"os",
".",
"path",
".",
"dirname",... | Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on the default search path). If neither tool is
available, raises ExecError. Retu... | [
"Create",
"a",
"zip",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L452-L497 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | get_archive_formats | def get_archive_formats():
"""Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description)
"""
formats = [(name, registry[2]) for name, registry in
_ARCHIVE_FORMATS.items()]
formats.sort()
return formats | python | def get_archive_formats():
"""Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description)
"""
formats = [(name, registry[2]) for name, registry in
_ARCHIVE_FORMATS.items()]
formats.sort()
return formats | [
"def",
"get_archive_formats",
"(",
")",
":",
"formats",
"=",
"[",
"(",
"name",
",",
"registry",
"[",
"2",
"]",
")",
"for",
"name",
",",
"registry",
"in",
"_ARCHIVE_FORMATS",
".",
"items",
"(",
")",
"]",
"formats",
".",
"sort",
"(",
")",
"return",
"fo... | Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description) | [
"Returns",
"a",
"list",
"of",
"supported",
"formats",
"for",
"archiving",
"and",
"unarchiving",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L510-L518 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | register_archive_format | def register_archive_format(name, function, extra_args=None, description=''):
"""Registers an archive format.
name is the name of the format. function is the callable that will be
used to create archives. If provided, extra_args is a sequence of
(name, value) tuples that will be passed as arguments to ... | python | def register_archive_format(name, function, extra_args=None, description=''):
"""Registers an archive format.
name is the name of the format. function is the callable that will be
used to create archives. If provided, extra_args is a sequence of
(name, value) tuples that will be passed as arguments to ... | [
"def",
"register_archive_format",
"(",
"name",
",",
"function",
",",
"extra_args",
"=",
"None",
",",
"description",
"=",
"''",
")",
":",
"if",
"extra_args",
"is",
"None",
":",
"extra_args",
"=",
"[",
"]",
"if",
"not",
"isinstance",
"(",
"function",
",",
... | Registers an archive format.
name is the name of the format. function is the callable that will be
used to create archives. If provided, extra_args is a sequence of
(name, value) tuples that will be passed as arguments to the callable.
description can be provided to describe the format, and will be ret... | [
"Registers",
"an",
"archive",
"format",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L520-L539 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | make_archive | def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
dry_run=0, owner=None, group=None, logger=None):
"""Create an archive file (eg. zip or tar).
'base_name' is the name of the file to create, minus any format-specific
extension; 'format' is the archive format: one ... | python | def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
dry_run=0, owner=None, group=None, logger=None):
"""Create an archive file (eg. zip or tar).
'base_name' is the name of the file to create, minus any format-specific
extension; 'format' is the archive format: one ... | [
"def",
"make_archive",
"(",
"base_name",
",",
"format",
",",
"root_dir",
"=",
"None",
",",
"base_dir",
"=",
"None",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"owner",
"=",
"None",
",",
"group",
"=",
"None",
",",
"logger",
"=",
"None",
... | Create an archive file (eg. zip or tar).
'base_name' is the name of the file to create, minus any format-specific
extension; 'format' is the archive format: one of "zip", "tar", "bztar"
or "gztar".
'root_dir' is a directory that will be the root directory of the
archive; ie. we typically chdir int... | [
"Create",
"an",
"archive",
"file",
"(",
"eg",
".",
"zip",
"or",
"tar",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L544-L596 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | get_unpack_formats | def get_unpack_formats():
"""Returns a list of supported formats for unpacking.
Each element of the returned sequence is a tuple
(name, extensions, description)
"""
formats = [(name, info[0], info[3]) for name, info in
_UNPACK_FORMATS.items()]
formats.sort()
return formats | python | def get_unpack_formats():
"""Returns a list of supported formats for unpacking.
Each element of the returned sequence is a tuple
(name, extensions, description)
"""
formats = [(name, info[0], info[3]) for name, info in
_UNPACK_FORMATS.items()]
formats.sort()
return formats | [
"def",
"get_unpack_formats",
"(",
")",
":",
"formats",
"=",
"[",
"(",
"name",
",",
"info",
"[",
"0",
"]",
",",
"info",
"[",
"3",
"]",
")",
"for",
"name",
",",
"info",
"in",
"_UNPACK_FORMATS",
".",
"items",
"(",
")",
"]",
"formats",
".",
"sort",
"... | Returns a list of supported formats for unpacking.
Each element of the returned sequence is a tuple
(name, extensions, description) | [
"Returns",
"a",
"list",
"of",
"supported",
"formats",
"for",
"unpacking",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L599-L608 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _check_unpack_options | def _check_unpack_options(extensions, function, extra_args):
"""Checks what gets registered as an unpacker."""
# first make sure no other unpacker is registered for this extension
existing_extensions = {}
for name, info in _UNPACK_FORMATS.items():
for ext in info[0]:
existing_extensi... | python | def _check_unpack_options(extensions, function, extra_args):
"""Checks what gets registered as an unpacker."""
# first make sure no other unpacker is registered for this extension
existing_extensions = {}
for name, info in _UNPACK_FORMATS.items():
for ext in info[0]:
existing_extensi... | [
"def",
"_check_unpack_options",
"(",
"extensions",
",",
"function",
",",
"extra_args",
")",
":",
"# first make sure no other unpacker is registered for this extension",
"existing_extensions",
"=",
"{",
"}",
"for",
"name",
",",
"info",
"in",
"_UNPACK_FORMATS",
".",
"items"... | Checks what gets registered as an unpacker. | [
"Checks",
"what",
"gets",
"registered",
"as",
"an",
"unpacker",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L610-L625 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | register_unpack_format | def register_unpack_format(name, extensions, function, extra_args=None,
description=''):
"""Registers an unpack format.
`name` is the name of the format. `extensions` is a list of extensions
corresponding to the format.
`function` is the callable that will be
used to unp... | python | def register_unpack_format(name, extensions, function, extra_args=None,
description=''):
"""Registers an unpack format.
`name` is the name of the format. `extensions` is a list of extensions
corresponding to the format.
`function` is the callable that will be
used to unp... | [
"def",
"register_unpack_format",
"(",
"name",
",",
"extensions",
",",
"function",
",",
"extra_args",
"=",
"None",
",",
"description",
"=",
"''",
")",
":",
"if",
"extra_args",
"is",
"None",
":",
"extra_args",
"=",
"[",
"]",
"_check_unpack_options",
"(",
"exte... | Registers an unpack format.
`name` is the name of the format. `extensions` is a list of extensions
corresponding to the format.
`function` is the callable that will be
used to unpack archives. The callable will receive archives to unpack.
If it's unable to handle an archive, it needs to raise a Re... | [
"Registers",
"an",
"unpack",
"format",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L628-L648 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _ensure_directory | def _ensure_directory(path):
"""Ensure that the parent directory of `path` exists"""
dirname = os.path.dirname(path)
if not os.path.isdir(dirname):
os.makedirs(dirname) | python | def _ensure_directory(path):
"""Ensure that the parent directory of `path` exists"""
dirname = os.path.dirname(path)
if not os.path.isdir(dirname):
os.makedirs(dirname) | [
"def",
"_ensure_directory",
"(",
"path",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"dirname",
")",
":",
"os",
".",
"makedirs",
"(",
"dirname",
")"
] | Ensure that the parent directory of `path` exists | [
"Ensure",
"that",
"the",
"parent",
"directory",
"of",
"path",
"exists"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L654-L658 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _unpack_zipfile | def _unpack_zipfile(filename, extract_dir):
"""Unpack zip `filename` to `extract_dir`
"""
try:
import zipfile
except ImportError:
raise ReadError('zlib not supported, cannot unpack this archive.')
if not zipfile.is_zipfile(filename):
raise ReadError("%s is not a zip file" % ... | python | def _unpack_zipfile(filename, extract_dir):
"""Unpack zip `filename` to `extract_dir`
"""
try:
import zipfile
except ImportError:
raise ReadError('zlib not supported, cannot unpack this archive.')
if not zipfile.is_zipfile(filename):
raise ReadError("%s is not a zip file" % ... | [
"def",
"_unpack_zipfile",
"(",
"filename",
",",
"extract_dir",
")",
":",
"try",
":",
"import",
"zipfile",
"except",
"ImportError",
":",
"raise",
"ReadError",
"(",
"'zlib not supported, cannot unpack this archive.'",
")",
"if",
"not",
"zipfile",
".",
"is_zipfile",
"(... | Unpack zip `filename` to `extract_dir` | [
"Unpack",
"zip",
"filename",
"to",
"extract_dir"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L660-L695 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | _unpack_tarfile | def _unpack_tarfile(filename, extract_dir):
"""Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`
"""
try:
tarobj = tarfile.open(filename)
except tarfile.TarError:
raise ReadError(
"%s is not a compressed or uncompressed tar file" % filename)
try:
tarobj.extrac... | python | def _unpack_tarfile(filename, extract_dir):
"""Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`
"""
try:
tarobj = tarfile.open(filename)
except tarfile.TarError:
raise ReadError(
"%s is not a compressed or uncompressed tar file" % filename)
try:
tarobj.extrac... | [
"def",
"_unpack_tarfile",
"(",
"filename",
",",
"extract_dir",
")",
":",
"try",
":",
"tarobj",
"=",
"tarfile",
".",
"open",
"(",
"filename",
")",
"except",
"tarfile",
".",
"TarError",
":",
"raise",
"ReadError",
"(",
"\"%s is not a compressed or uncompressed tar fi... | Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` | [
"Unpack",
"tar",
"/",
"tar",
".",
"gz",
"/",
"tar",
".",
"bz2",
"filename",
"to",
"extract_dir"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L697-L708 | train |
pypa/pipenv | pipenv/vendor/distlib/_backport/shutil.py | unpack_archive | def unpack_archive(filename, extract_dir=None, format=None):
"""Unpack an archive.
`filename` is the name of the archive.
`extract_dir` is the name of the target directory, where the archive
is unpacked. If not provided, the current working directory is used.
`format` is the archive format: one o... | python | def unpack_archive(filename, extract_dir=None, format=None):
"""Unpack an archive.
`filename` is the name of the archive.
`extract_dir` is the name of the target directory, where the archive
is unpacked. If not provided, the current working directory is used.
`format` is the archive format: one o... | [
"def",
"unpack_archive",
"(",
"filename",
",",
"extract_dir",
"=",
"None",
",",
"format",
"=",
"None",
")",
":",
"if",
"extract_dir",
"is",
"None",
":",
"extract_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
"if",
"format",
"is",
"not",
"None",
":",
"try",... | Unpack an archive.
`filename` is the name of the archive.
`extract_dir` is the name of the target directory, where the archive
is unpacked. If not provided, the current working directory is used.
`format` is the archive format: one of "zip", "tar", or "gztar". Or any
other registered format. If n... | [
"Unpack",
"an",
"archive",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/shutil.py#L727-L761 | train |
pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/html5parser.py | parseFragment | def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs):
"""Parse an HTML fragment as a string or file-like object into a tree
:arg doc: the fragment to parse as a string or file-like object
:arg container: the container context to parse the fragment in
:arg... | python | def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs):
"""Parse an HTML fragment as a string or file-like object into a tree
:arg doc: the fragment to parse as a string or file-like object
:arg container: the container context to parse the fragment in
:arg... | [
"def",
"parseFragment",
"(",
"doc",
",",
"container",
"=",
"\"div\"",
",",
"treebuilder",
"=",
"\"etree\"",
",",
"namespaceHTMLElements",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"tb",
"=",
"treebuilders",
".",
"getTreeBuilder",
"(",
"treebuilder",
")... | Parse an HTML fragment as a string or file-like object into a tree
:arg doc: the fragment to parse as a string or file-like object
:arg container: the container context to parse the fragment in
:arg treebuilder: the treebuilder to use when parsing
:arg namespaceHTMLElements: whether or not to namesp... | [
"Parse",
"an",
"HTML",
"fragment",
"as",
"a",
"string",
"or",
"file",
"-",
"like",
"object",
"into",
"a",
"tree"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/html5parser.py#L50-L72 | train |
pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/html5parser.py | HTMLParser.parse | def parse(self, stream, *args, **kwargs):
"""Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will ... | python | def parse(self, stream, *args, **kwargs):
"""Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will ... | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"False",
",",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
"."... | Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will be used,
regardless of any BOM or later d... | [
"Parse",
"a",
"HTML",
"document",
"into",
"a",
"well",
"-",
"formed",
"tree"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/html5parser.py#L267-L290 | train |
pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/html5parser.py | HTMLParser.parseFragment | def parseFragment(self, stream, *args, **kwargs):
"""Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be ... | python | def parseFragment(self, stream, *args, **kwargs):
"""Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be ... | [
"def",
"parseFragment",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
".",
"getFr... | Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a... | [
"Parse",
"a",
"HTML",
"fragment",
"into",
"a",
"well",
"-",
"formed",
"tree",
"fragment"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/html5parser.py#L292-L318 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | construct_tree | def construct_tree(index):
"""Construct tree representation of the pkgs from the index.
The keys of the dict representing the tree will be objects of type
DistPackage and the values will be list of ReqPackage objects.
:param dict index: dist index ie. index of pkgs by their keys
:returns: tree of ... | python | def construct_tree(index):
"""Construct tree representation of the pkgs from the index.
The keys of the dict representing the tree will be objects of type
DistPackage and the values will be list of ReqPackage objects.
:param dict index: dist index ie. index of pkgs by their keys
:returns: tree of ... | [
"def",
"construct_tree",
"(",
"index",
")",
":",
"return",
"dict",
"(",
"(",
"p",
",",
"[",
"ReqPackage",
"(",
"r",
",",
"index",
".",
"get",
"(",
"r",
".",
"key",
")",
")",
"for",
"r",
"in",
"p",
".",
"requires",
"(",
")",
"]",
")",
"for",
"... | Construct tree representation of the pkgs from the index.
The keys of the dict representing the tree will be objects of type
DistPackage and the values will be list of ReqPackage objects.
:param dict index: dist index ie. index of pkgs by their keys
:returns: tree of pkgs and their dependencies
:r... | [
"Construct",
"tree",
"representation",
"of",
"the",
"pkgs",
"from",
"the",
"index",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L42-L55 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | sorted_tree | def sorted_tree(tree):
"""Sorts the dict representation of the tree
The root packages as well as the intermediate packages are sorted
in the alphabetical order of the package names.
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:return... | python | def sorted_tree(tree):
"""Sorts the dict representation of the tree
The root packages as well as the intermediate packages are sorted
in the alphabetical order of the package names.
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:return... | [
"def",
"sorted_tree",
"(",
"tree",
")",
":",
"return",
"OrderedDict",
"(",
"sorted",
"(",
"[",
"(",
"k",
",",
"sorted",
"(",
"v",
",",
"key",
"=",
"attrgetter",
"(",
"'key'",
")",
")",
")",
"for",
"k",
",",
"v",
"in",
"tree",
".",
"items",
"(",
... | Sorts the dict representation of the tree
The root packages as well as the intermediate packages are sorted
in the alphabetical order of the package names.
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:returns: sorted tree
:rtype: col... | [
"Sorts",
"the",
"dict",
"representation",
"of",
"the",
"tree"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L58-L72 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | find_tree_root | def find_tree_root(tree, key):
"""Find a root in a tree by it's key
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:param str key: key of the root node to find
:returns: a root node if found else None
:rtype: mixed
"""
result = ... | python | def find_tree_root(tree, key):
"""Find a root in a tree by it's key
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:param str key: key of the root node to find
:returns: a root node if found else None
:rtype: mixed
"""
result = ... | [
"def",
"find_tree_root",
"(",
"tree",
",",
"key",
")",
":",
"result",
"=",
"[",
"p",
"for",
"p",
"in",
"tree",
".",
"keys",
"(",
")",
"if",
"p",
".",
"key",
"==",
"key",
"]",
"assert",
"len",
"(",
"result",
")",
"in",
"[",
"0",
",",
"1",
"]",... | Find a root in a tree by it's key
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:param str key: key of the root node to find
:returns: a root node if found else None
:rtype: mixed | [
"Find",
"a",
"root",
"in",
"a",
"tree",
"by",
"it",
"s",
"key"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L75-L87 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | reverse_tree | def reverse_tree(tree):
"""Reverse the dependency tree.
ie. the keys of the resulting dict are objects of type
ReqPackage and the values are lists of DistPackage objects.
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:returns: reverse... | python | def reverse_tree(tree):
"""Reverse the dependency tree.
ie. the keys of the resulting dict are objects of type
ReqPackage and the values are lists of DistPackage objects.
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:returns: reverse... | [
"def",
"reverse_tree",
"(",
"tree",
")",
":",
"rtree",
"=",
"defaultdict",
"(",
"list",
")",
"child_keys",
"=",
"set",
"(",
"c",
".",
"key",
"for",
"c",
"in",
"flatten",
"(",
"tree",
".",
"values",
"(",
")",
")",
")",
"for",
"k",
",",
"vs",
"in",... | Reverse the dependency tree.
ie. the keys of the resulting dict are objects of type
ReqPackage and the values are lists of DistPackage objects.
:param dict tree: the pkg dependency tree obtained by calling
`construct_tree` function
:returns: reversed tree
:rtype: dict | [
"Reverse",
"the",
"dependency",
"tree",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L90-L110 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | guess_version | def guess_version(pkg_key, default='?'):
"""Guess the version of a pkg when pip doesn't provide it
:param str pkg_key: key of the package
:param str default: default version to return if unable to find
:returns: version
:rtype: string
"""
try:
m = import_module(pkg_key)
except ... | python | def guess_version(pkg_key, default='?'):
"""Guess the version of a pkg when pip doesn't provide it
:param str pkg_key: key of the package
:param str default: default version to return if unable to find
:returns: version
:rtype: string
"""
try:
m = import_module(pkg_key)
except ... | [
"def",
"guess_version",
"(",
"pkg_key",
",",
"default",
"=",
"'?'",
")",
":",
"try",
":",
"m",
"=",
"import_module",
"(",
"pkg_key",
")",
"except",
"ImportError",
":",
"return",
"default",
"else",
":",
"return",
"getattr",
"(",
"m",
",",
"'__version__'",
... | Guess the version of a pkg when pip doesn't provide it
:param str pkg_key: key of the package
:param str default: default version to return if unable to find
:returns: version
:rtype: string | [
"Guess",
"the",
"version",
"of",
"a",
"pkg",
"when",
"pip",
"doesn",
"t",
"provide",
"it"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L113-L127 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | render_tree | def render_tree(tree, list_all=True, show_only=None, frozen=False, exclude=None):
"""Convert tree to string representation
:param dict tree: the package tree
:param bool list_all: whether to list all the pgks at the root
level or only those that are the
s... | python | def render_tree(tree, list_all=True, show_only=None, frozen=False, exclude=None):
"""Convert tree to string representation
:param dict tree: the package tree
:param bool list_all: whether to list all the pgks at the root
level or only those that are the
s... | [
"def",
"render_tree",
"(",
"tree",
",",
"list_all",
"=",
"True",
",",
"show_only",
"=",
"None",
",",
"frozen",
"=",
"False",
",",
"exclude",
"=",
"None",
")",
":",
"tree",
"=",
"sorted_tree",
"(",
"tree",
")",
"branch_keys",
"=",
"set",
"(",
"r",
"."... | Convert tree to string representation
:param dict tree: the package tree
:param bool list_all: whether to list all the pgks at the root
level or only those that are the
sub-dependencies
:param set show_only: set of select packages to be shown in the
... | [
"Convert",
"tree",
"to",
"string",
"representation"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L288-L337 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | render_json | def render_json(tree, indent):
"""Converts the tree into a flat json representation.
The json repr will be a list of hashes, each hash having 2 fields:
- package
- dependencies: list of dependencies
:param dict tree: dependency tree
:param int indent: no. of spaces to indent json
:retu... | python | def render_json(tree, indent):
"""Converts the tree into a flat json representation.
The json repr will be a list of hashes, each hash having 2 fields:
- package
- dependencies: list of dependencies
:param dict tree: dependency tree
:param int indent: no. of spaces to indent json
:retu... | [
"def",
"render_json",
"(",
"tree",
",",
"indent",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"[",
"{",
"'package'",
":",
"k",
".",
"as_dict",
"(",
")",
",",
"'dependencies'",
":",
"[",
"v",
".",
"as_dict",
"(",
")",
"for",
"v",
"in",
"vs",
"]... | Converts the tree into a flat json representation.
The json repr will be a list of hashes, each hash having 2 fields:
- package
- dependencies: list of dependencies
:param dict tree: dependency tree
:param int indent: no. of spaces to indent json
:returns: json representation of the tree
... | [
"Converts",
"the",
"tree",
"into",
"a",
"flat",
"json",
"representation",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L340-L356 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | render_json_tree | def render_json_tree(tree, indent):
"""Converts the tree into a nested json representation.
The json repr will be a list of hashes, each hash having the following fields:
- package_name
- key
- required_version
- installed_version
- dependencies: list of dependencies
:param d... | python | def render_json_tree(tree, indent):
"""Converts the tree into a nested json representation.
The json repr will be a list of hashes, each hash having the following fields:
- package_name
- key
- required_version
- installed_version
- dependencies: list of dependencies
:param d... | [
"def",
"render_json_tree",
"(",
"tree",
",",
"indent",
")",
":",
"tree",
"=",
"sorted_tree",
"(",
"tree",
")",
"branch_keys",
"=",
"set",
"(",
"r",
".",
"key",
"for",
"r",
"in",
"flatten",
"(",
"tree",
".",
"values",
"(",
")",
")",
")",
"nodes",
"=... | Converts the tree into a nested json representation.
The json repr will be a list of hashes, each hash having the following fields:
- package_name
- key
- required_version
- installed_version
- dependencies: list of dependencies
:param dict tree: dependency tree
:param int in... | [
"Converts",
"the",
"tree",
"into",
"a",
"nested",
"json",
"representation",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L359-L399 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | dump_graphviz | def dump_graphviz(tree, output_format='dot'):
"""Output dependency graph as one of the supported GraphViz output formats.
:param dict tree: dependency graph
:param string output_format: output format
:returns: representation of tree in the specified output format
:rtype: str or binary representatio... | python | def dump_graphviz(tree, output_format='dot'):
"""Output dependency graph as one of the supported GraphViz output formats.
:param dict tree: dependency graph
:param string output_format: output format
:returns: representation of tree in the specified output format
:rtype: str or binary representatio... | [
"def",
"dump_graphviz",
"(",
"tree",
",",
"output_format",
"=",
"'dot'",
")",
":",
"try",
":",
"from",
"graphviz",
"import",
"backend",
",",
"Digraph",
"except",
"ImportError",
":",
"print",
"(",
"'graphviz is not available, but necessary for the output '",
"'option. ... | Output dependency graph as one of the supported GraphViz output formats.
:param dict tree: dependency graph
:param string output_format: output format
:returns: representation of tree in the specified output format
:rtype: str or binary representation depending on the output format | [
"Output",
"dependency",
"graph",
"as",
"one",
"of",
"the",
"supported",
"GraphViz",
"output",
"formats",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L402-L445 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | print_graphviz | def print_graphviz(dump_output):
"""Dump the data generated by GraphViz to stdout.
:param dump_output: The output from dump_graphviz
"""
if hasattr(dump_output, 'encode'):
print(dump_output)
else:
with os.fdopen(sys.stdout.fileno(), 'wb') as bytestream:
bytestream.write(... | python | def print_graphviz(dump_output):
"""Dump the data generated by GraphViz to stdout.
:param dump_output: The output from dump_graphviz
"""
if hasattr(dump_output, 'encode'):
print(dump_output)
else:
with os.fdopen(sys.stdout.fileno(), 'wb') as bytestream:
bytestream.write(... | [
"def",
"print_graphviz",
"(",
"dump_output",
")",
":",
"if",
"hasattr",
"(",
"dump_output",
",",
"'encode'",
")",
":",
"print",
"(",
"dump_output",
")",
"else",
":",
"with",
"os",
".",
"fdopen",
"(",
"sys",
".",
"stdout",
".",
"fileno",
"(",
")",
",",
... | Dump the data generated by GraphViz to stdout.
:param dump_output: The output from dump_graphviz | [
"Dump",
"the",
"data",
"generated",
"by",
"GraphViz",
"to",
"stdout",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L448-L457 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | conflicting_deps | def conflicting_deps(tree):
"""Returns dependencies which are not present or conflict with the
requirements of other packages.
e.g. will warn if pkg1 requires pkg2==2.0 and pkg2==1.0 is installed
:param tree: the requirements tree (dict)
:returns: dict of DistPackage -> list of unsatisfied/unknown... | python | def conflicting_deps(tree):
"""Returns dependencies which are not present or conflict with the
requirements of other packages.
e.g. will warn if pkg1 requires pkg2==2.0 and pkg2==1.0 is installed
:param tree: the requirements tree (dict)
:returns: dict of DistPackage -> list of unsatisfied/unknown... | [
"def",
"conflicting_deps",
"(",
"tree",
")",
":",
"conflicting",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"p",
",",
"rs",
"in",
"tree",
".",
"items",
"(",
")",
":",
"for",
"req",
"in",
"rs",
":",
"if",
"req",
".",
"is_conflicting",
"(",
")",
":... | Returns dependencies which are not present or conflict with the
requirements of other packages.
e.g. will warn if pkg1 requires pkg2==2.0 and pkg2==1.0 is installed
:param tree: the requirements tree (dict)
:returns: dict of DistPackage -> list of unsatisfied/unknown ReqPackage
:rtype: dict | [
"Returns",
"dependencies",
"which",
"are",
"not",
"present",
"or",
"conflict",
"with",
"the",
"requirements",
"of",
"other",
"packages",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L460-L476 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | cyclic_deps | def cyclic_deps(tree):
"""Return cyclic dependencies as list of tuples
:param list pkgs: pkg_resources.Distribution instances
:param dict pkg_index: mapping of pkgs with their respective keys
:returns: list of tuples representing cyclic dependencies
:rtype: generator
"""
key_tree = dict((k... | python | def cyclic_deps(tree):
"""Return cyclic dependencies as list of tuples
:param list pkgs: pkg_resources.Distribution instances
:param dict pkg_index: mapping of pkgs with their respective keys
:returns: list of tuples representing cyclic dependencies
:rtype: generator
"""
key_tree = dict((k... | [
"def",
"cyclic_deps",
"(",
"tree",
")",
":",
"key_tree",
"=",
"dict",
"(",
"(",
"k",
".",
"key",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"tree",
".",
"items",
"(",
")",
")",
"get_children",
"=",
"lambda",
"n",
":",
"key_tree",
".",
"get",
"(... | Return cyclic dependencies as list of tuples
:param list pkgs: pkg_resources.Distribution instances
:param dict pkg_index: mapping of pkgs with their respective keys
:returns: list of tuples representing cyclic dependencies
:rtype: generator | [
"Return",
"cyclic",
"dependencies",
"as",
"list",
"of",
"tuples"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L479-L495 | train |
pypa/pipenv | pipenv/vendor/pipdeptree.py | ReqPackage.is_conflicting | def is_conflicting(self):
"""If installed version conflicts with required version"""
# unknown installed version is also considered conflicting
if self.installed_version == self.UNKNOWN_VERSION:
return True
ver_spec = (self.version_spec if self.version_spec else '')
r... | python | def is_conflicting(self):
"""If installed version conflicts with required version"""
# unknown installed version is also considered conflicting
if self.installed_version == self.UNKNOWN_VERSION:
return True
ver_spec = (self.version_spec if self.version_spec else '')
r... | [
"def",
"is_conflicting",
"(",
"self",
")",
":",
"# unknown installed version is also considered conflicting",
"if",
"self",
".",
"installed_version",
"==",
"self",
".",
"UNKNOWN_VERSION",
":",
"return",
"True",
"ver_spec",
"=",
"(",
"self",
".",
"version_spec",
"if",
... | If installed version conflicts with required version | [
"If",
"installed",
"version",
"conflicts",
"with",
"required",
"version"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pipdeptree.py#L254-L262 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/utils/hashes.py | Hashes.check_against_chunks | def check_against_chunks(self, chunks):
# type: (Iterator[bytes]) -> None
"""Check good hashes against ones built from iterable of chunks of
data.
Raise HashMismatch if none match.
"""
gots = {}
for hash_name in iterkeys(self._allowed):
try:
... | python | def check_against_chunks(self, chunks):
# type: (Iterator[bytes]) -> None
"""Check good hashes against ones built from iterable of chunks of
data.
Raise HashMismatch if none match.
"""
gots = {}
for hash_name in iterkeys(self._allowed):
try:
... | [
"def",
"check_against_chunks",
"(",
"self",
",",
"chunks",
")",
":",
"# type: (Iterator[bytes]) -> None",
"gots",
"=",
"{",
"}",
"for",
"hash_name",
"in",
"iterkeys",
"(",
"self",
".",
"_allowed",
")",
":",
"try",
":",
"gots",
"[",
"hash_name",
"]",
"=",
"... | Check good hashes against ones built from iterable of chunks of
data.
Raise HashMismatch if none match. | [
"Check",
"good",
"hashes",
"against",
"ones",
"built",
"from",
"iterable",
"of",
"chunks",
"of",
"data",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/hashes.py#L47-L69 | train |
pypa/pipenv | pipenv/vendor/attr/converters.py | default_if_none | def default_if_none(default=NOTHING, factory=None):
"""
A converter that allows to replace ``None`` values by *default* or the
result of *factory*.
:param default: Value to be used if ``None`` is passed. Passing an instance
of :class:`attr.Factory` is supported, however the ``takes_self`` option... | python | def default_if_none(default=NOTHING, factory=None):
"""
A converter that allows to replace ``None`` values by *default* or the
result of *factory*.
:param default: Value to be used if ``None`` is passed. Passing an instance
of :class:`attr.Factory` is supported, however the ``takes_self`` option... | [
"def",
"default_if_none",
"(",
"default",
"=",
"NOTHING",
",",
"factory",
"=",
"None",
")",
":",
"if",
"default",
"is",
"NOTHING",
"and",
"factory",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"Must pass either `default` or `factory`.\"",
")",
"if",
"default... | A converter that allows to replace ``None`` values by *default* or the
result of *factory*.
:param default: Value to be used if ``None`` is passed. Passing an instance
of :class:`attr.Factory` is supported, however the ``takes_self`` option
is *not*.
:param callable factory: A callable that t... | [
"A",
"converter",
"that",
"allows",
"to",
"replace",
"None",
"values",
"by",
"*",
"default",
"*",
"or",
"the",
"result",
"of",
"*",
"factory",
"*",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/converters.py#L29-L78 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._drop_nodes_from_errorpaths | def _drop_nodes_from_errorpaths(self, _errors, dp_items, sp_items):
""" Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to dr... | python | def _drop_nodes_from_errorpaths(self, _errors, dp_items, sp_items):
""" Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to dr... | [
"def",
"_drop_nodes_from_errorpaths",
"(",
"self",
",",
"_errors",
",",
"dp_items",
",",
"sp_items",
")",
":",
"dp_basedepth",
"=",
"len",
"(",
"self",
".",
"document_path",
")",
"sp_basedepth",
"=",
"len",
"(",
"self",
".",
"schema_path",
")",
"for",
"error... | Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_it... | [
"Removes",
"nodes",
"by",
"index",
"from",
"an",
"errorpath",
"relatively",
"to",
"the",
"basepaths",
"of",
"self",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L341-L361 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._lookup_field | def _lookup_field(self, path):
""" Searches for a field as defined by path. This method is used by the
``dependency`` evaluation logic.
:param path: Path elements are separated by a ``.``. A leading ``^``
indicates that the path relates to the document root,
... | python | def _lookup_field(self, path):
""" Searches for a field as defined by path. This method is used by the
``dependency`` evaluation logic.
:param path: Path elements are separated by a ``.``. A leading ``^``
indicates that the path relates to the document root,
... | [
"def",
"_lookup_field",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"'^'",
")",
":",
"path",
"=",
"path",
"[",
"1",
":",
"]",
"context",
"=",
"self",
".",
"document",
"if",
"path",
".",
"startswith",
"(",
"'^'",
")",
... | Searches for a field as defined by path. This method is used by the
``dependency`` evaluation logic.
:param path: Path elements are separated by a ``.``. A leading ``^``
indicates that the path relates to the document root,
otherwise it relates to the curre... | [
"Searches",
"for",
"a",
"field",
"as",
"defined",
"by",
"path",
".",
"This",
"method",
"is",
"used",
"by",
"the",
"dependency",
"evaluation",
"logic",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L363-L391 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator.types | def types(cls):
""" The constraints that can be used for the 'type' rule.
Type: A tuple of strings. """
redundant_types = \
set(cls.types_mapping) & set(cls._types_from_methods)
if redundant_types:
warn("These types are defined both with a method and in the"
... | python | def types(cls):
""" The constraints that can be used for the 'type' rule.
Type: A tuple of strings. """
redundant_types = \
set(cls.types_mapping) & set(cls._types_from_methods)
if redundant_types:
warn("These types are defined both with a method and in the"
... | [
"def",
"types",
"(",
"cls",
")",
":",
"redundant_types",
"=",
"set",
"(",
"cls",
".",
"types_mapping",
")",
"&",
"set",
"(",
"cls",
".",
"_types_from_methods",
")",
"if",
"redundant_types",
":",
"warn",
"(",
"\"These types are defined both with a method and in the... | The constraints that can be used for the 'type' rule.
Type: A tuple of strings. | [
"The",
"constraints",
"that",
"can",
"be",
"used",
"for",
"the",
"type",
"rule",
".",
"Type",
":",
"A",
"tuple",
"of",
"strings",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L524-L534 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._drop_remaining_rules | def _drop_remaining_rules(self, *rules):
""" Drops rules from the queue of the rules that still need to be
evaluated for the currently processed field.
If no arguments are given, the whole queue is emptied.
"""
if rules:
for rule in rules:
try:... | python | def _drop_remaining_rules(self, *rules):
""" Drops rules from the queue of the rules that still need to be
evaluated for the currently processed field.
If no arguments are given, the whole queue is emptied.
"""
if rules:
for rule in rules:
try:... | [
"def",
"_drop_remaining_rules",
"(",
"self",
",",
"*",
"rules",
")",
":",
"if",
"rules",
":",
"for",
"rule",
"in",
"rules",
":",
"try",
":",
"self",
".",
"_remaining_rules",
".",
"remove",
"(",
"rule",
")",
"except",
"ValueError",
":",
"pass",
"else",
... | Drops rules from the queue of the rules that still need to be
evaluated for the currently processed field.
If no arguments are given, the whole queue is emptied. | [
"Drops",
"rules",
"from",
"the",
"queue",
"of",
"the",
"rules",
"that",
"still",
"need",
"to",
"be",
"evaluated",
"for",
"the",
"currently",
"processed",
"field",
".",
"If",
"no",
"arguments",
"are",
"given",
"the",
"whole",
"queue",
"is",
"emptied",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L561-L573 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator.normalized | def normalized(self, document, schema=None, always_return_document=False):
""" Returns the document normalized according to the specified rules
of a schema.
:param document: The document to normalize.
:type document: any :term:`mapping`
:param schema: The validation schema. Defa... | python | def normalized(self, document, schema=None, always_return_document=False):
""" Returns the document normalized according to the specified rules
of a schema.
:param document: The document to normalize.
:type document: any :term:`mapping`
:param schema: The validation schema. Defa... | [
"def",
"normalized",
"(",
"self",
",",
"document",
",",
"schema",
"=",
"None",
",",
"always_return_document",
"=",
"False",
")",
":",
"self",
".",
"__init_processing",
"(",
"document",
",",
"schema",
")",
"self",
".",
"__normalize_mapping",
"(",
"self",
".",... | Returns the document normalized according to the specified rules
of a schema.
:param document: The document to normalize.
:type document: any :term:`mapping`
:param schema: The validation schema. Defaults to :obj:`None`. If not
provided here, the schema must have ... | [
"Returns",
"the",
"document",
"normalized",
"according",
"to",
"the",
"specified",
"rules",
"of",
"a",
"schema",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L577-L599 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._normalize_coerce | def _normalize_coerce(self, mapping, schema):
""" {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
]} """
... | python | def _normalize_coerce(self, mapping, schema):
""" {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
]} """
... | [
"def",
"_normalize_coerce",
"(",
"self",
",",
"mapping",
",",
"schema",
")",
":",
"error",
"=",
"errors",
".",
"COERCION_FAILED",
"for",
"field",
"in",
"mapping",
":",
"if",
"field",
"in",
"schema",
"and",
"'coerce'",
"in",
"schema",
"[",
"field",
"]",
"... | {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
]} | [
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"list",
"schema",
":",
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"string",
"}",
"]",
"}}",
"{",
"type",
":",
"string",
"}",
"]",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L621-L640 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._normalize_purge_unknown | def _normalize_purge_unknown(mapping, schema):
""" {'type': 'boolean'} """
for field in tuple(mapping):
if field not in schema:
del mapping[field]
return mapping | python | def _normalize_purge_unknown(mapping, schema):
""" {'type': 'boolean'} """
for field in tuple(mapping):
if field not in schema:
del mapping[field]
return mapping | [
"def",
"_normalize_purge_unknown",
"(",
"mapping",
",",
"schema",
")",
":",
"for",
"field",
"in",
"tuple",
"(",
"mapping",
")",
":",
"if",
"field",
"not",
"in",
"schema",
":",
"del",
"mapping",
"[",
"field",
"]",
"return",
"mapping"
] | {'type': 'boolean'} | [
"{",
"type",
":",
"boolean",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L751-L756 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._normalize_rename | def _normalize_rename(self, mapping, schema, field):
""" {'type': 'hashable'} """
if 'rename' in schema[field]:
mapping[schema[field]['rename']] = mapping[field]
del mapping[field] | python | def _normalize_rename(self, mapping, schema, field):
""" {'type': 'hashable'} """
if 'rename' in schema[field]:
mapping[schema[field]['rename']] = mapping[field]
del mapping[field] | [
"def",
"_normalize_rename",
"(",
"self",
",",
"mapping",
",",
"schema",
",",
"field",
")",
":",
"if",
"'rename'",
"in",
"schema",
"[",
"field",
"]",
":",
"mapping",
"[",
"schema",
"[",
"field",
"]",
"[",
"'rename'",
"]",
"]",
"=",
"mapping",
"[",
"fi... | {'type': 'hashable'} | [
"{",
"type",
":",
"hashable",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L769-L773 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._normalize_rename_handler | def _normalize_rename_handler(self, mapping, schema, field):
""" {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
... | python | def _normalize_rename_handler(self, mapping, schema, field):
""" {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
... | [
"def",
"_normalize_rename_handler",
"(",
"self",
",",
"mapping",
",",
"schema",
",",
"field",
")",
":",
"if",
"'rename_handler'",
"not",
"in",
"schema",
"[",
"field",
"]",
":",
"return",
"new_name",
"=",
"self",
".",
"__normalize_coerce",
"(",
"schema",
"[",... | {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
]} | [
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"list",
"schema",
":",
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"string",
"}",
"]",
"}}",
"{",
"type",
":",
"string",
"}",
"]",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L775-L790 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._normalize_default_setter | def _normalize_default_setter(self, mapping, schema, field):
""" {'oneof': [
{'type': 'callable'},
{'type': 'string'}
]} """
if 'default_setter' in schema[field]:
setter = schema[field]['default_setter']
if isinstance(setter, _str_t... | python | def _normalize_default_setter(self, mapping, schema, field):
""" {'oneof': [
{'type': 'callable'},
{'type': 'string'}
]} """
if 'default_setter' in schema[field]:
setter = schema[field]['default_setter']
if isinstance(setter, _str_t... | [
"def",
"_normalize_default_setter",
"(",
"self",
",",
"mapping",
",",
"schema",
",",
"field",
")",
":",
"if",
"'default_setter'",
"in",
"schema",
"[",
"field",
"]",
":",
"setter",
"=",
"schema",
"[",
"field",
"]",
"[",
"'default_setter'",
"]",
"if",
"isins... | {'oneof': [
{'type': 'callable'},
{'type': 'string'}
]} | [
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"string",
"}",
"]",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L832-L842 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator.validate | def validate(self, document, schema=None, update=False, normalize=True):
""" Normalizes and validates a mapping against a validation-schema of
defined rules.
:param document: The document to normalize.
:type document: any :term:`mapping`
:param schema: The validation schema. Def... | python | def validate(self, document, schema=None, update=False, normalize=True):
""" Normalizes and validates a mapping against a validation-schema of
defined rules.
:param document: The document to normalize.
:type document: any :term:`mapping`
:param schema: The validation schema. Def... | [
"def",
"validate",
"(",
"self",
",",
"document",
",",
"schema",
"=",
"None",
",",
"update",
"=",
"False",
",",
"normalize",
"=",
"True",
")",
":",
"self",
".",
"update",
"=",
"update",
"self",
".",
"_unrequired_by_excludes",
"=",
"set",
"(",
")",
"self... | Normalizes and validates a mapping against a validation-schema of
defined rules.
:param document: The document to normalize.
:type document: any :term:`mapping`
:param schema: The validation schema. Defaults to :obj:`None`. If not
provided here, the schema must ha... | [
"Normalizes",
"and",
"validates",
"a",
"mapping",
"against",
"a",
"validation",
"-",
"schema",
"of",
"defined",
"rules",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L846-L886 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator.validated | def validated(self, *args, **kwargs):
""" Wrapper around :meth:`~cerberus.Validator.validate` that returns
the normalized and validated document or :obj:`None` if validation
failed. """
always_return_document = kwargs.pop('always_return_document', False)
self.validate(*ar... | python | def validated(self, *args, **kwargs):
""" Wrapper around :meth:`~cerberus.Validator.validate` that returns
the normalized and validated document or :obj:`None` if validation
failed. """
always_return_document = kwargs.pop('always_return_document', False)
self.validate(*ar... | [
"def",
"validated",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"always_return_document",
"=",
"kwargs",
".",
"pop",
"(",
"'always_return_document'",
",",
"False",
")",
"self",
".",
"validate",
"(",
"*",
"args",
",",
"*",
"*",
"kw... | Wrapper around :meth:`~cerberus.Validator.validate` that returns
the normalized and validated document or :obj:`None` if validation
failed. | [
"Wrapper",
"around",
":",
"meth",
":",
"~cerberus",
".",
"Validator",
".",
"validate",
"that",
"returns",
"the",
"normalized",
"and",
"validated",
"document",
"or",
":",
"obj",
":",
"None",
"if",
"validation",
"failed",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L890-L899 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_allowed | def _validate_allowed(self, allowed_values, field, value):
""" {'type': 'list'} """
if isinstance(value, Iterable) and not isinstance(value, _str_type):
unallowed = set(value) - set(allowed_values)
if unallowed:
self._error(field, errors.UNALLOWED_VALUES, list(una... | python | def _validate_allowed(self, allowed_values, field, value):
""" {'type': 'list'} """
if isinstance(value, Iterable) and not isinstance(value, _str_type):
unallowed = set(value) - set(allowed_values)
if unallowed:
self._error(field, errors.UNALLOWED_VALUES, list(una... | [
"def",
"_validate_allowed",
"(",
"self",
",",
"allowed_values",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"_str_type",
")",
":",
"unallowed",
"=",
"set",
"... | {'type': 'list'} | [
"{",
"type",
":",
"list",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L957-L965 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_empty | def _validate_empty(self, empty, field, value):
""" {'type': 'boolean'} """
if isinstance(value, Iterable) and len(value) == 0:
self._drop_remaining_rules(
'allowed', 'forbidden', 'items', 'minlength', 'maxlength',
'regex', 'validator')
if not empt... | python | def _validate_empty(self, empty, field, value):
""" {'type': 'boolean'} """
if isinstance(value, Iterable) and len(value) == 0:
self._drop_remaining_rules(
'allowed', 'forbidden', 'items', 'minlength', 'maxlength',
'regex', 'validator')
if not empt... | [
"def",
"_validate_empty",
"(",
"self",
",",
"empty",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Iterable",
")",
"and",
"len",
"(",
"value",
")",
"==",
"0",
":",
"self",
".",
"_drop_remaining_rules",
"(",
"'allowed'",
... | {'type': 'boolean'} | [
"{",
"type",
":",
"boolean",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1005-L1012 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_excludes | def _validate_excludes(self, excludes, field, value):
""" {'type': ('hashable', 'list'),
'schema': {'type': 'hashable'}} """
if isinstance(excludes, Hashable):
excludes = [excludes]
# Save required field to be checked latter
if 'required' in self.schema[field] a... | python | def _validate_excludes(self, excludes, field, value):
""" {'type': ('hashable', 'list'),
'schema': {'type': 'hashable'}} """
if isinstance(excludes, Hashable):
excludes = [excludes]
# Save required field to be checked latter
if 'required' in self.schema[field] a... | [
"def",
"_validate_excludes",
"(",
"self",
",",
"excludes",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"excludes",
",",
"Hashable",
")",
":",
"excludes",
"=",
"[",
"excludes",
"]",
"# Save required field to be checked latter",
"if",
"'required... | {'type': ('hashable', 'list'),
'schema': {'type': 'hashable'}} | [
"{",
"type",
":",
"(",
"hashable",
"list",
")",
"schema",
":",
"{",
"type",
":",
"hashable",
"}}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1014-L1034 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_forbidden | def _validate_forbidden(self, forbidden_values, field, value):
""" {'type': 'list'} """
if isinstance(value, _str_type):
if value in forbidden_values:
self._error(field, errors.FORBIDDEN_VALUE, value)
elif isinstance(value, Sequence):
forbidden = set(value... | python | def _validate_forbidden(self, forbidden_values, field, value):
""" {'type': 'list'} """
if isinstance(value, _str_type):
if value in forbidden_values:
self._error(field, errors.FORBIDDEN_VALUE, value)
elif isinstance(value, Sequence):
forbidden = set(value... | [
"def",
"_validate_forbidden",
"(",
"self",
",",
"forbidden_values",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"_str_type",
")",
":",
"if",
"value",
"in",
"forbidden_values",
":",
"self",
".",
"_error",
"(",
"field",
",",
... | {'type': 'list'} | [
"{",
"type",
":",
"list",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1036-L1047 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator.__validate_logical | def __validate_logical(self, operator, definitions, field, value):
""" Validates value against all definitions and logs errors according
to the operator. """
valid_counter = 0
_errors = errors.ErrorList()
for i, definition in enumerate(definitions):
schema = {fie... | python | def __validate_logical(self, operator, definitions, field, value):
""" Validates value against all definitions and logs errors according
to the operator. """
valid_counter = 0
_errors = errors.ErrorList()
for i, definition in enumerate(definitions):
schema = {fie... | [
"def",
"__validate_logical",
"(",
"self",
",",
"operator",
",",
"definitions",
",",
"field",
",",
"value",
")",
":",
"valid_counter",
"=",
"0",
"_errors",
"=",
"errors",
".",
"ErrorList",
"(",
")",
"for",
"i",
",",
"definition",
"in",
"enumerate",
"(",
"... | Validates value against all definitions and logs errors according
to the operator. | [
"Validates",
"value",
"against",
"all",
"definitions",
"and",
"logs",
"errors",
"according",
"to",
"the",
"operator",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1062-L1085 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_anyof | def _validate_anyof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'anyof'} """
valids, _errors = \
self.__validate_logical('anyof', definitions, field, value)
if valids < 1:
self._error(field, errors.ANYOF, _errors,
valids, len(... | python | def _validate_anyof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'anyof'} """
valids, _errors = \
self.__validate_logical('anyof', definitions, field, value)
if valids < 1:
self._error(field, errors.ANYOF, _errors,
valids, len(... | [
"def",
"_validate_anyof",
"(",
"self",
",",
"definitions",
",",
"field",
",",
"value",
")",
":",
"valids",
",",
"_errors",
"=",
"self",
".",
"__validate_logical",
"(",
"'anyof'",
",",
"definitions",
",",
"field",
",",
"value",
")",
"if",
"valids",
"<",
"... | {'type': 'list', 'logical': 'anyof'} | [
"{",
"type",
":",
"list",
"logical",
":",
"anyof",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1087-L1093 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_allof | def _validate_allof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'allof'} """
valids, _errors = \
self.__validate_logical('allof', definitions, field, value)
if valids < len(definitions):
self._error(field, errors.ALLOF, _errors,
... | python | def _validate_allof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'allof'} """
valids, _errors = \
self.__validate_logical('allof', definitions, field, value)
if valids < len(definitions):
self._error(field, errors.ALLOF, _errors,
... | [
"def",
"_validate_allof",
"(",
"self",
",",
"definitions",
",",
"field",
",",
"value",
")",
":",
"valids",
",",
"_errors",
"=",
"self",
".",
"__validate_logical",
"(",
"'allof'",
",",
"definitions",
",",
"field",
",",
"value",
")",
"if",
"valids",
"<",
"... | {'type': 'list', 'logical': 'allof'} | [
"{",
"type",
":",
"list",
"logical",
":",
"allof",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1095-L1101 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_noneof | def _validate_noneof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'noneof'} """
valids, _errors = \
self.__validate_logical('noneof', definitions, field, value)
if valids > 0:
self._error(field, errors.NONEOF, _errors,
valids, ... | python | def _validate_noneof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'noneof'} """
valids, _errors = \
self.__validate_logical('noneof', definitions, field, value)
if valids > 0:
self._error(field, errors.NONEOF, _errors,
valids, ... | [
"def",
"_validate_noneof",
"(",
"self",
",",
"definitions",
",",
"field",
",",
"value",
")",
":",
"valids",
",",
"_errors",
"=",
"self",
".",
"__validate_logical",
"(",
"'noneof'",
",",
"definitions",
",",
"field",
",",
"value",
")",
"if",
"valids",
">",
... | {'type': 'list', 'logical': 'noneof'} | [
"{",
"type",
":",
"list",
"logical",
":",
"noneof",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1103-L1109 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_oneof | def _validate_oneof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'oneof'} """
valids, _errors = \
self.__validate_logical('oneof', definitions, field, value)
if valids != 1:
self._error(field, errors.ONEOF, _errors,
valids, len... | python | def _validate_oneof(self, definitions, field, value):
""" {'type': 'list', 'logical': 'oneof'} """
valids, _errors = \
self.__validate_logical('oneof', definitions, field, value)
if valids != 1:
self._error(field, errors.ONEOF, _errors,
valids, len... | [
"def",
"_validate_oneof",
"(",
"self",
",",
"definitions",
",",
"field",
",",
"value",
")",
":",
"valids",
",",
"_errors",
"=",
"self",
".",
"__validate_logical",
"(",
"'oneof'",
",",
"definitions",
",",
"field",
",",
"value",
")",
"if",
"valids",
"!=",
... | {'type': 'list', 'logical': 'oneof'} | [
"{",
"type",
":",
"list",
"logical",
":",
"oneof",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1111-L1117 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_max | def _validate_max(self, max_value, field, value):
""" {'nullable': False } """
try:
if value > max_value:
self._error(field, errors.MAX_VALUE)
except TypeError:
pass | python | def _validate_max(self, max_value, field, value):
""" {'nullable': False } """
try:
if value > max_value:
self._error(field, errors.MAX_VALUE)
except TypeError:
pass | [
"def",
"_validate_max",
"(",
"self",
",",
"max_value",
",",
"field",
",",
"value",
")",
":",
"try",
":",
"if",
"value",
">",
"max_value",
":",
"self",
".",
"_error",
"(",
"field",
",",
"errors",
".",
"MAX_VALUE",
")",
"except",
"TypeError",
":",
"pass"... | {'nullable': False } | [
"{",
"nullable",
":",
"False",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1119-L1125 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_min | def _validate_min(self, min_value, field, value):
""" {'nullable': False } """
try:
if value < min_value:
self._error(field, errors.MIN_VALUE)
except TypeError:
pass | python | def _validate_min(self, min_value, field, value):
""" {'nullable': False } """
try:
if value < min_value:
self._error(field, errors.MIN_VALUE)
except TypeError:
pass | [
"def",
"_validate_min",
"(",
"self",
",",
"min_value",
",",
"field",
",",
"value",
")",
":",
"try",
":",
"if",
"value",
"<",
"min_value",
":",
"self",
".",
"_error",
"(",
"field",
",",
"errors",
".",
"MIN_VALUE",
")",
"except",
"TypeError",
":",
"pass"... | {'nullable': False } | [
"{",
"nullable",
":",
"False",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1127-L1133 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_maxlength | def _validate_maxlength(self, max_length, field, value):
""" {'type': 'integer'} """
if isinstance(value, Iterable) and len(value) > max_length:
self._error(field, errors.MAX_LENGTH, len(value)) | python | def _validate_maxlength(self, max_length, field, value):
""" {'type': 'integer'} """
if isinstance(value, Iterable) and len(value) > max_length:
self._error(field, errors.MAX_LENGTH, len(value)) | [
"def",
"_validate_maxlength",
"(",
"self",
",",
"max_length",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Iterable",
")",
"and",
"len",
"(",
"value",
")",
">",
"max_length",
":",
"self",
".",
"_error",
"(",
"field",
",... | {'type': 'integer'} | [
"{",
"type",
":",
"integer",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1135-L1138 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_minlength | def _validate_minlength(self, min_length, field, value):
""" {'type': 'integer'} """
if isinstance(value, Iterable) and len(value) < min_length:
self._error(field, errors.MIN_LENGTH, len(value)) | python | def _validate_minlength(self, min_length, field, value):
""" {'type': 'integer'} """
if isinstance(value, Iterable) and len(value) < min_length:
self._error(field, errors.MIN_LENGTH, len(value)) | [
"def",
"_validate_minlength",
"(",
"self",
",",
"min_length",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Iterable",
")",
"and",
"len",
"(",
"value",
")",
"<",
"min_length",
":",
"self",
".",
"_error",
"(",
"field",
",... | {'type': 'integer'} | [
"{",
"type",
":",
"integer",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1140-L1143 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_keyschema | def _validate_keyschema(self, schema, field, value):
""" {'type': ['dict', 'string'], 'validator': 'bulk_schema',
'forbidden': ['rename', 'rename_handler']} """
if isinstance(value, Mapping):
validator = self._get_child_validator(
document_crumb=field,
... | python | def _validate_keyschema(self, schema, field, value):
""" {'type': ['dict', 'string'], 'validator': 'bulk_schema',
'forbidden': ['rename', 'rename_handler']} """
if isinstance(value, Mapping):
validator = self._get_child_validator(
document_crumb=field,
... | [
"def",
"_validate_keyschema",
"(",
"self",
",",
"schema",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Mapping",
")",
":",
"validator",
"=",
"self",
".",
"_get_child_validator",
"(",
"document_crumb",
"=",
"field",
",",
"sc... | {'type': ['dict', 'string'], 'validator': 'bulk_schema',
'forbidden': ['rename', 'rename_handler']} | [
"{",
"type",
":",
"[",
"dict",
"string",
"]",
"validator",
":",
"bulk_schema",
"forbidden",
":",
"[",
"rename",
"rename_handler",
"]",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1155-L1167 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_readonly | def _validate_readonly(self, readonly, field, value):
""" {'type': 'boolean'} """
if readonly:
if not self._is_normalized:
self._error(field, errors.READONLY_FIELD)
# If the document was normalized (and therefore already been
# checked for readonly fie... | python | def _validate_readonly(self, readonly, field, value):
""" {'type': 'boolean'} """
if readonly:
if not self._is_normalized:
self._error(field, errors.READONLY_FIELD)
# If the document was normalized (and therefore already been
# checked for readonly fie... | [
"def",
"_validate_readonly",
"(",
"self",
",",
"readonly",
",",
"field",
",",
"value",
")",
":",
"if",
"readonly",
":",
"if",
"not",
"self",
".",
"_is_normalized",
":",
"self",
".",
"_error",
"(",
"field",
",",
"errors",
".",
"READONLY_FIELD",
")",
"# If... | {'type': 'boolean'} | [
"{",
"type",
":",
"boolean",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1169-L1181 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_regex | def _validate_regex(self, pattern, field, value):
""" {'type': 'string'} """
if not isinstance(value, _str_type):
return
if not pattern.endswith('$'):
pattern += '$'
re_obj = re.compile(pattern)
if not re_obj.match(value):
self._error(field, er... | python | def _validate_regex(self, pattern, field, value):
""" {'type': 'string'} """
if not isinstance(value, _str_type):
return
if not pattern.endswith('$'):
pattern += '$'
re_obj = re.compile(pattern)
if not re_obj.match(value):
self._error(field, er... | [
"def",
"_validate_regex",
"(",
"self",
",",
"pattern",
",",
"field",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"_str_type",
")",
":",
"return",
"if",
"not",
"pattern",
".",
"endswith",
"(",
"'$'",
")",
":",
"pattern",
"+=",
... | {'type': 'string'} | [
"{",
"type",
":",
"string",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1183-L1191 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator.__validate_required_fields | def __validate_required_fields(self, document):
""" Validates that required fields are not missing.
:param document: The document being validated.
"""
try:
required = set(field for field, definition in self.schema.items()
if self._resolve_rules_set... | python | def __validate_required_fields(self, document):
""" Validates that required fields are not missing.
:param document: The document being validated.
"""
try:
required = set(field for field, definition in self.schema.items()
if self._resolve_rules_set... | [
"def",
"__validate_required_fields",
"(",
"self",
",",
"document",
")",
":",
"try",
":",
"required",
"=",
"set",
"(",
"field",
"for",
"field",
",",
"definition",
"in",
"self",
".",
"schema",
".",
"items",
"(",
")",
"if",
"self",
".",
"_resolve_rules_set",
... | Validates that required fields are not missing.
:param document: The document being validated. | [
"Validates",
"that",
"required",
"fields",
"are",
"not",
"missing",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1195-L1224 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_schema | def _validate_schema(self, schema, field, value):
""" {'type': ['dict', 'string'],
'anyof': [{'validator': 'schema'},
{'validator': 'bulk_schema'}]} """
if schema is None:
return
if isinstance(value, Sequence) and not isinstance(value, _str_type):... | python | def _validate_schema(self, schema, field, value):
""" {'type': ['dict', 'string'],
'anyof': [{'validator': 'schema'},
{'validator': 'bulk_schema'}]} """
if schema is None:
return
if isinstance(value, Sequence) and not isinstance(value, _str_type):... | [
"def",
"_validate_schema",
"(",
"self",
",",
"schema",
",",
"field",
",",
"value",
")",
":",
"if",
"schema",
"is",
"None",
":",
"return",
"if",
"isinstance",
"(",
"value",
",",
"Sequence",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"_str_type",
... | {'type': ['dict', 'string'],
'anyof': [{'validator': 'schema'},
{'validator': 'bulk_schema'}]} | [
"{",
"type",
":",
"[",
"dict",
"string",
"]",
"anyof",
":",
"[",
"{",
"validator",
":",
"schema",
"}",
"{",
"validator",
":",
"bulk_schema",
"}",
"]",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1226-L1236 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_type | def _validate_type(self, data_type, field, value):
""" {'type': ['string', 'list'],
'validator': 'type'} """
if not data_type:
return
types = (data_type,) if isinstance(data_type, _str_type) else data_type
for _type in types:
# TODO remove this bloc... | python | def _validate_type(self, data_type, field, value):
""" {'type': ['string', 'list'],
'validator': 'type'} """
if not data_type:
return
types = (data_type,) if isinstance(data_type, _str_type) else data_type
for _type in types:
# TODO remove this bloc... | [
"def",
"_validate_type",
"(",
"self",
",",
"data_type",
",",
"field",
",",
"value",
")",
":",
"if",
"not",
"data_type",
":",
"return",
"types",
"=",
"(",
"data_type",
",",
")",
"if",
"isinstance",
"(",
"data_type",
",",
"_str_type",
")",
"else",
"data_ty... | {'type': ['string', 'list'],
'validator': 'type'} | [
"{",
"type",
":",
"[",
"string",
"list",
"]",
"validator",
":",
"type",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1265-L1294 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_validator | def _validate_validator(self, validator, field, value):
""" {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
... | python | def _validate_validator(self, validator, field, value):
""" {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
... | [
"def",
"_validate_validator",
"(",
"self",
",",
"validator",
",",
"field",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"validator",
",",
"_str_type",
")",
":",
"validator",
"=",
"self",
".",
"__get_rule_handler",
"(",
"'validator'",
",",
"validator",
")... | {'oneof': [
{'type': 'callable'},
{'type': 'list',
'schema': {'oneof': [{'type': 'callable'},
{'type': 'string'}]}},
{'type': 'string'}
]} | [
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"list",
"schema",
":",
"{",
"oneof",
":",
"[",
"{",
"type",
":",
"callable",
"}",
"{",
"type",
":",
"string",
"}",
"]",
"}}",
"{",
"type",
":",
"string",
"}",
"]",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1296-L1311 | train |
pypa/pipenv | pipenv/vendor/cerberus/validator.py | BareValidator._validate_valueschema | def _validate_valueschema(self, schema, field, value):
""" {'type': ['dict', 'string'], 'validator': 'bulk_schema',
'forbidden': ['rename', 'rename_handler']} """
schema_crumb = (field, 'valueschema')
if isinstance(value, Mapping):
validator = self._get_child_validator(
... | python | def _validate_valueschema(self, schema, field, value):
""" {'type': ['dict', 'string'], 'validator': 'bulk_schema',
'forbidden': ['rename', 'rename_handler']} """
schema_crumb = (field, 'valueschema')
if isinstance(value, Mapping):
validator = self._get_child_validator(
... | [
"def",
"_validate_valueschema",
"(",
"self",
",",
"schema",
",",
"field",
",",
"value",
")",
":",
"schema_crumb",
"=",
"(",
"field",
",",
"'valueschema'",
")",
"if",
"isinstance",
"(",
"value",
",",
"Mapping",
")",
":",
"validator",
"=",
"self",
".",
"_g... | {'type': ['dict', 'string'], 'validator': 'bulk_schema',
'forbidden': ['rename', 'rename_handler']} | [
"{",
"type",
":",
"[",
"dict",
"string",
"]",
"validator",
":",
"bulk_schema",
"forbidden",
":",
"[",
"rename",
"rename_handler",
"]",
"}"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/cerberus/validator.py#L1313-L1324 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | make_attrgetter | def make_attrgetter(environment, attribute, postprocess=None):
"""Returns a callable that looks up the given attribute from a
passed object with the rules of the environment. Dots are allowed
to access attributes of attributes. Integer parts in paths are
looked up as integers.
"""
if attribute... | python | def make_attrgetter(environment, attribute, postprocess=None):
"""Returns a callable that looks up the given attribute from a
passed object with the rules of the environment. Dots are allowed
to access attributes of attributes. Integer parts in paths are
looked up as integers.
"""
if attribute... | [
"def",
"make_attrgetter",
"(",
"environment",
",",
"attribute",
",",
"postprocess",
"=",
"None",
")",
":",
"if",
"attribute",
"is",
"None",
":",
"attribute",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"attribute",
",",
"string_types",
")",
":",
"attribute",
... | Returns a callable that looks up the given attribute from a
passed object with the rules of the environment. Dots are allowed
to access attributes of attributes. Integer parts in paths are
looked up as integers. | [
"Returns",
"a",
"callable",
"that",
"looks",
"up",
"the",
"given",
"attribute",
"from",
"a",
"passed",
"object",
"with",
"the",
"rules",
"of",
"the",
"environment",
".",
"Dots",
"are",
"allowed",
"to",
"access",
"attributes",
"of",
"attributes",
".",
"Intege... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L62-L84 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_forceescape | def do_forceescape(value):
"""Enforce HTML escaping. This will probably double escape variables."""
if hasattr(value, '__html__'):
value = value.__html__()
return escape(text_type(value)) | python | def do_forceescape(value):
"""Enforce HTML escaping. This will probably double escape variables."""
if hasattr(value, '__html__'):
value = value.__html__()
return escape(text_type(value)) | [
"def",
"do_forceescape",
"(",
"value",
")",
":",
"if",
"hasattr",
"(",
"value",
",",
"'__html__'",
")",
":",
"value",
"=",
"value",
".",
"__html__",
"(",
")",
"return",
"escape",
"(",
"text_type",
"(",
"value",
")",
")"
] | Enforce HTML escaping. This will probably double escape variables. | [
"Enforce",
"HTML",
"escaping",
".",
"This",
"will",
"probably",
"double",
"escape",
"variables",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L87-L91 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_urlencode | def do_urlencode(value):
"""Escape strings for use in URLs (uses UTF-8 encoding). It accepts both
dictionaries and regular strings as well as pairwise iterables.
.. versionadded:: 2.7
"""
itemiter = None
if isinstance(value, dict):
itemiter = iteritems(value)
elif not isinstance(va... | python | def do_urlencode(value):
"""Escape strings for use in URLs (uses UTF-8 encoding). It accepts both
dictionaries and regular strings as well as pairwise iterables.
.. versionadded:: 2.7
"""
itemiter = None
if isinstance(value, dict):
itemiter = iteritems(value)
elif not isinstance(va... | [
"def",
"do_urlencode",
"(",
"value",
")",
":",
"itemiter",
"=",
"None",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"itemiter",
"=",
"iteritems",
"(",
"value",
")",
"elif",
"not",
"isinstance",
"(",
"value",
",",
"string_types",
")",
":",
... | Escape strings for use in URLs (uses UTF-8 encoding). It accepts both
dictionaries and regular strings as well as pairwise iterables.
.. versionadded:: 2.7 | [
"Escape",
"strings",
"for",
"use",
"in",
"URLs",
"(",
"uses",
"UTF",
"-",
"8",
"encoding",
")",
".",
"It",
"accepts",
"both",
"dictionaries",
"and",
"regular",
"strings",
"as",
"well",
"as",
"pairwise",
"iterables",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L94-L112 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_title | def do_title(s):
"""Return a titlecased version of the value. I.e. words will start with
uppercase letters, all remaining characters are lowercase.
"""
return ''.join(
[item[0].upper() + item[1:].lower()
for item in _word_beginning_split_re.split(soft_unicode(s))
if item]) | python | def do_title(s):
"""Return a titlecased version of the value. I.e. words will start with
uppercase letters, all remaining characters are lowercase.
"""
return ''.join(
[item[0].upper() + item[1:].lower()
for item in _word_beginning_split_re.split(soft_unicode(s))
if item]) | [
"def",
"do_title",
"(",
"s",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"item",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"+",
"item",
"[",
"1",
":",
"]",
".",
"lower",
"(",
")",
"for",
"item",
"in",
"_word_beginning_split_re",
".",
"split",
... | Return a titlecased version of the value. I.e. words will start with
uppercase letters, all remaining characters are lowercase. | [
"Return",
"a",
"titlecased",
"version",
"of",
"the",
"value",
".",
"I",
".",
"e",
".",
"words",
"will",
"start",
"with",
"uppercase",
"letters",
"all",
"remaining",
"characters",
"are",
"lowercase",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L196-L203 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_dictsort | def do_dictsort(value, case_sensitive=False, by='key', reverse=False):
"""Sort a dict and yield (key, value) pairs. Because python dicts are
unsorted you may want to use this function to order them by either
key or value:
.. sourcecode:: jinja
{% for item in mydict|dictsort %}
sort... | python | def do_dictsort(value, case_sensitive=False, by='key', reverse=False):
"""Sort a dict and yield (key, value) pairs. Because python dicts are
unsorted you may want to use this function to order them by either
key or value:
.. sourcecode:: jinja
{% for item in mydict|dictsort %}
sort... | [
"def",
"do_dictsort",
"(",
"value",
",",
"case_sensitive",
"=",
"False",
",",
"by",
"=",
"'key'",
",",
"reverse",
"=",
"False",
")",
":",
"if",
"by",
"==",
"'key'",
":",
"pos",
"=",
"0",
"elif",
"by",
"==",
"'value'",
":",
"pos",
"=",
"1",
"else",
... | Sort a dict and yield (key, value) pairs. Because python dicts are
unsorted you may want to use this function to order them by either
key or value:
.. sourcecode:: jinja
{% for item in mydict|dictsort %}
sort the dict by key, case insensitive
{% for item in mydict|dictsort(rev... | [
"Sort",
"a",
"dict",
"and",
"yield",
"(",
"key",
"value",
")",
"pairs",
".",
"Because",
"python",
"dicts",
"are",
"unsorted",
"you",
"may",
"want",
"to",
"use",
"this",
"function",
"to",
"order",
"them",
"by",
"either",
"key",
"or",
"value",
":"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L206-L242 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_sort | def do_sort(
environment, value, reverse=False, case_sensitive=False, attribute=None
):
"""Sort an iterable. Per default it sorts ascending, if you pass it
true as first argument it will reverse the sorting.
If the iterable is made of strings the third parameter can be used to
control the case sen... | python | def do_sort(
environment, value, reverse=False, case_sensitive=False, attribute=None
):
"""Sort an iterable. Per default it sorts ascending, if you pass it
true as first argument it will reverse the sorting.
If the iterable is made of strings the third parameter can be used to
control the case sen... | [
"def",
"do_sort",
"(",
"environment",
",",
"value",
",",
"reverse",
"=",
"False",
",",
"case_sensitive",
"=",
"False",
",",
"attribute",
"=",
"None",
")",
":",
"key_func",
"=",
"make_attrgetter",
"(",
"environment",
",",
"attribute",
",",
"postprocess",
"=",... | Sort an iterable. Per default it sorts ascending, if you pass it
true as first argument it will reverse the sorting.
If the iterable is made of strings the third parameter can be used to
control the case sensitiveness of the comparison which is disabled by
default.
.. sourcecode:: jinja
... | [
"Sort",
"an",
"iterable",
".",
"Per",
"default",
"it",
"sorts",
"ascending",
"if",
"you",
"pass",
"it",
"true",
"as",
"first",
"argument",
"it",
"will",
"reverse",
"the",
"sorting",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L246-L278 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_unique | def do_unique(environment, value, case_sensitive=False, attribute=None):
"""Returns a list of unique items from the the given iterable.
.. sourcecode:: jinja
{{ ['foo', 'bar', 'foobar', 'FooBar']|unique }}
-> ['foo', 'bar', 'foobar']
The unique items are yielded in the same order as t... | python | def do_unique(environment, value, case_sensitive=False, attribute=None):
"""Returns a list of unique items from the the given iterable.
.. sourcecode:: jinja
{{ ['foo', 'bar', 'foobar', 'FooBar']|unique }}
-> ['foo', 'bar', 'foobar']
The unique items are yielded in the same order as t... | [
"def",
"do_unique",
"(",
"environment",
",",
"value",
",",
"case_sensitive",
"=",
"False",
",",
"attribute",
"=",
"None",
")",
":",
"getter",
"=",
"make_attrgetter",
"(",
"environment",
",",
"attribute",
",",
"postprocess",
"=",
"ignore_case",
"if",
"not",
"... | Returns a list of unique items from the the given iterable.
.. sourcecode:: jinja
{{ ['foo', 'bar', 'foobar', 'FooBar']|unique }}
-> ['foo', 'bar', 'foobar']
The unique items are yielded in the same order as their first occurrence in
the iterable passed to the filter.
:param case... | [
"Returns",
"a",
"list",
"of",
"unique",
"items",
"from",
"the",
"the",
"given",
"iterable",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L282-L307 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_min | def do_min(environment, value, case_sensitive=False, attribute=None):
"""Return the smallest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|min }}
-> 1
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max ... | python | def do_min(environment, value, case_sensitive=False, attribute=None):
"""Return the smallest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|min }}
-> 1
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max ... | [
"def",
"do_min",
"(",
"environment",
",",
"value",
",",
"case_sensitive",
"=",
"False",
",",
"attribute",
"=",
"None",
")",
":",
"return",
"_min_or_max",
"(",
"environment",
",",
"value",
",",
"min",
",",
"case_sensitive",
",",
"attribute",
")"
] | Return the smallest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|min }}
-> 1
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max value of this attribute. | [
"Return",
"the",
"smallest",
"item",
"from",
"the",
"sequence",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L326-L337 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_max | def do_max(environment, value, case_sensitive=False, attribute=None):
"""Return the largest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|max }}
-> 3
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max v... | python | def do_max(environment, value, case_sensitive=False, attribute=None):
"""Return the largest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|max }}
-> 3
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max v... | [
"def",
"do_max",
"(",
"environment",
",",
"value",
",",
"case_sensitive",
"=",
"False",
",",
"attribute",
"=",
"None",
")",
":",
"return",
"_min_or_max",
"(",
"environment",
",",
"value",
",",
"max",
",",
"case_sensitive",
",",
"attribute",
")"
] | Return the largest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|max }}
-> 3
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max value of this attribute. | [
"Return",
"the",
"largest",
"item",
"from",
"the",
"sequence",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L341-L352 | train |
pypa/pipenv | pipenv/vendor/jinja2/filters.py | do_join | def do_join(eval_ctx, value, d=u'', attribute=None):
"""Return a string which is the concatenation of the strings in the
sequence. The separator between elements is an empty string per
default, you can define it with the optional parameter:
.. sourcecode:: jinja
{{ [1, 2, 3]|join('|') }}
... | python | def do_join(eval_ctx, value, d=u'', attribute=None):
"""Return a string which is the concatenation of the strings in the
sequence. The separator between elements is an empty string per
default, you can define it with the optional parameter:
.. sourcecode:: jinja
{{ [1, 2, 3]|join('|') }}
... | [
"def",
"do_join",
"(",
"eval_ctx",
",",
"value",
",",
"d",
"=",
"u''",
",",
"attribute",
"=",
"None",
")",
":",
"if",
"attribute",
"is",
"not",
"None",
":",
"value",
"=",
"imap",
"(",
"make_attrgetter",
"(",
"eval_ctx",
".",
"environment",
",",
"attrib... | Return a string which is the concatenation of the strings in the
sequence. The separator between elements is an empty string per
default, you can define it with the optional parameter:
.. sourcecode:: jinja
{{ [1, 2, 3]|join('|') }}
-> 1|2|3
{{ [1, 2, 3]|join }}
->... | [
"Return",
"a",
"string",
"which",
"is",
"the",
"concatenation",
"of",
"the",
"strings",
"in",
"the",
"sequence",
".",
"The",
"separator",
"between",
"elements",
"is",
"an",
"empty",
"string",
"per",
"default",
"you",
"can",
"define",
"it",
"with",
"the",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L378-L424 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.