partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | HelpFormatter.write_dl | Writes a definition list into the buffer. This is how options
and commands are usually formatted.
:param rows: a list of two item tuples for the terms and values.
:param col_max: the maximum width of the first column.
:param col_spacing: the number of spaces between the first and
... | pipenv/vendor/click/formatting.py | def write_dl(self, rows, col_max=30, col_spacing=2):
"""Writes a definition list into the buffer. This is how options
and commands are usually formatted.
:param rows: a list of two item tuples for the terms and values.
:param col_max: the maximum width of the first column.
:par... | def write_dl(self, rows, col_max=30, col_spacing=2):
"""Writes a definition list into the buffer. This is how options
and commands are usually formatted.
:param rows: a list of two item tuples for the terms and values.
:param col_max: the maximum width of the first column.
:par... | [
"Writes",
"a",
"definition",
"list",
"into",
"the",
"buffer",
".",
"This",
"is",
"how",
"options",
"and",
"commands",
"are",
"usually",
"formatted",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L173-L208 | [
"def",
"write_dl",
"(",
"self",
",",
"rows",
",",
"col_max",
"=",
"30",
",",
"col_spacing",
"=",
"2",
")",
":",
"rows",
"=",
"list",
"(",
"rows",
")",
"widths",
"=",
"measure_table",
"(",
"rows",
")",
"if",
"len",
"(",
"widths",
")",
"!=",
"2",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | HelpFormatter.section | Helpful context manager that writes a paragraph, a heading,
and the indents.
:param name: the section name that is written as heading. | pipenv/vendor/click/formatting.py | def section(self, name):
"""Helpful context manager that writes a paragraph, a heading,
and the indents.
:param name: the section name that is written as heading.
"""
self.write_paragraph()
self.write_heading(name)
self.indent()
try:
yield
... | def section(self, name):
"""Helpful context manager that writes a paragraph, a heading,
and the indents.
:param name: the section name that is written as heading.
"""
self.write_paragraph()
self.write_heading(name)
self.indent()
try:
yield
... | [
"Helpful",
"context",
"manager",
"that",
"writes",
"a",
"paragraph",
"a",
"heading",
"and",
"the",
"indents",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/formatting.py#L211-L223 | [
"def",
"section",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"write_paragraph",
"(",
")",
"self",
".",
"write_heading",
"(",
"name",
")",
"self",
".",
"indent",
"(",
")",
"try",
":",
"yield",
"finally",
":",
"self",
".",
"dedent",
"(",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | invalid_config_error_message | Returns a better error message when invalid configuration option
is provided. | pipenv/patched/notpip/_internal/cli/parser.py | def invalid_config_error_message(action, key, val):
"""Returns a better error message when invalid configuration option
is provided."""
if action in ('store_true', 'store_false'):
return ("{0} is not a valid value for {1} option, "
"please specify a boolean value like yes/no, "
... | def invalid_config_error_message(action, key, val):
"""Returns a better error message when invalid configuration option
is provided."""
if action in ('store_true', 'store_false'):
return ("{0} is not a valid value for {1} option, "
"please specify a boolean value like yes/no, "
... | [
"Returns",
"a",
"better",
"error",
"message",
"when",
"invalid",
"configuration",
"option",
"is",
"provided",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L251-L261 | [
"def",
"invalid_config_error_message",
"(",
"action",
",",
"key",
",",
"val",
")",
":",
"if",
"action",
"in",
"(",
"'store_true'",
",",
"'store_false'",
")",
":",
"return",
"(",
"\"{0} is not a valid value for {1} option, \"",
"\"please specify a boolean value like yes/no... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PrettyHelpFormatter._format_option_strings | Return a comma-separated list of option strings and metavars.
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
:param optsep: separator | pipenv/patched/notpip/_internal/cli/parser.py | def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
"""
Return a comma-separated list of option strings and metavars.
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
... | def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
"""
Return a comma-separated list of option strings and metavars.
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
... | [
"Return",
"a",
"comma",
"-",
"separated",
"list",
"of",
"option",
"strings",
"and",
"metavars",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L32-L53 | [
"def",
"_format_option_strings",
"(",
"self",
",",
"option",
",",
"mvarfmt",
"=",
"' <%s>'",
",",
"optsep",
"=",
"', '",
")",
":",
"opts",
"=",
"[",
"]",
"if",
"option",
".",
"_short_opts",
":",
"opts",
".",
"append",
"(",
"option",
".",
"_short_opts",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PrettyHelpFormatter.format_usage | Ensure there is only one newline between usage and the first heading
if there is no description. | pipenv/patched/notpip/_internal/cli/parser.py | def format_usage(self, usage):
"""
Ensure there is only one newline between usage and the first heading
if there is no description.
"""
msg = '\nUsage: %s\n' % self.indent_lines(textwrap.dedent(usage), " ")
return msg | def format_usage(self, usage):
"""
Ensure there is only one newline between usage and the first heading
if there is no description.
"""
msg = '\nUsage: %s\n' % self.indent_lines(textwrap.dedent(usage), " ")
return msg | [
"Ensure",
"there",
"is",
"only",
"one",
"newline",
"between",
"usage",
"and",
"the",
"first",
"heading",
"if",
"there",
"is",
"no",
"description",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L60-L66 | [
"def",
"format_usage",
"(",
"self",
",",
"usage",
")",
":",
"msg",
"=",
"'\\nUsage: %s\\n'",
"%",
"self",
".",
"indent_lines",
"(",
"textwrap",
".",
"dedent",
"(",
"usage",
")",
",",
"\" \"",
")",
"return",
"msg"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CustomOptionParser.insert_option_group | Insert an OptionGroup at a given position. | pipenv/patched/notpip/_internal/cli/parser.py | def insert_option_group(self, idx, *args, **kwargs):
"""Insert an OptionGroup at a given position."""
group = self.add_option_group(*args, **kwargs)
self.option_groups.pop()
self.option_groups.insert(idx, group)
return group | def insert_option_group(self, idx, *args, **kwargs):
"""Insert an OptionGroup at a given position."""
group = self.add_option_group(*args, **kwargs)
self.option_groups.pop()
self.option_groups.insert(idx, group)
return group | [
"Insert",
"an",
"OptionGroup",
"at",
"a",
"given",
"position",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L113-L120 | [
"def",
"insert_option_group",
"(",
"self",
",",
"idx",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"group",
"=",
"self",
".",
"add_option_group",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"option_groups",
".",
"pop",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CustomOptionParser.option_list_all | Get a list of all options, including those in option groups. | pipenv/patched/notpip/_internal/cli/parser.py | def option_list_all(self):
"""Get a list of all options, including those in option groups."""
res = self.option_list[:]
for i in self.option_groups:
res.extend(i.option_list)
return res | def option_list_all(self):
"""Get a list of all options, including those in option groups."""
res = self.option_list[:]
for i in self.option_groups:
res.extend(i.option_list)
return res | [
"Get",
"a",
"list",
"of",
"all",
"options",
"including",
"those",
"in",
"option",
"groups",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L123-L129 | [
"def",
"option_list_all",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"option_list",
"[",
":",
"]",
"for",
"i",
"in",
"self",
".",
"option_groups",
":",
"res",
".",
"extend",
"(",
"i",
".",
"option_list",
")",
"return",
"res"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ConfigOptionParser._update_defaults | Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists). | pipenv/patched/notpip/_internal/cli/parser.py | def _update_defaults(self, defaults):
"""Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists)."""
# Accumulate complex default state.
self.values = optparse.Values(self.defaults)
... | def _update_defaults(self, defaults):
"""Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists)."""
# Accumulate complex default state.
self.values = optparse.Values(self.defaults)
... | [
"Updates",
"the",
"given",
"defaults",
"with",
"values",
"from",
"the",
"config",
"files",
"and",
"the",
"environ",
".",
"Does",
"a",
"little",
"special",
"handling",
"for",
"certain",
"types",
"of",
"options",
"(",
"lists",
")",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L176-L223 | [
"def",
"_update_defaults",
"(",
"self",
",",
"defaults",
")",
":",
"# Accumulate complex default state.",
"self",
".",
"values",
"=",
"optparse",
".",
"Values",
"(",
"self",
".",
"defaults",
")",
"late_eval",
"=",
"set",
"(",
")",
"# Then set the options with thos... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ConfigOptionParser.get_default_values | Overriding to make updating the defaults after instantiation of
the option parser possible, _update_defaults() does the dirty work. | pipenv/patched/notpip/_internal/cli/parser.py | def get_default_values(self):
"""Overriding to make updating the defaults after instantiation of
the option parser possible, _update_defaults() does the dirty work."""
if not self.process_default_values:
# Old, pre-Optik 1.5 behaviour.
return optparse.Values(self.defaults... | def get_default_values(self):
"""Overriding to make updating the defaults after instantiation of
the option parser possible, _update_defaults() does the dirty work."""
if not self.process_default_values:
# Old, pre-Optik 1.5 behaviour.
return optparse.Values(self.defaults... | [
"Overriding",
"to",
"make",
"updating",
"the",
"defaults",
"after",
"instantiation",
"of",
"the",
"option",
"parser",
"possible",
"_update_defaults",
"()",
"does",
"the",
"dirty",
"work",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L225-L244 | [
"def",
"get_default_values",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"process_default_values",
":",
"# Old, pre-Optik 1.5 behaviour.",
"return",
"optparse",
".",
"Values",
"(",
"self",
".",
"defaults",
")",
"# Load the configuration, or error out in case of an er... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.safe_import | Helper utility for reimporting previously imported modules while inside the env | pipenv/environment.py | def safe_import(self, name):
"""Helper utility for reimporting previously imported modules while inside the env"""
module = None
if name not in self._modules:
self._modules[name] = importlib.import_module(name)
module = self._modules[name]
if not module:
d... | def safe_import(self, name):
"""Helper utility for reimporting previously imported modules while inside the env"""
module = None
if name not in self._modules:
self._modules[name] = importlib.import_module(name)
module = self._modules[name]
if not module:
d... | [
"Helper",
"utility",
"for",
"reimporting",
"previously",
"imported",
"modules",
"while",
"inside",
"the",
"env"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L51-L71 | [
"def",
"safe_import",
"(",
"self",
",",
"name",
")",
":",
"module",
"=",
"None",
"if",
"name",
"not",
"in",
"self",
".",
"_modules",
":",
"self",
".",
"_modules",
"[",
"name",
"]",
"=",
"importlib",
".",
"import_module",
"(",
"name",
")",
"module",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.resolve_dist | Given a local distribution and a working set, returns all dependencies from the set.
:param dist: A single distribution to find the dependencies of
:type dist: :class:`pkg_resources.Distribution`
:param working_set: A working set to search for all packages
:type working_set: :class:`pkg... | pipenv/environment.py | def resolve_dist(cls, dist, working_set):
"""Given a local distribution and a working set, returns all dependencies from the set.
:param dist: A single distribution to find the dependencies of
:type dist: :class:`pkg_resources.Distribution`
:param working_set: A working set to search fo... | def resolve_dist(cls, dist, working_set):
"""Given a local distribution and a working set, returns all dependencies from the set.
:param dist: A single distribution to find the dependencies of
:type dist: :class:`pkg_resources.Distribution`
:param working_set: A working set to search fo... | [
"Given",
"a",
"local",
"distribution",
"and",
"a",
"working",
"set",
"returns",
"all",
"dependencies",
"from",
"the",
"set",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L74-L94 | [
"def",
"resolve_dist",
"(",
"cls",
",",
"dist",
",",
"working_set",
")",
":",
"deps",
"=",
"set",
"(",
")",
"deps",
".",
"add",
"(",
"dist",
")",
"try",
":",
"reqs",
"=",
"dist",
".",
"requires",
"(",
")",
"except",
"(",
"AttributeError",
",",
"OSE... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.base_paths | Returns the context appropriate paths for the environment.
:return: A dictionary of environment specific paths to be used for installation operations
:rtype: dict
.. note:: The implementation of this is borrowed from a combination of pip and
virtualenv and is likely to change at som... | pipenv/environment.py | def base_paths(self):
"""
Returns the context appropriate paths for the environment.
:return: A dictionary of environment specific paths to be used for installation operations
:rtype: dict
.. note:: The implementation of this is borrowed from a combination of pip and
... | def base_paths(self):
"""
Returns the context appropriate paths for the environment.
:return: A dictionary of environment specific paths to be used for installation operations
:rtype: dict
.. note:: The implementation of this is borrowed from a combination of pip and
... | [
"Returns",
"the",
"context",
"appropriate",
"paths",
"for",
"the",
"environment",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L124-L173 | [
"def",
"base_paths",
"(",
"self",
")",
":",
"prefix",
"=",
"make_posix",
"(",
"self",
".",
"prefix",
".",
"as_posix",
"(",
")",
")",
"install_scheme",
"=",
"'nt'",
"if",
"(",
"os",
".",
"name",
"==",
"'nt'",
")",
"else",
"'posix_prefix'",
"paths",
"=",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.python | Path to the environment python | pipenv/environment.py | def python(self):
"""Path to the environment python"""
py = vistir.compat.Path(self.base_paths["scripts"]).joinpath("python").absolute().as_posix()
if not py:
return vistir.compat.Path(sys.executable).as_posix()
return py | def python(self):
"""Path to the environment python"""
py = vistir.compat.Path(self.base_paths["scripts"]).joinpath("python").absolute().as_posix()
if not py:
return vistir.compat.Path(sys.executable).as_posix()
return py | [
"Path",
"to",
"the",
"environment",
"python"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L182-L187 | [
"def",
"python",
"(",
"self",
")",
":",
"py",
"=",
"vistir",
".",
"compat",
".",
"Path",
"(",
"self",
".",
"base_paths",
"[",
"\"scripts\"",
"]",
")",
".",
"joinpath",
"(",
"\"python\"",
")",
".",
"absolute",
"(",
")",
".",
"as_posix",
"(",
")",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.sys_path | The system path inside the environment
:return: The :data:`sys.path` from the environment
:rtype: list | pipenv/environment.py | def sys_path(self):
"""
The system path inside the environment
:return: The :data:`sys.path` from the environment
:rtype: list
"""
from .vendor.vistir.compat import JSONDecodeError
current_executable = vistir.compat.Path(sys.executable).as_posix()
if not... | def sys_path(self):
"""
The system path inside the environment
:return: The :data:`sys.path` from the environment
:rtype: list
"""
from .vendor.vistir.compat import JSONDecodeError
current_executable = vistir.compat.Path(sys.executable).as_posix()
if not... | [
"The",
"system",
"path",
"inside",
"the",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L190-L210 | [
"def",
"sys_path",
"(",
"self",
")",
":",
"from",
".",
"vendor",
".",
"vistir",
".",
"compat",
"import",
"JSONDecodeError",
"current_executable",
"=",
"vistir",
".",
"compat",
".",
"Path",
"(",
"sys",
".",
"executable",
")",
".",
"as_posix",
"(",
")",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.sys_prefix | The prefix run inside the context of the environment
:return: The python prefix inside the environment
:rtype: :data:`sys.prefix` | pipenv/environment.py | def sys_prefix(self):
"""
The prefix run inside the context of the environment
:return: The python prefix inside the environment
:rtype: :data:`sys.prefix`
"""
command = [self.python, "-c" "import sys; print(sys.prefix)"]
c = vistir.misc.run(command, return_obje... | def sys_prefix(self):
"""
The prefix run inside the context of the environment
:return: The python prefix inside the environment
:rtype: :data:`sys.prefix`
"""
command = [self.python, "-c" "import sys; print(sys.prefix)"]
c = vistir.misc.run(command, return_obje... | [
"The",
"prefix",
"run",
"inside",
"the",
"context",
"of",
"the",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L213-L224 | [
"def",
"sys_prefix",
"(",
"self",
")",
":",
"command",
"=",
"[",
"self",
".",
"python",
",",
"\"-c\"",
"\"import sys; print(sys.prefix)\"",
"]",
"c",
"=",
"vistir",
".",
"misc",
".",
"run",
"(",
"command",
",",
"return_object",
"=",
"True",
",",
"block",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.pip_version | Get the pip version in the environment. Useful for knowing which args we can use
when installing. | pipenv/environment.py | def pip_version(self):
"""
Get the pip version in the environment. Useful for knowing which args we can use
when installing.
"""
from .vendor.packaging.version import parse as parse_version
pip = next(iter(
pkg for pkg in self.get_installed_packages() if pkg.... | def pip_version(self):
"""
Get the pip version in the environment. Useful for knowing which args we can use
when installing.
"""
from .vendor.packaging.version import parse as parse_version
pip = next(iter(
pkg for pkg in self.get_installed_packages() if pkg.... | [
"Get",
"the",
"pip",
"version",
"in",
"the",
"environment",
".",
"Useful",
"for",
"knowing",
"which",
"args",
"we",
"can",
"use",
"when",
"installing",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L251-L262 | [
"def",
"pip_version",
"(",
"self",
")",
":",
"from",
".",
"vendor",
".",
"packaging",
".",
"version",
"import",
"parse",
"as",
"parse_version",
"pip",
"=",
"next",
"(",
"iter",
"(",
"pkg",
"for",
"pkg",
"in",
"self",
".",
"get_installed_packages",
"(",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.get_distributions | Retrives the distributions installed on the library path of the environment
:return: A set of distributions found on the library path
:rtype: iterator | pipenv/environment.py | def get_distributions(self):
"""
Retrives the distributions installed on the library path of the environment
:return: A set of distributions found on the library path
:rtype: iterator
"""
pkg_resources = self.safe_import("pkg_resources")
libdirs = self.base_path... | def get_distributions(self):
"""
Retrives the distributions installed on the library path of the environment
:return: A set of distributions found on the library path
:rtype: iterator
"""
pkg_resources = self.safe_import("pkg_resources")
libdirs = self.base_path... | [
"Retrives",
"the",
"distributions",
"installed",
"on",
"the",
"library",
"path",
"of",
"the",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L264-L276 | [
"def",
"get_distributions",
"(",
"self",
")",
":",
"pkg_resources",
"=",
"self",
".",
"safe_import",
"(",
"\"pkg_resources\"",
")",
"libdirs",
"=",
"self",
".",
"base_paths",
"[",
"\"libdirs\"",
"]",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
"dists",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.find_egg | Find an egg by name in the given environment | pipenv/environment.py | def find_egg(self, egg_dist):
"""Find an egg by name in the given environment"""
site_packages = self.libdir[1]
search_filename = "{0}.egg-link".format(egg_dist.project_name)
try:
user_site = site.getusersitepackages()
except AttributeError:
user_site = si... | def find_egg(self, egg_dist):
"""Find an egg by name in the given environment"""
site_packages = self.libdir[1]
search_filename = "{0}.egg-link".format(egg_dist.project_name)
try:
user_site = site.getusersitepackages()
except AttributeError:
user_site = si... | [
"Find",
"an",
"egg",
"by",
"name",
"in",
"the",
"given",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L278-L290 | [
"def",
"find_egg",
"(",
"self",
",",
"egg_dist",
")",
":",
"site_packages",
"=",
"self",
".",
"libdir",
"[",
"1",
"]",
"search_filename",
"=",
"\"{0}.egg-link\"",
".",
"format",
"(",
"egg_dist",
".",
"project_name",
")",
"try",
":",
"user_site",
"=",
"site... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.dist_is_in_project | Determine whether the supplied distribution is in the environment. | pipenv/environment.py | def dist_is_in_project(self, dist):
"""Determine whether the supplied distribution is in the environment."""
from .project import _normalized
prefixes = [
_normalized(prefix) for prefix in self.base_paths["libdirs"].split(os.pathsep)
if _normalized(prefix).startswith(_nor... | def dist_is_in_project(self, dist):
"""Determine whether the supplied distribution is in the environment."""
from .project import _normalized
prefixes = [
_normalized(prefix) for prefix in self.base_paths["libdirs"].split(os.pathsep)
if _normalized(prefix).startswith(_nor... | [
"Determine",
"whether",
"the",
"supplied",
"distribution",
"is",
"in",
"the",
"environment",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L300-L311 | [
"def",
"dist_is_in_project",
"(",
"self",
",",
"dist",
")",
":",
"from",
".",
"project",
"import",
"_normalized",
"prefixes",
"=",
"[",
"_normalized",
"(",
"prefix",
")",
"for",
"prefix",
"in",
"self",
".",
"base_paths",
"[",
"\"libdirs\"",
"]",
".",
"spli... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.is_installed | Given a package name, returns whether it is installed in the environment
:param str pkgname: The name of a package
:return: Whether the supplied package is installed in the environment
:rtype: bool | pipenv/environment.py | def is_installed(self, pkgname):
"""Given a package name, returns whether it is installed in the environment
:param str pkgname: The name of a package
:return: Whether the supplied package is installed in the environment
:rtype: bool
"""
return any(d for d in self.get_d... | def is_installed(self, pkgname):
"""Given a package name, returns whether it is installed in the environment
:param str pkgname: The name of a package
:return: Whether the supplied package is installed in the environment
:rtype: bool
"""
return any(d for d in self.get_d... | [
"Given",
"a",
"package",
"name",
"returns",
"whether",
"it",
"is",
"installed",
"in",
"the",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L481-L489 | [
"def",
"is_installed",
"(",
"self",
",",
"pkgname",
")",
":",
"return",
"any",
"(",
"d",
"for",
"d",
"in",
"self",
".",
"get_distributions",
"(",
")",
"if",
"d",
".",
"project_name",
"==",
"pkgname",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.run_py | Run a python command in the enviornment context.
:param cmd: A command to run in the environment - runs with `python -c`
:type cmd: str or list
:param str cwd: The working directory in which to execute the command, defaults to :data:`os.curdir`
:return: A finished command object
... | pipenv/environment.py | def run_py(self, cmd, cwd=os.curdir):
"""Run a python command in the enviornment context.
:param cmd: A command to run in the environment - runs with `python -c`
:type cmd: str or list
:param str cwd: The working directory in which to execute the command, defaults to :data:`os.curdir`
... | def run_py(self, cmd, cwd=os.curdir):
"""Run a python command in the enviornment context.
:param cmd: A command to run in the environment - runs with `python -c`
:type cmd: str or list
:param str cwd: The working directory in which to execute the command, defaults to :data:`os.curdir`
... | [
"Run",
"a",
"python",
"command",
"in",
"the",
"enviornment",
"context",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L507-L524 | [
"def",
"run_py",
"(",
"self",
",",
"cmd",
",",
"cwd",
"=",
"os",
".",
"curdir",
")",
":",
"c",
"=",
"None",
"if",
"isinstance",
"(",
"cmd",
",",
"six",
".",
"string_types",
")",
":",
"script",
"=",
"vistir",
".",
"cmdparse",
".",
"Script",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.run_activate_this | Runs the environment's inline activation script | pipenv/environment.py | def run_activate_this(self):
"""Runs the environment's inline activation script"""
if self.is_venv:
activate_this = os.path.join(self.scripts_dir, "activate_this.py")
if not os.path.isfile(activate_this):
raise OSError("No such file: {0!s}".format(activate_this))
... | def run_activate_this(self):
"""Runs the environment's inline activation script"""
if self.is_venv:
activate_this = os.path.join(self.scripts_dir, "activate_this.py")
if not os.path.isfile(activate_this):
raise OSError("No such file: {0!s}".format(activate_this))
... | [
"Runs",
"the",
"environment",
"s",
"inline",
"activation",
"script"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L526-L534 | [
"def",
"run_activate_this",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_venv",
":",
"activate_this",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"scripts_dir",
",",
"\"activate_this.py\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.activated | Helper context manager to activate the environment.
This context manager will set the following variables for the duration
of its activation:
* sys.prefix
* sys.path
* os.environ["VIRTUAL_ENV"]
* os.environ["PATH"]
In addition, it will make any ... | pipenv/environment.py | def activated(self, include_extras=True, extra_dists=None):
"""Helper context manager to activate the environment.
This context manager will set the following variables for the duration
of its activation:
* sys.prefix
* sys.path
* os.environ["VIRTUAL_ENV"]
... | def activated(self, include_extras=True, extra_dists=None):
"""Helper context manager to activate the environment.
This context manager will set the following variables for the duration
of its activation:
* sys.prefix
* sys.path
* os.environ["VIRTUAL_ENV"]
... | [
"Helper",
"context",
"manager",
"to",
"activate",
"the",
"environment",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L537-L605 | [
"def",
"activated",
"(",
"self",
",",
"include_extras",
"=",
"True",
",",
"extra_dists",
"=",
"None",
")",
":",
"if",
"not",
"extra_dists",
":",
"extra_dists",
"=",
"[",
"]",
"original_path",
"=",
"sys",
".",
"path",
"original_prefix",
"=",
"sys",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Environment.uninstall | A context manager which allows uninstallation of packages from the environment
:param str pkgname: The name of a package to uninstall
>>> env = Environment("/path/to/env/root")
>>> with env.uninstall("pytz", auto_confirm=True, verbose=False) as uninstaller:
cleaned = uninstalle... | pipenv/environment.py | def uninstall(self, pkgname, *args, **kwargs):
"""A context manager which allows uninstallation of packages from the environment
:param str pkgname: The name of a package to uninstall
>>> env = Environment("/path/to/env/root")
>>> with env.uninstall("pytz", auto_confirm=True, verbose=F... | def uninstall(self, pkgname, *args, **kwargs):
"""A context manager which allows uninstallation of packages from the environment
:param str pkgname: The name of a package to uninstall
>>> env = Environment("/path/to/env/root")
>>> with env.uninstall("pytz", auto_confirm=True, verbose=F... | [
"A",
"context",
"manager",
"which",
"allows",
"uninstallation",
"of",
"packages",
"from",
"the",
"environment"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L673-L713 | [
"def",
"uninstall",
"(",
"self",
",",
"pkgname",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"auto_confirm",
"=",
"kwargs",
".",
"pop",
"(",
"\"auto_confirm\"",
",",
"True",
")",
"verbose",
"=",
"kwargs",
".",
"pop",
"(",
"\"verbose\"",
",",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | stn | Convert a string to a null-terminated bytes object. | pipenv/vendor/distlib/_backport/tarfile.py | def stn(s, length, encoding, errors):
"""Convert a string to a null-terminated bytes object.
"""
s = s.encode(encoding, errors)
return s[:length] + (length - len(s)) * NUL | def stn(s, length, encoding, errors):
"""Convert a string to a null-terminated bytes object.
"""
s = s.encode(encoding, errors)
return s[:length] + (length - len(s)) * NUL | [
"Convert",
"a",
"string",
"to",
"a",
"null",
"-",
"terminated",
"bytes",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L185-L189 | [
"def",
"stn",
"(",
"s",
",",
"length",
",",
"encoding",
",",
"errors",
")",
":",
"s",
"=",
"s",
".",
"encode",
"(",
"encoding",
",",
"errors",
")",
"return",
"s",
"[",
":",
"length",
"]",
"+",
"(",
"length",
"-",
"len",
"(",
"s",
")",
")",
"*... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | nts | Convert a null-terminated bytes object to a string. | pipenv/vendor/distlib/_backport/tarfile.py | def nts(s, encoding, errors):
"""Convert a null-terminated bytes object to a string.
"""
p = s.find(b"\0")
if p != -1:
s = s[:p]
return s.decode(encoding, errors) | def nts(s, encoding, errors):
"""Convert a null-terminated bytes object to a string.
"""
p = s.find(b"\0")
if p != -1:
s = s[:p]
return s.decode(encoding, errors) | [
"Convert",
"a",
"null",
"-",
"terminated",
"bytes",
"object",
"to",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L191-L197 | [
"def",
"nts",
"(",
"s",
",",
"encoding",
",",
"errors",
")",
":",
"p",
"=",
"s",
".",
"find",
"(",
"b\"\\0\"",
")",
"if",
"p",
"!=",
"-",
"1",
":",
"s",
"=",
"s",
"[",
":",
"p",
"]",
"return",
"s",
".",
"decode",
"(",
"encoding",
",",
"erro... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | nti | Convert a number field to a python number. | pipenv/vendor/distlib/_backport/tarfile.py | def nti(s):
"""Convert a number field to a python number.
"""
# There are two possible encodings for a number field, see
# itn() below.
if s[0] != chr(0o200):
try:
n = int(nts(s, "ascii", "strict") or "0", 8)
except ValueError:
raise InvalidHeaderError("invali... | def nti(s):
"""Convert a number field to a python number.
"""
# There are two possible encodings for a number field, see
# itn() below.
if s[0] != chr(0o200):
try:
n = int(nts(s, "ascii", "strict") or "0", 8)
except ValueError:
raise InvalidHeaderError("invali... | [
"Convert",
"a",
"number",
"field",
"to",
"a",
"python",
"number",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L199-L214 | [
"def",
"nti",
"(",
"s",
")",
":",
"# There are two possible encodings for a number field, see",
"# itn() below.",
"if",
"s",
"[",
"0",
"]",
"!=",
"chr",
"(",
"0o200",
")",
":",
"try",
":",
"n",
"=",
"int",
"(",
"nts",
"(",
"s",
",",
"\"ascii\"",
",",
"\"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | itn | Convert a python number to a number field. | pipenv/vendor/distlib/_backport/tarfile.py | def itn(n, digits=8, format=DEFAULT_FORMAT):
"""Convert a python number to a number field.
"""
# POSIX 1003.1-1988 requires numbers to be encoded as a string of
# octal digits followed by a null-byte, this allows values up to
# (8**(digits-1))-1. GNU tar allows storing numbers greater than
# tha... | def itn(n, digits=8, format=DEFAULT_FORMAT):
"""Convert a python number to a number field.
"""
# POSIX 1003.1-1988 requires numbers to be encoded as a string of
# octal digits followed by a null-byte, this allows values up to
# (8**(digits-1))-1. GNU tar allows storing numbers greater than
# tha... | [
"Convert",
"a",
"python",
"number",
"to",
"a",
"number",
"field",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L216-L241 | [
"def",
"itn",
"(",
"n",
",",
"digits",
"=",
"8",
",",
"format",
"=",
"DEFAULT_FORMAT",
")",
":",
"# POSIX 1003.1-1988 requires numbers to be encoded as a string of",
"# octal digits followed by a null-byte, this allows values up to",
"# (8**(digits-1))-1. GNU tar allows storing numbe... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | calc_chksums | Calculate the checksum for a member's header by summing up all
characters except for the chksum field which is treated as if
it was filled with spaces. According to the GNU tar sources,
some tars (Sun and NeXT) calculate chksum with signed char,
which will be different if there are chars in ... | pipenv/vendor/distlib/_backport/tarfile.py | def calc_chksums(buf):
"""Calculate the checksum for a member's header by summing up all
characters except for the chksum field which is treated as if
it was filled with spaces. According to the GNU tar sources,
some tars (Sun and NeXT) calculate chksum with signed char,
which will be di... | def calc_chksums(buf):
"""Calculate the checksum for a member's header by summing up all
characters except for the chksum field which is treated as if
it was filled with spaces. According to the GNU tar sources,
some tars (Sun and NeXT) calculate chksum with signed char,
which will be di... | [
"Calculate",
"the",
"checksum",
"for",
"a",
"member",
"s",
"header",
"by",
"summing",
"up",
"all",
"characters",
"except",
"for",
"the",
"chksum",
"field",
"which",
"is",
"treated",
"as",
"if",
"it",
"was",
"filled",
"with",
"spaces",
".",
"According",
"to... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L243-L254 | [
"def",
"calc_chksums",
"(",
"buf",
")",
":",
"unsigned_chksum",
"=",
"256",
"+",
"sum",
"(",
"struct",
".",
"unpack",
"(",
"\"148B\"",
",",
"buf",
"[",
":",
"148",
"]",
")",
"+",
"struct",
".",
"unpack",
"(",
"\"356B\"",
",",
"buf",
"[",
"156",
":"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | copyfileobj | Copy length bytes from fileobj src to fileobj dst.
If length is None, copy the entire content. | pipenv/vendor/distlib/_backport/tarfile.py | def copyfileobj(src, dst, length=None):
"""Copy length bytes from fileobj src to fileobj dst.
If length is None, copy the entire content.
"""
if length == 0:
return
if length is None:
while True:
buf = src.read(16*1024)
if not buf:
break
... | def copyfileobj(src, dst, length=None):
"""Copy length bytes from fileobj src to fileobj dst.
If length is None, copy the entire content.
"""
if length == 0:
return
if length is None:
while True:
buf = src.read(16*1024)
if not buf:
break
... | [
"Copy",
"length",
"bytes",
"from",
"fileobj",
"src",
"to",
"fileobj",
"dst",
".",
"If",
"length",
"is",
"None",
"copy",
"the",
"entire",
"content",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L256-L283 | [
"def",
"copyfileobj",
"(",
"src",
",",
"dst",
",",
"length",
"=",
"None",
")",
":",
"if",
"length",
"==",
"0",
":",
"return",
"if",
"length",
"is",
"None",
":",
"while",
"True",
":",
"buf",
"=",
"src",
".",
"read",
"(",
"16",
"*",
"1024",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | filemode | Convert a file's mode to a string of the form
-rwxrwxrwx.
Used by TarFile.list() | pipenv/vendor/distlib/_backport/tarfile.py | def filemode(mode):
"""Convert a file's mode to a string of the form
-rwxrwxrwx.
Used by TarFile.list()
"""
perm = []
for table in filemode_table:
for bit, char in table:
if mode & bit == bit:
perm.append(char)
break
else:
... | def filemode(mode):
"""Convert a file's mode to a string of the form
-rwxrwxrwx.
Used by TarFile.list()
"""
perm = []
for table in filemode_table:
for bit, char in table:
if mode & bit == bit:
perm.append(char)
break
else:
... | [
"Convert",
"a",
"file",
"s",
"mode",
"to",
"a",
"string",
"of",
"the",
"form",
"-",
"rwxrwxrwx",
".",
"Used",
"by",
"TarFile",
".",
"list",
"()"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L312-L325 | [
"def",
"filemode",
"(",
"mode",
")",
":",
"perm",
"=",
"[",
"]",
"for",
"table",
"in",
"filemode_table",
":",
"for",
"bit",
",",
"char",
"in",
"table",
":",
"if",
"mode",
"&",
"bit",
"==",
"bit",
":",
"perm",
".",
"append",
"(",
"char",
")",
"bre... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | is_tarfile | Return True if name points to a tar archive that we
are able to handle, else return False. | pipenv/vendor/distlib/_backport/tarfile.py | def is_tarfile(name):
"""Return True if name points to a tar archive that we
are able to handle, else return False.
"""
try:
t = open(name)
t.close()
return True
except TarError:
return False | def is_tarfile(name):
"""Return True if name points to a tar archive that we
are able to handle, else return False.
"""
try:
t = open(name)
t.close()
return True
except TarError:
return False | [
"Return",
"True",
"if",
"name",
"points",
"to",
"a",
"tar",
"archive",
"that",
"we",
"are",
"able",
"to",
"handle",
"else",
"return",
"False",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2595-L2604 | [
"def",
"is_tarfile",
"(",
"name",
")",
":",
"try",
":",
"t",
"=",
"open",
"(",
"name",
")",
"t",
".",
"close",
"(",
")",
"return",
"True",
"except",
"TarError",
":",
"return",
"False"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream._init_write_gz | Initialize for writing with gzip compression. | pipenv/vendor/distlib/_backport/tarfile.py | def _init_write_gz(self):
"""Initialize for writing with gzip compression.
"""
self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED,
-self.zlib.MAX_WBITS,
self.zlib.DEF_MEM_LEVEL,
... | def _init_write_gz(self):
"""Initialize for writing with gzip compression.
"""
self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED,
-self.zlib.MAX_WBITS,
self.zlib.DEF_MEM_LEVEL,
... | [
"Initialize",
"for",
"writing",
"with",
"gzip",
"compression",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L455-L467 | [
"def",
"_init_write_gz",
"(",
"self",
")",
":",
"self",
".",
"cmp",
"=",
"self",
".",
"zlib",
".",
"compressobj",
"(",
"9",
",",
"self",
".",
"zlib",
".",
"DEFLATED",
",",
"-",
"self",
".",
"zlib",
".",
"MAX_WBITS",
",",
"self",
".",
"zlib",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream.write | Write string s to the stream. | pipenv/vendor/distlib/_backport/tarfile.py | def write(self, s):
"""Write string s to the stream.
"""
if self.comptype == "gz":
self.crc = self.zlib.crc32(s, self.crc)
self.pos += len(s)
if self.comptype != "tar":
s = self.cmp.compress(s)
self.__write(s) | def write(self, s):
"""Write string s to the stream.
"""
if self.comptype == "gz":
self.crc = self.zlib.crc32(s, self.crc)
self.pos += len(s)
if self.comptype != "tar":
s = self.cmp.compress(s)
self.__write(s) | [
"Write",
"string",
"s",
"to",
"the",
"stream",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L469-L477 | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"comptype",
"==",
"\"gz\"",
":",
"self",
".",
"crc",
"=",
"self",
".",
"zlib",
".",
"crc32",
"(",
"s",
",",
"self",
".",
"crc",
")",
"self",
".",
"pos",
"+=",
"len",
"(",
"s"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream.__write | Write string s to the stream if a whole new block
is ready to be written. | pipenv/vendor/distlib/_backport/tarfile.py | def __write(self, s):
"""Write string s to the stream if a whole new block
is ready to be written.
"""
self.buf += s
while len(self.buf) > self.bufsize:
self.fileobj.write(self.buf[:self.bufsize])
self.buf = self.buf[self.bufsize:] | def __write(self, s):
"""Write string s to the stream if a whole new block
is ready to be written.
"""
self.buf += s
while len(self.buf) > self.bufsize:
self.fileobj.write(self.buf[:self.bufsize])
self.buf = self.buf[self.bufsize:] | [
"Write",
"string",
"s",
"to",
"the",
"stream",
"if",
"a",
"whole",
"new",
"block",
"is",
"ready",
"to",
"be",
"written",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L479-L486 | [
"def",
"__write",
"(",
"self",
",",
"s",
")",
":",
"self",
".",
"buf",
"+=",
"s",
"while",
"len",
"(",
"self",
".",
"buf",
")",
">",
"self",
".",
"bufsize",
":",
"self",
".",
"fileobj",
".",
"write",
"(",
"self",
".",
"buf",
"[",
":",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream.close | Close the _Stream object. No operation should be
done on it afterwards. | pipenv/vendor/distlib/_backport/tarfile.py | def close(self):
"""Close the _Stream object. No operation should be
done on it afterwards.
"""
if self.closed:
return
if self.mode == "w" and self.comptype != "tar":
self.buf += self.cmp.flush()
if self.mode == "w" and self.buf:
s... | def close(self):
"""Close the _Stream object. No operation should be
done on it afterwards.
"""
if self.closed:
return
if self.mode == "w" and self.comptype != "tar":
self.buf += self.cmp.flush()
if self.mode == "w" and self.buf:
s... | [
"Close",
"the",
"_Stream",
"object",
".",
"No",
"operation",
"should",
"be",
"done",
"on",
"it",
"afterwards",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L488-L514 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"return",
"if",
"self",
".",
"mode",
"==",
"\"w\"",
"and",
"self",
".",
"comptype",
"!=",
"\"tar\"",
":",
"self",
".",
"buf",
"+=",
"self",
".",
"cmp",
".",
"flush",
"(",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream._init_read_gz | Initialize for reading a gzip compressed fileobj. | pipenv/vendor/distlib/_backport/tarfile.py | def _init_read_gz(self):
"""Initialize for reading a gzip compressed fileobj.
"""
self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS)
self.dbuf = b""
# taken from gzip.GzipFile with some alterations
if self.__read(2) != b"\037\213":
raise ReadError("not ... | def _init_read_gz(self):
"""Initialize for reading a gzip compressed fileobj.
"""
self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS)
self.dbuf = b""
# taken from gzip.GzipFile with some alterations
if self.__read(2) != b"\037\213":
raise ReadError("not ... | [
"Initialize",
"for",
"reading",
"a",
"gzip",
"compressed",
"fileobj",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L516-L545 | [
"def",
"_init_read_gz",
"(",
"self",
")",
":",
"self",
".",
"cmp",
"=",
"self",
".",
"zlib",
".",
"decompressobj",
"(",
"-",
"self",
".",
"zlib",
".",
"MAX_WBITS",
")",
"self",
".",
"dbuf",
"=",
"b\"\"",
"# taken from gzip.GzipFile with some alterations",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream.seek | Set the stream's file pointer to pos. Negative seeking
is forbidden. | pipenv/vendor/distlib/_backport/tarfile.py | def seek(self, pos=0):
"""Set the stream's file pointer to pos. Negative seeking
is forbidden.
"""
if pos - self.pos >= 0:
blocks, remainder = divmod(pos - self.pos, self.bufsize)
for i in range(blocks):
self.read(self.bufsize)
self.... | def seek(self, pos=0):
"""Set the stream's file pointer to pos. Negative seeking
is forbidden.
"""
if pos - self.pos >= 0:
blocks, remainder = divmod(pos - self.pos, self.bufsize)
for i in range(blocks):
self.read(self.bufsize)
self.... | [
"Set",
"the",
"stream",
"s",
"file",
"pointer",
"to",
"pos",
".",
"Negative",
"seeking",
"is",
"forbidden",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L552-L563 | [
"def",
"seek",
"(",
"self",
",",
"pos",
"=",
"0",
")",
":",
"if",
"pos",
"-",
"self",
".",
"pos",
">=",
"0",
":",
"blocks",
",",
"remainder",
"=",
"divmod",
"(",
"pos",
"-",
"self",
".",
"pos",
",",
"self",
".",
"bufsize",
")",
"for",
"i",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream.read | Return the next size number of bytes from the stream.
If size is not defined, return all bytes of the stream
up to EOF. | pipenv/vendor/distlib/_backport/tarfile.py | def read(self, size=None):
"""Return the next size number of bytes from the stream.
If size is not defined, return all bytes of the stream
up to EOF.
"""
if size is None:
t = []
while True:
buf = self._read(self.bufsize)
... | def read(self, size=None):
"""Return the next size number of bytes from the stream.
If size is not defined, return all bytes of the stream
up to EOF.
"""
if size is None:
t = []
while True:
buf = self._read(self.bufsize)
... | [
"Return",
"the",
"next",
"size",
"number",
"of",
"bytes",
"from",
"the",
"stream",
".",
"If",
"size",
"is",
"not",
"defined",
"return",
"all",
"bytes",
"of",
"the",
"stream",
"up",
"to",
"EOF",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L565-L581 | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"size",
"is",
"None",
":",
"t",
"=",
"[",
"]",
"while",
"True",
":",
"buf",
"=",
"self",
".",
"_read",
"(",
"self",
".",
"bufsize",
")",
"if",
"not",
"buf",
":",
"break",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream._read | Return size bytes from the stream. | pipenv/vendor/distlib/_backport/tarfile.py | def _read(self, size):
"""Return size bytes from the stream.
"""
if self.comptype == "tar":
return self.__read(size)
c = len(self.dbuf)
while c < size:
buf = self.__read(self.bufsize)
if not buf:
break
try:
... | def _read(self, size):
"""Return size bytes from the stream.
"""
if self.comptype == "tar":
return self.__read(size)
c = len(self.dbuf)
while c < size:
buf = self.__read(self.bufsize)
if not buf:
break
try:
... | [
"Return",
"size",
"bytes",
"from",
"the",
"stream",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L583-L602 | [
"def",
"_read",
"(",
"self",
",",
"size",
")",
":",
"if",
"self",
".",
"comptype",
"==",
"\"tar\"",
":",
"return",
"self",
".",
"__read",
"(",
"size",
")",
"c",
"=",
"len",
"(",
"self",
".",
"dbuf",
")",
"while",
"c",
"<",
"size",
":",
"buf",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _Stream.__read | Return size bytes from stream. If internal buffer is empty,
read another block from the stream. | pipenv/vendor/distlib/_backport/tarfile.py | def __read(self, size):
"""Return size bytes from stream. If internal buffer is empty,
read another block from the stream.
"""
c = len(self.buf)
while c < size:
buf = self.fileobj.read(self.bufsize)
if not buf:
break
self.buf... | def __read(self, size):
"""Return size bytes from stream. If internal buffer is empty,
read another block from the stream.
"""
c = len(self.buf)
while c < size:
buf = self.fileobj.read(self.bufsize)
if not buf:
break
self.buf... | [
"Return",
"size",
"bytes",
"from",
"stream",
".",
"If",
"internal",
"buffer",
"is",
"empty",
"read",
"another",
"block",
"from",
"the",
"stream",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L604-L617 | [
"def",
"__read",
"(",
"self",
",",
"size",
")",
":",
"c",
"=",
"len",
"(",
"self",
".",
"buf",
")",
"while",
"c",
"<",
"size",
":",
"buf",
"=",
"self",
".",
"fileobj",
".",
"read",
"(",
"self",
".",
"bufsize",
")",
"if",
"not",
"buf",
":",
"b... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _FileInFile.read | Read data from the file. | pipenv/vendor/distlib/_backport/tarfile.py | def read(self, size=None):
"""Read data from the file.
"""
if size is None:
size = self.size - self.position
else:
size = min(size, self.size - self.position)
buf = b""
while size > 0:
while True:
data, start, stop, off... | def read(self, size=None):
"""Read data from the file.
"""
if size is None:
size = self.size - self.position
else:
size = min(size, self.size - self.position)
buf = b""
while size > 0:
while True:
data, start, stop, off... | [
"Read",
"data",
"from",
"the",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L752-L778 | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"size",
"is",
"None",
":",
"size",
"=",
"self",
".",
"size",
"-",
"self",
".",
"position",
"else",
":",
"size",
"=",
"min",
"(",
"size",
",",
"self",
".",
"size",
"-",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ExFileObject.read | Read at most size bytes from the file. If size is not
present or None, read all data until EOF is reached. | pipenv/vendor/distlib/_backport/tarfile.py | def read(self, size=None):
"""Read at most size bytes from the file. If size is not
present or None, read all data until EOF is reached.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
buf = b""
if self.buffer:
if size is N... | def read(self, size=None):
"""Read at most size bytes from the file. If size is not
present or None, read all data until EOF is reached.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
buf = b""
if self.buffer:
if size is N... | [
"Read",
"at",
"most",
"size",
"bytes",
"from",
"the",
"file",
".",
"If",
"size",
"is",
"not",
"present",
"or",
"None",
"read",
"all",
"data",
"until",
"EOF",
"is",
"reached",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L810-L832 | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"I/O operation on closed file\"",
")",
"buf",
"=",
"b\"\"",
"if",
"self",
".",
"buffer",
":",
"if",
"size",
"is",
"None",
":... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ExFileObject.readline | Read one entire line from the file. If size is present
and non-negative, return a string with at most that
size, which may be an incomplete line. | pipenv/vendor/distlib/_backport/tarfile.py | def readline(self, size=-1):
"""Read one entire line from the file. If size is present
and non-negative, return a string with at most that
size, which may be an incomplete line.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
pos = ... | def readline(self, size=-1):
"""Read one entire line from the file. If size is present
and non-negative, return a string with at most that
size, which may be an incomplete line.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
pos = ... | [
"Read",
"one",
"entire",
"line",
"from",
"the",
"file",
".",
"If",
"size",
"is",
"present",
"and",
"non",
"-",
"negative",
"return",
"a",
"string",
"with",
"at",
"most",
"that",
"size",
"which",
"may",
"be",
"an",
"incomplete",
"line",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L837-L864 | [
"def",
"readline",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"I/O operation on closed file\"",
")",
"pos",
"=",
"self",
".",
"buffer",
".",
"find",
"(",
"b\"\\n\"",
")",
"+",
"1",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ExFileObject.seek | Seek to a position in the file. | pipenv/vendor/distlib/_backport/tarfile.py | def seek(self, pos, whence=os.SEEK_SET):
"""Seek to a position in the file.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
if whence == os.SEEK_SET:
self.position = min(max(pos, 0), self.size)
elif whence == os.SEEK_CUR:
... | def seek(self, pos, whence=os.SEEK_SET):
"""Seek to a position in the file.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
if whence == os.SEEK_SET:
self.position = min(max(pos, 0), self.size)
elif whence == os.SEEK_CUR:
... | [
"Seek",
"to",
"a",
"position",
"in",
"the",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L884-L903 | [
"def",
"seek",
"(",
"self",
",",
"pos",
",",
"whence",
"=",
"os",
".",
"SEEK_SET",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"I/O operation on closed file\"",
")",
"if",
"whence",
"==",
"os",
".",
"SEEK_SET",
":",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.get_info | Return the TarInfo's attributes as a dictionary. | pipenv/vendor/distlib/_backport/tarfile.py | def get_info(self):
"""Return the TarInfo's attributes as a dictionary.
"""
info = {
"name": self.name,
"mode": self.mode & 0o7777,
"uid": self.uid,
"gid": self.gid,
"size": self.size,
"mtime": self.... | def get_info(self):
"""Return the TarInfo's attributes as a dictionary.
"""
info = {
"name": self.name,
"mode": self.mode & 0o7777,
"uid": self.uid,
"gid": self.gid,
"size": self.size,
"mtime": self.... | [
"Return",
"the",
"TarInfo",
"s",
"attributes",
"as",
"a",
"dictionary",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L978-L1000 | [
"def",
"get_info",
"(",
"self",
")",
":",
"info",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"mode\"",
":",
"self",
".",
"mode",
"&",
"0o7777",
",",
"\"uid\"",
":",
"self",
".",
"uid",
",",
"\"gid\"",
":",
"self",
".",
"gid",
",",
"\"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.tobuf | Return a tar header as a string of 512 byte blocks. | pipenv/vendor/distlib/_backport/tarfile.py | def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"):
"""Return a tar header as a string of 512 byte blocks.
"""
info = self.get_info()
if format == USTAR_FORMAT:
return self.create_ustar_header(info, encoding, errors)
elif format == GN... | def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"):
"""Return a tar header as a string of 512 byte blocks.
"""
info = self.get_info()
if format == USTAR_FORMAT:
return self.create_ustar_header(info, encoding, errors)
elif format == GN... | [
"Return",
"a",
"tar",
"header",
"as",
"a",
"string",
"of",
"512",
"byte",
"blocks",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1002-L1014 | [
"def",
"tobuf",
"(",
"self",
",",
"format",
"=",
"DEFAULT_FORMAT",
",",
"encoding",
"=",
"ENCODING",
",",
"errors",
"=",
"\"surrogateescape\"",
")",
":",
"info",
"=",
"self",
".",
"get_info",
"(",
")",
"if",
"format",
"==",
"USTAR_FORMAT",
":",
"return",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.create_ustar_header | Return the object as a ustar header block. | pipenv/vendor/distlib/_backport/tarfile.py | def create_ustar_header(self, info, encoding, errors):
"""Return the object as a ustar header block.
"""
info["magic"] = POSIX_MAGIC
if len(info["linkname"]) > LENGTH_LINK:
raise ValueError("linkname is too long")
if len(info["name"]) > LENGTH_NAME:
info... | def create_ustar_header(self, info, encoding, errors):
"""Return the object as a ustar header block.
"""
info["magic"] = POSIX_MAGIC
if len(info["linkname"]) > LENGTH_LINK:
raise ValueError("linkname is too long")
if len(info["name"]) > LENGTH_NAME:
info... | [
"Return",
"the",
"object",
"as",
"a",
"ustar",
"header",
"block",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1016-L1027 | [
"def",
"create_ustar_header",
"(",
"self",
",",
"info",
",",
"encoding",
",",
"errors",
")",
":",
"info",
"[",
"\"magic\"",
"]",
"=",
"POSIX_MAGIC",
"if",
"len",
"(",
"info",
"[",
"\"linkname\"",
"]",
")",
">",
"LENGTH_LINK",
":",
"raise",
"ValueError",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.create_gnu_header | Return the object as a GNU header block sequence. | pipenv/vendor/distlib/_backport/tarfile.py | def create_gnu_header(self, info, encoding, errors):
"""Return the object as a GNU header block sequence.
"""
info["magic"] = GNU_MAGIC
buf = b""
if len(info["linkname"]) > LENGTH_LINK:
buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding,... | def create_gnu_header(self, info, encoding, errors):
"""Return the object as a GNU header block sequence.
"""
info["magic"] = GNU_MAGIC
buf = b""
if len(info["linkname"]) > LENGTH_LINK:
buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding,... | [
"Return",
"the",
"object",
"as",
"a",
"GNU",
"header",
"block",
"sequence",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1029-L1041 | [
"def",
"create_gnu_header",
"(",
"self",
",",
"info",
",",
"encoding",
",",
"errors",
")",
":",
"info",
"[",
"\"magic\"",
"]",
"=",
"GNU_MAGIC",
"buf",
"=",
"b\"\"",
"if",
"len",
"(",
"info",
"[",
"\"linkname\"",
"]",
")",
">",
"LENGTH_LINK",
":",
"buf... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.create_pax_header | Return the object as a ustar header block. If it cannot be
represented this way, prepend a pax extended header sequence
with supplement information. | pipenv/vendor/distlib/_backport/tarfile.py | def create_pax_header(self, info, encoding):
"""Return the object as a ustar header block. If it cannot be
represented this way, prepend a pax extended header sequence
with supplement information.
"""
info["magic"] = POSIX_MAGIC
pax_headers = self.pax_headers.copy()... | def create_pax_header(self, info, encoding):
"""Return the object as a ustar header block. If it cannot be
represented this way, prepend a pax extended header sequence
with supplement information.
"""
info["magic"] = POSIX_MAGIC
pax_headers = self.pax_headers.copy()... | [
"Return",
"the",
"object",
"as",
"a",
"ustar",
"header",
"block",
".",
"If",
"it",
"cannot",
"be",
"represented",
"this",
"way",
"prepend",
"a",
"pax",
"extended",
"header",
"sequence",
"with",
"supplement",
"information",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1043-L1090 | [
"def",
"create_pax_header",
"(",
"self",
",",
"info",
",",
"encoding",
")",
":",
"info",
"[",
"\"magic\"",
"]",
"=",
"POSIX_MAGIC",
"pax_headers",
"=",
"self",
".",
"pax_headers",
".",
"copy",
"(",
")",
"# Test string fields for values that exceed the field length o... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._posix_split_name | Split a name longer than 100 chars into a prefix
and a name part. | pipenv/vendor/distlib/_backport/tarfile.py | def _posix_split_name(self, name):
"""Split a name longer than 100 chars into a prefix
and a name part.
"""
prefix = name[:LENGTH_PREFIX + 1]
while prefix and prefix[-1] != "/":
prefix = prefix[:-1]
name = name[len(prefix):]
prefix = prefix[:-1]
... | def _posix_split_name(self, name):
"""Split a name longer than 100 chars into a prefix
and a name part.
"""
prefix = name[:LENGTH_PREFIX + 1]
while prefix and prefix[-1] != "/":
prefix = prefix[:-1]
name = name[len(prefix):]
prefix = prefix[:-1]
... | [
"Split",
"a",
"name",
"longer",
"than",
"100",
"chars",
"into",
"a",
"prefix",
"and",
"a",
"name",
"part",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1098-L1111 | [
"def",
"_posix_split_name",
"(",
"self",
",",
"name",
")",
":",
"prefix",
"=",
"name",
"[",
":",
"LENGTH_PREFIX",
"+",
"1",
"]",
"while",
"prefix",
"and",
"prefix",
"[",
"-",
"1",
"]",
"!=",
"\"/\"",
":",
"prefix",
"=",
"prefix",
"[",
":",
"-",
"1"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._create_header | Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants. | pipenv/vendor/distlib/_backport/tarfile.py | def _create_header(info, format, encoding, errors):
"""Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants.
"""
parts = [
stn(info.get("name", ""), 100, encoding, errors),
itn(info.get("mode", 0) & 0o7... | def _create_header(info, format, encoding, errors):
"""Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants.
"""
parts = [
stn(info.get("name", ""), 100, encoding, errors),
itn(info.get("mode", 0) & 0o7... | [
"Return",
"a",
"header",
"block",
".",
"info",
"is",
"a",
"dictionary",
"with",
"file",
"information",
"format",
"must",
"be",
"one",
"of",
"the",
"*",
"_FORMAT",
"constants",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1114-L1139 | [
"def",
"_create_header",
"(",
"info",
",",
"format",
",",
"encoding",
",",
"errors",
")",
":",
"parts",
"=",
"[",
"stn",
"(",
"info",
".",
"get",
"(",
"\"name\"",
",",
"\"\"",
")",
",",
"100",
",",
"encoding",
",",
"errors",
")",
",",
"itn",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._create_payload | Return the string payload filled with zero bytes
up to the next 512 byte border. | pipenv/vendor/distlib/_backport/tarfile.py | def _create_payload(payload):
"""Return the string payload filled with zero bytes
up to the next 512 byte border.
"""
blocks, remainder = divmod(len(payload), BLOCKSIZE)
if remainder > 0:
payload += (BLOCKSIZE - remainder) * NUL
return payload | def _create_payload(payload):
"""Return the string payload filled with zero bytes
up to the next 512 byte border.
"""
blocks, remainder = divmod(len(payload), BLOCKSIZE)
if remainder > 0:
payload += (BLOCKSIZE - remainder) * NUL
return payload | [
"Return",
"the",
"string",
"payload",
"filled",
"with",
"zero",
"bytes",
"up",
"to",
"the",
"next",
"512",
"byte",
"border",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1142-L1149 | [
"def",
"_create_payload",
"(",
"payload",
")",
":",
"blocks",
",",
"remainder",
"=",
"divmod",
"(",
"len",
"(",
"payload",
")",
",",
"BLOCKSIZE",
")",
"if",
"remainder",
">",
"0",
":",
"payload",
"+=",
"(",
"BLOCKSIZE",
"-",
"remainder",
")",
"*",
"NUL... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._create_gnu_long_header | Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
for name. | pipenv/vendor/distlib/_backport/tarfile.py | def _create_gnu_long_header(cls, name, type, encoding, errors):
"""Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
for name.
"""
name = name.encode(encoding, errors) + NUL
info = {}
info["name"] = "././@LongLink"
info["type"] = type
info["size"]... | def _create_gnu_long_header(cls, name, type, encoding, errors):
"""Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
for name.
"""
name = name.encode(encoding, errors) + NUL
info = {}
info["name"] = "././@LongLink"
info["type"] = type
info["size"]... | [
"Return",
"a",
"GNUTYPE_LONGNAME",
"or",
"GNUTYPE_LONGLINK",
"sequence",
"for",
"name",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1152-L1166 | [
"def",
"_create_gnu_long_header",
"(",
"cls",
",",
"name",
",",
"type",
",",
"encoding",
",",
"errors",
")",
":",
"name",
"=",
"name",
".",
"encode",
"(",
"encoding",
",",
"errors",
")",
"+",
"NUL",
"info",
"=",
"{",
"}",
"info",
"[",
"\"name\"",
"]"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._create_pax_generic_header | Return a POSIX.1-2008 extended or global header sequence
that contains a list of keyword, value pairs. The values
must be strings. | pipenv/vendor/distlib/_backport/tarfile.py | def _create_pax_generic_header(cls, pax_headers, type, encoding):
"""Return a POSIX.1-2008 extended or global header sequence
that contains a list of keyword, value pairs. The values
must be strings.
"""
# Check if one of the fields contains surrogate characters and thereby... | def _create_pax_generic_header(cls, pax_headers, type, encoding):
"""Return a POSIX.1-2008 extended or global header sequence
that contains a list of keyword, value pairs. The values
must be strings.
"""
# Check if one of the fields contains surrogate characters and thereby... | [
"Return",
"a",
"POSIX",
".",
"1",
"-",
"2008",
"extended",
"or",
"global",
"header",
"sequence",
"that",
"contains",
"a",
"list",
"of",
"keyword",
"value",
"pairs",
".",
"The",
"values",
"must",
"be",
"strings",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1169-L1217 | [
"def",
"_create_pax_generic_header",
"(",
"cls",
",",
"pax_headers",
",",
"type",
",",
"encoding",
")",
":",
"# Check if one of the fields contains surrogate characters and thereby",
"# forces hdrcharset=BINARY, see _proc_pax() for more information.",
"binary",
"=",
"False",
"for",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.frombuf | Construct a TarInfo object from a 512 byte bytes object. | pipenv/vendor/distlib/_backport/tarfile.py | def frombuf(cls, buf, encoding, errors):
"""Construct a TarInfo object from a 512 byte bytes object.
"""
if len(buf) == 0:
raise EmptyHeaderError("empty header")
if len(buf) != BLOCKSIZE:
raise TruncatedHeaderError("truncated header")
if buf.count(NUL) == ... | def frombuf(cls, buf, encoding, errors):
"""Construct a TarInfo object from a 512 byte bytes object.
"""
if len(buf) == 0:
raise EmptyHeaderError("empty header")
if len(buf) != BLOCKSIZE:
raise TruncatedHeaderError("truncated header")
if buf.count(NUL) == ... | [
"Construct",
"a",
"TarInfo",
"object",
"from",
"a",
"512",
"byte",
"bytes",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1220-L1280 | [
"def",
"frombuf",
"(",
"cls",
",",
"buf",
",",
"encoding",
",",
"errors",
")",
":",
"if",
"len",
"(",
"buf",
")",
"==",
"0",
":",
"raise",
"EmptyHeaderError",
"(",
"\"empty header\"",
")",
"if",
"len",
"(",
"buf",
")",
"!=",
"BLOCKSIZE",
":",
"raise"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo.fromtarfile | Return the next TarInfo object from TarFile object
tarfile. | pipenv/vendor/distlib/_backport/tarfile.py | def fromtarfile(cls, tarfile):
"""Return the next TarInfo object from TarFile object
tarfile.
"""
buf = tarfile.fileobj.read(BLOCKSIZE)
obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
return obj._proc_mem... | def fromtarfile(cls, tarfile):
"""Return the next TarInfo object from TarFile object
tarfile.
"""
buf = tarfile.fileobj.read(BLOCKSIZE)
obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
return obj._proc_mem... | [
"Return",
"the",
"next",
"TarInfo",
"object",
"from",
"TarFile",
"object",
"tarfile",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1283-L1290 | [
"def",
"fromtarfile",
"(",
"cls",
",",
"tarfile",
")",
":",
"buf",
"=",
"tarfile",
".",
"fileobj",
".",
"read",
"(",
"BLOCKSIZE",
")",
"obj",
"=",
"cls",
".",
"frombuf",
"(",
"buf",
",",
"tarfile",
".",
"encoding",
",",
"tarfile",
".",
"errors",
")",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_member | Choose the right processing method depending on
the type and call it. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_member(self, tarfile):
"""Choose the right processing method depending on
the type and call it.
"""
if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK):
return self._proc_gnulong(tarfile)
elif self.type == GNUTYPE_SPARSE:
return self._proc_sp... | def _proc_member(self, tarfile):
"""Choose the right processing method depending on
the type and call it.
"""
if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK):
return self._proc_gnulong(tarfile)
elif self.type == GNUTYPE_SPARSE:
return self._proc_sp... | [
"Choose",
"the",
"right",
"processing",
"method",
"depending",
"on",
"the",
"type",
"and",
"call",
"it",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1303-L1314 | [
"def",
"_proc_member",
"(",
"self",
",",
"tarfile",
")",
":",
"if",
"self",
".",
"type",
"in",
"(",
"GNUTYPE_LONGNAME",
",",
"GNUTYPE_LONGLINK",
")",
":",
"return",
"self",
".",
"_proc_gnulong",
"(",
"tarfile",
")",
"elif",
"self",
".",
"type",
"==",
"GN... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_builtin | Process a builtin type or an unknown type which
will be treated as a regular file. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_builtin(self, tarfile):
"""Process a builtin type or an unknown type which
will be treated as a regular file.
"""
self.offset_data = tarfile.fileobj.tell()
offset = self.offset_data
if self.isreg() or self.type not in SUPPORTED_TYPES:
# Skip the f... | def _proc_builtin(self, tarfile):
"""Process a builtin type or an unknown type which
will be treated as a regular file.
"""
self.offset_data = tarfile.fileobj.tell()
offset = self.offset_data
if self.isreg() or self.type not in SUPPORTED_TYPES:
# Skip the f... | [
"Process",
"a",
"builtin",
"type",
"or",
"an",
"unknown",
"type",
"which",
"will",
"be",
"treated",
"as",
"a",
"regular",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1316-L1331 | [
"def",
"_proc_builtin",
"(",
"self",
",",
"tarfile",
")",
":",
"self",
".",
"offset_data",
"=",
"tarfile",
".",
"fileobj",
".",
"tell",
"(",
")",
"offset",
"=",
"self",
".",
"offset_data",
"if",
"self",
".",
"isreg",
"(",
")",
"or",
"self",
".",
"typ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_gnulong | Process the blocks that hold a GNU longname
or longlink member. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_gnulong(self, tarfile):
"""Process the blocks that hold a GNU longname
or longlink member.
"""
buf = tarfile.fileobj.read(self._block(self.size))
# Fetch the next header and process it.
try:
next = self.fromtarfile(tarfile)
except HeaderE... | def _proc_gnulong(self, tarfile):
"""Process the blocks that hold a GNU longname
or longlink member.
"""
buf = tarfile.fileobj.read(self._block(self.size))
# Fetch the next header and process it.
try:
next = self.fromtarfile(tarfile)
except HeaderE... | [
"Process",
"the",
"blocks",
"that",
"hold",
"a",
"GNU",
"longname",
"or",
"longlink",
"member",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1333-L1353 | [
"def",
"_proc_gnulong",
"(",
"self",
",",
"tarfile",
")",
":",
"buf",
"=",
"tarfile",
".",
"fileobj",
".",
"read",
"(",
"self",
".",
"_block",
"(",
"self",
".",
"size",
")",
")",
"# Fetch the next header and process it.",
"try",
":",
"next",
"=",
"self",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_sparse | Process a GNU sparse header plus extra headers. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_sparse(self, tarfile):
"""Process a GNU sparse header plus extra headers.
"""
# We already collected some sparse structures in frombuf().
structs, isextended, origsize = self._sparse_structs
del self._sparse_structs
# Collect sparse structures from extended hea... | def _proc_sparse(self, tarfile):
"""Process a GNU sparse header plus extra headers.
"""
# We already collected some sparse structures in frombuf().
structs, isextended, origsize = self._sparse_structs
del self._sparse_structs
# Collect sparse structures from extended hea... | [
"Process",
"a",
"GNU",
"sparse",
"header",
"plus",
"extra",
"headers",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1355-L1381 | [
"def",
"_proc_sparse",
"(",
"self",
",",
"tarfile",
")",
":",
"# We already collected some sparse structures in frombuf().",
"structs",
",",
"isextended",
",",
"origsize",
"=",
"self",
".",
"_sparse_structs",
"del",
"self",
".",
"_sparse_structs",
"# Collect sparse struct... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_pax | Process an extended or global header as described in
POSIX.1-2008. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_pax(self, tarfile):
"""Process an extended or global header as described in
POSIX.1-2008.
"""
# Read the header information.
buf = tarfile.fileobj.read(self._block(self.size))
# A pax header stores supplemental information for either
# the following ... | def _proc_pax(self, tarfile):
"""Process an extended or global header as described in
POSIX.1-2008.
"""
# Read the header information.
buf = tarfile.fileobj.read(self._block(self.size))
# A pax header stores supplemental information for either
# the following ... | [
"Process",
"an",
"extended",
"or",
"global",
"header",
"as",
"described",
"in",
"POSIX",
".",
"1",
"-",
"2008",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1383-L1483 | [
"def",
"_proc_pax",
"(",
"self",
",",
"tarfile",
")",
":",
"# Read the header information.",
"buf",
"=",
"tarfile",
".",
"fileobj",
".",
"read",
"(",
"self",
".",
"_block",
"(",
"self",
".",
"size",
")",
")",
"# A pax header stores supplemental information for eit... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_gnusparse_00 | Process a GNU tar extended sparse header, version 0.0. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_gnusparse_00(self, next, pax_headers, buf):
"""Process a GNU tar extended sparse header, version 0.0.
"""
offsets = []
for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf):
offsets.append(int(match.group(1)))
numbytes = []
for match in re... | def _proc_gnusparse_00(self, next, pax_headers, buf):
"""Process a GNU tar extended sparse header, version 0.0.
"""
offsets = []
for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf):
offsets.append(int(match.group(1)))
numbytes = []
for match in re... | [
"Process",
"a",
"GNU",
"tar",
"extended",
"sparse",
"header",
"version",
"0",
".",
"0",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1485-L1494 | [
"def",
"_proc_gnusparse_00",
"(",
"self",
",",
"next",
",",
"pax_headers",
",",
"buf",
")",
":",
"offsets",
"=",
"[",
"]",
"for",
"match",
"in",
"re",
".",
"finditer",
"(",
"br\"\\d+ GNU.sparse.offset=(\\d+)\\n\"",
",",
"buf",
")",
":",
"offsets",
".",
"ap... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_gnusparse_01 | Process a GNU tar extended sparse header, version 0.1. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_gnusparse_01(self, next, pax_headers):
"""Process a GNU tar extended sparse header, version 0.1.
"""
sparse = [int(x) for x in pax_headers["GNU.sparse.map"].split(",")]
next.sparse = list(zip(sparse[::2], sparse[1::2])) | def _proc_gnusparse_01(self, next, pax_headers):
"""Process a GNU tar extended sparse header, version 0.1.
"""
sparse = [int(x) for x in pax_headers["GNU.sparse.map"].split(",")]
next.sparse = list(zip(sparse[::2], sparse[1::2])) | [
"Process",
"a",
"GNU",
"tar",
"extended",
"sparse",
"header",
"version",
"0",
".",
"1",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1496-L1500 | [
"def",
"_proc_gnusparse_01",
"(",
"self",
",",
"next",
",",
"pax_headers",
")",
":",
"sparse",
"=",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"pax_headers",
"[",
"\"GNU.sparse.map\"",
"]",
".",
"split",
"(",
"\",\"",
")",
"]",
"next",
".",
"sparse",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._proc_gnusparse_10 | Process a GNU tar extended sparse header, version 1.0. | pipenv/vendor/distlib/_backport/tarfile.py | def _proc_gnusparse_10(self, next, pax_headers, tarfile):
"""Process a GNU tar extended sparse header, version 1.0.
"""
fields = None
sparse = []
buf = tarfile.fileobj.read(BLOCKSIZE)
fields, buf = buf.split(b"\n", 1)
fields = int(fields)
while len(sparse)... | def _proc_gnusparse_10(self, next, pax_headers, tarfile):
"""Process a GNU tar extended sparse header, version 1.0.
"""
fields = None
sparse = []
buf = tarfile.fileobj.read(BLOCKSIZE)
fields, buf = buf.split(b"\n", 1)
fields = int(fields)
while len(sparse)... | [
"Process",
"a",
"GNU",
"tar",
"extended",
"sparse",
"header",
"version",
"1",
".",
"0",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1502-L1516 | [
"def",
"_proc_gnusparse_10",
"(",
"self",
",",
"next",
",",
"pax_headers",
",",
"tarfile",
")",
":",
"fields",
"=",
"None",
"sparse",
"=",
"[",
"]",
"buf",
"=",
"tarfile",
".",
"fileobj",
".",
"read",
"(",
"BLOCKSIZE",
")",
"fields",
",",
"buf",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._apply_pax_info | Replace fields with supplemental information from a previous
pax extended or global header. | pipenv/vendor/distlib/_backport/tarfile.py | def _apply_pax_info(self, pax_headers, encoding, errors):
"""Replace fields with supplemental information from a previous
pax extended or global header.
"""
for keyword, value in pax_headers.items():
if keyword == "GNU.sparse.name":
setattr(self, "path", va... | def _apply_pax_info(self, pax_headers, encoding, errors):
"""Replace fields with supplemental information from a previous
pax extended or global header.
"""
for keyword, value in pax_headers.items():
if keyword == "GNU.sparse.name":
setattr(self, "path", va... | [
"Replace",
"fields",
"with",
"supplemental",
"information",
"from",
"a",
"previous",
"pax",
"extended",
"or",
"global",
"header",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1518-L1539 | [
"def",
"_apply_pax_info",
"(",
"self",
",",
"pax_headers",
",",
"encoding",
",",
"errors",
")",
":",
"for",
"keyword",
",",
"value",
"in",
"pax_headers",
".",
"items",
"(",
")",
":",
"if",
"keyword",
"==",
"\"GNU.sparse.name\"",
":",
"setattr",
"(",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._decode_pax_field | Decode a single field from a pax record. | pipenv/vendor/distlib/_backport/tarfile.py | def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors):
"""Decode a single field from a pax record.
"""
try:
return value.decode(encoding, "strict")
except UnicodeDecodeError:
return value.decode(fallback_encoding, fallback_errors) | def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors):
"""Decode a single field from a pax record.
"""
try:
return value.decode(encoding, "strict")
except UnicodeDecodeError:
return value.decode(fallback_encoding, fallback_errors) | [
"Decode",
"a",
"single",
"field",
"from",
"a",
"pax",
"record",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1541-L1547 | [
"def",
"_decode_pax_field",
"(",
"self",
",",
"value",
",",
"encoding",
",",
"fallback_encoding",
",",
"fallback_errors",
")",
":",
"try",
":",
"return",
"value",
".",
"decode",
"(",
"encoding",
",",
"\"strict\"",
")",
"except",
"UnicodeDecodeError",
":",
"ret... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarInfo._block | Round up a byte count by BLOCKSIZE and return it,
e.g. _block(834) => 1024. | pipenv/vendor/distlib/_backport/tarfile.py | def _block(self, count):
"""Round up a byte count by BLOCKSIZE and return it,
e.g. _block(834) => 1024.
"""
blocks, remainder = divmod(count, BLOCKSIZE)
if remainder:
blocks += 1
return blocks * BLOCKSIZE | def _block(self, count):
"""Round up a byte count by BLOCKSIZE and return it,
e.g. _block(834) => 1024.
"""
blocks, remainder = divmod(count, BLOCKSIZE)
if remainder:
blocks += 1
return blocks * BLOCKSIZE | [
"Round",
"up",
"a",
"byte",
"count",
"by",
"BLOCKSIZE",
"and",
"return",
"it",
"e",
".",
"g",
".",
"_block",
"(",
"834",
")",
"=",
">",
"1024",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1549-L1556 | [
"def",
"_block",
"(",
"self",
",",
"count",
")",
":",
"blocks",
",",
"remainder",
"=",
"divmod",
"(",
"count",
",",
"BLOCKSIZE",
")",
"if",
"remainder",
":",
"blocks",
"+=",
"1",
"return",
"blocks",
"*",
"BLOCKSIZE"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.open | Open a tar archive for reading, writing or appending. Return
an appropriate TarFile class.
mode:
'r' or 'r:*' open for reading with transparent compression
'r:' open for reading exclusively uncompressed
'r:gz' open for reading with gzip compression
... | pipenv/vendor/distlib/_backport/tarfile.py | def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
"""Open a tar archive for reading, writing or appending. Return
an appropriate TarFile class.
mode:
'r' or 'r:*' open for reading with transparent compression
'r:' open for readin... | def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
"""Open a tar archive for reading, writing or appending. Return
an appropriate TarFile class.
mode:
'r' or 'r:*' open for reading with transparent compression
'r:' open for readin... | [
"Open",
"a",
"tar",
"archive",
"for",
"reading",
"writing",
"or",
"appending",
".",
"Return",
"an",
"appropriate",
"TarFile",
"class",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1714-L1787 | [
"def",
"open",
"(",
"cls",
",",
"name",
"=",
"None",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"bufsize",
"=",
"RECORDSIZE",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"name",
"and",
"not",
"fileobj",
":",
"raise",
"ValueErr... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.taropen | Open uncompressed tar archive name for reading or writing. | pipenv/vendor/distlib/_backport/tarfile.py | def taropen(cls, name, mode="r", fileobj=None, **kwargs):
"""Open uncompressed tar archive name for reading or writing.
"""
if len(mode) > 1 or mode not in "raw":
raise ValueError("mode must be 'r', 'a' or 'w'")
return cls(name, mode, fileobj, **kwargs) | def taropen(cls, name, mode="r", fileobj=None, **kwargs):
"""Open uncompressed tar archive name for reading or writing.
"""
if len(mode) > 1 or mode not in "raw":
raise ValueError("mode must be 'r', 'a' or 'w'")
return cls(name, mode, fileobj, **kwargs) | [
"Open",
"uncompressed",
"tar",
"archive",
"name",
"for",
"reading",
"or",
"writing",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1790-L1795 | [
"def",
"taropen",
"(",
"cls",
",",
"name",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"mode",
")",
">",
"1",
"or",
"mode",
"not",
"in",
"\"raw\"",
":",
"raise",
"ValueError",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.gzopen | Open gzip compressed tar archive name for reading or writing.
Appending is not allowed. | pipenv/vendor/distlib/_backport/tarfile.py | def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
"""Open gzip compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'")
try:
... | def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
"""Open gzip compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'")
try:
... | [
"Open",
"gzip",
"compressed",
"tar",
"archive",
"name",
"for",
"reading",
"or",
"writing",
".",
"Appending",
"is",
"not",
"allowed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1798-L1826 | [
"def",
"gzopen",
"(",
"cls",
",",
"name",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"compresslevel",
"=",
"9",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"mode",
")",
">",
"1",
"or",
"mode",
"not",
"in",
"\"rw\"",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.bz2open | Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed. | pipenv/vendor/distlib/_backport/tarfile.py | def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
"""Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'.")
try:
... | def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
"""Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'.")
try:
... | [
"Open",
"bzip2",
"compressed",
"tar",
"archive",
"name",
"for",
"reading",
"or",
"writing",
".",
"Appending",
"is",
"not",
"allowed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1829-L1852 | [
"def",
"bz2open",
"(",
"cls",
",",
"name",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"compresslevel",
"=",
"9",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"mode",
")",
">",
"1",
"or",
"mode",
"not",
"in",
"\"rw\"",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.close | Close the TarFile. In write-mode, two finishing zero blocks are
appended to the archive. | pipenv/vendor/distlib/_backport/tarfile.py | def close(self):
"""Close the TarFile. In write-mode, two finishing zero blocks are
appended to the archive.
"""
if self.closed:
return
if self.mode in "aw":
self.fileobj.write(NUL * (BLOCKSIZE * 2))
self.offset += (BLOCKSIZE * 2)
... | def close(self):
"""Close the TarFile. In write-mode, two finishing zero blocks are
appended to the archive.
"""
if self.closed:
return
if self.mode in "aw":
self.fileobj.write(NUL * (BLOCKSIZE * 2))
self.offset += (BLOCKSIZE * 2)
... | [
"Close",
"the",
"TarFile",
".",
"In",
"write",
"-",
"mode",
"two",
"finishing",
"zero",
"blocks",
"are",
"appended",
"to",
"the",
"archive",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1864-L1882 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"return",
"if",
"self",
".",
"mode",
"in",
"\"aw\"",
":",
"self",
".",
"fileobj",
".",
"write",
"(",
"NUL",
"*",
"(",
"BLOCKSIZE",
"*",
"2",
")",
")",
"self",
".",
"offset",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.getmember | Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version. | pipenv/vendor/distlib/_backport/tarfile.py | def getmember(self, name):
"""Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
"""
tarinfo... | def getmember(self, name):
"""Return a TarInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
"""
tarinfo... | [
"Return",
"a",
"TarInfo",
"object",
"for",
"member",
"name",
".",
"If",
"name",
"can",
"not",
"be",
"found",
"in",
"the",
"archive",
"KeyError",
"is",
"raised",
".",
"If",
"a",
"member",
"occurs",
"more",
"than",
"once",
"in",
"the",
"archive",
"its",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1884-L1893 | [
"def",
"getmember",
"(",
"self",
",",
"name",
")",
":",
"tarinfo",
"=",
"self",
".",
"_getmember",
"(",
"name",
")",
"if",
"tarinfo",
"is",
"None",
":",
"raise",
"KeyError",
"(",
"\"filename %r not found\"",
"%",
"name",
")",
"return",
"tarinfo"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.getmembers | Return the members of the archive as a list of TarInfo objects. The
list has the same order as the members in the archive. | pipenv/vendor/distlib/_backport/tarfile.py | def getmembers(self):
"""Return the members of the archive as a list of TarInfo objects. The
list has the same order as the members in the archive.
"""
self._check()
if not self._loaded: # if we want to obtain a list of
self._load() # all members, we firs... | def getmembers(self):
"""Return the members of the archive as a list of TarInfo objects. The
list has the same order as the members in the archive.
"""
self._check()
if not self._loaded: # if we want to obtain a list of
self._load() # all members, we firs... | [
"Return",
"the",
"members",
"of",
"the",
"archive",
"as",
"a",
"list",
"of",
"TarInfo",
"objects",
".",
"The",
"list",
"has",
"the",
"same",
"order",
"as",
"the",
"members",
"in",
"the",
"archive",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1895-L1903 | [
"def",
"getmembers",
"(",
"self",
")",
":",
"self",
".",
"_check",
"(",
")",
"if",
"not",
"self",
".",
"_loaded",
":",
"# if we want to obtain a list of",
"self",
".",
"_load",
"(",
")",
"# all members, we first have to",
"# scan the whole archive.",
"return",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.gettarinfo | Create a TarInfo object for either the file `name' or the file
object `fileobj' (using os.fstat on its file descriptor). You can
modify some of the TarInfo's attributes before you add it using
addfile(). If given, `arcname' specifies an alternative name for the
file in the ar... | pipenv/vendor/distlib/_backport/tarfile.py | def gettarinfo(self, name=None, arcname=None, fileobj=None):
"""Create a TarInfo object for either the file `name' or the file
object `fileobj' (using os.fstat on its file descriptor). You can
modify some of the TarInfo's attributes before you add it using
addfile(). If given, `... | def gettarinfo(self, name=None, arcname=None, fileobj=None):
"""Create a TarInfo object for either the file `name' or the file
object `fileobj' (using os.fstat on its file descriptor). You can
modify some of the TarInfo's attributes before you add it using
addfile(). If given, `... | [
"Create",
"a",
"TarInfo",
"object",
"for",
"either",
"the",
"file",
"name",
"or",
"the",
"file",
"object",
"fileobj",
"(",
"using",
"os",
".",
"fstat",
"on",
"its",
"file",
"descriptor",
")",
".",
"You",
"can",
"modify",
"some",
"of",
"the",
"TarInfo",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1911-L2007 | [
"def",
"gettarinfo",
"(",
"self",
",",
"name",
"=",
"None",
",",
"arcname",
"=",
"None",
",",
"fileobj",
"=",
"None",
")",
":",
"self",
".",
"_check",
"(",
"\"aw\"",
")",
"# When fileobj is given, replace name by",
"# fileobj's real name.",
"if",
"fileobj",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.list | Print a table of contents to sys.stdout. If `verbose' is False, only
the names of the members are printed. If it is True, an `ls -l'-like
output is produced. | pipenv/vendor/distlib/_backport/tarfile.py | def list(self, verbose=True):
"""Print a table of contents to sys.stdout. If `verbose' is False, only
the names of the members are printed. If it is True, an `ls -l'-like
output is produced.
"""
self._check()
for tarinfo in self:
if verbose:
... | def list(self, verbose=True):
"""Print a table of contents to sys.stdout. If `verbose' is False, only
the names of the members are printed. If it is True, an `ls -l'-like
output is produced.
"""
self._check()
for tarinfo in self:
if verbose:
... | [
"Print",
"a",
"table",
"of",
"contents",
"to",
"sys",
".",
"stdout",
".",
"If",
"verbose",
"is",
"False",
"only",
"the",
"names",
"of",
"the",
"members",
"are",
"printed",
".",
"If",
"it",
"is",
"True",
"an",
"ls",
"-",
"l",
"-",
"like",
"output",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2009-L2036 | [
"def",
"list",
"(",
"self",
",",
"verbose",
"=",
"True",
")",
":",
"self",
".",
"_check",
"(",
")",
"for",
"tarinfo",
"in",
"self",
":",
"if",
"verbose",
":",
"print",
"(",
"filemode",
"(",
"tarinfo",
".",
"mode",
")",
",",
"end",
"=",
"' '",
")"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.addfile | Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be opened with mode
'rb' to avoid irritation ... | pipenv/vendor/distlib/_backport/tarfile.py | def addfile(self, tarinfo, fileobj=None):
"""Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be ... | def addfile(self, tarinfo, fileobj=None):
"""Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be ... | [
"Add",
"the",
"TarInfo",
"object",
"tarinfo",
"to",
"the",
"archive",
".",
"If",
"fileobj",
"is",
"given",
"tarinfo",
".",
"size",
"bytes",
"are",
"read",
"from",
"it",
"and",
"added",
"to",
"the",
"archive",
".",
"You",
"can",
"create",
"TarInfo",
"obje... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2100-L2124 | [
"def",
"addfile",
"(",
"self",
",",
"tarinfo",
",",
"fileobj",
"=",
"None",
")",
":",
"self",
".",
"_check",
"(",
"\"aw\"",
")",
"tarinfo",
"=",
"copy",
".",
"copy",
"(",
"tarinfo",
")",
"buf",
"=",
"tarinfo",
".",
"tobuf",
"(",
"self",
".",
"forma... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.extractall | Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must be a subset of the
list returned by getmember... | pipenv/vendor/distlib/_backport/tarfile.py | def extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must... | def extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must... | [
"Extract",
"all",
"members",
"from",
"the",
"archive",
"to",
"the",
"current",
"working",
"directory",
"and",
"set",
"owner",
"modification",
"time",
"and",
"permissions",
"on",
"directories",
"afterwards",
".",
"path",
"specifies",
"a",
"different",
"directory",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2126-L2162 | [
"def",
"extractall",
"(",
"self",
",",
"path",
"=",
"\".\"",
",",
"members",
"=",
"None",
")",
":",
"directories",
"=",
"[",
"]",
"if",
"members",
"is",
"None",
":",
"members",
"=",
"self",
"for",
"tarinfo",
"in",
"members",
":",
"if",
"tarinfo",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.extract | Extract a member from the archive to the current working directory,
using its full name. Its file information is extracted as accurately
as possible. `member' may be a filename or a TarInfo object. You can
specify a different directory using `path'. File attributes (owner,
mt... | pipenv/vendor/distlib/_backport/tarfile.py | def extract(self, member, path="", set_attrs=True):
"""Extract a member from the archive to the current working directory,
using its full name. Its file information is extracted as accurately
as possible. `member' may be a filename or a TarInfo object. You can
specify a differen... | def extract(self, member, path="", set_attrs=True):
"""Extract a member from the archive to the current working directory,
using its full name. Its file information is extracted as accurately
as possible. `member' may be a filename or a TarInfo object. You can
specify a differen... | [
"Extract",
"a",
"member",
"from",
"the",
"archive",
"to",
"the",
"current",
"working",
"directory",
"using",
"its",
"full",
"name",
".",
"Its",
"file",
"information",
"is",
"extracted",
"as",
"accurately",
"as",
"possible",
".",
"member",
"may",
"be",
"a",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2164-L2197 | [
"def",
"extract",
"(",
"self",
",",
"member",
",",
"path",
"=",
"\"\"",
",",
"set_attrs",
"=",
"True",
")",
":",
"self",
".",
"_check",
"(",
"\"r\"",
")",
"if",
"isinstance",
"(",
"member",
",",
"str",
")",
":",
"tarinfo",
"=",
"self",
".",
"getmem... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.extractfile | Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file, a
file-like object is returned. If `member' is a link, a file-like
object is constructed from the link's target. If `member' is none of
the above... | pipenv/vendor/distlib/_backport/tarfile.py | def extractfile(self, member):
"""Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file, a
file-like object is returned. If `member' is a link, a file-like
object is constructed from the link's target. I... | def extractfile(self, member):
"""Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file, a
file-like object is returned. If `member' is a link, a file-like
object is constructed from the link's target. I... | [
"Extract",
"a",
"member",
"from",
"the",
"archive",
"as",
"a",
"file",
"object",
".",
"member",
"may",
"be",
"a",
"filename",
"or",
"a",
"TarInfo",
"object",
".",
"If",
"member",
"is",
"a",
"regular",
"file",
"a",
"file",
"-",
"like",
"object",
"is",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2199-L2235 | [
"def",
"extractfile",
"(",
"self",
",",
"member",
")",
":",
"self",
".",
"_check",
"(",
"\"r\"",
")",
"if",
"isinstance",
"(",
"member",
",",
"str",
")",
":",
"tarinfo",
"=",
"self",
".",
"getmember",
"(",
"member",
")",
"else",
":",
"tarinfo",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile._extract_member | Extract the TarInfo object tarinfo to a physical
file called targetpath. | pipenv/vendor/distlib/_backport/tarfile.py | def _extract_member(self, tarinfo, targetpath, set_attrs=True):
"""Extract the TarInfo object tarinfo to a physical
file called targetpath.
"""
# Fetch the TarInfo object for the given name
# and build the destination pathname, replacing
# forward slashes to platform s... | def _extract_member(self, tarinfo, targetpath, set_attrs=True):
"""Extract the TarInfo object tarinfo to a physical
file called targetpath.
"""
# Fetch the TarInfo object for the given name
# and build the destination pathname, replacing
# forward slashes to platform s... | [
"Extract",
"the",
"TarInfo",
"object",
"tarinfo",
"to",
"a",
"physical",
"file",
"called",
"targetpath",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2237-L2278 | [
"def",
"_extract_member",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
",",
"set_attrs",
"=",
"True",
")",
":",
"# Fetch the TarInfo object for the given name",
"# and build the destination pathname, replacing",
"# forward slashes to platform specific separators.",
"targetpath",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.makedir | Make a directory called targetpath. | pipenv/vendor/distlib/_backport/tarfile.py | def makedir(self, tarinfo, targetpath):
"""Make a directory called targetpath.
"""
try:
# Use a safe mode for the directory, the real mode is set
# later in _extract_member().
os.mkdir(targetpath, 0o700)
except EnvironmentError as e:
if e.e... | def makedir(self, tarinfo, targetpath):
"""Make a directory called targetpath.
"""
try:
# Use a safe mode for the directory, the real mode is set
# later in _extract_member().
os.mkdir(targetpath, 0o700)
except EnvironmentError as e:
if e.e... | [
"Make",
"a",
"directory",
"called",
"targetpath",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2285-L2294 | [
"def",
"makedir",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"try",
":",
"# Use a safe mode for the directory, the real mode is set",
"# later in _extract_member().",
"os",
".",
"mkdir",
"(",
"targetpath",
",",
"0o700",
")",
"except",
"EnvironmentError",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.makefile | Make a file called targetpath. | pipenv/vendor/distlib/_backport/tarfile.py | def makefile(self, tarinfo, targetpath):
"""Make a file called targetpath.
"""
source = self.fileobj
source.seek(tarinfo.offset_data)
target = bltn_open(targetpath, "wb")
if tarinfo.sparse is not None:
for offset, size in tarinfo.sparse:
target... | def makefile(self, tarinfo, targetpath):
"""Make a file called targetpath.
"""
source = self.fileobj
source.seek(tarinfo.offset_data)
target = bltn_open(targetpath, "wb")
if tarinfo.sparse is not None:
for offset, size in tarinfo.sparse:
target... | [
"Make",
"a",
"file",
"called",
"targetpath",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2296-L2310 | [
"def",
"makefile",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"source",
"=",
"self",
".",
"fileobj",
"source",
".",
"seek",
"(",
"tarinfo",
".",
"offset_data",
")",
"target",
"=",
"bltn_open",
"(",
"targetpath",
",",
"\"wb\"",
")",
"if",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.makeunknown | Make a file from a TarInfo object with an unknown type
at targetpath. | pipenv/vendor/distlib/_backport/tarfile.py | def makeunknown(self, tarinfo, targetpath):
"""Make a file from a TarInfo object with an unknown type
at targetpath.
"""
self.makefile(tarinfo, targetpath)
self._dbg(1, "tarfile: Unknown file type %r, " \
"extracted as regular file." % tarinfo.type) | def makeunknown(self, tarinfo, targetpath):
"""Make a file from a TarInfo object with an unknown type
at targetpath.
"""
self.makefile(tarinfo, targetpath)
self._dbg(1, "tarfile: Unknown file type %r, " \
"extracted as regular file." % tarinfo.type) | [
"Make",
"a",
"file",
"from",
"a",
"TarInfo",
"object",
"with",
"an",
"unknown",
"type",
"at",
"targetpath",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2312-L2318 | [
"def",
"makeunknown",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"self",
".",
"makefile",
"(",
"tarinfo",
",",
"targetpath",
")",
"self",
".",
"_dbg",
"(",
"1",
",",
"\"tarfile: Unknown file type %r, \"",
"\"extracted as regular file.\"",
"%",
"ta... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.makefifo | Make a fifo called targetpath. | pipenv/vendor/distlib/_backport/tarfile.py | def makefifo(self, tarinfo, targetpath):
"""Make a fifo called targetpath.
"""
if hasattr(os, "mkfifo"):
os.mkfifo(targetpath)
else:
raise ExtractError("fifo not supported by system") | def makefifo(self, tarinfo, targetpath):
"""Make a fifo called targetpath.
"""
if hasattr(os, "mkfifo"):
os.mkfifo(targetpath)
else:
raise ExtractError("fifo not supported by system") | [
"Make",
"a",
"fifo",
"called",
"targetpath",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2320-L2326 | [
"def",
"makefifo",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"hasattr",
"(",
"os",
",",
"\"mkfifo\"",
")",
":",
"os",
".",
"mkfifo",
"(",
"targetpath",
")",
"else",
":",
"raise",
"ExtractError",
"(",
"\"fifo not supported by system\"",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.makedev | Make a character or block device called targetpath. | pipenv/vendor/distlib/_backport/tarfile.py | def makedev(self, tarinfo, targetpath):
"""Make a character or block device called targetpath.
"""
if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
raise ExtractError("special devices not supported by system")
mode = tarinfo.mode
if tarinfo.isblk():
... | def makedev(self, tarinfo, targetpath):
"""Make a character or block device called targetpath.
"""
if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
raise ExtractError("special devices not supported by system")
mode = tarinfo.mode
if tarinfo.isblk():
... | [
"Make",
"a",
"character",
"or",
"block",
"device",
"called",
"targetpath",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2328-L2341 | [
"def",
"makedev",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"not",
"hasattr",
"(",
"os",
",",
"\"mknod\"",
")",
"or",
"not",
"hasattr",
"(",
"os",
",",
"\"makedev\"",
")",
":",
"raise",
"ExtractError",
"(",
"\"special devices not supp... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.makelink | Make a (symbolic) link called targetpath. If it cannot be created
(platform limitation), we try to make a copy of the referenced file
instead of a link. | pipenv/vendor/distlib/_backport/tarfile.py | def makelink(self, tarinfo, targetpath):
"""Make a (symbolic) link called targetpath. If it cannot be created
(platform limitation), we try to make a copy of the referenced file
instead of a link.
"""
try:
# For systems that support symbolic and hard links.
... | def makelink(self, tarinfo, targetpath):
"""Make a (symbolic) link called targetpath. If it cannot be created
(platform limitation), we try to make a copy of the referenced file
instead of a link.
"""
try:
# For systems that support symbolic and hard links.
... | [
"Make",
"a",
"(",
"symbolic",
")",
"link",
"called",
"targetpath",
".",
"If",
"it",
"cannot",
"be",
"created",
"(",
"platform",
"limitation",
")",
"we",
"try",
"to",
"make",
"a",
"copy",
"of",
"the",
"referenced",
"file",
"instead",
"of",
"a",
"link",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2343-L2370 | [
"def",
"makelink",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"try",
":",
"# For systems that support symbolic and hard links.",
"if",
"tarinfo",
".",
"issym",
"(",
")",
":",
"os",
".",
"symlink",
"(",
"tarinfo",
".",
"linkname",
",",
"targetpat... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.chown | Set owner of targetpath according to tarinfo. | pipenv/vendor/distlib/_backport/tarfile.py | def chown(self, tarinfo, targetpath):
"""Set owner of targetpath according to tarinfo.
"""
if pwd and hasattr(os, "geteuid") and os.geteuid() == 0:
# We have to be root to do so.
try:
g = grp.getgrnam(tarinfo.gname)[2]
except KeyError:
... | def chown(self, tarinfo, targetpath):
"""Set owner of targetpath according to tarinfo.
"""
if pwd and hasattr(os, "geteuid") and os.geteuid() == 0:
# We have to be root to do so.
try:
g = grp.getgrnam(tarinfo.gname)[2]
except KeyError:
... | [
"Set",
"owner",
"of",
"targetpath",
"according",
"to",
"tarinfo",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2372-L2392 | [
"def",
"chown",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"pwd",
"and",
"hasattr",
"(",
"os",
",",
"\"geteuid\"",
")",
"and",
"os",
".",
"geteuid",
"(",
")",
"==",
"0",
":",
"# We have to be root to do so.",
"try",
":",
"g",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.chmod | Set file permissions of targetpath according to tarinfo. | pipenv/vendor/distlib/_backport/tarfile.py | def chmod(self, tarinfo, targetpath):
"""Set file permissions of targetpath according to tarinfo.
"""
if hasattr(os, 'chmod'):
try:
os.chmod(targetpath, tarinfo.mode)
except EnvironmentError as e:
raise ExtractError("could not change mode") | def chmod(self, tarinfo, targetpath):
"""Set file permissions of targetpath according to tarinfo.
"""
if hasattr(os, 'chmod'):
try:
os.chmod(targetpath, tarinfo.mode)
except EnvironmentError as e:
raise ExtractError("could not change mode") | [
"Set",
"file",
"permissions",
"of",
"targetpath",
"according",
"to",
"tarinfo",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2394-L2401 | [
"def",
"chmod",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"hasattr",
"(",
"os",
",",
"'chmod'",
")",
":",
"try",
":",
"os",
".",
"chmod",
"(",
"targetpath",
",",
"tarinfo",
".",
"mode",
")",
"except",
"EnvironmentError",
"as",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.utime | Set modification time of targetpath according to tarinfo. | pipenv/vendor/distlib/_backport/tarfile.py | def utime(self, tarinfo, targetpath):
"""Set modification time of targetpath according to tarinfo.
"""
if not hasattr(os, 'utime'):
return
try:
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
except EnvironmentError as e:
raise ExtractErro... | def utime(self, tarinfo, targetpath):
"""Set modification time of targetpath according to tarinfo.
"""
if not hasattr(os, 'utime'):
return
try:
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
except EnvironmentError as e:
raise ExtractErro... | [
"Set",
"modification",
"time",
"of",
"targetpath",
"according",
"to",
"tarinfo",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2403-L2411 | [
"def",
"utime",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"not",
"hasattr",
"(",
"os",
",",
"'utime'",
")",
":",
"return",
"try",
":",
"os",
".",
"utime",
"(",
"targetpath",
",",
"(",
"tarinfo",
".",
"mtime",
",",
"tarinfo",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile.next | Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available. | pipenv/vendor/distlib/_backport/tarfile.py | def next(self):
"""Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available.
"""
self._check("ra")
if self.firstmember is not None:
m = self.firstmember
self.firs... | def next(self):
"""Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available.
"""
self._check("ra")
if self.firstmember is not None:
m = self.firstmember
self.firs... | [
"Return",
"the",
"next",
"member",
"of",
"the",
"archive",
"as",
"a",
"TarInfo",
"object",
"when",
"TarFile",
"is",
"opened",
"for",
"reading",
".",
"Return",
"None",
"if",
"there",
"is",
"no",
"more",
"available",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2414-L2458 | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"_check",
"(",
"\"ra\"",
")",
"if",
"self",
".",
"firstmember",
"is",
"not",
"None",
":",
"m",
"=",
"self",
".",
"firstmember",
"self",
".",
"firstmember",
"=",
"None",
"return",
"m",
"# Read the next ... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile._getmember | Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point. | pipenv/vendor/distlib/_backport/tarfile.py | def _getmember(self, name, tarinfo=None, normalize=False):
"""Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point.
"""
# Ensure that all members have been loaded.
members = self.getmembers()
# Limit the member searc... | def _getmember(self, name, tarinfo=None, normalize=False):
"""Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point.
"""
# Ensure that all members have been loaded.
members = self.getmembers()
# Limit the member searc... | [
"Find",
"an",
"archive",
"member",
"by",
"name",
"from",
"bottom",
"to",
"top",
".",
"If",
"tarinfo",
"is",
"given",
"it",
"is",
"used",
"as",
"the",
"starting",
"point",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2463-L2484 | [
"def",
"_getmember",
"(",
"self",
",",
"name",
",",
"tarinfo",
"=",
"None",
",",
"normalize",
"=",
"False",
")",
":",
"# Ensure that all members have been loaded.",
"members",
"=",
"self",
".",
"getmembers",
"(",
")",
"# Limit the member search list up to tarinfo.",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile._load | Read through the entire archive file and look for readable
members. | pipenv/vendor/distlib/_backport/tarfile.py | def _load(self):
"""Read through the entire archive file and look for readable
members.
"""
while True:
tarinfo = self.next()
if tarinfo is None:
break
self._loaded = True | def _load(self):
"""Read through the entire archive file and look for readable
members.
"""
while True:
tarinfo = self.next()
if tarinfo is None:
break
self._loaded = True | [
"Read",
"through",
"the",
"entire",
"archive",
"file",
"and",
"look",
"for",
"readable",
"members",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2486-L2494 | [
"def",
"_load",
"(",
"self",
")",
":",
"while",
"True",
":",
"tarinfo",
"=",
"self",
".",
"next",
"(",
")",
"if",
"tarinfo",
"is",
"None",
":",
"break",
"self",
".",
"_loaded",
"=",
"True"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile._check | Check if TarFile is still open, and if the operation's mode
corresponds to TarFile's mode. | pipenv/vendor/distlib/_backport/tarfile.py | def _check(self, mode=None):
"""Check if TarFile is still open, and if the operation's mode
corresponds to TarFile's mode.
"""
if self.closed:
raise IOError("%s is closed" % self.__class__.__name__)
if mode is not None and self.mode not in mode:
raise I... | def _check(self, mode=None):
"""Check if TarFile is still open, and if the operation's mode
corresponds to TarFile's mode.
"""
if self.closed:
raise IOError("%s is closed" % self.__class__.__name__)
if mode is not None and self.mode not in mode:
raise I... | [
"Check",
"if",
"TarFile",
"is",
"still",
"open",
"and",
"if",
"the",
"operation",
"s",
"mode",
"corresponds",
"to",
"TarFile",
"s",
"mode",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2496-L2503 | [
"def",
"_check",
"(",
"self",
",",
"mode",
"=",
"None",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"IOError",
"(",
"\"%s is closed\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
")",
"if",
"mode",
"is",
"not",
"None",
"and",
"self",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile._find_link_target | Find the target member of a symlink or hardlink member in the
archive. | pipenv/vendor/distlib/_backport/tarfile.py | def _find_link_target(self, tarinfo):
"""Find the target member of a symlink or hardlink member in the
archive.
"""
if tarinfo.issym():
# Always search the entire archive.
linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname
limit = Non... | def _find_link_target(self, tarinfo):
"""Find the target member of a symlink or hardlink member in the
archive.
"""
if tarinfo.issym():
# Always search the entire archive.
linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname
limit = Non... | [
"Find",
"the",
"target",
"member",
"of",
"a",
"symlink",
"or",
"hardlink",
"member",
"in",
"the",
"archive",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2505-L2522 | [
"def",
"_find_link_target",
"(",
"self",
",",
"tarinfo",
")",
":",
"if",
"tarinfo",
".",
"issym",
"(",
")",
":",
"# Always search the entire archive.",
"linkname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"tarinfo",
".",
"name",
")",
"+",
"\"/\"",
"+",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | TarFile._dbg | Write debugging output to sys.stderr. | pipenv/vendor/distlib/_backport/tarfile.py | def _dbg(self, level, msg):
"""Write debugging output to sys.stderr.
"""
if level <= self.debug:
print(msg, file=sys.stderr) | def _dbg(self, level, msg):
"""Write debugging output to sys.stderr.
"""
if level <= self.debug:
print(msg, file=sys.stderr) | [
"Write",
"debugging",
"output",
"to",
"sys",
".",
"stderr",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2532-L2536 | [
"def",
"_dbg",
"(",
"self",
",",
"level",
",",
"msg",
")",
":",
"if",
"level",
"<=",
"self",
".",
"debug",
":",
"print",
"(",
"msg",
",",
"file",
"=",
"sys",
".",
"stderr",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project.path_to | Returns the absolute path to a given relative path. | pipenv/project.py | def path_to(self, p):
"""Returns the absolute path to a given relative path."""
if os.path.isabs(p):
return p
return os.sep.join([self._original_dir, p]) | def path_to(self, p):
"""Returns the absolute path to a given relative path."""
if os.path.isabs(p):
return p
return os.sep.join([self._original_dir, p]) | [
"Returns",
"the",
"absolute",
"path",
"to",
"a",
"given",
"relative",
"path",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L159-L164 | [
"def",
"path_to",
"(",
"self",
",",
"p",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"p",
")",
":",
"return",
"p",
"return",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"self",
".",
"_original_dir",
",",
"p",
"]",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project._build_package_list | Returns a list of packages for pip-tools to consume. | pipenv/project.py | def _build_package_list(self, package_section):
"""Returns a list of packages for pip-tools to consume."""
from pipenv.vendor.requirementslib.utils import is_vcs
ps = {}
# TODO: Separate the logic for showing packages from the filters for supplying pip-tools
for k, v in self.pars... | def _build_package_list(self, package_section):
"""Returns a list of packages for pip-tools to consume."""
from pipenv.vendor.requirementslib.utils import is_vcs
ps = {}
# TODO: Separate the logic for showing packages from the filters for supplying pip-tools
for k, v in self.pars... | [
"Returns",
"a",
"list",
"of",
"packages",
"for",
"pip",
"-",
"tools",
"to",
"consume",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L166-L219 | [
"def",
"_build_package_list",
"(",
"self",
",",
"package_section",
")",
":",
"from",
"pipenv",
".",
"vendor",
".",
"requirementslib",
".",
"utils",
"import",
"is_vcs",
"ps",
"=",
"{",
"}",
"# TODO: Separate the logic for showing packages from the filters for supplying pip... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Project._get_virtualenv_hash | Get the name of the virtualenv adjusted for windows if needed
Returns (name, encoded_hash) | pipenv/project.py | def _get_virtualenv_hash(self, name):
"""Get the name of the virtualenv adjusted for windows if needed
Returns (name, encoded_hash)
"""
def get_name(name, location):
name = self._sanitize(name)
hash = hashlib.sha256(location.encode()).digest()[:6]
en... | def _get_virtualenv_hash(self, name):
"""Get the name of the virtualenv adjusted for windows if needed
Returns (name, encoded_hash)
"""
def get_name(name, location):
name = self._sanitize(name)
hash = hashlib.sha256(location.encode()).digest()[:6]
en... | [
"Get",
"the",
"name",
"of",
"the",
"virtualenv",
"adjusted",
"for",
"windows",
"if",
"needed"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/project.py#L368-L407 | [
"def",
"_get_virtualenv_hash",
"(",
"self",
",",
"name",
")",
":",
"def",
"get_name",
"(",
"name",
",",
"location",
")",
":",
"name",
"=",
"self",
".",
"_sanitize",
"(",
"name",
")",
"hash",
"=",
"hashlib",
".",
"sha256",
"(",
"location",
".",
"encode"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.