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 | Lexer.tokenize | Calls tokeniter + tokenize and wraps it in a token stream. | pipenv/vendor/jinja2/lexer.py | def tokenize(self, source, name=None, filename=None, state=None):
"""Calls tokeniter + tokenize and wraps it in a token stream.
"""
stream = self.tokeniter(source, name, filename, state)
return TokenStream(self.wrap(stream, name, filename), name, filename) | def tokenize(self, source, name=None, filename=None, state=None):
"""Calls tokeniter + tokenize and wraps it in a token stream.
"""
stream = self.tokeniter(source, name, filename, state)
return TokenStream(self.wrap(stream, name, filename), name, filename) | [
"Calls",
"tokeniter",
"+",
"tokenize",
"and",
"wraps",
"it",
"in",
"a",
"token",
"stream",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/lexer.py#L552-L556 | [
"def",
"tokenize",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"stream",
"=",
"self",
".",
"tokeniter",
"(",
"source",
",",
"name",
",",
"filename",
",",
"state",
")",
"re... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Lexer.wrap | This is called with the stream as returned by `tokenize` and wraps
every token in a :class:`Token` and converts the value. | pipenv/vendor/jinja2/lexer.py | def wrap(self, stream, name=None, filename=None):
"""This is called with the stream as returned by `tokenize` and wraps
every token in a :class:`Token` and converts the value.
"""
for lineno, token, value in stream:
if token in ignored_tokens:
continue
... | def wrap(self, stream, name=None, filename=None):
"""This is called with the stream as returned by `tokenize` and wraps
every token in a :class:`Token` and converts the value.
"""
for lineno, token, value in stream:
if token in ignored_tokens:
continue
... | [
"This",
"is",
"called",
"with",
"the",
"stream",
"as",
"returned",
"by",
"tokenize",
"and",
"wraps",
"every",
"token",
"in",
"a",
":",
"class",
":",
"Token",
"and",
"converts",
"the",
"value",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/lexer.py#L558-L597 | [
"def",
"wrap",
"(",
"self",
",",
"stream",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"for",
"lineno",
",",
"token",
",",
"value",
"in",
"stream",
":",
"if",
"token",
"in",
"ignored_tokens",
":",
"continue",
"elif",
"token",
"=... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | load_pyproject_toml | Load the pyproject.toml file.
Parameters:
use_pep517 - Has the user requested PEP 517 processing? None
means the user hasn't explicitly specified.
pyproject_toml - Location of the project's pyproject.toml file
setup_py - Location of the project's setup.py file
r... | pipenv/patched/notpip/_internal/pyproject.py | def load_pyproject_toml(
use_pep517, # type: Optional[bool]
pyproject_toml, # type: str
setup_py, # type: str
req_name # type: str
):
# type: (...) -> Optional[Tuple[List[str], str, List[str]]]
"""Load the pyproject.toml file.
Parameters:
use_pep517 - Has the user requested PEP ... | def load_pyproject_toml(
use_pep517, # type: Optional[bool]
pyproject_toml, # type: str
setup_py, # type: str
req_name # type: str
):
# type: (...) -> Optional[Tuple[List[str], str, List[str]]]
"""Load the pyproject.toml file.
Parameters:
use_pep517 - Has the user requested PEP ... | [
"Load",
"the",
"pyproject",
".",
"toml",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/pyproject.py#L35-L171 | [
"def",
"load_pyproject_toml",
"(",
"use_pep517",
",",
"# type: Optional[bool]",
"pyproject_toml",
",",
"# type: str",
"setup_py",
",",
"# type: str",
"req_name",
"# type: str",
")",
":",
"# type: (...) -> Optional[Tuple[List[str], str, List[str]]]",
"has_pyproject",
"=",
"os",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Runner.iter_installable_versions | Iterate through CPython versions available for Pipenv to install. | pipenv/pyenv.py | def iter_installable_versions(self):
"""Iterate through CPython versions available for Pipenv to install.
"""
for name in self._pyenv('install', '--list').out.splitlines():
try:
version = Version.parse(name.strip())
except ValueError:
conti... | def iter_installable_versions(self):
"""Iterate through CPython versions available for Pipenv to install.
"""
for name in self._pyenv('install', '--list').out.splitlines():
try:
version = Version.parse(name.strip())
except ValueError:
conti... | [
"Iterate",
"through",
"CPython",
"versions",
"available",
"for",
"Pipenv",
"to",
"install",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/pyenv.py#L75-L83 | [
"def",
"iter_installable_versions",
"(",
"self",
")",
":",
"for",
"name",
"in",
"self",
".",
"_pyenv",
"(",
"'install'",
",",
"'--list'",
")",
".",
"out",
".",
"splitlines",
"(",
")",
":",
"try",
":",
"version",
"=",
"Version",
".",
"parse",
"(",
"name... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Runner.find_version_to_install | Find a version in pyenv from the version supplied.
A ValueError is raised if a matching version cannot be found. | pipenv/pyenv.py | def find_version_to_install(self, name):
"""Find a version in pyenv from the version supplied.
A ValueError is raised if a matching version cannot be found.
"""
version = Version.parse(name)
if version.patch is not None:
return name
try:
best_matc... | def find_version_to_install(self, name):
"""Find a version in pyenv from the version supplied.
A ValueError is raised if a matching version cannot be found.
"""
version = Version.parse(name)
if version.patch is not None:
return name
try:
best_matc... | [
"Find",
"a",
"version",
"in",
"pyenv",
"from",
"the",
"version",
"supplied",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/pyenv.py#L85-L103 | [
"def",
"find_version_to_install",
"(",
"self",
",",
"name",
")",
":",
"version",
"=",
"Version",
".",
"parse",
"(",
"name",
")",
"if",
"version",
".",
"patch",
"is",
"not",
"None",
":",
"return",
"name",
"try",
":",
"best_match",
"=",
"max",
"(",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Runner.install | Install the given version with pyenv.
The version must be a ``Version`` instance representing a version
found in pyenv.
A ValueError is raised if the given version does not have a match in
pyenv. A PyenvError is raised if the pyenv command fails. | pipenv/pyenv.py | def install(self, version):
"""Install the given version with pyenv.
The version must be a ``Version`` instance representing a version
found in pyenv.
A ValueError is raised if the given version does not have a match in
pyenv. A PyenvError is raised if the pyenv command fails.
... | def install(self, version):
"""Install the given version with pyenv.
The version must be a ``Version`` instance representing a version
found in pyenv.
A ValueError is raised if the given version does not have a match in
pyenv. A PyenvError is raised if the pyenv command fails.
... | [
"Install",
"the",
"given",
"version",
"with",
"pyenv",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/pyenv.py#L105-L118 | [
"def",
"install",
"(",
"self",
",",
"version",
")",
":",
"c",
"=",
"self",
".",
"_pyenv",
"(",
"'install'",
",",
"'-s'",
",",
"str",
"(",
"version",
")",
",",
"timeout",
"=",
"PIPENV_INSTALL_TIMEOUT",
",",
")",
"return",
"c"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse_editable | Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
.[some_extra] | pipenv/patched/notpip/_internal/req/constructors.py | def parse_editable(editable_req):
# type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]
"""Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirecto... | def parse_editable(editable_req):
# type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]
"""Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirecto... | [
"Parses",
"an",
"editable",
"requirement",
"into",
":",
"-",
"a",
"requirement",
"name",
"-",
"an",
"URL",
"-",
"extras",
"-",
"editable",
"options",
"Accepted",
"requirements",
":",
"svn",
"+",
"http",
":",
"//",
"blahblah"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/constructors.py#L62-L133 | [
"def",
"parse_editable",
"(",
"editable_req",
")",
":",
"# type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]",
"url",
"=",
"editable_req",
"# If a file path is specified with extras, strip off the extras.",
"url_no_extras",
",",
"extras",
"=",
"_strip_extras",
"(",
"url"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | deduce_helpful_msg | Returns helpful msg in case requirements file does not exist,
or cannot be parsed.
:params req: Requirements file path | pipenv/patched/notpip/_internal/req/constructors.py | def deduce_helpful_msg(req):
# type: (str) -> str
"""Returns helpful msg in case requirements file does not exist,
or cannot be parsed.
:params req: Requirements file path
"""
msg = ""
if os.path.exists(req):
msg = " It does exist."
# Try to parse and check if it is a requir... | def deduce_helpful_msg(req):
# type: (str) -> str
"""Returns helpful msg in case requirements file does not exist,
or cannot be parsed.
:params req: Requirements file path
"""
msg = ""
if os.path.exists(req):
msg = " It does exist."
# Try to parse and check if it is a requir... | [
"Returns",
"helpful",
"msg",
"in",
"case",
"requirements",
"file",
"does",
"not",
"exist",
"or",
"cannot",
"be",
"parsed",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/constructors.py#L136-L161 | [
"def",
"deduce_helpful_msg",
"(",
"req",
")",
":",
"# type: (str) -> str",
"msg",
"=",
"\"\"",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"req",
")",
":",
"msg",
"=",
"\" It does exist.\"",
"# Try to parse and check if it is a requirements file.",
"try",
":",
"w... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | install_req_from_line | Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL. | pipenv/patched/notpip/_internal/req/constructors.py | def install_req_from_line(
name, # type: str
comes_from=None, # type: Optional[Union[str, InstallRequirement]]
use_pep517=None, # type: Optional[bool]
isolated=False, # type: bool
options=None, # type: Optional[Dict[str, Any]]
wheel_cache=None, # type: Optional[WheelCache]
constraint=F... | def install_req_from_line(
name, # type: str
comes_from=None, # type: Optional[Union[str, InstallRequirement]]
use_pep517=None, # type: Optional[bool]
isolated=False, # type: bool
options=None, # type: Optional[Dict[str, Any]]
wheel_cache=None, # type: Optional[WheelCache]
constraint=F... | [
"Creates",
"an",
"InstallRequirement",
"from",
"a",
"name",
"which",
"might",
"be",
"a",
"requirement",
"directory",
"containing",
"setup",
".",
"py",
"filename",
"or",
"URL",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/constructors.py#L203-L308 | [
"def",
"install_req_from_line",
"(",
"name",
",",
"# type: str",
"comes_from",
"=",
"None",
",",
"# type: Optional[Union[str, InstallRequirement]]",
"use_pep517",
"=",
"None",
",",
"# type: Optional[bool]",
"isolated",
"=",
"False",
",",
"# type: bool",
"options",
"=",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | url_to_file_path | Return the file cache path based on the URL.
This does not ensure the file exists! | pipenv/patched/notpip/_vendor/cachecontrol/caches/file_cache.py | def url_to_file_path(url, filecache):
"""Return the file cache path based on the URL.
This does not ensure the file exists!
"""
key = CacheController.cache_url(url)
return filecache._fn(key) | def url_to_file_path(url, filecache):
"""Return the file cache path based on the URL.
This does not ensure the file exists!
"""
key = CacheController.cache_url(url)
return filecache._fn(key) | [
"Return",
"the",
"file",
"cache",
"path",
"based",
"on",
"the",
"URL",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/caches/file_cache.py#L140-L146 | [
"def",
"url_to_file_path",
"(",
"url",
",",
"filecache",
")",
":",
"key",
"=",
"CacheController",
".",
"cache_url",
"(",
"url",
")",
"return",
"filecache",
".",
"_fn",
"(",
"key",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | write_pid_to_pidfile | Write the PID in the named PID file.
Get the numeric process ID (“PID”) of the current process
and write it to the named file as a line of text. | pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py | def write_pid_to_pidfile(pidfile_path):
""" Write the PID in the named PID file.
Get the numeric process ID (“PID”) of the current process
and write it to the named file as a line of text.
"""
open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY)
open_mode = 0o644
pidfile_fd = os... | def write_pid_to_pidfile(pidfile_path):
""" Write the PID in the named PID file.
Get the numeric process ID (“PID”) of the current process
and write it to the named file as a line of text.
"""
open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY)
open_mode = 0o644
pidfile_fd = os... | [
"Write",
"the",
"PID",
"in",
"the",
"named",
"PID",
"file",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py#L152-L173 | [
"def",
"write_pid_to_pidfile",
"(",
"pidfile_path",
")",
":",
"open_flags",
"=",
"(",
"os",
".",
"O_CREAT",
"|",
"os",
".",
"O_EXCL",
"|",
"os",
".",
"O_WRONLY",
")",
"open_mode",
"=",
"0o644",
"pidfile_fd",
"=",
"os",
".",
"open",
"(",
"pidfile_path",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | remove_existing_pidfile | Remove the named PID file if it exists.
Removing a PID file that doesn't already exist puts us in the
desired state, so we ignore the condition if the file does not
exist. | pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py | def remove_existing_pidfile(pidfile_path):
""" Remove the named PID file if it exists.
Removing a PID file that doesn't already exist puts us in the
desired state, so we ignore the condition if the file does not
exist.
"""
try:
os.remove(pidfile_path)
except OSError... | def remove_existing_pidfile(pidfile_path):
""" Remove the named PID file if it exists.
Removing a PID file that doesn't already exist puts us in the
desired state, so we ignore the condition if the file does not
exist.
"""
try:
os.remove(pidfile_path)
except OSError... | [
"Remove",
"the",
"named",
"PID",
"file",
"if",
"it",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py#L176-L190 | [
"def",
"remove_existing_pidfile",
"(",
"pidfile_path",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"pidfile_path",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"==",
"errno",
".",
"ENOENT",
":",
"pass",
"else",
":",
"raise"
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | PIDLockFile.release | Release the lock.
Removes the PID file to release the lock, or raises an
error if the current process does not hold the lock. | pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py | def release(self):
""" Release the lock.
Removes the PID file to release the lock, or raises an
error if the current process does not hold the lock.
"""
if not self.is_locked():
raise NotLocked("%s is not locked" % self.path)
if not self.i_am_loc... | def release(self):
""" Release the lock.
Removes the PID file to release the lock, or raises an
error if the current process does not hold the lock.
"""
if not self.is_locked():
raise NotLocked("%s is not locked" % self.path)
if not self.i_am_loc... | [
"Release",
"the",
"lock",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/pidlockfile.py#L95-L106 | [
"def",
"release",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_locked",
"(",
")",
":",
"raise",
"NotLocked",
"(",
"\"%s is not locked\"",
"%",
"self",
".",
"path",
")",
"if",
"not",
"self",
".",
"i_am_locking",
"(",
")",
":",
"raise",
"NotMyLoc... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Bazaar.export | Export the Bazaar repository at the url to the destination location | pipenv/patched/notpip/_internal/vcs/bazaar.py | def export(self, location):
"""
Export the Bazaar repository at the url to the destination location
"""
# Remove the location to make sure Bazaar can export it correctly
if os.path.exists(location):
rmtree(location)
with TempDirectory(kind="export") as temp_d... | def export(self, location):
"""
Export the Bazaar repository at the url to the destination location
"""
# Remove the location to make sure Bazaar can export it correctly
if os.path.exists(location):
rmtree(location)
with TempDirectory(kind="export") as temp_d... | [
"Export",
"the",
"Bazaar",
"repository",
"at",
"the",
"url",
"to",
"the",
"destination",
"location"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/bazaar.py#L37-L51 | [
"def",
"export",
"(",
"self",
",",
"location",
")",
":",
"# Remove the location to make sure Bazaar can export it correctly",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"location",
")",
":",
"rmtree",
"(",
"location",
")",
"with",
"TempDirectory",
"(",
"kind",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | search_packages_info | Gather details from installed distributions. Print distribution name,
version, location, and installed files. Installed files requires a
pip generated 'installed-files.txt' in the distributions '.egg-info'
directory. | pipenv/patched/notpip/_internal/commands/show.py | def search_packages_info(query):
"""
Gather details from installed distributions. Print distribution name,
version, location, and installed files. Installed files requires a
pip generated 'installed-files.txt' in the distributions '.egg-info'
directory.
"""
installed = {}
for p in pkg_re... | def search_packages_info(query):
"""
Gather details from installed distributions. Print distribution name,
version, location, and installed files. Installed files requires a
pip generated 'installed-files.txt' in the distributions '.egg-info'
directory.
"""
installed = {}
for p in pkg_re... | [
"Gather",
"details",
"from",
"installed",
"distributions",
".",
"Print",
"distribution",
"name",
"version",
"location",
"and",
"installed",
"files",
".",
"Installed",
"files",
"requires",
"a",
"pip",
"generated",
"installed",
"-",
"files",
".",
"txt",
"in",
"the... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/show.py#L52-L122 | [
"def",
"search_packages_info",
"(",
"query",
")",
":",
"installed",
"=",
"{",
"}",
"for",
"p",
"in",
"pkg_resources",
".",
"working_set",
":",
"installed",
"[",
"canonicalize_name",
"(",
"p",
".",
"project_name",
")",
"]",
"=",
"p",
"query_names",
"=",
"["... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | print_results | Print the informations from installed distributions found. | pipenv/patched/notpip/_internal/commands/show.py | def print_results(distributions, list_files=False, verbose=False):
"""
Print the informations from installed distributions found.
"""
results_printed = False
for i, dist in enumerate(distributions):
results_printed = True
if i > 0:
logger.info("---")
name = dist.... | def print_results(distributions, list_files=False, verbose=False):
"""
Print the informations from installed distributions found.
"""
results_printed = False
for i, dist in enumerate(distributions):
results_printed = True
if i > 0:
logger.info("---")
name = dist.... | [
"Print",
"the",
"informations",
"from",
"installed",
"distributions",
"found",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/show.py#L125-L168 | [
"def",
"print_results",
"(",
"distributions",
",",
"list_files",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"results_printed",
"=",
"False",
"for",
"i",
",",
"dist",
"in",
"enumerate",
"(",
"distributions",
")",
":",
"results_printed",
"=",
"True"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.fail | Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename. | pipenv/vendor/jinja2/parser.py | def fail(self, msg, lineno=None, exc=TemplateSyntaxError):
"""Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename.
"""
if lineno is None:
lineno = self.stream.current.lineno
rai... | def fail(self, msg, lineno=None, exc=TemplateSyntaxError):
"""Convenience method that raises `exc` with the message, passed
line number or last line number as well as the current name and
filename.
"""
if lineno is None:
lineno = self.stream.current.lineno
rai... | [
"Convenience",
"method",
"that",
"raises",
"exc",
"with",
"the",
"message",
"passed",
"line",
"number",
"or",
"last",
"line",
"number",
"as",
"well",
"as",
"the",
"current",
"name",
"and",
"filename",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L52-L59 | [
"def",
"fail",
"(",
"self",
",",
"msg",
",",
"lineno",
"=",
"None",
",",
"exc",
"=",
"TemplateSyntaxError",
")",
":",
"if",
"lineno",
"is",
"None",
":",
"lineno",
"=",
"self",
".",
"stream",
".",
"current",
".",
"lineno",
"raise",
"exc",
"(",
"msg",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.fail_unknown_tag | Called if the parser encounters an unknown tag. Tries to fail
with a human readable error message that could help to identify
the problem. | pipenv/vendor/jinja2/parser.py | def fail_unknown_tag(self, name, lineno=None):
"""Called if the parser encounters an unknown tag. Tries to fail
with a human readable error message that could help to identify
the problem.
"""
return self._fail_ut_eof(name, self._end_token_stack, lineno) | def fail_unknown_tag(self, name, lineno=None):
"""Called if the parser encounters an unknown tag. Tries to fail
with a human readable error message that could help to identify
the problem.
"""
return self._fail_ut_eof(name, self._end_token_stack, lineno) | [
"Called",
"if",
"the",
"parser",
"encounters",
"an",
"unknown",
"tag",
".",
"Tries",
"to",
"fail",
"with",
"a",
"human",
"readable",
"error",
"message",
"that",
"could",
"help",
"to",
"identify",
"the",
"problem",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L92-L97 | [
"def",
"fail_unknown_tag",
"(",
"self",
",",
"name",
",",
"lineno",
"=",
"None",
")",
":",
"return",
"self",
".",
"_fail_ut_eof",
"(",
"name",
",",
"self",
".",
"_end_token_stack",
",",
"lineno",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.fail_eof | Like fail_unknown_tag but for end of template situations. | pipenv/vendor/jinja2/parser.py | def fail_eof(self, end_tokens=None, lineno=None):
"""Like fail_unknown_tag but for end of template situations."""
stack = list(self._end_token_stack)
if end_tokens is not None:
stack.append(end_tokens)
return self._fail_ut_eof(None, stack, lineno) | def fail_eof(self, end_tokens=None, lineno=None):
"""Like fail_unknown_tag but for end of template situations."""
stack = list(self._end_token_stack)
if end_tokens is not None:
stack.append(end_tokens)
return self._fail_ut_eof(None, stack, lineno) | [
"Like",
"fail_unknown_tag",
"but",
"for",
"end",
"of",
"template",
"situations",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L99-L104 | [
"def",
"fail_eof",
"(",
"self",
",",
"end_tokens",
"=",
"None",
",",
"lineno",
"=",
"None",
")",
":",
"stack",
"=",
"list",
"(",
"self",
".",
"_end_token_stack",
")",
"if",
"end_tokens",
"is",
"not",
"None",
":",
"stack",
".",
"append",
"(",
"end_token... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.is_tuple_end | Are we at the end of a tuple? | pipenv/vendor/jinja2/parser.py | def is_tuple_end(self, extra_end_rules=None):
"""Are we at the end of a tuple?"""
if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
return True
elif extra_end_rules is not None:
return self.stream.current.test_any(extra_end_rules)
return Fals... | def is_tuple_end(self, extra_end_rules=None):
"""Are we at the end of a tuple?"""
if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
return True
elif extra_end_rules is not None:
return self.stream.current.test_any(extra_end_rules)
return Fals... | [
"Are",
"we",
"at",
"the",
"end",
"of",
"a",
"tuple?"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L106-L112 | [
"def",
"is_tuple_end",
"(",
"self",
",",
"extra_end_rules",
"=",
"None",
")",
":",
"if",
"self",
".",
"stream",
".",
"current",
".",
"type",
"in",
"(",
"'variable_end'",
",",
"'block_end'",
",",
"'rparen'",
")",
":",
"return",
"True",
"elif",
"extra_end_ru... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.free_identifier | Return a new free identifier as :class:`~jinja2.nodes.InternalName`. | pipenv/vendor/jinja2/parser.py | def free_identifier(self, lineno=None):
"""Return a new free identifier as :class:`~jinja2.nodes.InternalName`."""
self._last_identifier += 1
rv = object.__new__(nodes.InternalName)
nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno)
return rv | def free_identifier(self, lineno=None):
"""Return a new free identifier as :class:`~jinja2.nodes.InternalName`."""
self._last_identifier += 1
rv = object.__new__(nodes.InternalName)
nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno)
return rv | [
"Return",
"a",
"new",
"free",
"identifier",
"as",
":",
"class",
":",
"~jinja2",
".",
"nodes",
".",
"InternalName",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L114-L119 | [
"def",
"free_identifier",
"(",
"self",
",",
"lineno",
"=",
"None",
")",
":",
"self",
".",
"_last_identifier",
"+=",
"1",
"rv",
"=",
"object",
".",
"__new__",
"(",
"nodes",
".",
"InternalName",
")",
"nodes",
".",
"Node",
".",
"__init__",
"(",
"rv",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse_statement | Parse a single statement. | pipenv/vendor/jinja2/parser.py | def parse_statement(self):
"""Parse a single statement."""
token = self.stream.current
if token.type != 'name':
self.fail('tag name expected', token.lineno)
self._tag_stack.append(token.value)
pop_tag = True
try:
if token.value in _statement_keywor... | def parse_statement(self):
"""Parse a single statement."""
token = self.stream.current
if token.type != 'name':
self.fail('tag name expected', token.lineno)
self._tag_stack.append(token.value)
pop_tag = True
try:
if token.value in _statement_keywor... | [
"Parse",
"a",
"single",
"statement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L121-L147 | [
"def",
"parse_statement",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"stream",
".",
"current",
"if",
"token",
".",
"type",
"!=",
"'name'",
":",
"self",
".",
"fail",
"(",
"'tag name expected'",
",",
"token",
".",
"lineno",
")",
"self",
".",
"_tag... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse_statements | Parse multiple statements into a list until one of the end tokens
is reached. This is used to parse the body of statements as it also
parses template data if appropriate. The parser checks first if the
current token is a colon and skips it if there is one. Then it checks
for the block... | pipenv/vendor/jinja2/parser.py | def parse_statements(self, end_tokens, drop_needle=False):
"""Parse multiple statements into a list until one of the end tokens
is reached. This is used to parse the body of statements as it also
parses template data if appropriate. The parser checks first if the
current token is a col... | def parse_statements(self, end_tokens, drop_needle=False):
"""Parse multiple statements into a list until one of the end tokens
is reached. This is used to parse the body of statements as it also
parses template data if appropriate. The parser checks first if the
current token is a col... | [
"Parse",
"multiple",
"statements",
"into",
"a",
"list",
"until",
"one",
"of",
"the",
"end",
"tokens",
"is",
"reached",
".",
"This",
"is",
"used",
"to",
"parse",
"the",
"body",
"of",
"statements",
"as",
"it",
"also",
"parses",
"template",
"data",
"if",
"a... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L149-L174 | [
"def",
"parse_statements",
"(",
"self",
",",
"end_tokens",
",",
"drop_needle",
"=",
"False",
")",
":",
"# the first token may be a colon for python compatibility",
"self",
".",
"stream",
".",
"skip_if",
"(",
"'colon'",
")",
"# in the future it would be possible to add whole... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse_set | Parse an assign statement. | pipenv/vendor/jinja2/parser.py | def parse_set(self):
"""Parse an assign statement."""
lineno = next(self.stream).lineno
target = self.parse_assign_target(with_namespace=True)
if self.stream.skip_if('assign'):
expr = self.parse_tuple()
return nodes.Assign(target, expr, lineno=lineno)
filt... | def parse_set(self):
"""Parse an assign statement."""
lineno = next(self.stream).lineno
target = self.parse_assign_target(with_namespace=True)
if self.stream.skip_if('assign'):
expr = self.parse_tuple()
return nodes.Assign(target, expr, lineno=lineno)
filt... | [
"Parse",
"an",
"assign",
"statement",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L176-L186 | [
"def",
"parse_set",
"(",
"self",
")",
":",
"lineno",
"=",
"next",
"(",
"self",
".",
"stream",
")",
".",
"lineno",
"target",
"=",
"self",
".",
"parse_assign_target",
"(",
"with_namespace",
"=",
"True",
")",
"if",
"self",
".",
"stream",
".",
"skip_if",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse_for | Parse a for loop. | pipenv/vendor/jinja2/parser.py | def parse_for(self):
"""Parse a for loop."""
lineno = self.stream.expect('name:for').lineno
target = self.parse_assign_target(extra_end_rules=('name:in',))
self.stream.expect('name:in')
iter = self.parse_tuple(with_condexpr=False,
extra_end_rules=(... | def parse_for(self):
"""Parse a for loop."""
lineno = self.stream.expect('name:for').lineno
target = self.parse_assign_target(extra_end_rules=('name:in',))
self.stream.expect('name:in')
iter = self.parse_tuple(with_condexpr=False,
extra_end_rules=(... | [
"Parse",
"a",
"for",
"loop",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L188-L205 | [
"def",
"parse_for",
"(",
"self",
")",
":",
"lineno",
"=",
"self",
".",
"stream",
".",
"expect",
"(",
"'name:for'",
")",
".",
"lineno",
"target",
"=",
"self",
".",
"parse_assign_target",
"(",
"extra_end_rules",
"=",
"(",
"'name:in'",
",",
")",
")",
"self"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse_if | Parse an if construct. | pipenv/vendor/jinja2/parser.py | def parse_if(self):
"""Parse an if construct."""
node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
while 1:
node.test = self.parse_tuple(with_condexpr=False)
node.body = self.parse_statements(('name:elif', 'name:else',
... | def parse_if(self):
"""Parse an if construct."""
node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
while 1:
node.test = self.parse_tuple(with_condexpr=False)
node.body = self.parse_statements(('name:elif', 'name:else',
... | [
"Parse",
"an",
"if",
"construct",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L207-L225 | [
"def",
"parse_if",
"(",
"self",
")",
":",
"node",
"=",
"result",
"=",
"nodes",
".",
"If",
"(",
"lineno",
"=",
"self",
".",
"stream",
".",
"expect",
"(",
"'name:if'",
")",
".",
"lineno",
")",
"while",
"1",
":",
"node",
".",
"test",
"=",
"self",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse_assign_target | Parse an assignment target. As Jinja2 allows assignments to
tuples, this function can parse all allowed assignment targets. Per
default assignments to tuples are parsed, that can be disable however
by setting `with_tuple` to `False`. If only assignments to names are
wanted `name_only`... | pipenv/vendor/jinja2/parser.py | def parse_assign_target(self, with_tuple=True, name_only=False,
extra_end_rules=None, with_namespace=False):
"""Parse an assignment target. As Jinja2 allows assignments to
tuples, this function can parse all allowed assignment targets. Per
default assignments to tup... | def parse_assign_target(self, with_tuple=True, name_only=False,
extra_end_rules=None, with_namespace=False):
"""Parse an assignment target. As Jinja2 allows assignments to
tuples, this function can parse all allowed assignment targets. Per
default assignments to tup... | [
"Parse",
"an",
"assignment",
"target",
".",
"As",
"Jinja2",
"allows",
"assignments",
"to",
"tuples",
"this",
"function",
"can",
"parse",
"all",
"allowed",
"assignment",
"targets",
".",
"Per",
"default",
"assignments",
"to",
"tuples",
"are",
"parsed",
"that",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L396-L424 | [
"def",
"parse_assign_target",
"(",
"self",
",",
"with_tuple",
"=",
"True",
",",
"name_only",
"=",
"False",
",",
"extra_end_rules",
"=",
"None",
",",
"with_namespace",
"=",
"False",
")",
":",
"if",
"with_namespace",
"and",
"self",
".",
"stream",
".",
"look",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parser.parse | Parse the whole template into a `Template` node. | pipenv/vendor/jinja2/parser.py | def parse(self):
"""Parse the whole template into a `Template` node."""
result = nodes.Template(self.subparse(), lineno=1)
result.set_environment(self.environment)
return result | def parse(self):
"""Parse the whole template into a `Template` node."""
result = nodes.Template(self.subparse(), lineno=1)
result.set_environment(self.environment)
return result | [
"Parse",
"the",
"whole",
"template",
"into",
"a",
"Template",
"node",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/parser.py#L899-L903 | [
"def",
"parse",
"(",
"self",
")",
":",
"result",
"=",
"nodes",
".",
"Template",
"(",
"self",
".",
"subparse",
"(",
")",
",",
"lineno",
"=",
"1",
")",
"result",
".",
"set_environment",
"(",
"self",
".",
"environment",
")",
"return",
"result"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | ExceptionPexpect.get_trace | This returns an abbreviated stack trace with lines that only concern
the caller. In other words, the stack trace inside the Pexpect module
is not included. | pipenv/vendor/pexpect/exceptions.py | def get_trace(self):
'''This returns an abbreviated stack trace with lines that only concern
the caller. In other words, the stack trace inside the Pexpect module
is not included. '''
tblist = traceback.extract_tb(sys.exc_info()[2])
tblist = [item for item in tblist if ('pexpect... | def get_trace(self):
'''This returns an abbreviated stack trace with lines that only concern
the caller. In other words, the stack trace inside the Pexpect module
is not included. '''
tblist = traceback.extract_tb(sys.exc_info()[2])
tblist = [item for item in tblist if ('pexpect... | [
"This",
"returns",
"an",
"abbreviated",
"stack",
"trace",
"with",
"lines",
"that",
"only",
"concern",
"the",
"caller",
".",
"In",
"other",
"words",
"the",
"stack",
"trace",
"inside",
"the",
"Pexpect",
"module",
"is",
"not",
"included",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/exceptions.py#L17-L26 | [
"def",
"get_trace",
"(",
"self",
")",
":",
"tblist",
"=",
"traceback",
".",
"extract_tb",
"(",
"sys",
".",
"exc_info",
"(",
")",
"[",
"2",
"]",
")",
"tblist",
"=",
"[",
"item",
"for",
"item",
"in",
"tblist",
"if",
"(",
"'pexpect/__init__'",
"not",
"i... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | parse_uri | Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri) | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | def parse_uri(uri):
"""Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri)
"""
groups = URI.match(uri).groups()
return (groups[1], groups[3], groups[4], groups[6], groups[8]) | def parse_uri(uri):
"""Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri)
"""
groups = URI.match(uri).groups()
return (groups[1], groups[3], groups[4], groups[6], groups[8]) | [
"Parses",
"a",
"URI",
"using",
"the",
"regex",
"given",
"in",
"Appendix",
"B",
"of",
"RFC",
"3986",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L21-L27 | [
"def",
"parse_uri",
"(",
"uri",
")",
":",
"groups",
"=",
"URI",
".",
"match",
"(",
"uri",
")",
".",
"groups",
"(",
")",
"return",
"(",
"groups",
"[",
"1",
"]",
",",
"groups",
"[",
"3",
"]",
",",
"groups",
"[",
"4",
"]",
",",
"groups",
"[",
"6... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CacheController._urlnorm | Normalize the URL to create a safe key for the cache | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | def _urlnorm(cls, uri):
"""Normalize the URL to create a safe key for the cache"""
(scheme, authority, path, query, fragment) = parse_uri(uri)
if not scheme or not authority:
raise Exception("Only absolute URIs are allowed. uri = %s" % uri)
scheme = scheme.lower()
au... | def _urlnorm(cls, uri):
"""Normalize the URL to create a safe key for the cache"""
(scheme, authority, path, query, fragment) = parse_uri(uri)
if not scheme or not authority:
raise Exception("Only absolute URIs are allowed. uri = %s" % uri)
scheme = scheme.lower()
au... | [
"Normalize",
"the",
"URL",
"to",
"create",
"a",
"safe",
"key",
"for",
"the",
"cache"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L43-L60 | [
"def",
"_urlnorm",
"(",
"cls",
",",
"uri",
")",
":",
"(",
"scheme",
",",
"authority",
",",
"path",
",",
"query",
",",
"fragment",
")",
"=",
"parse_uri",
"(",
"uri",
")",
"if",
"not",
"scheme",
"or",
"not",
"authority",
":",
"raise",
"Exception",
"(",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CacheController.cached_request | Return a cached response if it exists in the cache, otherwise
return False. | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | def cached_request(self, request):
"""
Return a cached response if it exists in the cache, otherwise
return False.
"""
cache_url = self.cache_url(request.url)
logger.debug('Looking up "%s" in the cache', cache_url)
cc = self.parse_cache_control(request.headers)
... | def cached_request(self, request):
"""
Return a cached response if it exists in the cache, otherwise
return False.
"""
cache_url = self.cache_url(request.url)
logger.debug('Looking up "%s" in the cache', cache_url)
cc = self.parse_cache_control(request.headers)
... | [
"Return",
"a",
"cached",
"response",
"if",
"it",
"exists",
"in",
"the",
"cache",
"otherwise",
"return",
"False",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L120-L229 | [
"def",
"cached_request",
"(",
"self",
",",
"request",
")",
":",
"cache_url",
"=",
"self",
".",
"cache_url",
"(",
"request",
".",
"url",
")",
"logger",
".",
"debug",
"(",
"'Looking up \"%s\" in the cache'",
",",
"cache_url",
")",
"cc",
"=",
"self",
".",
"pa... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CacheController.cache_response | Algorithm for caching requests.
This assumes a requests Response object. | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | def cache_response(self, request, response, body=None, status_codes=None):
"""
Algorithm for caching requests.
This assumes a requests Response object.
"""
# From httplib2: Don't cache 206's since we aren't going to
# handle byte range requests
cac... | def cache_response(self, request, response, body=None, status_codes=None):
"""
Algorithm for caching requests.
This assumes a requests Response object.
"""
# From httplib2: Don't cache 206's since we aren't going to
# handle byte range requests
cac... | [
"Algorithm",
"for",
"caching",
"requests",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L247-L327 | [
"def",
"cache_response",
"(",
"self",
",",
"request",
",",
"response",
",",
"body",
"=",
"None",
",",
"status_codes",
"=",
"None",
")",
":",
"# From httplib2: Don't cache 206's since we aren't going to",
"# handle byte range requests",
"cacheable_status_codes",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | CacheController.update_cached_response | On a 304 we will get a new set of headers that we want to
update our cached value with, assuming we have one.
This should only ever be called when we've sent an ETag and
gotten a 304 as the response. | pipenv/patched/notpip/_vendor/cachecontrol/controller.py | def update_cached_response(self, request, response):
"""On a 304 we will get a new set of headers that we want to
update our cached value with, assuming we have one.
This should only ever be called when we've sent an ETag and
gotten a 304 as the response.
"""
cache_url =... | def update_cached_response(self, request, response):
"""On a 304 we will get a new set of headers that we want to
update our cached value with, assuming we have one.
This should only ever be called when we've sent an ETag and
gotten a 304 as the response.
"""
cache_url =... | [
"On",
"a",
"304",
"we",
"will",
"get",
"a",
"new",
"set",
"of",
"headers",
"that",
"we",
"want",
"to",
"update",
"our",
"cached",
"value",
"with",
"assuming",
"we",
"have",
"one",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/controller.py#L329-L367 | [
"def",
"update_cached_response",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"cache_url",
"=",
"self",
".",
"cache_url",
"(",
"request",
".",
"url",
")",
"cached_response",
"=",
"self",
".",
"serializer",
".",
"loads",
"(",
"request",
",",
"sel... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fdspawn.close | Close the file descriptor.
Calling this method a second time does nothing, but if the file
descriptor was closed elsewhere, :class:`OSError` will be raised. | pipenv/vendor/pexpect/fdpexpect.py | def close (self):
"""Close the file descriptor.
Calling this method a second time does nothing, but if the file
descriptor was closed elsewhere, :class:`OSError` will be raised.
"""
if self.child_fd == -1:
return
self.flush()
os.close(self.child_fd)
... | def close (self):
"""Close the file descriptor.
Calling this method a second time does nothing, but if the file
descriptor was closed elsewhere, :class:`OSError` will be raised.
"""
if self.child_fd == -1:
return
self.flush()
os.close(self.child_fd)
... | [
"Close",
"the",
"file",
"descriptor",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L63-L75 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"child_fd",
"==",
"-",
"1",
":",
"return",
"self",
".",
"flush",
"(",
")",
"os",
".",
"close",
"(",
"self",
".",
"child_fd",
")",
"self",
".",
"child_fd",
"=",
"-",
"1",
"self",
".",
"cl... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fdspawn.isalive | This checks if the file descriptor is still valid. If :func:`os.fstat`
does not raise an exception then we assume it is alive. | pipenv/vendor/pexpect/fdpexpect.py | def isalive (self):
'''This checks if the file descriptor is still valid. If :func:`os.fstat`
does not raise an exception then we assume it is alive. '''
if self.child_fd == -1:
return False
try:
os.fstat(self.child_fd)
return True
except:
... | def isalive (self):
'''This checks if the file descriptor is still valid. If :func:`os.fstat`
does not raise an exception then we assume it is alive. '''
if self.child_fd == -1:
return False
try:
os.fstat(self.child_fd)
return True
except:
... | [
"This",
"checks",
"if",
"the",
"file",
"descriptor",
"is",
"still",
"valid",
".",
"If",
":",
"func",
":",
"os",
".",
"fstat",
"does",
"not",
"raise",
"an",
"exception",
"then",
"we",
"assume",
"it",
"is",
"alive",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L77-L87 | [
"def",
"isalive",
"(",
"self",
")",
":",
"if",
"self",
".",
"child_fd",
"==",
"-",
"1",
":",
"return",
"False",
"try",
":",
"os",
".",
"fstat",
"(",
"self",
".",
"child_fd",
")",
"return",
"True",
"except",
":",
"return",
"False"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fdspawn.read_nonblocking | Read from the file descriptor and return the result as a string.
The read_nonblocking method of :class:`SpawnBase` assumes that a call
to os.read will not block (timeout parameter is ignored). This is not
the case for POSIX file-like objects such as sockets and serial ports.
Use :func:... | pipenv/vendor/pexpect/fdpexpect.py | def read_nonblocking(self, size=1, timeout=-1):
"""
Read from the file descriptor and return the result as a string.
The read_nonblocking method of :class:`SpawnBase` assumes that a call
to os.read will not block (timeout parameter is ignored). This is not
the case for POSIX fil... | def read_nonblocking(self, size=1, timeout=-1):
"""
Read from the file descriptor and return the result as a string.
The read_nonblocking method of :class:`SpawnBase` assumes that a call
to os.read will not block (timeout parameter is ignored). This is not
the case for POSIX fil... | [
"Read",
"from",
"the",
"file",
"descriptor",
"and",
"return",
"the",
"result",
"as",
"a",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/fdpexpect.py#L118-L148 | [
"def",
"read_nonblocking",
"(",
"self",
",",
"size",
"=",
"1",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"os",
".",
"name",
"==",
"'posix'",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self",
".",
"timeout",
"rlist",
"=",
"["... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | clear_caches | Jinja2 keeps internal caches for environments and lexers. These are
used so that Jinja2 doesn't have to recreate environments and lexers all
the time. Normally you don't have to care about that but if you are
measuring memory consumption you may want to clean the caches. | pipenv/vendor/jinja2/utils.py | def clear_caches():
"""Jinja2 keeps internal caches for environments and lexers. These are
used so that Jinja2 doesn't have to recreate environments and lexers all
the time. Normally you don't have to care about that but if you are
measuring memory consumption you may want to clean the caches.
"""... | def clear_caches():
"""Jinja2 keeps internal caches for environments and lexers. These are
used so that Jinja2 doesn't have to recreate environments and lexers all
the time. Normally you don't have to care about that but if you are
measuring memory consumption you may want to clean the caches.
"""... | [
"Jinja2",
"keeps",
"internal",
"caches",
"for",
"environments",
"and",
"lexers",
".",
"These",
"are",
"used",
"so",
"that",
"Jinja2",
"doesn",
"t",
"have",
"to",
"recreate",
"environments",
"and",
"lexers",
"all",
"the",
"time",
".",
"Normally",
"you",
"don"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L111-L120 | [
"def",
"clear_caches",
"(",
")",
":",
"from",
"jinja2",
".",
"environment",
"import",
"_spontaneous_environments",
"from",
"jinja2",
".",
"lexer",
"import",
"_lexer_cache",
"_spontaneous_environments",
".",
"clear",
"(",
")",
"_lexer_cache",
".",
"clear",
"(",
")"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | import_string | Imports an object based on a string. This is useful if you want to
use import paths as endpoints or something similar. An import path can
be specified either in dotted notation (``xml.sax.saxutils.escape``)
or with a colon as object delimiter (``xml.sax.saxutils:escape``).
If the `silent` is True the... | pipenv/vendor/jinja2/utils.py | def import_string(import_name, silent=False):
"""Imports an object based on a string. This is useful if you want to
use import paths as endpoints or something similar. An import path can
be specified either in dotted notation (``xml.sax.saxutils.escape``)
or with a colon as object delimiter (``xml.sax... | def import_string(import_name, silent=False):
"""Imports an object based on a string. This is useful if you want to
use import paths as endpoints or something similar. An import path can
be specified either in dotted notation (``xml.sax.saxutils.escape``)
or with a colon as object delimiter (``xml.sax... | [
"Imports",
"an",
"object",
"based",
"on",
"a",
"string",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"use",
"import",
"paths",
"as",
"endpoints",
"or",
"something",
"similar",
".",
"An",
"import",
"path",
"can",
"be",
"specified",
"either",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L123-L146 | [
"def",
"import_string",
"(",
"import_name",
",",
"silent",
"=",
"False",
")",
":",
"try",
":",
"if",
"':'",
"in",
"import_name",
":",
"module",
",",
"obj",
"=",
"import_name",
".",
"split",
"(",
"':'",
",",
"1",
")",
"elif",
"'.'",
"in",
"import_name",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | pformat | Prettyprint an object. Either use the `pretty` library or the
builtin `pprint`. | pipenv/vendor/jinja2/utils.py | def pformat(obj, verbose=False):
"""Prettyprint an object. Either use the `pretty` library or the
builtin `pprint`.
"""
try:
from pretty import pretty
return pretty(obj, verbose=verbose)
except ImportError:
from pprint import pformat
return pformat(obj) | def pformat(obj, verbose=False):
"""Prettyprint an object. Either use the `pretty` library or the
builtin `pprint`.
"""
try:
from pretty import pretty
return pretty(obj, verbose=verbose)
except ImportError:
from pprint import pformat
return pformat(obj) | [
"Prettyprint",
"an",
"object",
".",
"Either",
"use",
"the",
"pretty",
"library",
"or",
"the",
"builtin",
"pprint",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L177-L186 | [
"def",
"pformat",
"(",
"obj",
",",
"verbose",
"=",
"False",
")",
":",
"try",
":",
"from",
"pretty",
"import",
"pretty",
"return",
"pretty",
"(",
"obj",
",",
"verbose",
"=",
"verbose",
")",
"except",
"ImportError",
":",
"from",
"pprint",
"import",
"pforma... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | unicode_urlencode | URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to their unicode
representation first. | pipenv/vendor/jinja2/utils.py | def unicode_urlencode(obj, charset='utf-8', for_qs=False):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to thei... | def unicode_urlencode(obj, charset='utf-8', for_qs=False):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to thei... | [
"URL",
"escapes",
"a",
"single",
"bytestring",
"or",
"unicode",
"string",
"with",
"the",
"given",
"charset",
"if",
"applicable",
"to",
"URL",
"safe",
"quoting",
"under",
"all",
"rules",
"that",
"need",
"to",
"be",
"considered",
"under",
"all",
"supported",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L287-L303 | [
"def",
"unicode_urlencode",
"(",
"obj",
",",
"charset",
"=",
"'utf-8'",
",",
"for_qs",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"string_types",
")",
":",
"obj",
"=",
"text_type",
"(",
"obj",
")",
"if",
"isinstance",
"(",
"obj... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | select_autoescape | Intelligently sets the initial value of autoescaping based on the
filename of the template. This is the recommended way to configure
autoescaping if you do not want to write a custom function yourself.
If you want to enable it for all templates created from strings or
for all templates with `.html` an... | pipenv/vendor/jinja2/utils.py | def select_autoescape(enabled_extensions=('html', 'htm', 'xml'),
disabled_extensions=(),
default_for_string=True,
default=False):
"""Intelligently sets the initial value of autoescaping based on the
filename of the template. This is the recommen... | def select_autoescape(enabled_extensions=('html', 'htm', 'xml'),
disabled_extensions=(),
default_for_string=True,
default=False):
"""Intelligently sets the initial value of autoescaping based on the
filename of the template. This is the recommen... | [
"Intelligently",
"sets",
"the",
"initial",
"value",
"of",
"autoescaping",
"based",
"on",
"the",
"filename",
"of",
"the",
"template",
".",
"This",
"is",
"the",
"recommended",
"way",
"to",
"configure",
"autoescaping",
"if",
"you",
"do",
"not",
"want",
"to",
"w... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L491-L542 | [
"def",
"select_autoescape",
"(",
"enabled_extensions",
"=",
"(",
"'html'",
",",
"'htm'",
",",
"'xml'",
")",
",",
"disabled_extensions",
"=",
"(",
")",
",",
"default_for_string",
"=",
"True",
",",
"default",
"=",
"False",
")",
":",
"enabled_patterns",
"=",
"t... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | htmlsafe_json_dumps | Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. Due to how this function escapes certain
characters this... | pipenv/vendor/jinja2/utils.py | def htmlsafe_json_dumps(obj, dumper=None, **kwargs):
"""Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. ... | def htmlsafe_json_dumps(obj, dumper=None, **kwargs):
"""Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. ... | [
"Works",
"exactly",
"like",
":",
"func",
":",
"dumps",
"but",
"is",
"safe",
"for",
"use",
"in",
"<script",
">",
"tags",
".",
"It",
"accepts",
"the",
"same",
"arguments",
"and",
"returns",
"a",
"JSON",
"string",
".",
"Note",
"that",
"this",
"is",
"avail... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L545-L570 | [
"def",
"htmlsafe_json_dumps",
"(",
"obj",
",",
"dumper",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dumper",
"is",
"None",
":",
"dumper",
"=",
"json",
".",
"dumps",
"rv",
"=",
"dumper",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LRUCache.copy | Return a shallow copy of the instance. | pipenv/vendor/jinja2/utils.py | def copy(self):
"""Return a shallow copy of the instance."""
rv = self.__class__(self.capacity)
rv._mapping.update(self._mapping)
rv._queue = deque(self._queue)
return rv | def copy(self):
"""Return a shallow copy of the instance."""
rv = self.__class__(self.capacity)
rv._mapping.update(self._mapping)
rv._queue = deque(self._queue)
return rv | [
"Return",
"a",
"shallow",
"copy",
"of",
"the",
"instance",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L341-L346 | [
"def",
"copy",
"(",
"self",
")",
":",
"rv",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"capacity",
")",
"rv",
".",
"_mapping",
".",
"update",
"(",
"self",
".",
"_mapping",
")",
"rv",
".",
"_queue",
"=",
"deque",
"(",
"self",
".",
"_queue",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LRUCache.setdefault | Set `default` if the key is not in the cache otherwise
leave unchanged. Return the value of this key. | pipenv/vendor/jinja2/utils.py | def setdefault(self, key, default=None):
"""Set `default` if the key is not in the cache otherwise
leave unchanged. Return the value of this key.
"""
self._wlock.acquire()
try:
try:
return self[key]
except KeyError:
self[key... | def setdefault(self, key, default=None):
"""Set `default` if the key is not in the cache otherwise
leave unchanged. Return the value of this key.
"""
self._wlock.acquire()
try:
try:
return self[key]
except KeyError:
self[key... | [
"Set",
"default",
"if",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"otherwise",
"leave",
"unchanged",
".",
"Return",
"the",
"value",
"of",
"this",
"key",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L355-L367 | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_wlock",
".",
"acquire",
"(",
")",
"try",
":",
"try",
":",
"return",
"self",
"[",
"key",
"]",
"except",
"KeyError",
":",
"self",
"[",
"key",
"]",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LRUCache.clear | Clear the cache. | pipenv/vendor/jinja2/utils.py | def clear(self):
"""Clear the cache."""
self._wlock.acquire()
try:
self._mapping.clear()
self._queue.clear()
finally:
self._wlock.release() | def clear(self):
"""Clear the cache."""
self._wlock.acquire()
try:
self._mapping.clear()
self._queue.clear()
finally:
self._wlock.release() | [
"Clear",
"the",
"cache",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L369-L376 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_wlock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_mapping",
".",
"clear",
"(",
")",
"self",
".",
"_queue",
".",
"clear",
"(",
")",
"finally",
":",
"self",
".",
"_wlock",
".",
"relea... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | LRUCache.items | Return a list of items. | pipenv/vendor/jinja2/utils.py | def items(self):
"""Return a list of items."""
result = [(key, self._mapping[key]) for key in list(self._queue)]
result.reverse()
return result | def items(self):
"""Return a list of items."""
result = [(key, self._mapping[key]) for key in list(self._queue)]
result.reverse()
return result | [
"Return",
"a",
"list",
"of",
"items",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L444-L448 | [
"def",
"items",
"(",
"self",
")",
":",
"result",
"=",
"[",
"(",
"key",
",",
"self",
".",
"_mapping",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"list",
"(",
"self",
".",
"_queue",
")",
"]",
"result",
".",
"reverse",
"(",
")",
"return",
"result"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | license_fallback | Hardcoded license URLs. Check when updating if those are still needed | tasks/vendoring/__init__.py | def license_fallback(vendor_dir, sdist_name):
"""Hardcoded license URLs. Check when updating if those are still needed"""
libname = libname_from_dir(sdist_name)
if libname not in HARDCODED_LICENSE_URLS:
raise ValueError('No hardcoded URL for {} license'.format(libname))
url = HARDCODED_LICENSE_... | def license_fallback(vendor_dir, sdist_name):
"""Hardcoded license URLs. Check when updating if those are still needed"""
libname = libname_from_dir(sdist_name)
if libname not in HARDCODED_LICENSE_URLS:
raise ValueError('No hardcoded URL for {} license'.format(libname))
url = HARDCODED_LICENSE_... | [
"Hardcoded",
"license",
"URLs",
".",
"Check",
"when",
"updating",
"if",
"those",
"are",
"still",
"needed"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L588-L600 | [
"def",
"license_fallback",
"(",
"vendor_dir",
",",
"sdist_name",
")",
":",
"libname",
"=",
"libname_from_dir",
"(",
"sdist_name",
")",
"if",
"libname",
"not",
"in",
"HARDCODED_LICENSE_URLS",
":",
"raise",
"ValueError",
"(",
"'No hardcoded URL for {} license'",
".",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | libname_from_dir | Reconstruct the library name without it's version | tasks/vendoring/__init__.py | def libname_from_dir(dirname):
"""Reconstruct the library name without it's version"""
parts = []
for part in dirname.split('-'):
if part[0].isdigit():
break
parts.append(part)
return '-'.join(parts) | def libname_from_dir(dirname):
"""Reconstruct the library name without it's version"""
parts = []
for part in dirname.split('-'):
if part[0].isdigit():
break
parts.append(part)
return '-'.join(parts) | [
"Reconstruct",
"the",
"library",
"name",
"without",
"it",
"s",
"version"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L603-L610 | [
"def",
"libname_from_dir",
"(",
"dirname",
")",
":",
"parts",
"=",
"[",
"]",
"for",
"part",
"in",
"dirname",
".",
"split",
"(",
"'-'",
")",
":",
"if",
"part",
"[",
"0",
"]",
".",
"isdigit",
"(",
")",
":",
"break",
"parts",
".",
"append",
"(",
"pa... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | license_destination | Given the (reconstructed) library name, find appropriate destination | tasks/vendoring/__init__.py | def license_destination(vendor_dir, libname, filename):
"""Given the (reconstructed) library name, find appropriate destination"""
normal = vendor_dir / libname
if normal.is_dir():
return normal / filename
lowercase = vendor_dir / libname.lower().replace('-', '_')
if lowercase.is_dir():
... | def license_destination(vendor_dir, libname, filename):
"""Given the (reconstructed) library name, find appropriate destination"""
normal = vendor_dir / libname
if normal.is_dir():
return normal / filename
lowercase = vendor_dir / libname.lower().replace('-', '_')
if lowercase.is_dir():
... | [
"Given",
"the",
"(",
"reconstructed",
")",
"library",
"name",
"find",
"appropriate",
"destination"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L613-L634 | [
"def",
"license_destination",
"(",
"vendor_dir",
",",
"libname",
",",
"filename",
")",
":",
"normal",
"=",
"vendor_dir",
"/",
"libname",
"if",
"normal",
".",
"is_dir",
"(",
")",
":",
"return",
"normal",
"/",
"filename",
"lowercase",
"=",
"vendor_dir",
"/",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _convert_hashes | Convert Pipfile.lock hash lines into InstallRequirement option format.
The option format uses a str-list mapping. Keys are hash algorithms, and
the list contains all values of that algorithm. | pipenv/vendor/passa/internals/_pip.py | def _convert_hashes(values):
"""Convert Pipfile.lock hash lines into InstallRequirement option format.
The option format uses a str-list mapping. Keys are hash algorithms, and
the list contains all values of that algorithm.
"""
hashes = {}
if not values:
return hashes
for value in v... | def _convert_hashes(values):
"""Convert Pipfile.lock hash lines into InstallRequirement option format.
The option format uses a str-list mapping. Keys are hash algorithms, and
the list contains all values of that algorithm.
"""
hashes = {}
if not values:
return hashes
for value in v... | [
"Convert",
"Pipfile",
".",
"lock",
"hash",
"lines",
"into",
"InstallRequirement",
"option",
"format",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L113-L130 | [
"def",
"_convert_hashes",
"(",
"values",
")",
":",
"hashes",
"=",
"{",
"}",
"if",
"not",
"values",
":",
"return",
"hashes",
"for",
"value",
"in",
"values",
":",
"try",
":",
"name",
",",
"value",
"=",
"value",
".",
"split",
"(",
"\":\"",
",",
"1",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _suppress_distutils_logs | Hack to hide noise generated by `setup.py develop`.
There isn't a good way to suppress them now, so let's monky-patch.
See https://bugs.python.org/issue25392. | pipenv/vendor/passa/internals/_pip.py | def _suppress_distutils_logs():
"""Hack to hide noise generated by `setup.py develop`.
There isn't a good way to suppress them now, so let's monky-patch.
See https://bugs.python.org/issue25392.
"""
f = distutils.log.Log._log
def _log(log, level, msg, args):
if level >= distutils.log.ER... | def _suppress_distutils_logs():
"""Hack to hide noise generated by `setup.py develop`.
There isn't a good way to suppress them now, so let's monky-patch.
See https://bugs.python.org/issue25392.
"""
f = distutils.log.Log._log
def _log(log, level, msg, args):
if level >= distutils.log.ER... | [
"Hack",
"to",
"hide",
"noise",
"generated",
"by",
"setup",
".",
"py",
"develop",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L258-L272 | [
"def",
"_suppress_distutils_logs",
"(",
")",
":",
"f",
"=",
"distutils",
".",
"log",
".",
"Log",
".",
"_log",
"def",
"_log",
"(",
"log",
",",
"level",
",",
"msg",
",",
"args",
")",
":",
"if",
"level",
">=",
"distutils",
".",
"log",
".",
"ERROR",
":... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _find_egg_info | Find this package's .egg-info directory.
Due to how sdists are designed, the .egg-info directory cannot be reliably
found without running setup.py to aggregate all configurations. This
function instead uses some heuristics to locate the egg-info directory
that most likely represents this package.
... | pipenv/vendor/passa/internals/_pip.py | def _find_egg_info(ireq):
"""Find this package's .egg-info directory.
Due to how sdists are designed, the .egg-info directory cannot be reliably
found without running setup.py to aggregate all configurations. This
function instead uses some heuristics to locate the egg-info directory
that most like... | def _find_egg_info(ireq):
"""Find this package's .egg-info directory.
Due to how sdists are designed, the .egg-info directory cannot be reliably
found without running setup.py to aggregate all configurations. This
function instead uses some heuristics to locate the egg-info directory
that most like... | [
"Find",
"this",
"package",
"s",
".",
"egg",
"-",
"info",
"directory",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/_pip.py#L355-L389 | [
"def",
"_find_egg_info",
"(",
"ireq",
")",
":",
"root",
"=",
"ireq",
".",
"setup_py_dir",
"directory_iterator",
"=",
"_iter_egg_info_directories",
"(",
"root",
",",
"ireq",
".",
"name",
")",
"try",
":",
"top_egg_info",
"=",
"next",
"(",
"directory_iterator",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fs_str | Encodes a string into the proper filesystem encoding
Borrowed from pip-tools | pipenv/vendor/vistir/compat.py | def fs_str(string):
"""Encodes a string into the proper filesystem encoding
Borrowed from pip-tools
"""
if isinstance(string, str):
return string
assert not isinstance(string, bytes)
return string.encode(_fs_encoding) | def fs_str(string):
"""Encodes a string into the proper filesystem encoding
Borrowed from pip-tools
"""
if isinstance(string, str):
return string
assert not isinstance(string, bytes)
return string.encode(_fs_encoding) | [
"Encodes",
"a",
"string",
"into",
"the",
"proper",
"filesystem",
"encoding"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L208-L217 | [
"def",
"fs_str",
"(",
"string",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"str",
")",
":",
"return",
"string",
"assert",
"not",
"isinstance",
"(",
"string",
",",
"bytes",
")",
"return",
"string",
".",
"encode",
"(",
"_fs_encoding",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _get_path | Fetch the string value from a path-like object
Returns **None** if there is no string value. | pipenv/vendor/vistir/compat.py | def _get_path(path):
"""
Fetch the string value from a path-like object
Returns **None** if there is no string value.
"""
if isinstance(path, (six.string_types, bytes)):
return path
path_type = type(path)
try:
path_repr = path_type.__fspath__(path)
except AttributeError... | def _get_path(path):
"""
Fetch the string value from a path-like object
Returns **None** if there is no string value.
"""
if isinstance(path, (six.string_types, bytes)):
return path
path_type = type(path)
try:
path_repr = path_type.__fspath__(path)
except AttributeError... | [
"Fetch",
"the",
"string",
"value",
"from",
"a",
"path",
"-",
"like",
"object"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L220-L236 | [
"def",
"_get_path",
"(",
"path",
")",
":",
"if",
"isinstance",
"(",
"path",
",",
"(",
"six",
".",
"string_types",
",",
"bytes",
")",
")",
":",
"return",
"path",
"path_type",
"=",
"type",
"(",
"path",
")",
"try",
":",
"path_repr",
"=",
"path_type",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fs_encode | Encode a filesystem path to the proper filesystem encoding
:param Union[str, bytes] path: A string-like path
:returns: A bytes-encoded filesystem path representation | pipenv/vendor/vistir/compat.py | def fs_encode(path):
"""
Encode a filesystem path to the proper filesystem encoding
:param Union[str, bytes] path: A string-like path
:returns: A bytes-encoded filesystem path representation
"""
path = _get_path(path)
if path is None:
raise TypeError("expected a valid path to encod... | def fs_encode(path):
"""
Encode a filesystem path to the proper filesystem encoding
:param Union[str, bytes] path: A string-like path
:returns: A bytes-encoded filesystem path representation
"""
path = _get_path(path)
if path is None:
raise TypeError("expected a valid path to encod... | [
"Encode",
"a",
"filesystem",
"path",
"to",
"the",
"proper",
"filesystem",
"encoding"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L239-L252 | [
"def",
"fs_encode",
"(",
"path",
")",
":",
"path",
"=",
"_get_path",
"(",
"path",
")",
"if",
"path",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"expected a valid path to encode\"",
")",
"if",
"isinstance",
"(",
"path",
",",
"six",
".",
"text_type",
")... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fs_decode | Decode a filesystem path using the proper filesystem encoding
:param path: The filesystem path to decode from bytes or string
:return: [description]
:rtype: [type] | pipenv/vendor/vistir/compat.py | def fs_decode(path):
"""
Decode a filesystem path using the proper filesystem encoding
:param path: The filesystem path to decode from bytes or string
:return: [description]
:rtype: [type]
"""
path = _get_path(path)
if path is None:
raise TypeError("expected a valid path to dec... | def fs_decode(path):
"""
Decode a filesystem path using the proper filesystem encoding
:param path: The filesystem path to decode from bytes or string
:return: [description]
:rtype: [type]
"""
path = _get_path(path)
if path is None:
raise TypeError("expected a valid path to dec... | [
"Decode",
"a",
"filesystem",
"path",
"using",
"the",
"proper",
"filesystem",
"encoding"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/compat.py#L255-L269 | [
"def",
"fs_decode",
"(",
"path",
")",
":",
"path",
"=",
"_get_path",
"(",
"path",
")",
"if",
"path",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"expected a valid path to decode\"",
")",
"if",
"isinstance",
"(",
"path",
",",
"six",
".",
"binary_type",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | trace_graph | Build a collection of "traces" for each package.
A trace is a list of names that eventually leads to the package. For
example, if A and B are root dependencies, A depends on C and D, B
depends on C, and C depends on D, the return value would be like::
{
None: [],
"A": [None... | pipenv/vendor/passa/internals/traces.py | def trace_graph(graph):
"""Build a collection of "traces" for each package.
A trace is a list of names that eventually leads to the package. For
example, if A and B are root dependencies, A depends on C and D, B
depends on C, and C depends on D, the return value would be like::
{
N... | def trace_graph(graph):
"""Build a collection of "traces" for each package.
A trace is a list of names that eventually leads to the package. For
example, if A and B are root dependencies, A depends on C and D, B
depends on C, and C depends on D, the return value would be like::
{
N... | [
"Build",
"a",
"collection",
"of",
"traces",
"for",
"each",
"package",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/traces.py#L18-L40 | [
"def",
"trace_graph",
"(",
"graph",
")",
":",
"result",
"=",
"{",
"None",
":",
"[",
"]",
"}",
"for",
"vertex",
"in",
"graph",
":",
"result",
"[",
"vertex",
"]",
"=",
"[",
"]",
"for",
"root",
"in",
"graph",
".",
"iter_children",
"(",
"None",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Timeout._validate_timeout | Check that a timeout attribute is valid.
:param value: The timeout value to validate
:param name: The name of the timeout attribute to validate. This is
used to specify in error messages.
:return: The validated and casted version of the given value.
:raises ValueError: If it... | pipenv/vendor/urllib3/util/timeout.py | def _validate_timeout(cls, value, name):
""" Check that a timeout attribute is valid.
:param value: The timeout value to validate
:param name: The name of the timeout attribute to validate. This is
used to specify in error messages.
:return: The validated and casted version ... | def _validate_timeout(cls, value, name):
""" Check that a timeout attribute is valid.
:param value: The timeout value to validate
:param name: The name of the timeout attribute to validate. This is
used to specify in error messages.
:return: The validated and casted version ... | [
"Check",
"that",
"a",
"timeout",
"attribute",
"is",
"valid",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L104-L138 | [
"def",
"_validate_timeout",
"(",
"cls",
",",
"value",
",",
"name",
")",
":",
"if",
"value",
"is",
"_Default",
":",
"return",
"cls",
".",
"DEFAULT_TIMEOUT",
"if",
"value",
"is",
"None",
"or",
"value",
"is",
"cls",
".",
"DEFAULT_TIMEOUT",
":",
"return",
"v... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Timeout.clone | Create a copy of the timeout object
Timeout properties are stored per-pool but each request needs a fresh
Timeout object to ensure each one has its own start/stop configured.
:return: a copy of the timeout object
:rtype: :class:`Timeout` | pipenv/vendor/urllib3/util/timeout.py | def clone(self):
""" Create a copy of the timeout object
Timeout properties are stored per-pool but each request needs a fresh
Timeout object to ensure each one has its own start/stop configured.
:return: a copy of the timeout object
:rtype: :class:`Timeout`
"""
... | def clone(self):
""" Create a copy of the timeout object
Timeout properties are stored per-pool but each request needs a fresh
Timeout object to ensure each one has its own start/stop configured.
:return: a copy of the timeout object
:rtype: :class:`Timeout`
"""
... | [
"Create",
"a",
"copy",
"of",
"the",
"timeout",
"object"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L156-L169 | [
"def",
"clone",
"(",
"self",
")",
":",
"# We can't use copy.deepcopy because that will also create a new object",
"# for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to",
"# detect the user default.",
"return",
"Timeout",
"(",
"connect",
"=",
"self",
".",
"_connect",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Timeout.start_connect | Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already. | pipenv/vendor/urllib3/util/timeout.py | def start_connect(self):
""" Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already.
"""
if self._start_connect is not None:
raise TimeoutStateError("Tim... | def start_connect(self):
""" Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already.
"""
if self._start_connect is not None:
raise TimeoutStateError("Tim... | [
"Start",
"the",
"timeout",
"clock",
"used",
"during",
"a",
"connect",
"()",
"attempt"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L171-L180 | [
"def",
"start_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_start_connect",
"is",
"not",
"None",
":",
"raise",
"TimeoutStateError",
"(",
"\"Timeout timer has already been started.\"",
")",
"self",
".",
"_start_connect",
"=",
"current_time",
"(",
")",
"retu... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Timeout.connect_timeout | Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None | pipenv/vendor/urllib3/util/timeout.py | def connect_timeout(self):
""" Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
... | def connect_timeout(self):
""" Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
... | [
"Get",
"the",
"value",
"to",
"use",
"when",
"setting",
"a",
"connection",
"timeout",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L196-L211 | [
"def",
"connect_timeout",
"(",
"self",
")",
":",
"if",
"self",
".",
"total",
"is",
"None",
":",
"return",
"self",
".",
"_connect",
"if",
"self",
".",
"_connect",
"is",
"None",
"or",
"self",
".",
"_connect",
"is",
"self",
".",
"DEFAULT_TIMEOUT",
":",
"r... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Timeout.read_timeout | Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If the connection time has not been
... | pipenv/vendor/urllib3/util/timeout.py | def read_timeout(self):
""" Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If t... | def read_timeout(self):
""" Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If t... | [
"Get",
"the",
"value",
"for",
"the",
"read",
"timeout",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/timeout.py#L214-L242 | [
"def",
"read_timeout",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"total",
"is",
"not",
"None",
"and",
"self",
".",
"total",
"is",
"not",
"self",
".",
"DEFAULT_TIMEOUT",
"and",
"self",
".",
"_read",
"is",
"not",
"None",
"and",
"self",
".",
"_read... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | SOCKSConnection._new_conn | Establish a new connection via the SOCKS proxy. | pipenv/vendor/urllib3/contrib/socks.py | def _new_conn(self):
"""
Establish a new connection via the SOCKS proxy.
"""
extra_kw = {}
if self.source_address:
extra_kw['source_address'] = self.source_address
if self.socket_options:
extra_kw['socket_options'] = self.socket_options
t... | def _new_conn(self):
"""
Establish a new connection via the SOCKS proxy.
"""
extra_kw = {}
if self.source_address:
extra_kw['source_address'] = self.source_address
if self.socket_options:
extra_kw['socket_options'] = self.socket_options
t... | [
"Establish",
"a",
"new",
"connection",
"via",
"the",
"SOCKS",
"proxy",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/contrib/socks.py#L67-L122 | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"extra_kw",
"=",
"{",
"}",
"if",
"self",
".",
"source_address",
":",
"extra_kw",
"[",
"'source_address'",
"]",
"=",
"self",
".",
"source_address",
"if",
"self",
".",
"socket_options",
":",
"extra_kw",
"[",
"'socke... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_requirement_info | Compute and return values (req, editable, comments) for use in
FrozenRequirement.from_dist(). | pipenv/patched/notpip/_internal/operations/freeze.py | def get_requirement_info(dist):
# type: (Distribution) -> RequirementInfo
"""
Compute and return values (req, editable, comments) for use in
FrozenRequirement.from_dist().
"""
if not dist_is_editable(dist):
return (None, False, [])
location = os.path.normcase(os.path.abspath(dist.lo... | def get_requirement_info(dist):
# type: (Distribution) -> RequirementInfo
"""
Compute and return values (req, editable, comments) for use in
FrozenRequirement.from_dist().
"""
if not dist_is_editable(dist):
return (None, False, [])
location = os.path.normcase(os.path.abspath(dist.lo... | [
"Compute",
"and",
"return",
"values",
"(",
"req",
"editable",
"comments",
")",
"for",
"use",
"in",
"FrozenRequirement",
".",
"from_dist",
"()",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/freeze.py#L164-L223 | [
"def",
"get_requirement_info",
"(",
"dist",
")",
":",
"# type: (Distribution) -> RequirementInfo",
"if",
"not",
"dist_is_editable",
"(",
"dist",
")",
":",
"return",
"(",
"None",
",",
"False",
",",
"[",
"]",
")",
"location",
"=",
"os",
".",
"path",
".",
"norm... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | detect_proc | Detect /proc filesystem style.
This checks the /proc/{pid} directory for possible formats. Returns one of
the followings as str:
* `stat`: Linux-style, i.e. ``/proc/{pid}/stat``.
* `status`: BSD-style, i.e. ``/proc/{pid}/status``. | pipenv/vendor/shellingham/posix/proc.py | def detect_proc():
"""Detect /proc filesystem style.
This checks the /proc/{pid} directory for possible formats. Returns one of
the followings as str:
* `stat`: Linux-style, i.e. ``/proc/{pid}/stat``.
* `status`: BSD-style, i.e. ``/proc/{pid}/status``.
"""
pid = os.getpid()
for name in... | def detect_proc():
"""Detect /proc filesystem style.
This checks the /proc/{pid} directory for possible formats. Returns one of
the followings as str:
* `stat`: Linux-style, i.e. ``/proc/{pid}/stat``.
* `status`: BSD-style, i.e. ``/proc/{pid}/status``.
"""
pid = os.getpid()
for name in... | [
"Detect",
"/",
"proc",
"filesystem",
"style",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/proc.py#L15-L28 | [
"def",
"detect_proc",
"(",
")",
":",
"pid",
"=",
"os",
".",
"getpid",
"(",
")",
"for",
"name",
"in",
"(",
"'stat'",
",",
"'status'",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'/proc'",
",",
"st... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | get_process_mapping | Try to look up the process tree via the /proc interface. | pipenv/vendor/shellingham/posix/proc.py | def get_process_mapping():
"""Try to look up the process tree via the /proc interface.
"""
stat_name = detect_proc()
self_tty = _get_stat(os.getpid(), stat_name)[0]
processes = {}
for pid in os.listdir('/proc'):
if not pid.isdigit():
continue
try:
tty, ppi... | def get_process_mapping():
"""Try to look up the process tree via the /proc interface.
"""
stat_name = detect_proc()
self_tty = _get_stat(os.getpid(), stat_name)[0]
processes = {}
for pid in os.listdir('/proc'):
if not pid.isdigit():
continue
try:
tty, ppi... | [
"Try",
"to",
"look",
"up",
"the",
"process",
"tree",
"via",
"the",
"/",
"proc",
"interface",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/proc.py#L54-L72 | [
"def",
"get_process_mapping",
"(",
")",
":",
"stat_name",
"=",
"detect_proc",
"(",
")",
"self_tty",
"=",
"_get_stat",
"(",
"os",
".",
"getpid",
"(",
")",
",",
"stat_name",
")",
"[",
"0",
"]",
"processes",
"=",
"{",
"}",
"for",
"pid",
"in",
"os",
".",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | NamedTemporaryFile | Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to io.open (default "w+b").
'buffering' -- the buffer size argument to io.open (default -1).
'encoding' -- the encoding argument to io.open (default None)
'newline' -- the newl... | pipenv/vendor/vistir/backports/tempfile.py | def NamedTemporaryFile(
mode="w+b",
buffering=-1,
encoding=None,
newline=None,
suffix=None,
prefix=None,
dir=None,
delete=True,
wrapper_class_override=None,
):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the... | def NamedTemporaryFile(
mode="w+b",
buffering=-1,
encoding=None,
newline=None,
suffix=None,
prefix=None,
dir=None,
delete=True,
wrapper_class_override=None,
):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the... | [
"Create",
"and",
"return",
"a",
"temporary",
"file",
".",
"Arguments",
":",
"prefix",
"suffix",
"dir",
"--",
"as",
"for",
"mkstemp",
".",
"mode",
"--",
"the",
"mode",
"argument",
"to",
"io",
".",
"open",
"(",
"default",
"w",
"+",
"b",
")",
".",
"buff... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/backports/tempfile.py#L168-L216 | [
"def",
"NamedTemporaryFile",
"(",
"mode",
"=",
"\"w+b\"",
",",
"buffering",
"=",
"-",
"1",
",",
"encoding",
"=",
"None",
",",
"newline",
"=",
"None",
",",
"suffix",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"dir",
"=",
"None",
",",
"delete",
"=",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | fast_exit | Exit without garbage collection, this speeds up exit by about 10ms for
things like bash completion. | pipenv/vendor/click/core.py | def fast_exit(code):
"""Exit without garbage collection, this speeds up exit by about 10ms for
things like bash completion.
"""
sys.stdout.flush()
sys.stderr.flush()
os._exit(code) | def fast_exit(code):
"""Exit without garbage collection, this speeds up exit by about 10ms for
things like bash completion.
"""
sys.stdout.flush()
sys.stderr.flush()
os._exit(code) | [
"Exit",
"without",
"garbage",
"collection",
"this",
"speeds",
"up",
"exit",
"by",
"about",
"10ms",
"for",
"things",
"like",
"bash",
"completion",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L39-L45 | [
"def",
"fast_exit",
"(",
"code",
")",
":",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"sys",
".",
"stderr",
".",
"flush",
"(",
")",
"os",
".",
"_exit",
"(",
"code",
")"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | _bashcomplete | Internal handler for the bash completion support. | pipenv/vendor/click/core.py | def _bashcomplete(cmd, prog_name, complete_var=None):
"""Internal handler for the bash completion support."""
if complete_var is None:
complete_var = '_%s_COMPLETE' % (prog_name.replace('-', '_')).upper()
complete_instr = os.environ.get(complete_var)
if not complete_instr:
return
fr... | def _bashcomplete(cmd, prog_name, complete_var=None):
"""Internal handler for the bash completion support."""
if complete_var is None:
complete_var = '_%s_COMPLETE' % (prog_name.replace('-', '_')).upper()
complete_instr = os.environ.get(complete_var)
if not complete_instr:
return
fr... | [
"Internal",
"handler",
"for",
"the",
"bash",
"completion",
"support",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L48-L58 | [
"def",
"_bashcomplete",
"(",
"cmd",
",",
"prog_name",
",",
"complete_var",
"=",
"None",
")",
":",
"if",
"complete_var",
"is",
"None",
":",
"complete_var",
"=",
"'_%s_COMPLETE'",
"%",
"(",
"prog_name",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
")",
"."... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | augment_usage_errors | Context manager that attaches extra information to exceptions that
fly. | pipenv/vendor/click/core.py | def augment_usage_errors(ctx, param=None):
"""Context manager that attaches extra information to exceptions that
fly.
"""
try:
yield
except BadParameter as e:
if e.ctx is None:
e.ctx = ctx
if param is not None and e.param is None:
e.param = param
... | def augment_usage_errors(ctx, param=None):
"""Context manager that attaches extra information to exceptions that
fly.
"""
try:
yield
except BadParameter as e:
if e.ctx is None:
e.ctx = ctx
if param is not None and e.param is None:
e.param = param
... | [
"Context",
"manager",
"that",
"attaches",
"extra",
"information",
"to",
"exceptions",
"that",
"fly",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L100-L115 | [
"def",
"augment_usage_errors",
"(",
"ctx",
",",
"param",
"=",
"None",
")",
":",
"try",
":",
"yield",
"except",
"BadParameter",
"as",
"e",
":",
"if",
"e",
".",
"ctx",
"is",
"None",
":",
"e",
".",
"ctx",
"=",
"ctx",
"if",
"param",
"is",
"not",
"None"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | iter_params_for_processing | Given a sequence of parameters in the order as should be considered
for processing and an iterable of parameters that exist, this returns
a list in the correct order as they should be processed. | pipenv/vendor/click/core.py | def iter_params_for_processing(invocation_order, declaration_order):
"""Given a sequence of parameters in the order as should be considered
for processing and an iterable of parameters that exist, this returns
a list in the correct order as they should be processed.
"""
def sort_key(item):
t... | def iter_params_for_processing(invocation_order, declaration_order):
"""Given a sequence of parameters in the order as should be considered
for processing and an iterable of parameters that exist, this returns
a list in the correct order as they should be processed.
"""
def sort_key(item):
t... | [
"Given",
"a",
"sequence",
"of",
"parameters",
"in",
"the",
"order",
"as",
"should",
"be",
"considered",
"for",
"processing",
"and",
"an",
"iterable",
"of",
"parameters",
"that",
"exist",
"this",
"returns",
"a",
"list",
"in",
"the",
"correct",
"order",
"as",
... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L118-L130 | [
"def",
"iter_params_for_processing",
"(",
"invocation_order",
",",
"declaration_order",
")",
":",
"def",
"sort_key",
"(",
"item",
")",
":",
"try",
":",
"idx",
"=",
"invocation_order",
".",
"index",
"(",
"item",
")",
"except",
"ValueError",
":",
"idx",
"=",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.scope | This helper method can be used with the context object to promote
it to the current thread local (see :func:`get_current_context`).
The default behavior of this is to invoke the cleanup functions which
can be disabled by setting `cleanup` to `False`. The cleanup
functions are typically ... | pipenv/vendor/click/core.py | def scope(self, cleanup=True):
"""This helper method can be used with the context object to promote
it to the current thread local (see :func:`get_current_context`).
The default behavior of this is to invoke the cleanup functions which
can be disabled by setting `cleanup` to `False`. Th... | def scope(self, cleanup=True):
"""This helper method can be used with the context object to promote
it to the current thread local (see :func:`get_current_context`).
The default behavior of this is to invoke the cleanup functions which
can be disabled by setting `cleanup` to `False`. Th... | [
"This",
"helper",
"method",
"can",
"be",
"used",
"with",
"the",
"context",
"object",
"to",
"promote",
"it",
"to",
"the",
"current",
"thread",
"local",
"(",
"see",
":",
"func",
":",
"get_current_context",
")",
".",
"The",
"default",
"behavior",
"of",
"this"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L355-L390 | [
"def",
"scope",
"(",
"self",
",",
"cleanup",
"=",
"True",
")",
":",
"if",
"not",
"cleanup",
":",
"self",
".",
"_depth",
"+=",
"1",
"try",
":",
"with",
"self",
"as",
"rv",
":",
"yield",
"rv",
"finally",
":",
"if",
"not",
"cleanup",
":",
"self",
".... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.command_path | The computed command path. This is used for the ``usage``
information on the help page. It's automatically created by
combining the info names of the chain of contexts to the root. | pipenv/vendor/click/core.py | def command_path(self):
"""The computed command path. This is used for the ``usage``
information on the help page. It's automatically created by
combining the info names of the chain of contexts to the root.
"""
rv = ''
if self.info_name is not None:
rv = se... | def command_path(self):
"""The computed command path. This is used for the ``usage``
information on the help page. It's automatically created by
combining the info names of the chain of contexts to the root.
"""
rv = ''
if self.info_name is not None:
rv = se... | [
"The",
"computed",
"command",
"path",
".",
"This",
"is",
"used",
"for",
"the",
"usage",
"information",
"on",
"the",
"help",
"page",
".",
"It",
"s",
"automatically",
"created",
"by",
"combining",
"the",
"info",
"names",
"of",
"the",
"chain",
"of",
"contexts... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L444-L454 | [
"def",
"command_path",
"(",
"self",
")",
":",
"rv",
"=",
"''",
"if",
"self",
".",
"info_name",
"is",
"not",
"None",
":",
"rv",
"=",
"self",
".",
"info_name",
"if",
"self",
".",
"parent",
"is",
"not",
"None",
":",
"rv",
"=",
"self",
".",
"parent",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.find_root | Finds the outermost context. | pipenv/vendor/click/core.py | def find_root(self):
"""Finds the outermost context."""
node = self
while node.parent is not None:
node = node.parent
return node | def find_root(self):
"""Finds the outermost context."""
node = self
while node.parent is not None:
node = node.parent
return node | [
"Finds",
"the",
"outermost",
"context",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L456-L461 | [
"def",
"find_root",
"(",
"self",
")",
":",
"node",
"=",
"self",
"while",
"node",
".",
"parent",
"is",
"not",
"None",
":",
"node",
"=",
"node",
".",
"parent",
"return",
"node"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.find_object | Finds the closest object of a given type. | pipenv/vendor/click/core.py | def find_object(self, object_type):
"""Finds the closest object of a given type."""
node = self
while node is not None:
if isinstance(node.obj, object_type):
return node.obj
node = node.parent | def find_object(self, object_type):
"""Finds the closest object of a given type."""
node = self
while node is not None:
if isinstance(node.obj, object_type):
return node.obj
node = node.parent | [
"Finds",
"the",
"closest",
"object",
"of",
"a",
"given",
"type",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L463-L469 | [
"def",
"find_object",
"(",
"self",
",",
"object_type",
")",
":",
"node",
"=",
"self",
"while",
"node",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"node",
".",
"obj",
",",
"object_type",
")",
":",
"return",
"node",
".",
"obj",
"node",
"=",
"no... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.ensure_object | Like :meth:`find_object` but sets the innermost object to a
new instance of `object_type` if it does not exist. | pipenv/vendor/click/core.py | def ensure_object(self, object_type):
"""Like :meth:`find_object` but sets the innermost object to a
new instance of `object_type` if it does not exist.
"""
rv = self.find_object(object_type)
if rv is None:
self.obj = rv = object_type()
return rv | def ensure_object(self, object_type):
"""Like :meth:`find_object` but sets the innermost object to a
new instance of `object_type` if it does not exist.
"""
rv = self.find_object(object_type)
if rv is None:
self.obj = rv = object_type()
return rv | [
"Like",
":",
"meth",
":",
"find_object",
"but",
"sets",
"the",
"innermost",
"object",
"to",
"a",
"new",
"instance",
"of",
"object_type",
"if",
"it",
"does",
"not",
"exist",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L471-L478 | [
"def",
"ensure_object",
"(",
"self",
",",
"object_type",
")",
":",
"rv",
"=",
"self",
".",
"find_object",
"(",
"object_type",
")",
"if",
"rv",
"is",
"None",
":",
"self",
".",
"obj",
"=",
"rv",
"=",
"object_type",
"(",
")",
"return",
"rv"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.lookup_default | Looks up the default for a parameter name. This by default
looks into the :attr:`default_map` if available. | pipenv/vendor/click/core.py | def lookup_default(self, name):
"""Looks up the default for a parameter name. This by default
looks into the :attr:`default_map` if available.
"""
if self.default_map is not None:
rv = self.default_map.get(name)
if callable(rv):
rv = rv()
... | def lookup_default(self, name):
"""Looks up the default for a parameter name. This by default
looks into the :attr:`default_map` if available.
"""
if self.default_map is not None:
rv = self.default_map.get(name)
if callable(rv):
rv = rv()
... | [
"Looks",
"up",
"the",
"default",
"for",
"a",
"parameter",
"name",
".",
"This",
"by",
"default",
"looks",
"into",
"the",
":",
"attr",
":",
"default_map",
"if",
"available",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L480-L488 | [
"def",
"lookup_default",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"default_map",
"is",
"not",
"None",
":",
"rv",
"=",
"self",
".",
"default_map",
".",
"get",
"(",
"name",
")",
"if",
"callable",
"(",
"rv",
")",
":",
"rv",
"=",
"rv",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.invoke | Invokes a command callback in exactly the way it expects. There
are two ways to invoke this method:
1. the first argument can be a callback and all other arguments and
keyword arguments are forwarded directly to the function.
2. the first argument is a click command object. In t... | pipenv/vendor/click/core.py | def invoke(*args, **kwargs):
"""Invokes a command callback in exactly the way it expects. There
are two ways to invoke this method:
1. the first argument can be a callback and all other arguments and
keyword arguments are forwarded directly to the function.
2. the first a... | def invoke(*args, **kwargs):
"""Invokes a command callback in exactly the way it expects. There
are two ways to invoke this method:
1. the first argument can be a callback and all other arguments and
keyword arguments are forwarded directly to the function.
2. the first a... | [
"Invokes",
"a",
"command",
"callback",
"in",
"exactly",
"the",
"way",
"it",
"expects",
".",
"There",
"are",
"two",
"ways",
"to",
"invoke",
"this",
"method",
":"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L518-L555 | [
"def",
"invoke",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
",",
"callback",
"=",
"args",
"[",
":",
"2",
"]",
"ctx",
"=",
"self",
"# It's also possible to invoke another command which might or",
"# might not have a callback. In that case we also fil... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Context.forward | Similar to :meth:`invoke` but fills in default keyword
arguments from the current context if the other command expects
it. This cannot invoke callbacks directly, only other commands. | pipenv/vendor/click/core.py | def forward(*args, **kwargs):
"""Similar to :meth:`invoke` but fills in default keyword
arguments from the current context if the other command expects
it. This cannot invoke callbacks directly, only other commands.
"""
self, cmd = args[:2]
# It's also possible to invok... | def forward(*args, **kwargs):
"""Similar to :meth:`invoke` but fills in default keyword
arguments from the current context if the other command expects
it. This cannot invoke callbacks directly, only other commands.
"""
self, cmd = args[:2]
# It's also possible to invok... | [
"Similar",
"to",
":",
"meth",
":",
"invoke",
"but",
"fills",
"in",
"default",
"keyword",
"arguments",
"from",
"the",
"current",
"context",
"if",
"the",
"other",
"command",
"expects",
"it",
".",
"This",
"cannot",
"invoke",
"callbacks",
"directly",
"only",
"ot... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L557-L573 | [
"def",
"forward",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
",",
"cmd",
"=",
"args",
"[",
":",
"2",
"]",
"# It's also possible to invoke another command which might or",
"# might not have a callback.",
"if",
"not",
"isinstance",
"(",
"cmd",
",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | BaseCommand.main | This is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, ``SystemExit``
needs to be caught.
This method is also available by directly calling the instance of
... | pipenv/vendor/click/core.py | def main(self, args=None, prog_name=None, complete_var=None,
standalone_mode=True, **extra):
"""This is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, ``Syste... | def main(self, args=None, prog_name=None, complete_var=None,
standalone_mode=True, **extra):
"""This is the way to invoke a script with all the bells and
whistles as a command line application. This will always terminate
the application after a call. If this is not wanted, ``Syste... | [
"This",
"is",
"the",
"way",
"to",
"invoke",
"a",
"script",
"with",
"all",
"the",
"bells",
"and",
"whistles",
"as",
"a",
"command",
"line",
"application",
".",
"This",
"will",
"always",
"terminate",
"the",
"application",
"after",
"a",
"call",
".",
"If",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L658-L760 | [
"def",
"main",
"(",
"self",
",",
"args",
"=",
"None",
",",
"prog_name",
"=",
"None",
",",
"complete_var",
"=",
"None",
",",
"standalone_mode",
"=",
"True",
",",
"*",
"*",
"extra",
")",
":",
"# If we are in Python 3, we will verify that the environment is",
"# sa... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.format_usage | Writes the usage line into the formatter. | pipenv/vendor/click/core.py | def format_usage(self, ctx, formatter):
"""Writes the usage line into the formatter."""
pieces = self.collect_usage_pieces(ctx)
formatter.write_usage(ctx.command_path, ' '.join(pieces)) | def format_usage(self, ctx, formatter):
"""Writes the usage line into the formatter."""
pieces = self.collect_usage_pieces(ctx)
formatter.write_usage(ctx.command_path, ' '.join(pieces)) | [
"Writes",
"the",
"usage",
"line",
"into",
"the",
"formatter",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L830-L833 | [
"def",
"format_usage",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"pieces",
"=",
"self",
".",
"collect_usage_pieces",
"(",
"ctx",
")",
"formatter",
".",
"write_usage",
"(",
"ctx",
".",
"command_path",
",",
"' '",
".",
"join",
"(",
"pieces",
")"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.collect_usage_pieces | Returns all the pieces that go into the usage line and returns
it as a list of strings. | pipenv/vendor/click/core.py | def collect_usage_pieces(self, ctx):
"""Returns all the pieces that go into the usage line and returns
it as a list of strings.
"""
rv = [self.options_metavar]
for param in self.get_params(ctx):
rv.extend(param.get_usage_pieces(ctx))
return rv | def collect_usage_pieces(self, ctx):
"""Returns all the pieces that go into the usage line and returns
it as a list of strings.
"""
rv = [self.options_metavar]
for param in self.get_params(ctx):
rv.extend(param.get_usage_pieces(ctx))
return rv | [
"Returns",
"all",
"the",
"pieces",
"that",
"go",
"into",
"the",
"usage",
"line",
"and",
"returns",
"it",
"as",
"a",
"list",
"of",
"strings",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L835-L842 | [
"def",
"collect_usage_pieces",
"(",
"self",
",",
"ctx",
")",
":",
"rv",
"=",
"[",
"self",
".",
"options_metavar",
"]",
"for",
"param",
"in",
"self",
".",
"get_params",
"(",
"ctx",
")",
":",
"rv",
".",
"extend",
"(",
"param",
".",
"get_usage_pieces",
"(... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.get_help_option_names | Returns the names for the help option. | pipenv/vendor/click/core.py | def get_help_option_names(self, ctx):
"""Returns the names for the help option."""
all_names = set(ctx.help_option_names)
for param in self.params:
all_names.difference_update(param.opts)
all_names.difference_update(param.secondary_opts)
return all_names | def get_help_option_names(self, ctx):
"""Returns the names for the help option."""
all_names = set(ctx.help_option_names)
for param in self.params:
all_names.difference_update(param.opts)
all_names.difference_update(param.secondary_opts)
return all_names | [
"Returns",
"the",
"names",
"for",
"the",
"help",
"option",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L844-L850 | [
"def",
"get_help_option_names",
"(",
"self",
",",
"ctx",
")",
":",
"all_names",
"=",
"set",
"(",
"ctx",
".",
"help_option_names",
")",
"for",
"param",
"in",
"self",
".",
"params",
":",
"all_names",
".",
"difference_update",
"(",
"param",
".",
"opts",
")",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.get_help_option | Returns the help option object. | pipenv/vendor/click/core.py | def get_help_option(self, ctx):
"""Returns the help option object."""
help_options = self.get_help_option_names(ctx)
if not help_options or not self.add_help_option:
return
def show_help(ctx, param, value):
if value and not ctx.resilient_parsing:
... | def get_help_option(self, ctx):
"""Returns the help option object."""
help_options = self.get_help_option_names(ctx)
if not help_options or not self.add_help_option:
return
def show_help(ctx, param, value):
if value and not ctx.resilient_parsing:
... | [
"Returns",
"the",
"help",
"option",
"object",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L852-L865 | [
"def",
"get_help_option",
"(",
"self",
",",
"ctx",
")",
":",
"help_options",
"=",
"self",
".",
"get_help_option_names",
"(",
"ctx",
")",
"if",
"not",
"help_options",
"or",
"not",
"self",
".",
"add_help_option",
":",
"return",
"def",
"show_help",
"(",
"ctx",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.make_parser | Creates the underlying option parser for this command. | pipenv/vendor/click/core.py | def make_parser(self, ctx):
"""Creates the underlying option parser for this command."""
parser = OptionParser(ctx)
for param in self.get_params(ctx):
param.add_to_parser(parser, ctx)
return parser | def make_parser(self, ctx):
"""Creates the underlying option parser for this command."""
parser = OptionParser(ctx)
for param in self.get_params(ctx):
param.add_to_parser(parser, ctx)
return parser | [
"Creates",
"the",
"underlying",
"option",
"parser",
"for",
"this",
"command",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L867-L872 | [
"def",
"make_parser",
"(",
"self",
",",
"ctx",
")",
":",
"parser",
"=",
"OptionParser",
"(",
"ctx",
")",
"for",
"param",
"in",
"self",
".",
"get_params",
"(",
"ctx",
")",
":",
"param",
".",
"add_to_parser",
"(",
"parser",
",",
"ctx",
")",
"return",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.get_help | Formats the help into a string and returns it. This creates a
formatter and will call into the following formatting methods: | pipenv/vendor/click/core.py | def get_help(self, ctx):
"""Formats the help into a string and returns it. This creates a
formatter and will call into the following formatting methods:
"""
formatter = ctx.make_formatter()
self.format_help(ctx, formatter)
return formatter.getvalue().rstrip('\n') | def get_help(self, ctx):
"""Formats the help into a string and returns it. This creates a
formatter and will call into the following formatting methods:
"""
formatter = ctx.make_formatter()
self.format_help(ctx, formatter)
return formatter.getvalue().rstrip('\n') | [
"Formats",
"the",
"help",
"into",
"a",
"string",
"and",
"returns",
"it",
".",
"This",
"creates",
"a",
"formatter",
"and",
"will",
"call",
"into",
"the",
"following",
"formatting",
"methods",
":"
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L874-L880 | [
"def",
"get_help",
"(",
"self",
",",
"ctx",
")",
":",
"formatter",
"=",
"ctx",
".",
"make_formatter",
"(",
")",
"self",
".",
"format_help",
"(",
"ctx",
",",
"formatter",
")",
"return",
"formatter",
".",
"getvalue",
"(",
")",
".",
"rstrip",
"(",
"'\\n'"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.get_short_help_str | Gets short help for the command or makes it by shortening the long help string. | pipenv/vendor/click/core.py | def get_short_help_str(self, limit=45):
"""Gets short help for the command or makes it by shortening the long help string."""
return self.short_help or self.help and make_default_short_help(self.help, limit) or '' | def get_short_help_str(self, limit=45):
"""Gets short help for the command or makes it by shortening the long help string."""
return self.short_help or self.help and make_default_short_help(self.help, limit) or '' | [
"Gets",
"short",
"help",
"for",
"the",
"command",
"or",
"makes",
"it",
"by",
"shortening",
"the",
"long",
"help",
"string",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L882-L884 | [
"def",
"get_short_help_str",
"(",
"self",
",",
"limit",
"=",
"45",
")",
":",
"return",
"self",
".",
"short_help",
"or",
"self",
".",
"help",
"and",
"make_default_short_help",
"(",
"self",
".",
"help",
",",
"limit",
")",
"or",
"''"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.format_help | Writes the help into the formatter if it exists.
This calls into the following methods:
- :meth:`format_usage`
- :meth:`format_help_text`
- :meth:`format_options`
- :meth:`format_epilog` | pipenv/vendor/click/core.py | def format_help(self, ctx, formatter):
"""Writes the help into the formatter if it exists.
This calls into the following methods:
- :meth:`format_usage`
- :meth:`format_help_text`
- :meth:`format_options`
- :meth:`format_epilog`
"""
self.format_u... | def format_help(self, ctx, formatter):
"""Writes the help into the formatter if it exists.
This calls into the following methods:
- :meth:`format_usage`
- :meth:`format_help_text`
- :meth:`format_options`
- :meth:`format_epilog`
"""
self.format_u... | [
"Writes",
"the",
"help",
"into",
"the",
"formatter",
"if",
"it",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L886-L899 | [
"def",
"format_help",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"self",
".",
"format_usage",
"(",
"ctx",
",",
"formatter",
")",
"self",
".",
"format_help_text",
"(",
"ctx",
",",
"formatter",
")",
"self",
".",
"format_options",
"(",
"ctx",
",",... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.format_help_text | Writes the help text to the formatter if it exists. | pipenv/vendor/click/core.py | def format_help_text(self, ctx, formatter):
"""Writes the help text to the formatter if it exists."""
if self.help:
formatter.write_paragraph()
with formatter.indentation():
help_text = self.help
if self.deprecated:
help_text +=... | def format_help_text(self, ctx, formatter):
"""Writes the help text to the formatter if it exists."""
if self.help:
formatter.write_paragraph()
with formatter.indentation():
help_text = self.help
if self.deprecated:
help_text +=... | [
"Writes",
"the",
"help",
"text",
"to",
"the",
"formatter",
"if",
"it",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L901-L913 | [
"def",
"format_help_text",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"if",
"self",
".",
"help",
":",
"formatter",
".",
"write_paragraph",
"(",
")",
"with",
"formatter",
".",
"indentation",
"(",
")",
":",
"help_text",
"=",
"self",
".",
"help",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.format_options | Writes all the options into the formatter if they exist. | pipenv/vendor/click/core.py | def format_options(self, ctx, formatter):
"""Writes all the options into the formatter if they exist."""
opts = []
for param in self.get_params(ctx):
rv = param.get_help_record(ctx)
if rv is not None:
opts.append(rv)
if opts:
with form... | def format_options(self, ctx, formatter):
"""Writes all the options into the formatter if they exist."""
opts = []
for param in self.get_params(ctx):
rv = param.get_help_record(ctx)
if rv is not None:
opts.append(rv)
if opts:
with form... | [
"Writes",
"all",
"the",
"options",
"into",
"the",
"formatter",
"if",
"they",
"exist",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L915-L925 | [
"def",
"format_options",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"opts",
"=",
"[",
"]",
"for",
"param",
"in",
"self",
".",
"get_params",
"(",
"ctx",
")",
":",
"rv",
"=",
"param",
".",
"get_help_record",
"(",
"ctx",
")",
"if",
"rv",
"is... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.format_epilog | Writes the epilog into the formatter if it exists. | pipenv/vendor/click/core.py | def format_epilog(self, ctx, formatter):
"""Writes the epilog into the formatter if it exists."""
if self.epilog:
formatter.write_paragraph()
with formatter.indentation():
formatter.write_text(self.epilog) | def format_epilog(self, ctx, formatter):
"""Writes the epilog into the formatter if it exists."""
if self.epilog:
formatter.write_paragraph()
with formatter.indentation():
formatter.write_text(self.epilog) | [
"Writes",
"the",
"epilog",
"into",
"the",
"formatter",
"if",
"it",
"exists",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L927-L932 | [
"def",
"format_epilog",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"if",
"self",
".",
"epilog",
":",
"formatter",
".",
"write_paragraph",
"(",
")",
"with",
"formatter",
".",
"indentation",
"(",
")",
":",
"formatter",
".",
"write_text",
"(",
"se... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Command.invoke | Given a context, this invokes the attached callback (if it exists)
in the right way. | pipenv/vendor/click/core.py | def invoke(self, ctx):
"""Given a context, this invokes the attached callback (if it exists)
in the right way.
"""
_maybe_show_deprecated_notice(self)
if self.callback is not None:
return ctx.invoke(self.callback, **ctx.params) | def invoke(self, ctx):
"""Given a context, this invokes the attached callback (if it exists)
in the right way.
"""
_maybe_show_deprecated_notice(self)
if self.callback is not None:
return ctx.invoke(self.callback, **ctx.params) | [
"Given",
"a",
"context",
"this",
"invokes",
"the",
"attached",
"callback",
"(",
"if",
"it",
"exists",
")",
"in",
"the",
"right",
"way",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L950-L956 | [
"def",
"invoke",
"(",
"self",
",",
"ctx",
")",
":",
"_maybe_show_deprecated_notice",
"(",
"self",
")",
"if",
"self",
".",
"callback",
"is",
"not",
"None",
":",
"return",
"ctx",
".",
"invoke",
"(",
"self",
".",
"callback",
",",
"*",
"*",
"ctx",
".",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | MultiCommand.resultcallback | Adds a result callback to the chain command. By default if a
result callback is already registered this will chain them but
this can be disabled with the `replace` parameter. The result
callback is invoked with the return value of the subcommand
(or the list of return values from all s... | pipenv/vendor/click/core.py | def resultcallback(self, replace=False):
"""Adds a result callback to the chain command. By default if a
result callback is already registered this will chain them but
this can be disabled with the `replace` parameter. The result
callback is invoked with the return value of the subcomm... | def resultcallback(self, replace=False):
"""Adds a result callback to the chain command. By default if a
result callback is already registered this will chain them but
this can be disabled with the `replace` parameter. The result
callback is invoked with the return value of the subcomm... | [
"Adds",
"a",
"result",
"callback",
"to",
"the",
"chain",
"command",
".",
"By",
"default",
"if",
"a",
"result",
"callback",
"is",
"already",
"registered",
"this",
"will",
"chain",
"them",
"but",
"this",
"can",
"be",
"disabled",
"with",
"the",
"replace",
"pa... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1019-L1054 | [
"def",
"resultcallback",
"(",
"self",
",",
"replace",
"=",
"False",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"old_callback",
"=",
"self",
".",
"result_callback",
"if",
"old_callback",
"is",
"None",
"or",
"replace",
":",
"self",
".",
"result_callba... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | MultiCommand.format_commands | Extra format methods for multi methods that adds all the commands
after the options. | pipenv/vendor/click/core.py | def format_commands(self, ctx, formatter):
"""Extra format methods for multi methods that adds all the commands
after the options.
"""
commands = []
for subcommand in self.list_commands(ctx):
cmd = self.get_command(ctx, subcommand)
# What is this, the tool... | def format_commands(self, ctx, formatter):
"""Extra format methods for multi methods that adds all the commands
after the options.
"""
commands = []
for subcommand in self.list_commands(ctx):
cmd = self.get_command(ctx, subcommand)
# What is this, the tool... | [
"Extra",
"format",
"methods",
"for",
"multi",
"methods",
"that",
"adds",
"all",
"the",
"commands",
"after",
"the",
"options",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1056-L1082 | [
"def",
"format_commands",
"(",
"self",
",",
"ctx",
",",
"formatter",
")",
":",
"commands",
"=",
"[",
"]",
"for",
"subcommand",
"in",
"self",
".",
"list_commands",
"(",
"ctx",
")",
":",
"cmd",
"=",
"self",
".",
"get_command",
"(",
"ctx",
",",
"subcomman... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Group.add_command | Registers another :class:`Command` with this group. If the name
is not provided, the name of the command is used. | pipenv/vendor/click/core.py | def add_command(self, cmd, name=None):
"""Registers another :class:`Command` with this group. If the name
is not provided, the name of the command is used.
"""
name = name or cmd.name
if name is None:
raise TypeError('Command has no name.')
_check_multicomman... | def add_command(self, cmd, name=None):
"""Registers another :class:`Command` with this group. If the name
is not provided, the name of the command is used.
"""
name = name or cmd.name
if name is None:
raise TypeError('Command has no name.')
_check_multicomman... | [
"Registers",
"another",
":",
"class",
":",
"Command",
"with",
"this",
"group",
".",
"If",
"the",
"name",
"is",
"not",
"provided",
"the",
"name",
"of",
"the",
"command",
"is",
"used",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1217-L1225 | [
"def",
"add_command",
"(",
"self",
",",
"cmd",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"name",
"or",
"cmd",
".",
"name",
"if",
"name",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'Command has no name.'",
")",
"_check_multicommand",
"(",
"self... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Group.command | A shortcut decorator for declaring and attaching a command to
the group. This takes the same arguments as :func:`command` but
immediately registers the created command with this instance by
calling into :meth:`add_command`. | pipenv/vendor/click/core.py | def command(self, *args, **kwargs):
"""A shortcut decorator for declaring and attaching a command to
the group. This takes the same arguments as :func:`command` but
immediately registers the created command with this instance by
calling into :meth:`add_command`.
"""
def ... | def command(self, *args, **kwargs):
"""A shortcut decorator for declaring and attaching a command to
the group. This takes the same arguments as :func:`command` but
immediately registers the created command with this instance by
calling into :meth:`add_command`.
"""
def ... | [
"A",
"shortcut",
"decorator",
"for",
"declaring",
"and",
"attaching",
"a",
"command",
"to",
"the",
"group",
".",
"This",
"takes",
"the",
"same",
"arguments",
"as",
":",
"func",
":",
"command",
"but",
"immediately",
"registers",
"the",
"created",
"command",
"... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1227-L1237 | [
"def",
"command",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"cmd",
"=",
"command",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"(",
"f",
")",
"self",
".",
"add_command",
"(",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Group.group | A shortcut decorator for declaring and attaching a group to
the group. This takes the same arguments as :func:`group` but
immediately registers the created command with this instance by
calling into :meth:`add_command`. | pipenv/vendor/click/core.py | def group(self, *args, **kwargs):
"""A shortcut decorator for declaring and attaching a group to
the group. This takes the same arguments as :func:`group` but
immediately registers the created command with this instance by
calling into :meth:`add_command`.
"""
def decora... | def group(self, *args, **kwargs):
"""A shortcut decorator for declaring and attaching a group to
the group. This takes the same arguments as :func:`group` but
immediately registers the created command with this instance by
calling into :meth:`add_command`.
"""
def decora... | [
"A",
"shortcut",
"decorator",
"for",
"declaring",
"and",
"attaching",
"a",
"group",
"to",
"the",
"group",
".",
"This",
"takes",
"the",
"same",
"arguments",
"as",
":",
"func",
":",
"group",
"but",
"immediately",
"registers",
"the",
"created",
"command",
"with... | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1239-L1249 | [
"def",
"group",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"cmd",
"=",
"group",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"(",
"f",
")",
"self",
".",
"add_command",
"(",
"cm... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parameter.get_default | Given a context variable this calculates the default value. | pipenv/vendor/click/core.py | def get_default(self, ctx):
"""Given a context variable this calculates the default value."""
# Otherwise go with the regular default.
if callable(self.default):
rv = self.default()
else:
rv = self.default
return self.type_cast_value(ctx, rv) | def get_default(self, ctx):
"""Given a context variable this calculates the default value."""
# Otherwise go with the regular default.
if callable(self.default):
rv = self.default()
else:
rv = self.default
return self.type_cast_value(ctx, rv) | [
"Given",
"a",
"context",
"variable",
"this",
"calculates",
"the",
"default",
"value",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1378-L1385 | [
"def",
"get_default",
"(",
"self",
",",
"ctx",
")",
":",
"# Otherwise go with the regular default.",
"if",
"callable",
"(",
"self",
".",
"default",
")",
":",
"rv",
"=",
"self",
".",
"default",
"(",
")",
"else",
":",
"rv",
"=",
"self",
".",
"default",
"re... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
train | Parameter.type_cast_value | Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types. | pipenv/vendor/click/core.py | def type_cast_value(self, ctx, value):
"""Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types.
"""
if self.type.is_composite:
if self.nargs <= 1:
raise Ty... | def type_cast_value(self, ctx, value):
"""Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types.
"""
if self.type.is_composite:
if self.nargs <= 1:
raise Ty... | [
"Given",
"a",
"value",
"this",
"runs",
"it",
"properly",
"through",
"the",
"type",
"system",
".",
"This",
"automatically",
"handles",
"things",
"like",
"nargs",
"and",
"multiple",
"as",
"well",
"as",
"composite",
"types",
"."
] | pypa/pipenv | python | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1398-L1417 | [
"def",
"type_cast_value",
"(",
"self",
",",
"ctx",
",",
"value",
")",
":",
"if",
"self",
".",
"type",
".",
"is_composite",
":",
"if",
"self",
".",
"nargs",
"<=",
"1",
":",
"raise",
"TypeError",
"(",
"'Attempted to invoke composite type '",
"'but nargs has been... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.