repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
pypa/pipenv
pipenv/patched/notpip/_vendor/cachecontrol/adapter.py
CacheControlAdapter.build_response
def build_response( self, request, response, from_cache=False, cacheable_methods=None ): """ Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response """ cacheable = cacheable_methods o...
python
def build_response( self, request, response, from_cache=False, cacheable_methods=None ): """ Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response """ cacheable = cacheable_methods o...
[ "def", "build_response", "(", "self", ",", "request", ",", "response", ",", "from_cache", "=", "False", ",", "cacheable_methods", "=", "None", ")", ":", "cacheable", "=", "cacheable_methods", "or", "self", ".", "cacheable_methods", "if", "not", "from_cache", "...
Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response
[ "Build", "a", "response", "by", "making", "a", "request", "or", "using", "the", "cache", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/cachecontrol/adapter.py#L57-L129
train
pypa/pipenv
pipenv/vendor/shellingham/posix/linux.py
get_process_mapping
def get_process_mapping(): """Try to look up the process tree via Linux's /proc """ with open('/proc/{0}/stat'.format(os.getpid())) as f: self_tty = f.read().split()[STAT_TTY] processes = {} for pid in os.listdir('/proc'): if not pid.isdigit(): continue try: ...
python
def get_process_mapping(): """Try to look up the process tree via Linux's /proc """ with open('/proc/{0}/stat'.format(os.getpid())) as f: self_tty = f.read().split()[STAT_TTY] processes = {} for pid in os.listdir('/proc'): if not pid.isdigit(): continue try: ...
[ "def", "get_process_mapping", "(", ")", ":", "with", "open", "(", "'/proc/{0}/stat'", ".", "format", "(", "os", ".", "getpid", "(", ")", ")", ")", "as", "f", ":", "self_tty", "=", "f", ".", "read", "(", ")", ".", "split", "(", ")", "[", "STAT_TTY",...
Try to look up the process tree via Linux's /proc
[ "Try", "to", "look", "up", "the", "process", "tree", "via", "Linux", "s", "/", "proc" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/linux.py#L11-L35
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
rehash
def rehash(path, blocksize=1 << 20): # type: (str, int) -> Tuple[str, str] """Return (hash, length) for path using hashlib.sha256()""" h = hashlib.sha256() length = 0 with open(path, 'rb') as f: for block in read_chunks(f, size=blocksize): length += len(block) h.updat...
python
def rehash(path, blocksize=1 << 20): # type: (str, int) -> Tuple[str, str] """Return (hash, length) for path using hashlib.sha256()""" h = hashlib.sha256() length = 0 with open(path, 'rb') as f: for block in read_chunks(f, size=blocksize): length += len(block) h.updat...
[ "def", "rehash", "(", "path", ",", "blocksize", "=", "1", "<<", "20", ")", ":", "# type: (str, int) -> Tuple[str, str]", "h", "=", "hashlib", ".", "sha256", "(", ")", "length", "=", "0", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", ...
Return (hash, length) for path using hashlib.sha256()
[ "Return", "(", "hash", "length", ")", "for", "path", "using", "hashlib", ".", "sha256", "()" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L71-L84
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
replace_python_tag
def replace_python_tag(wheelname, new_tag): # type: (str, str) -> str """Replace the Python tag in a wheel file name with a new value. """ parts = wheelname.split('-') parts[-3] = new_tag return '-'.join(parts)
python
def replace_python_tag(wheelname, new_tag): # type: (str, str) -> str """Replace the Python tag in a wheel file name with a new value. """ parts = wheelname.split('-') parts[-3] = new_tag return '-'.join(parts)
[ "def", "replace_python_tag", "(", "wheelname", ",", "new_tag", ")", ":", "# type: (str, str) -> str", "parts", "=", "wheelname", ".", "split", "(", "'-'", ")", "parts", "[", "-", "3", "]", "=", "new_tag", "return", "'-'", ".", "join", "(", "parts", ")" ]
Replace the Python tag in a wheel file name with a new value.
[ "Replace", "the", "Python", "tag", "in", "a", "wheel", "file", "name", "with", "a", "new", "value", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L98-L104
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
message_about_scripts_not_on_PATH
def message_about_scripts_not_on_PATH(scripts): # type: (Sequence[str]) -> Optional[str] """Determine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. """ if not scripts: return None # Group scrip...
python
def message_about_scripts_not_on_PATH(scripts): # type: (Sequence[str]) -> Optional[str] """Determine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. """ if not scripts: return None # Group scrip...
[ "def", "message_about_scripts_not_on_PATH", "(", "scripts", ")", ":", "# type: (Sequence[str]) -> Optional[str]", "if", "not", "scripts", ":", "return", "None", "# Group scripts by the path they were installed in", "grouped_by_dir", "=", "collections", ".", "defaultdict", "(", ...
Determine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None.
[ "Determine", "if", "any", "scripts", "are", "not", "on", "PATH", "and", "format", "a", "warning", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L180-L239
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
sorted_outrows
def sorted_outrows(outrows): # type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow] """ Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed...
python
def sorted_outrows(outrows): # type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow] """ Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed...
[ "def", "sorted_outrows", "(", "outrows", ")", ":", "# type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]", "# Normally, there should only be one row per path, in which case the", "# second and third elements don't come into play when sorting.", "# However, in cases in the wild where a path...
Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string.
[ "Return", "the", "given", "rows", "of", "a", "RECORD", "file", "in", "sorted", "order", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L242-L260
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
get_csv_rows_for_installed
def get_csv_rows_for_installed( old_csv_rows, # type: Iterable[List[str]] installed, # type: Dict[str, str] changed, # type: set generated, # type: List[str] lib_dir, # type: str ): # type: (...) -> List[InstalledCSVRow] """ :param installed: A map from archive RECORD path to instal...
python
def get_csv_rows_for_installed( old_csv_rows, # type: Iterable[List[str]] installed, # type: Dict[str, str] changed, # type: set generated, # type: List[str] lib_dir, # type: str ): # type: (...) -> List[InstalledCSVRow] """ :param installed: A map from archive RECORD path to instal...
[ "def", "get_csv_rows_for_installed", "(", "old_csv_rows", ",", "# type: Iterable[List[str]]", "installed", ",", "# type: Dict[str, str]", "changed", ",", "# type: set", "generated", ",", "# type: List[str]", "lib_dir", ",", "# type: str", ")", ":", "# type: (...) -> List[Inst...
:param installed: A map from archive RECORD path to installation RECORD path.
[ ":", "param", "installed", ":", "A", "map", "from", "archive", "RECORD", "path", "to", "installation", "RECORD", "path", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L263-L296
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
move_wheel_files
def move_wheel_files( name, # type: str req, # type: Requirement wheeldir, # type: str user=False, # type: bool home=None, # type: Optional[str] root=None, # type: Optional[str] pycompile=True, # type: bool scheme=None, # type: Optional[Mapping[str, str]] isolated=False, # t...
python
def move_wheel_files( name, # type: str req, # type: Requirement wheeldir, # type: str user=False, # type: bool home=None, # type: Optional[str] root=None, # type: Optional[str] pycompile=True, # type: bool scheme=None, # type: Optional[Mapping[str, str]] isolated=False, # t...
[ "def", "move_wheel_files", "(", "name", ",", "# type: str", "req", ",", "# type: Requirement", "wheeldir", ",", "# type: str", "user", "=", "False", ",", "# type: bool", "home", "=", "None", ",", "# type: Optional[str]", "root", "=", "None", ",", "# type: Optional...
Install a wheel
[ "Install", "a", "wheel" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L299-L614
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
wheel_version
def wheel_version(source_dir): # type: (Optional[str]) -> Optional[Tuple[int, ...]] """ Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it. """ try: dist = [d for d in pkg_resources.find_on_path(None, source_dir)][0] ...
python
def wheel_version(source_dir): # type: (Optional[str]) -> Optional[Tuple[int, ...]] """ Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it. """ try: dist = [d for d in pkg_resources.find_on_path(None, source_dir)][0] ...
[ "def", "wheel_version", "(", "source_dir", ")", ":", "# type: (Optional[str]) -> Optional[Tuple[int, ...]]", "try", ":", "dist", "=", "[", "d", "for", "d", "in", "pkg_resources", ".", "find_on_path", "(", "None", ",", "source_dir", ")", "]", "[", "0", "]", "wh...
Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it.
[ "Return", "the", "Wheel", "-", "Version", "of", "an", "extracted", "wheel", "if", "possible", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L617-L634
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
_contains_egg_info
def _contains_egg_info( s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)): """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s))
python
def _contains_egg_info( s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)): """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s))
[ "def", "_contains_egg_info", "(", "s", ",", "_egg_info_re", "=", "re", ".", "compile", "(", "r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)'", ",", "re", ".", "I", ")", ")", ":", "return", "bool", "(", "_egg_info_re", ".", "search", "(", "s", ")", ")" ]
Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1
[ "Determine", "whether", "the", "string", "looks", "like", "an", "egg_info", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L727-L733
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
should_use_ephemeral_cache
def should_use_ephemeral_cache( req, # type: InstallRequirement format_control, # type: FormatControl autobuilding, # type: bool cache_available # type: bool ): # type: (...) -> Optional[bool] """ Return whether to build an InstallRequirement object using the ephemeral cache. :p...
python
def should_use_ephemeral_cache( req, # type: InstallRequirement format_control, # type: FormatControl autobuilding, # type: bool cache_available # type: bool ): # type: (...) -> Optional[bool] """ Return whether to build an InstallRequirement object using the ephemeral cache. :p...
[ "def", "should_use_ephemeral_cache", "(", "req", ",", "# type: InstallRequirement", "format_control", ",", "# type: FormatControl", "autobuilding", ",", "# type: bool", "cache_available", "# type: bool", ")", ":", "# type: (...) -> Optional[bool]", "if", "req", ".", "constrai...
Return whether to build an InstallRequirement object using the ephemeral cache. :param cache_available: whether a cache directory is available for the autobuilding=True case. :return: True or False to build the requirement with ephem_cache=True or False, respectively; or None not to build ...
[ "Return", "whether", "to", "build", "an", "InstallRequirement", "object", "using", "the", "ephemeral", "cache", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L736-L787
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
format_command
def format_command( command_args, # type: List[str] command_output, # type: str ): # type: (...) -> str """ Format command information for logging. """ text = 'Command arguments: {}\n'.format(command_args) if not command_output: text += 'Command output: None' elif logger.g...
python
def format_command( command_args, # type: List[str] command_output, # type: str ): # type: (...) -> str """ Format command information for logging. """ text = 'Command arguments: {}\n'.format(command_args) if not command_output: text += 'Command output: None' elif logger.g...
[ "def", "format_command", "(", "command_args", ",", "# type: List[str]", "command_output", ",", "# type: str", ")", ":", "# type: (...) -> str", "text", "=", "'Command arguments: {}\\n'", ".", "format", "(", "command_args", ")", "if", "not", "command_output", ":", "tex...
Format command information for logging.
[ "Format", "command", "information", "for", "logging", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L790-L812
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
get_legacy_build_wheel_path
def get_legacy_build_wheel_path( names, # type: List[str] temp_dir, # type: str req, # type: InstallRequirement command_args, # type: List[str] command_output, # type: str ): # type: (...) -> Optional[str] """ Return the path to the wheel in the temporary build directory. """ ...
python
def get_legacy_build_wheel_path( names, # type: List[str] temp_dir, # type: str req, # type: InstallRequirement command_args, # type: List[str] command_output, # type: str ): # type: (...) -> Optional[str] """ Return the path to the wheel in the temporary build directory. """ ...
[ "def", "get_legacy_build_wheel_path", "(", "names", ",", "# type: List[str]", "temp_dir", ",", "# type: str", "req", ",", "# type: InstallRequirement", "command_args", ",", "# type: List[str]", "command_output", ",", "# type: str", ")", ":", "# type: (...) -> Optional[str]", ...
Return the path to the wheel in the temporary build directory.
[ "Return", "the", "path", "to", "the", "wheel", "in", "the", "temporary", "build", "directory", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L815-L844
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
Wheel.support_index_min
def support_index_min(self, tags=None): # type: (Optional[List[Pep425Tag]]) -> Optional[int] """ Return the lowest index that one of the wheel's file_tag combinations achieves in the supported_tags list e.g. if there are 8 supported tags, and one of the file tags is first in the ...
python
def support_index_min(self, tags=None): # type: (Optional[List[Pep425Tag]]) -> Optional[int] """ Return the lowest index that one of the wheel's file_tag combinations achieves in the supported_tags list e.g. if there are 8 supported tags, and one of the file tags is first in the ...
[ "def", "support_index_min", "(", "self", ",", "tags", "=", "None", ")", ":", "# type: (Optional[List[Pep425Tag]]) -> Optional[int]", "if", "tags", "is", "None", ":", "# for mock", "tags", "=", "pep425tags", ".", "get_supported", "(", ")", "indexes", "=", "[", "t...
Return the lowest index that one of the wheel's file_tag combinations achieves in the supported_tags list e.g. if there are 8 supported tags, and one of the file tags is first in the list, then return 0. Returns None is the wheel is not supported.
[ "Return", "the", "lowest", "index", "that", "one", "of", "the", "wheel", "s", "file_tag", "combinations", "achieves", "in", "the", "supported_tags", "list", "e", ".", "g", ".", "if", "there", "are", "8", "supported", "tags", "and", "one", "of", "the", "f...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L706-L717
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
Wheel.supported
def supported(self, tags=None): # type: (Optional[List[Pep425Tag]]) -> bool """Is this wheel supported on this system?""" if tags is None: # for mock tags = pep425tags.get_supported() return bool(set(tags).intersection(self.file_tags))
python
def supported(self, tags=None): # type: (Optional[List[Pep425Tag]]) -> bool """Is this wheel supported on this system?""" if tags is None: # for mock tags = pep425tags.get_supported() return bool(set(tags).intersection(self.file_tags))
[ "def", "supported", "(", "self", ",", "tags", "=", "None", ")", ":", "# type: (Optional[List[Pep425Tag]]) -> bool", "if", "tags", "is", "None", ":", "# for mock", "tags", "=", "pep425tags", ".", "get_supported", "(", ")", "return", "bool", "(", "set", "(", "...
Is this wheel supported on this system?
[ "Is", "this", "wheel", "supported", "on", "this", "system?" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L719-L724
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
WheelBuilder._build_one
def _build_one(self, req, output_dir, python_tag=None): """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ # Install build deps into temporary directory (PEP 518) with req.build_env: return self._build_one_inside_env(req, o...
python
def _build_one(self, req, output_dir, python_tag=None): """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ # Install build deps into temporary directory (PEP 518) with req.build_env: return self._build_one_inside_env(req, o...
[ "def", "_build_one", "(", "self", ",", "req", ",", "output_dir", ",", "python_tag", "=", "None", ")", ":", "# Install build deps into temporary directory (PEP 518)", "with", "req", ".", "build_env", ":", "return", "self", ".", "_build_one_inside_env", "(", "req", ...
Build one wheel. :return: The filename of the built wheel, or None if the build failed.
[ "Build", "one", "wheel", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L870-L878
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
WheelBuilder._build_one_pep517
def _build_one_pep517(self, req, tempd, python_tag=None): """Build one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert req.metadata_directory is not None try: req.spin_message = 'Bui...
python
def _build_one_pep517(self, req, tempd, python_tag=None): """Build one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert req.metadata_directory is not None try: req.spin_message = 'Bui...
[ "def", "_build_one_pep517", "(", "self", ",", "req", ",", "tempd", ",", "python_tag", "=", "None", ")", ":", "assert", "req", ".", "metadata_directory", "is", "not", "None", "try", ":", "req", ".", "spin_message", "=", "'Building wheel for %s (PEP 517)'", "%",...
Build one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None.
[ "Build", "one", "InstallRequirement", "using", "the", "PEP", "517", "build", "process", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L911-L938
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
WheelBuilder._build_one_legacy
def _build_one_legacy(self, req, tempd, python_tag=None): """Build one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. """ base_args = self._base_setup_args(req) spin_message = 'Building wheel for %s (se...
python
def _build_one_legacy(self, req, tempd, python_tag=None): """Build one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. """ base_args = self._base_setup_args(req) spin_message = 'Building wheel for %s (se...
[ "def", "_build_one_legacy", "(", "self", ",", "req", ",", "tempd", ",", "python_tag", "=", "None", ")", ":", "base_args", "=", "self", ".", "_base_setup_args", "(", "req", ")", "spin_message", "=", "'Building wheel for %s (setup.py)'", "%", "(", "req", ".", ...
Build one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None.
[ "Build", "one", "InstallRequirement", "using", "the", "legacy", "build", "process", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L940-L971
train
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
WheelBuilder.build
def build( self, requirements, # type: Iterable[InstallRequirement] session, # type: PipSession autobuilding=False # type: bool ): # type: (...) -> List[InstallRequirement] """Build wheels. :param unpack: If True, replace the sdist we built from with the ...
python
def build( self, requirements, # type: Iterable[InstallRequirement] session, # type: PipSession autobuilding=False # type: bool ): # type: (...) -> List[InstallRequirement] """Build wheels. :param unpack: If True, replace the sdist we built from with the ...
[ "def", "build", "(", "self", ",", "requirements", ",", "# type: Iterable[InstallRequirement]", "session", ",", "# type: PipSession", "autobuilding", "=", "False", "# type: bool", ")", ":", "# type: (...) -> List[InstallRequirement]", "buildset", "=", "[", "]", "format_con...
Build wheels. :param unpack: If True, replace the sdist we built from with the newly built wheel, in preparation for installation. :return: True if all the wheels built correctly.
[ "Build", "wheels", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L985-L1097
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex._get_pypirc_command
def _get_pypirc_command(self): """ Get the distutils command for interacting with PyPI configurations. :return: the command. """ from distutils.core import Distribution from distutils.config import PyPIRCCommand d = Distribution() return PyPIRCCommand(d)
python
def _get_pypirc_command(self): """ Get the distutils command for interacting with PyPI configurations. :return: the command. """ from distutils.core import Distribution from distutils.config import PyPIRCCommand d = Distribution() return PyPIRCCommand(d)
[ "def", "_get_pypirc_command", "(", "self", ")", ":", "from", "distutils", ".", "core", "import", "Distribution", "from", "distutils", ".", "config", "import", "PyPIRCCommand", "d", "=", "Distribution", "(", ")", "return", "PyPIRCCommand", "(", "d", ")" ]
Get the distutils command for interacting with PyPI configurations. :return: the command.
[ "Get", "the", "distutils", "command", "for", "interacting", "with", "PyPI", "configurations", ".", ":", "return", ":", "the", "command", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L65-L73
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.read_configuration
def read_configuration(self): """ Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. """ # get distutils to do the work ...
python
def read_configuration(self): """ Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. """ # get distutils to do the work ...
[ "def", "read_configuration", "(", "self", ")", ":", "# get distutils to do the work", "c", "=", "self", ".", "_get_pypirc_command", "(", ")", "c", ".", "repository", "=", "self", ".", "url", "cfg", "=", "c", ".", "_read_pypirc", "(", ")", "self", ".", "use...
Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration.
[ "Read", "the", "PyPI", "access", "configuration", "as", "supported", "by", "distutils", "getting", "PyPI", "to", "do", "the", "actual", "work", ".", "This", "populates", "username", "password", "realm", "and", "url", "attributes", "from", "the", "configuration",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L75-L88
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.save_configuration
def save_configuration(self): """ Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. """ self.check_credentials() # get distutils to do the wor...
python
def save_configuration(self): """ Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. """ self.check_credentials() # get distutils to do the wor...
[ "def", "save_configuration", "(", "self", ")", ":", "self", ".", "check_credentials", "(", ")", "# get distutils to do the work", "c", "=", "self", ".", "_get_pypirc_command", "(", ")", "c", ".", "_store_pypirc", "(", "self", ".", "username", ",", "self", ".",...
Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work.
[ "Save", "the", "PyPI", "access", "configuration", ".", "You", "must", "have", "set", "username", "and", "password", "attributes", "before", "calling", "this", "method", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L90-L100
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.check_credentials
def check_credentials(self): """ Check that ``username`` and ``password`` have been set, and raise an exception if not. """ if self.username is None or self.password is None: raise DistlibException('username and password must be set') pm = HTTPPasswordMgr() ...
python
def check_credentials(self): """ Check that ``username`` and ``password`` have been set, and raise an exception if not. """ if self.username is None or self.password is None: raise DistlibException('username and password must be set') pm = HTTPPasswordMgr() ...
[ "def", "check_credentials", "(", "self", ")", ":", "if", "self", ".", "username", "is", "None", "or", "self", ".", "password", "is", "None", ":", "raise", "DistlibException", "(", "'username and password must be set'", ")", "pm", "=", "HTTPPasswordMgr", "(", "...
Check that ``username`` and ``password`` have been set, and raise an exception if not.
[ "Check", "that", "username", "and", "password", "have", "been", "set", "and", "raise", "an", "exception", "if", "not", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L102-L112
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.register
def register(self, metadata): """ Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The...
python
def register(self, metadata): """ Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The...
[ "def", "register", "(", "self", ",", "metadata", ")", ":", "self", ".", "check_credentials", "(", ")", "metadata", ".", "validate", "(", ")", "d", "=", "metadata", ".", "todict", "(", ")", "d", "[", "':action'", "]", "=", "'verify'", "request", "=", ...
Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission ...
[ "Register", "a", "distribution", "on", "PyPI", "using", "the", "provided", "metadata", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L114-L132
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex._reader
def _reader(self, name, stream, outbuf): """ Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to th...
python
def _reader(self, name, stream, outbuf): """ Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to th...
[ "def", "_reader", "(", "self", ",", "name", ",", "stream", ",", "outbuf", ")", ":", "while", "True", ":", "s", "=", "stream", ".", "readline", "(", ")", "if", "not", "s", ":", "break", "s", "=", "s", ".", "decode", "(", "'utf-8'", ")", ".", "rs...
Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The l...
[ "Thread", "runner", "for", "reading", "lines", "of", "from", "a", "subprocess", "into", "a", "buffer", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L134-L150
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.get_sign_command
def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_pas...
python
def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_pas...
[ "def", "get_sign_command", "(", "self", ",", "filename", ",", "signer", ",", "sign_password", ",", "keystore", "=", "None", ")", ":", "cmd", "=", "[", "self", ".", "gpg", ",", "'--status-fd'", ",", "'2'", ",", "'--no-tty'", "]", "if", "keystore", "is", ...
Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystor...
[ "Return", "a", "suitable", "command", "for", "signing", "a", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L152-L179
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.run_command
def run_command(self, cmd, input_data=None): """ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process...
python
def run_command(self, cmd, input_data=None): """ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process...
[ "def", "run_command", "(", "self", ",", "cmd", ",", "input_data", "=", "None", ")", ":", "kwargs", "=", "{", "'stdout'", ":", "subprocess", ".", "PIPE", ",", "'stderr'", ":", "subprocess", ".", "PIPE", ",", "}", "if", "input_data", "is", "not", "None",...
Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit cod...
[ "Run", "a", "command", "in", "a", "child", "process", "passing", "it", "any", "input", "data", "specified", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L181-L214
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.sign_file
def sign_file(self, filename, signer, sign_password, keystore=None): """ Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's ...
python
def sign_file(self, filename, signer, sign_password, keystore=None): """ Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's ...
[ "def", "sign_file", "(", "self", ",", "filename", ",", "signer", ",", "sign_password", ",", "keystore", "=", "None", ")", ":", "cmd", ",", "sig_file", "=", "self", ".", "get_sign_command", "(", "filename", ",", "signer", ",", "sign_password", ",", "keystor...
Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which ...
[ "Sign", "a", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L216-L237
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.upload_documentation
def upload_documentation(self, metadata, doc_dir): """ Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The...
python
def upload_documentation(self, metadata, doc_dir): """ Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The...
[ "def", "upload_documentation", "(", "self", ",", "metadata", ",", "doc_dir", ")", ":", "self", ".", "check_credentials", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "doc_dir", ")", ":", "raise", "DistlibException", "(", "'not a directory: %r...
Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the d...
[ "Upload", "documentation", "to", "the", "index", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L296-L322
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.get_verify_command
def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_fil...
python
def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_fil...
[ "def", "get_verify_command", "(", "self", ",", "signature_filename", ",", "data_filename", ",", "keystore", "=", "None", ")", ":", "cmd", "=", "[", "self", ".", "gpg", ",", "'--status-fd'", ",", "'2'", ",", "'--no-tty'", "]", "if", "keystore", "is", "None"...
Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to ...
[ "Return", "a", "suitable", "command", "for", "verifying", "a", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L324-L346
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.verify_signature
def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname t...
python
def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname t...
[ "def", "verify_signature", "(", "self", ",", "signature_filename", ",", "data_filename", ",", "keystore", "=", "None", ")", ":", "if", "not", "self", ".", "gpg", ":", "raise", "DistlibException", "(", "'verification unavailable because gpg '", "'unavailable'", ")", ...
Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which...
[ "Verify", "a", "signature", "for", "a", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L348-L371
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.download_file
def download_file(self, url, destfile, digest=None, reporthook=None): """ This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). ...
python
def download_file(self, url, destfile, digest=None, reporthook=None): """ This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). ...
[ "def", "download_file", "(", "self", ",", "url", ",", "destfile", ",", "digest", "=", "None", ",", "reporthook", "=", "None", ")", ":", "if", "digest", "is", "None", ":", "digester", "=", "None", "logger", ".", "debug", "(", "'No digest specified'", ")",...
This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard libra...
[ "This", "is", "a", "convenience", "method", "for", "downloading", "a", "file", "from", "an", "URL", ".", "Normally", "this", "will", "be", "a", "file", "from", "the", "index", "though", "currently", "no", "check", "is", "made", "for", "this", "(", "i", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L373-L448
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.send_request
def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler:...
python
def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler:...
[ "def", "send_request", "(", "self", ",", "req", ")", ":", "handlers", "=", "[", "]", "if", "self", ".", "password_handler", ":", "handlers", ".", "append", "(", "self", ".", "password_handler", ")", "if", "self", ".", "ssl_verifier", ":", "handlers", "."...
Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse).
[ "Send", "a", "standard", "library", ":", "class", ":", "Request", "to", "PyPI", "and", "return", "its", "response", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L450-L464
train
pypa/pipenv
pipenv/vendor/distlib/index.py
PackageIndex.encode_request
def encode_request(self, fields, files): """ Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, f...
python
def encode_request(self, fields, files): """ Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, f...
[ "def", "encode_request", "(", "self", ",", "fields", ",", "files", ")", ":", "# Adapted from packaging, which in turn was adapted from", "# http://code.activestate.com/recipes/146306", "parts", "=", "[", "]", "boundary", "=", "self", ".", "boundary", "for", "k", ",", ...
Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple.
[ "Encode", "fields", "and", "files", "for", "posting", "to", "an", "HTTP", "server", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/index.py#L466-L507
train
pypa/pipenv
pipenv/vendor/click_completion/core.py
do_bash_complete
def do_bash_complete(cli, prog_name): """Do the completion for bash Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, F...
python
def do_bash_complete(cli, prog_name): """Do the completion for bash Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, F...
[ "def", "do_bash_complete", "(", "cli", ",", "prog_name", ")", ":", "comp_words", "=", "os", ".", "environ", "[", "'COMP_WORDS'", "]", "try", ":", "cwords", "=", "shlex", ".", "split", "(", "comp_words", ")", "quoted", "=", "False", "except", "ValueError", ...
Do the completion for bash Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False otherwise
[ "Do", "the", "completion", "for", "bash" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L141-L176
train
pypa/pipenv
pipenv/vendor/click_completion/core.py
do_fish_complete
def do_fish_complete(cli, prog_name): """Do the fish completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False...
python
def do_fish_complete(cli, prog_name): """Do the fish completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False...
[ "def", "do_fish_complete", "(", "cli", ",", "prog_name", ")", ":", "commandline", "=", "os", ".", "environ", "[", "'COMMANDLINE'", "]", "args", "=", "split_args", "(", "commandline", ")", "[", "1", ":", "]", "if", "args", "and", "not", "commandline", "."...
Do the fish completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False otherwise
[ "Do", "the", "fish", "completion" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L179-L208
train
pypa/pipenv
pipenv/vendor/click_completion/core.py
do_powershell_complete
def do_powershell_complete(cli, prog_name): """Do the powershell completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was succe...
python
def do_powershell_complete(cli, prog_name): """Do the powershell completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was succe...
[ "def", "do_powershell_complete", "(", "cli", ",", "prog_name", ")", ":", "commandline", "=", "os", ".", "environ", "[", "'COMMANDLINE'", "]", "args", "=", "split_args", "(", "commandline", ")", "[", "1", ":", "]", "quote", "=", "single_quote", "incomplete", ...
Do the powershell completion Parameters ---------- cli : click.Command The main click Command of the program prog_name : str The program name on the command line Returns ------- bool True if the completion was successful, False otherwise
[ "Do", "the", "powershell", "completion" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L250-L279
train
pypa/pipenv
pipenv/vendor/click_completion/core.py
get_code
def get_code(shell=None, prog_name=None, env_name=None, extra_env=None): """Returns the completion code to be evaluated by the shell Parameters ---------- shell : Shell The shell type (Default value = None) prog_name : str The program name on the command line (Default value = None) ...
python
def get_code(shell=None, prog_name=None, env_name=None, extra_env=None): """Returns the completion code to be evaluated by the shell Parameters ---------- shell : Shell The shell type (Default value = None) prog_name : str The program name on the command line (Default value = None) ...
[ "def", "get_code", "(", "shell", "=", "None", ",", "prog_name", "=", "None", ",", "env_name", "=", "None", ",", "extra_env", "=", "None", ")", ":", "from", "jinja2", "import", "Environment", ",", "FileSystemLoader", "if", "shell", "in", "[", "None", ",",...
Returns the completion code to be evaluated by the shell Parameters ---------- shell : Shell The shell type (Default value = None) prog_name : str The program name on the command line (Default value = None) env_name : str The environment variable used to control the completi...
[ "Returns", "the", "completion", "code", "to", "be", "evaluated", "by", "the", "shell" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L282-L311
train
pypa/pipenv
pipenv/vendor/click_completion/core.py
install
def install(shell=None, prog_name=None, env_name=None, path=None, append=None, extra_env=None): """Install the completion Parameters ---------- shell : Shell The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None) prog_name : str ...
python
def install(shell=None, prog_name=None, env_name=None, path=None, append=None, extra_env=None): """Install the completion Parameters ---------- shell : Shell The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None) prog_name : str ...
[ "def", "install", "(", "shell", "=", "None", ",", "prog_name", "=", "None", ",", "env_name", "=", "None", ",", "path", "=", "None", ",", "append", "=", "None", ",", "extra_env", "=", "None", ")", ":", "prog_name", "=", "prog_name", "or", "click", "."...
Install the completion Parameters ---------- shell : Shell The shell type targeted. It will be guessed with get_auto_shell() if the value is None (Default value = None) prog_name : str The program name on the command line. It will be automatically computed if the value is None (...
[ "Install", "the", "completion" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/core.py#L314-L377
train
pypa/pipenv
pipenv/patched/notpip/_vendor/html5lib/treebuilders/__init__.py
getTreeBuilder
def getTreeBuilder(treeType, implementation=None, **kwargs): """Get a TreeBuilder class for various types of trees with built-in support :arg treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom" - A generic builder for DOM implementations, defaulting t...
python
def getTreeBuilder(treeType, implementation=None, **kwargs): """Get a TreeBuilder class for various types of trees with built-in support :arg treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom" - A generic builder for DOM implementations, defaulting t...
[ "def", "getTreeBuilder", "(", "treeType", ",", "implementation", "=", "None", ",", "*", "*", "kwargs", ")", ":", "treeType", "=", "treeType", ".", "lower", "(", ")", "if", "treeType", "not", "in", "treeBuilderCache", ":", "if", "treeType", "==", "\"dom\"",...
Get a TreeBuilder class for various types of trees with built-in support :arg treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom" - A generic builder for DOM implementations, defaulting to a xml.dom.minidom based implementation. * "etree...
[ "Get", "a", "TreeBuilder", "class", "for", "various", "types", "of", "trees", "with", "built", "-", "in", "support" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/__init__.py#L39-L88
train
pypa/pipenv
pipenv/vendor/urllib3/filepost.py
choose_boundary
def choose_boundary(): """ Our embarrassingly-simple replacement for mimetools.choose_boundary. """ boundary = binascii.hexlify(os.urandom(16)) if six.PY3: boundary = boundary.decode('ascii') return boundary
python
def choose_boundary(): """ Our embarrassingly-simple replacement for mimetools.choose_boundary. """ boundary = binascii.hexlify(os.urandom(16)) if six.PY3: boundary = boundary.decode('ascii') return boundary
[ "def", "choose_boundary", "(", ")", ":", "boundary", "=", "binascii", ".", "hexlify", "(", "os", ".", "urandom", "(", "16", ")", ")", "if", "six", ".", "PY3", ":", "boundary", "=", "boundary", ".", "decode", "(", "'ascii'", ")", "return", "boundary" ]
Our embarrassingly-simple replacement for mimetools.choose_boundary.
[ "Our", "embarrassingly", "-", "simple", "replacement", "for", "mimetools", ".", "choose_boundary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L15-L22
train
pypa/pipenv
pipenv/vendor/urllib3/filepost.py
iter_field_objects
def iter_field_objects(fields): """ Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`. """ if isinstance(fields, dict): i = six.iteritems(fields) else: i = iter(fields) for field in i: if isinstanc...
python
def iter_field_objects(fields): """ Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`. """ if isinstance(fields, dict): i = six.iteritems(fields) else: i = iter(fields) for field in i: if isinstanc...
[ "def", "iter_field_objects", "(", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "dict", ")", ":", "i", "=", "six", ".", "iteritems", "(", "fields", ")", "else", ":", "i", "=", "iter", "(", "fields", ")", "for", "field", "in", "i", ":"...
Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`.
[ "Iterate", "over", "fields", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L25-L42
train
pypa/pipenv
pipenv/vendor/urllib3/filepost.py
iter_fields
def iter_fields(fields): """ .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples an...
python
def iter_fields(fields): """ .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples an...
[ "def", "iter_fields", "(", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "dict", ")", ":", "return", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "fields", ")", ")", "return", "(", "(", "...
.. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples and dicts.
[ "..", "deprecated", "::", "1", ".", "6" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L45-L60
train
pypa/pipenv
pipenv/vendor/urllib3/filepost.py
encode_multipart_formdata
def encode_multipart_formdata(fields, boundary=None): """ Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary ...
python
def encode_multipart_formdata(fields, boundary=None): """ Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary ...
[ "def", "encode_multipart_formdata", "(", "fields", ",", "boundary", "=", "None", ")", ":", "body", "=", "BytesIO", "(", ")", "if", "boundary", "is", "None", ":", "boundary", "=", "choose_boundary", "(", ")", "for", "field", "in", "iter_field_objects", "(", ...
Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). :param boundary: If not specified, then a random boundary will be generated using :func:`urllib3.filepost.choose_bou...
[ "Encode", "a", "dictionary", "of", "fields", "using", "the", "multipart", "/", "form", "-", "data", "MIME", "format", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/filepost.py#L63-L98
train
pypa/pipenv
pipenv/vendor/distlib/resources.py
finder
def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: ...
python
def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: ...
[ "def", "finder", "(", "package", ")", ":", "if", "package", "in", "_finder_cache", ":", "result", "=", "_finder_cache", "[", "package", "]", "else", ":", "if", "package", "not", "in", "sys", ".", "modules", ":", "__import__", "(", "package", ")", "module...
Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package.
[ "Return", "a", "resource", "finder", "for", "a", "package", ".", ":", "param", "package", ":", "The", "name", "of", "the", "package", ".", ":", "return", ":", "A", ":", "class", ":", "ResourceFinder", "instance", "for", "the", "package", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L310-L332
train
pypa/pipenv
pipenv/vendor/distlib/resources.py
finder_for_path
def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) load...
python
def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) load...
[ "def", "finder_for_path", "(", "path", ")", ":", "result", "=", "None", "# calls any path hooks, gets importer into cache", "pkgutil", ".", "get_importer", "(", "path", ")", "loader", "=", "sys", ".", "path_importer_cache", ".", "get", "(", "path", ")", "finder", ...
Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path.
[ "Return", "a", "resource", "finder", "for", "a", "path", "which", "should", "represent", "a", "container", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L338-L355
train
pypa/pipenv
pipenv/vendor/distlib/resources.py
ResourceCache.get
def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path...
python
def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path...
[ "def", "get", "(", "self", ",", "resource", ")", ":", "prefix", ",", "path", "=", "resource", ".", "finder", ".", "get_cache_info", "(", "resource", ")", "if", "prefix", "is", "None", ":", "result", "=", "path", "else", ":", "result", "=", "os", ".",...
Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache.
[ "Get", "a", "resource", "into", "the", "cache" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/resources.py#L46-L69
train
pypa/pipenv
pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py
to_sax
def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use """ handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixM...
python
def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use """ handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixM...
[ "def", "to_sax", "(", "walker", ",", "handler", ")", ":", "handler", ".", "startDocument", "(", ")", "for", "prefix", ",", "namespace", "in", "prefix_mapping", ".", "items", "(", ")", ":", "handler", ".", "startPrefixMapping", "(", "prefix", ",", "namespac...
Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use
[ "Call", "SAX", "-", "like", "content", "handler", "based", "on", "treewalker", "walker" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py#L13-L50
train
pypa/pipenv
pipenv/patched/notpip/_vendor/retrying.py
retry
def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and cal...
python
def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and cal...
[ "def", "retry", "(", "*", "dargs", ",", "*", "*", "dkw", ")", ":", "# support both @retry and @retry() as valid syntax", "if", "len", "(", "dargs", ")", "==", "1", "and", "callable", "(", "dargs", "[", "0", "]", ")", ":", "def", "wrap_simple", "(", "f", ...
Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object
[ "Decorator", "function", "that", "instantiates", "the", "Retrying", "object" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L26-L53
train
pypa/pipenv
pipenv/patched/notpip/_vendor/retrying.py
Retrying.random_sleep
def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a random amount of time between wait_random_min and wait_random_max""" return random.randint(self._wait_random_min, self._wait_random_max)
python
def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a random amount of time between wait_random_min and wait_random_max""" return random.randint(self._wait_random_min, self._wait_random_max)
[ "def", "random_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "random", ".", "randint", "(", "self", ".", "_wait_random_min", ",", "self", ".", "_wait_random_max", ")" ]
Sleep a random amount of time between wait_random_min and wait_random_max
[ "Sleep", "a", "random", "amount", "of", "time", "between", "wait_random_min", "and", "wait_random_max" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L157-L159
train
pypa/pipenv
pipenv/patched/notpip/_vendor/retrying.py
Retrying.incrementing_sleep
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ result = self._wait_incrementing_start + (self....
python
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ result = self._wait_incrementing_start + (self....
[ "def", "incrementing_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "result", "=", "self", ".", "_wait_incrementing_start", "+", "(", "self", ".", "_wait_incrementing_increment", "*", "(", "previous_attempt_number", "...
Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment
[ "Sleep", "an", "incremental", "amount", "of", "time", "after", "each", "attempt", "starting", "at", "wait_incrementing_start", "and", "incrementing", "by", "wait_incrementing_increment" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L161-L169
train
pypa/pipenv
pipenv/patched/notpip/_vendor/retrying.py
Attempt.get
def get(self, wrap_exception=False): """ Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. """ if self.has_exception: if wrap_exception: ...
python
def get(self, wrap_exception=False): """ Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. """ if self.has_exception: if wrap_exception: ...
[ "def", "get", "(", "self", ",", "wrap_exception", "=", "False", ")", ":", "if", "self", ".", "has_exception", ":", "if", "wrap_exception", ":", "raise", "RetryError", "(", "self", ")", "else", ":", "six", ".", "reraise", "(", "self", ".", "value", "[",...
Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised.
[ "Return", "the", "return", "value", "of", "this", "Attempt", "instance", "or", "raise", "an", "Exception", ".", "If", "wrap_exception", "is", "true", "this", "Attempt", "is", "wrapped", "inside", "of", "a", "RetryError", "before", "being", "raised", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/retrying.py#L237-L249
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
safe_range
def safe_range(*args): """A range that can't generate ranges with a length of more than MAX_RANGE items. """ rng = range(*args) if len(rng) > MAX_RANGE: raise OverflowError('range too big, maximum size for range is %d' % MAX_RANGE) return rng
python
def safe_range(*args): """A range that can't generate ranges with a length of more than MAX_RANGE items. """ rng = range(*args) if len(rng) > MAX_RANGE: raise OverflowError('range too big, maximum size for range is %d' % MAX_RANGE) return rng
[ "def", "safe_range", "(", "*", "args", ")", ":", "rng", "=", "range", "(", "*", "args", ")", "if", "len", "(", "rng", ")", ">", "MAX_RANGE", ":", "raise", "OverflowError", "(", "'range too big, maximum size for range is %d'", "%", "MAX_RANGE", ")", "return",...
A range that can't generate ranges with a length of more than MAX_RANGE items.
[ "A", "range", "that", "can", "t", "generate", "ranges", "with", "a", "length", "of", "more", "than", "MAX_RANGE", "items", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L147-L155
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
is_internal_attribute
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >...
python
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >...
[ "def", "is_internal_attribute", "(", "obj", ",", "attr", ")", ":", "if", "isinstance", "(", "obj", ",", "types", ".", "FunctionType", ")", ":", "if", "attr", "in", "UNSAFE_FUNCTION_ATTRIBUTES", ":", "return", "True", "elif", "isinstance", "(", "obj", ",", ...
Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >>> from jinja2.sandbox import is_internal_att...
[ "Test", "if", "the", "attribute", "given", "is", "an", "internal", "python", "attribute", ".", "For", "example", "this", "function", "returns", "True", "for", "the", "func_code", "attribute", "of", "python", "objects", ".", "This", "is", "useful", "if", "the...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L171-L204
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
modifies_known_mutable
def modifies_known_mutable(obj, attr): """This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `Mut...
python
def modifies_known_mutable(obj, attr): """This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `Mut...
[ "def", "modifies_known_mutable", "(", "obj", ",", "attr", ")", ":", "for", "typespec", ",", "unsafe", "in", "_mutable_spec", ":", "if", "isinstance", "(", "obj", ",", "typespec", ")", ":", "return", "attr", "in", "unsafe", "return", "False" ]
This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `MutableSet`, `MutableMapping`, and `MutableSe...
[ "This", "function", "checks", "if", "an", "attribute", "on", "a", "builtin", "mutable", "object", "(", "list", "dict", "set", "or", "deque", ")", "would", "modify", "it", "if", "called", ".", "It", "also", "supports", "the", "user", "-", "versions", "of"...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L207-L232
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
SandboxedEnvironment.is_safe_attribute
def is_safe_attribute(self, obj, attr, value): """The sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python ...
python
def is_safe_attribute(self, obj, attr, value): """The sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python ...
[ "def", "is_safe_attribute", "(", "self", ",", "obj", ",", "attr", ",", "value", ")", ":", "return", "not", "(", "attr", ".", "startswith", "(", "'_'", ")", "or", "is_internal_attribute", "(", "obj", ",", "attr", ")", ")" ]
The sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python objects as returned by the :func:`is_internal_attr...
[ "The", "sandboxed", "environment", "will", "call", "this", "method", "to", "check", "if", "the", "attribute", "of", "an", "object", "is", "safe", "to", "access", ".", "Per", "default", "all", "attributes", "starting", "with", "an", "underscore", "are", "cons...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L323-L330
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
SandboxedEnvironment.call_binop
def call_binop(self, context, operator, left, right): """For intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6 """ ...
python
def call_binop(self, context, operator, left, right): """For intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6 """ ...
[ "def", "call_binop", "(", "self", ",", "context", ",", "operator", ",", "left", ",", "right", ")", ":", "return", "self", ".", "binop_table", "[", "operator", "]", "(", "left", ",", "right", ")" ]
For intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6
[ "For", "intercepted", "binary", "operator", "calls", "(", ":", "meth", ":", "intercepted_binops", ")", "this", "function", "is", "executed", "instead", "of", "the", "builtin", "operator", ".", "This", "can", "be", "used", "to", "fine", "tune", "the", "behavi...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L341-L348
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
SandboxedEnvironment.getattr
def getattr(self, obj, attribute): """Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring. """ try: value = getattr(obj, attribute) except AttributeError: try: return obj[attribute]...
python
def getattr(self, obj, attribute): """Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring. """ try: value = getattr(obj, attribute) except AttributeError: try: return obj[attribute]...
[ "def", "getattr", "(", "self", ",", "obj", ",", "attribute", ")", ":", "try", ":", "value", "=", "getattr", "(", "obj", ",", "attribute", ")", "except", "AttributeError", ":", "try", ":", "return", "obj", "[", "attribute", "]", "except", "(", "TypeErro...
Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring.
[ "Subscribe", "an", "object", "from", "sandboxed", "code", "and", "prefer", "the", "attribute", ".", "The", "attribute", "passed", "*", "must", "*", "be", "a", "bytestring", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L380-L395
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
SandboxedEnvironment.unsafe_undefined
def unsafe_undefined(self, obj, attribute): """Return an undefined object for unsafe attributes.""" return self.undefined('access to attribute %r of %r ' 'object is unsafe.' % ( attribute, obj.__class__.__name__ ), name=attribute, obj=obj, ex...
python
def unsafe_undefined(self, obj, attribute): """Return an undefined object for unsafe attributes.""" return self.undefined('access to attribute %r of %r ' 'object is unsafe.' % ( attribute, obj.__class__.__name__ ), name=attribute, obj=obj, ex...
[ "def", "unsafe_undefined", "(", "self", ",", "obj", ",", "attribute", ")", ":", "return", "self", ".", "undefined", "(", "'access to attribute %r of %r '", "'object is unsafe.'", "%", "(", "attribute", ",", "obj", ".", "__class__", ".", "__name__", ")", ",", "...
Return an undefined object for unsafe attributes.
[ "Return", "an", "undefined", "object", "for", "unsafe", "attributes", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L397-L403
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
SandboxedEnvironment.format_string
def format_string(self, s, args, kwargs): """If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it. """ if isinstance(s, Markup): formatter = SandboxedEscapeFormatter(self, s.escape) else: forma...
python
def format_string(self, s, args, kwargs): """If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it. """ if isinstance(s, Markup): formatter = SandboxedEscapeFormatter(self, s.escape) else: forma...
[ "def", "format_string", "(", "self", ",", "s", ",", "args", ",", "kwargs", ")", ":", "if", "isinstance", "(", "s", ",", "Markup", ")", ":", "formatter", "=", "SandboxedEscapeFormatter", "(", "self", ",", "s", ".", "escape", ")", "else", ":", "formatter...
If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it.
[ "If", "a", "format", "call", "is", "detected", "then", "this", "is", "routed", "through", "this", "method", "so", "that", "our", "safety", "sandbox", "can", "be", "used", "for", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L405-L415
train
pypa/pipenv
pipenv/vendor/jinja2/sandbox.py
SandboxedEnvironment.call
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" fmt = inspect_format_method(__obj) if fmt is not None: return __self.format_string(fmt, args, kwargs) # the double prefixes are to avoid double keyword argument # errors wh...
python
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" fmt = inspect_format_method(__obj) if fmt is not None: return __self.format_string(fmt, args, kwargs) # the double prefixes are to avoid double keyword argument # errors wh...
[ "def", "call", "(", "__self", ",", "__context", ",", "__obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "fmt", "=", "inspect_format_method", "(", "__obj", ")", "if", "fmt", "is", "not", "None", ":", "return", "__self", ".", "format_string", ...
Call an object from sandboxed code.
[ "Call", "an", "object", "from", "sandboxed", "code", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/sandbox.py#L417-L427
train
pypa/pipenv
pipenv/vendor/attr/_make.py
attrib
def attrib( default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=None, type=None, converter=None, factory=None, kw_only=False, ): """ Create a new attribute on a class. .. warning:: Does *not* do anythin...
python
def attrib( default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata=None, type=None, converter=None, factory=None, kw_only=False, ): """ Create a new attribute on a class. .. warning:: Does *not* do anythin...
[ "def", "attrib", "(", "default", "=", "NOTHING", ",", "validator", "=", "None", ",", "repr", "=", "True", ",", "cmp", "=", "True", ",", "hash", "=", "None", ",", "init", "=", "True", ",", "convert", "=", "None", ",", "metadata", "=", "None", ",", ...
Create a new attribute on a class. .. warning:: Does *not* do anything unless the class is also decorated with :func:`attr.s`! :param default: A value that is used if an ``attrs``-generated ``__init__`` is used and no value is passed while instantiating or the attribute is ex...
[ "Create", "a", "new", "attribute", "on", "a", "class", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L70-L219
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_make_attr_tuple_class
def _make_attr_tuple_class(cls_name, attr_names): """ Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) """ attr_class_name = "{}A...
python
def _make_attr_tuple_class(cls_name, attr_names): """ Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) """ attr_class_name = "{}A...
[ "def", "_make_attr_tuple_class", "(", "cls_name", ",", "attr_names", ")", ":", "attr_class_name", "=", "\"{}Attributes\"", ".", "format", "(", "cls_name", ")", "attr_class_template", "=", "[", "\"class {}(tuple):\"", ".", "format", "(", "attr_class_name", ")", ",", ...
Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0))
[ "Create", "a", "tuple", "subclass", "to", "hold", "Attribute", "s", "for", "an", "attrs", "class", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L222-L247
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_get_annotations
def _get_annotations(cls): """ Get annotations for *cls*. """ anns = getattr(cls, "__annotations__", None) if anns is None: return {} # Verify that the annotations aren't merely inherited. for base_cls in cls.__mro__[1:]: if anns is getattr(base_cls, "__annotations__", None)...
python
def _get_annotations(cls): """ Get annotations for *cls*. """ anns = getattr(cls, "__annotations__", None) if anns is None: return {} # Verify that the annotations aren't merely inherited. for base_cls in cls.__mro__[1:]: if anns is getattr(base_cls, "__annotations__", None)...
[ "def", "_get_annotations", "(", "cls", ")", ":", "anns", "=", "getattr", "(", "cls", ",", "\"__annotations__\"", ",", "None", ")", "if", "anns", "is", "None", ":", "return", "{", "}", "# Verify that the annotations aren't merely inherited.", "for", "base_cls", "...
Get annotations for *cls*.
[ "Get", "annotations", "for", "*", "cls", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L276-L289
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_transform_attrs
def _transform_attrs(cls, these, auto_attribs, kw_only): """ Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. Return an `_Attributes`. """ cd = cls.__dict__ anns = _get_annotations(cls) if these is not No...
python
def _transform_attrs(cls, these, auto_attribs, kw_only): """ Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. Return an `_Attributes`. """ cd = cls.__dict__ anns = _get_annotations(cls) if these is not No...
[ "def", "_transform_attrs", "(", "cls", ",", "these", ",", "auto_attribs", ",", "kw_only", ")", ":", "cd", "=", "cls", ".", "__dict__", "anns", "=", "_get_annotations", "(", "cls", ")", "if", "these", "is", "not", "None", ":", "ca_list", "=", "[", "(", ...
Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. Return an `_Attributes`.
[ "Transform", "all", "_CountingAttr", "s", "on", "a", "class", "into", "Attribute", "s", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L299-L421
train
pypa/pipenv
pipenv/vendor/attr/_make.py
attrs
def attrs( maybe_cls=None, these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, ): r""" A class decorator that...
python
def attrs( maybe_cls=None, these=None, repr_ns=None, repr=True, cmp=True, hash=None, init=True, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, ): r""" A class decorator that...
[ "def", "attrs", "(", "maybe_cls", "=", "None", ",", "these", "=", "None", ",", "repr_ns", "=", "None", ",", "repr", "=", "True", ",", "cmp", "=", "True", ",", "hash", "=", "None", ",", "init", "=", "True", ",", "slots", "=", "False", ",", "frozen...
r""" A class decorator that adds `dunder <https://wiki.python.org/moin/DunderAlias>`_\ -methods according to the specified attributes using :func:`attr.ib` or the *these* argument. :param these: A dictionary of name to :func:`attr.ib` mappings. This is useful to avoid the definition of your at...
[ "r", "A", "class", "decorator", "that", "adds", "dunder", "<https", ":", "//", "wiki", ".", "python", ".", "org", "/", "moin", "/", "DunderAlias", ">", "_", "\\", "-", "methods", "according", "to", "the", "specified", "attributes", "using", ":", "func", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L730-L959
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_attrs_to_tuple
def _attrs_to_tuple(obj, attrs): """ Create a tuple of all values of *obj*'s *attrs*. """ return tuple(getattr(obj, a.name) for a in attrs)
python
def _attrs_to_tuple(obj, attrs): """ Create a tuple of all values of *obj*'s *attrs*. """ return tuple(getattr(obj, a.name) for a in attrs)
[ "def", "_attrs_to_tuple", "(", "obj", ",", "attrs", ")", ":", "return", "tuple", "(", "getattr", "(", "obj", ",", "a", ".", "name", ")", "for", "a", "in", "attrs", ")" ]
Create a tuple of all values of *obj*'s *attrs*.
[ "Create", "a", "tuple", "of", "all", "values", "of", "*", "obj", "*", "s", "*", "attrs", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L993-L997
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_add_hash
def _add_hash(cls, attrs): """ Add a hash method to *cls*. """ cls.__hash__ = _make_hash(attrs, frozen=False, cache_hash=False) return cls
python
def _add_hash(cls, attrs): """ Add a hash method to *cls*. """ cls.__hash__ = _make_hash(attrs, frozen=False, cache_hash=False) return cls
[ "def", "_add_hash", "(", "cls", ",", "attrs", ")", ":", "cls", ".", "__hash__", "=", "_make_hash", "(", "attrs", ",", "frozen", "=", "False", ",", "cache_hash", "=", "False", ")", "return", "cls" ]
Add a hash method to *cls*.
[ "Add", "a", "hash", "method", "to", "*", "cls", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1065-L1070
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_add_cmp
def _add_cmp(cls, attrs=None): """ Add comparison methods to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__eq__, cls.__ne__, cls.__lt__, cls.__le__, cls.__gt__, cls.__ge__ = _make_cmp( # noqa attrs ) return cls
python
def _add_cmp(cls, attrs=None): """ Add comparison methods to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__eq__, cls.__ne__, cls.__lt__, cls.__le__, cls.__gt__, cls.__ge__ = _make_cmp( # noqa attrs ) return cls
[ "def", "_add_cmp", "(", "cls", ",", "attrs", "=", "None", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "cls", ".", "__attrs_attrs__", "cls", ".", "__eq__", ",", "cls", ".", "__ne__", ",", "cls", ".", "__lt__", ",", "cls", ".", "__le__"...
Add comparison methods to *cls*.
[ "Add", "comparison", "methods", "to", "*", "cls", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1194-L1205
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_make_repr
def _make_repr(attrs, ns): """ Make a repr method for *attr_names* adding *ns* to the full name. """ attr_names = tuple(a.name for a in attrs if a.repr) def __repr__(self): """ Automatically created by attrs. """ try: working_set = _already_repring.workin...
python
def _make_repr(attrs, ns): """ Make a repr method for *attr_names* adding *ns* to the full name. """ attr_names = tuple(a.name for a in attrs if a.repr) def __repr__(self): """ Automatically created by attrs. """ try: working_set = _already_repring.workin...
[ "def", "_make_repr", "(", "attrs", ",", "ns", ")", ":", "attr_names", "=", "tuple", "(", "a", ".", "name", "for", "a", "in", "attrs", "if", "a", ".", "repr", ")", "def", "__repr__", "(", "self", ")", ":", "\"\"\"\n Automatically created by attrs.\n ...
Make a repr method for *attr_names* adding *ns* to the full name.
[ "Make", "a", "repr", "method", "for", "*", "attr_names", "*", "adding", "*", "ns", "*", "to", "the", "full", "name", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1211-L1257
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_add_repr
def _add_repr(cls, ns=None, attrs=None): """ Add a repr method to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__repr__ = _make_repr(attrs, ns) return cls
python
def _add_repr(cls, ns=None, attrs=None): """ Add a repr method to *cls*. """ if attrs is None: attrs = cls.__attrs_attrs__ cls.__repr__ = _make_repr(attrs, ns) return cls
[ "def", "_add_repr", "(", "cls", ",", "ns", "=", "None", ",", "attrs", "=", "None", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "cls", ".", "__attrs_attrs__", "cls", ".", "__repr__", "=", "_make_repr", "(", "attrs", ",", "ns", ")", "re...
Add a repr method to *cls*.
[ "Add", "a", "repr", "method", "to", "*", "cls", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1260-L1268
train
pypa/pipenv
pipenv/vendor/attr/_make.py
fields
def fields(cls): """ Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *...
python
def fields(cls): """ Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *...
[ "def", "fields", "(", "cls", ")", ":", "if", "not", "isclass", "(", "cls", ")", ":", "raise", "TypeError", "(", "\"Passed object must be a class.\"", ")", "attrs", "=", "getattr", "(", "cls", ",", "\"__attrs_attrs__\"", ",", "None", ")", "if", "attrs", "is...
Return the tuple of ``attrs`` attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` ...
[ "Return", "the", "tuple", "of", "attrs", "attributes", "for", "a", "class", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1311-L1336
train
pypa/pipenv
pipenv/vendor/attr/_make.py
fields_dict
def fields_dict(cls): """ Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` cla...
python
def fields_dict(cls): """ Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` cla...
[ "def", "fields_dict", "(", "cls", ")", ":", "if", "not", "isclass", "(", "cls", ")", ":", "raise", "TypeError", "(", "\"Passed object must be a class.\"", ")", "attrs", "=", "getattr", "(", "cls", ",", "\"__attrs_attrs__\"", ",", "None", ")", "if", "attrs", ...
Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` class. :rtype: an ordered dict w...
[ "Return", "an", "ordered", "dictionary", "of", "attrs", "attributes", "for", "a", "class", "whose", "keys", "are", "the", "attribute", "names", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1339-L1364
train
pypa/pipenv
pipenv/vendor/attr/_make.py
validate
def validate(inst): """ Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes. """ if _config._run_validators is False: return for a in fields(inst.__class__): v = a.validator ...
python
def validate(inst): """ Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes. """ if _config._run_validators is False: return for a in fields(inst.__class__): v = a.validator ...
[ "def", "validate", "(", "inst", ")", ":", "if", "_config", ".", "_run_validators", "is", "False", ":", "return", "for", "a", "in", "fields", "(", "inst", ".", "__class__", ")", ":", "v", "=", "a", ".", "validator", "if", "v", "is", "not", "None", "...
Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes.
[ "Validate", "all", "attributes", "on", "*", "inst", "*", "that", "have", "a", "validator", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1367-L1381
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_attrs_to_init_script
def _attrs_to_init_script( attrs, frozen, slots, post_init, cache_hash, base_attr_map, is_exc ): """ Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cac...
python
def _attrs_to_init_script( attrs, frozen, slots, post_init, cache_hash, base_attr_map, is_exc ): """ Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cac...
[ "def", "_attrs_to_init_script", "(", "attrs", ",", "frozen", ",", "slots", ",", "post_init", ",", "cache_hash", ",", "base_attr_map", ",", "is_exc", ")", ":", "lines", "=", "[", "]", "any_slot_ancestors", "=", "any", "(", "_is_slot_attr", "(", "a", ".", "n...
Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cached ``object.__setattr__``.
[ "Return", "a", "script", "of", "an", "initializer", "for", "*", "attrs", "*", "and", "a", "dict", "of", "globals", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1395-L1672
train
pypa/pipenv
pipenv/vendor/attr/_make.py
make_class
def make_class(name, attrs, bases=(object,), **attributes_arguments): """ A quick way to create a new class called *name* with *attrs*. :param name: The name for the new class. :type name: str :param attrs: A list of names or a dictionary of mappings of names to attributes. If *at...
python
def make_class(name, attrs, bases=(object,), **attributes_arguments): """ A quick way to create a new class called *name* with *attrs*. :param name: The name for the new class. :type name: str :param attrs: A list of names or a dictionary of mappings of names to attributes. If *at...
[ "def", "make_class", "(", "name", ",", "attrs", ",", "bases", "=", "(", "object", ",", ")", ",", "*", "*", "attributes_arguments", ")", ":", "if", "isinstance", "(", "attrs", ",", "dict", ")", ":", "cls_dict", "=", "attrs", "elif", "isinstance", "(", ...
A quick way to create a new class called *name* with *attrs*. :param name: The name for the new class. :type name: str :param attrs: A list of names or a dictionary of mappings of names to attributes. If *attrs* is a list or an ordered dict (:class:`dict` on Python 3.6+, :class:`c...
[ "A", "quick", "way", "to", "create", "a", "new", "class", "called", "*", "name", "*", "with", "*", "attrs", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1997-L2047
train
pypa/pipenv
pipenv/vendor/attr/_make.py
and_
def and_(*validators): """ A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param validators: Arbitrary number of validators. :type validators: callables .. versionadded:: 17.1.0 """ vals = [] for validator in validat...
python
def and_(*validators): """ A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param validators: Arbitrary number of validators. :type validators: callables .. versionadded:: 17.1.0 """ vals = [] for validator in validat...
[ "def", "and_", "(", "*", "validators", ")", ":", "vals", "=", "[", "]", "for", "validator", "in", "validators", ":", "vals", ".", "extend", "(", "validator", ".", "_validators", "if", "isinstance", "(", "validator", ",", "_AndValidator", ")", "else", "["...
A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param validators: Arbitrary number of validators. :type validators: callables .. versionadded:: 17.1.0
[ "A", "validator", "that", "composes", "multiple", "validators", "into", "one", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L2067-L2086
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_ClassBuilder._patch_original_class
def _patch_original_class(self): """ Apply accumulated methods and return the class. """ cls = self._cls base_names = self._base_names # Clean class of attribute definitions (`attr.ib()`s). if self._delete_attribs: for name in self._attr_names: ...
python
def _patch_original_class(self): """ Apply accumulated methods and return the class. """ cls = self._cls base_names = self._base_names # Clean class of attribute definitions (`attr.ib()`s). if self._delete_attribs: for name in self._attr_names: ...
[ "def", "_patch_original_class", "(", "self", ")", ":", "cls", "=", "self", ".", "_cls", "base_names", "=", "self", ".", "_base_names", "# Clean class of attribute definitions (`attr.ib()`s).", "if", "self", ".", "_delete_attribs", ":", "for", "name", "in", "self", ...
Apply accumulated methods and return the class.
[ "Apply", "accumulated", "methods", "and", "return", "the", "class", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L509-L555
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_ClassBuilder._create_slots_class
def _create_slots_class(self): """ Build and return a new class with a `__slots__` attribute. """ base_names = self._base_names cd = { k: v for k, v in iteritems(self._cls_dict) if k not in tuple(self._attr_names) + ("__dict__", "__weakref__") ...
python
def _create_slots_class(self): """ Build and return a new class with a `__slots__` attribute. """ base_names = self._base_names cd = { k: v for k, v in iteritems(self._cls_dict) if k not in tuple(self._attr_names) + ("__dict__", "__weakref__") ...
[ "def", "_create_slots_class", "(", "self", ")", ":", "base_names", "=", "self", ".", "_base_names", "cd", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "iteritems", "(", "self", ".", "_cls_dict", ")", "if", "k", "not", "in", "tuple", "(", "s...
Build and return a new class with a `__slots__` attribute.
[ "Build", "and", "return", "a", "new", "class", "with", "a", "__slots__", "attribute", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L557-L651
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_ClassBuilder._add_method_dunders
def _add_method_dunders(self, method): """ Add __module__ and __qualname__ to a *method* if possible. """ try: method.__module__ = self._cls.__module__ except AttributeError: pass try: method.__qualname__ = ".".join( (s...
python
def _add_method_dunders(self, method): """ Add __module__ and __qualname__ to a *method* if possible. """ try: method.__module__ = self._cls.__module__ except AttributeError: pass try: method.__qualname__ = ".".join( (s...
[ "def", "_add_method_dunders", "(", "self", ",", "method", ")", ":", "try", ":", "method", ".", "__module__", "=", "self", ".", "_cls", ".", "__module__", "except", "AttributeError", ":", "pass", "try", ":", "method", ".", "__qualname__", "=", "\".\"", ".",...
Add __module__ and __qualname__ to a *method* if possible.
[ "Add", "__module__", "and", "__qualname__", "to", "a", "*", "method", "*", "if", "possible", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L711-L727
train
pypa/pipenv
pipenv/vendor/attr/_make.py
Attribute._assoc
def _assoc(self, **changes): """ Copy *self* and apply *changes*. """ new = copy.copy(self) new._setattrs(changes.items()) return new
python
def _assoc(self, **changes): """ Copy *self* and apply *changes*. """ new = copy.copy(self) new._setattrs(changes.items()) return new
[ "def", "_assoc", "(", "self", ",", "*", "*", "changes", ")", ":", "new", "=", "copy", ".", "copy", "(", "self", ")", "new", ".", "_setattrs", "(", "changes", ".", "items", "(", ")", ")", "return", "new" ]
Copy *self* and apply *changes*.
[ "Copy", "*", "self", "*", "and", "apply", "*", "changes", "*", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1796-L1804
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_CountingAttr.validator
def validator(self, meth): """ Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 """ if self._validator is None: self._validator = meth else: self._validator = and_(self._validator, m...
python
def validator(self, meth): """ Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 """ if self._validator is None: self._validator = meth else: self._validator = and_(self._validator, m...
[ "def", "validator", "(", "self", ",", "meth", ")", ":", "if", "self", ".", "_validator", "is", "None", ":", "self", ".", "_validator", "=", "meth", "else", ":", "self", ".", "_validator", "=", "and_", "(", "self", ".", "_validator", ",", "meth", ")",...
Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0
[ "Decorator", "that", "adds", "*", "meth", "*", "to", "the", "list", "of", "validators", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1934-L1946
train
pypa/pipenv
pipenv/vendor/attr/_make.py
_CountingAttr.default
def default(self, meth): """ Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 """ if self._default is not NOTHING: raise Def...
python
def default(self, meth): """ Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 """ if self._default is not NOTHING: raise Def...
[ "def", "default", "(", "self", ",", "meth", ")", ":", "if", "self", ".", "_default", "is", "not", "NOTHING", ":", "raise", "DefaultAlreadySetError", "(", ")", "self", ".", "_default", "=", "Factory", "(", "meth", ",", "takes_self", "=", "True", ")", "r...
Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0
[ "Decorator", "that", "allows", "to", "set", "the", "default", "for", "an", "attribute", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1948-L1963
train
pypa/pipenv
pipenv/vendor/delegator.py
_expand_args
def _expand_args(command): """Parses command strings and returns a Popen-ready list.""" # Prepare arguments. if isinstance(command, STR_TYPES): if sys.version_info[0] == 2: splitter = shlex.shlex(command.encode("utf-8")) elif sys.version_info[0] == 3: splitter = shle...
python
def _expand_args(command): """Parses command strings and returns a Popen-ready list.""" # Prepare arguments. if isinstance(command, STR_TYPES): if sys.version_info[0] == 2: splitter = shlex.shlex(command.encode("utf-8")) elif sys.version_info[0] == 3: splitter = shle...
[ "def", "_expand_args", "(", "command", ")", ":", "# Prepare arguments.", "if", "isinstance", "(", "command", ",", "STR_TYPES", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "==", "2", ":", "splitter", "=", "shlex", ".", "shlex", "(", "comman...
Parses command strings and returns a Popen-ready list.
[ "Parses", "command", "strings", "and", "returns", "a", "Popen", "-", "ready", "list", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L290-L314
train
pypa/pipenv
pipenv/vendor/delegator.py
Command.out
def out(self): """Std/out output (cached)""" if self.__out is not None: return self.__out if self._uses_subprocess: self.__out = self.std_out.read() else: self.__out = self._pexpect_out return self.__out
python
def out(self): """Std/out output (cached)""" if self.__out is not None: return self.__out if self._uses_subprocess: self.__out = self.std_out.read() else: self.__out = self._pexpect_out return self.__out
[ "def", "out", "(", "self", ")", ":", "if", "self", ".", "__out", "is", "not", "None", ":", "return", "self", ".", "__out", "if", "self", ".", "_uses_subprocess", ":", "self", ".", "__out", "=", "self", ".", "std_out", ".", "read", "(", ")", "else",...
Std/out output (cached)
[ "Std", "/", "out", "output", "(", "cached", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L125-L135
train
pypa/pipenv
pipenv/vendor/delegator.py
Command.expect
def expect(self, pattern, timeout=-1): """Waits on the given pattern to appear in std_out""" if self.blocking: raise RuntimeError("expect can only be used on non-blocking commands.") try: self.subprocess.expect(pattern=pattern, timeout=timeout) except pexpect.EO...
python
def expect(self, pattern, timeout=-1): """Waits on the given pattern to appear in std_out""" if self.blocking: raise RuntimeError("expect can only be used on non-blocking commands.") try: self.subprocess.expect(pattern=pattern, timeout=timeout) except pexpect.EO...
[ "def", "expect", "(", "self", ",", "pattern", ",", "timeout", "=", "-", "1", ")", ":", "if", "self", ".", "blocking", ":", "raise", "RuntimeError", "(", "\"expect can only be used on non-blocking commands.\"", ")", "try", ":", "self", ".", "subprocess", ".", ...
Waits on the given pattern to appear in std_out
[ "Waits", "on", "the", "given", "pattern", "to", "appear", "in", "std_out" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L208-L217
train
pypa/pipenv
pipenv/vendor/delegator.py
Command.block
def block(self): """Blocks until process is complete.""" if self._uses_subprocess: # consume stdout and stderr if self.blocking: try: stdout, stderr = self.subprocess.communicate() self.__out = stdout sel...
python
def block(self): """Blocks until process is complete.""" if self._uses_subprocess: # consume stdout and stderr if self.blocking: try: stdout, stderr = self.subprocess.communicate() self.__out = stdout sel...
[ "def", "block", "(", "self", ")", ":", "if", "self", ".", "_uses_subprocess", ":", "# consume stdout and stderr", "if", "self", ".", "blocking", ":", "try", ":", "stdout", ",", "stderr", "=", "self", ".", "subprocess", ".", "communicate", "(", ")", "self",...
Blocks until process is complete.
[ "Blocks", "until", "process", "is", "complete", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L242-L264
train
pypa/pipenv
pipenv/vendor/delegator.py
Command.pipe
def pipe(self, command, timeout=None, cwd=None): """Runs the current command and passes its output to the next given process. """ if not timeout: timeout = self.timeout if not self.was_run: self.run(block=False, cwd=cwd) data = self.out ...
python
def pipe(self, command, timeout=None, cwd=None): """Runs the current command and passes its output to the next given process. """ if not timeout: timeout = self.timeout if not self.was_run: self.run(block=False, cwd=cwd) data = self.out ...
[ "def", "pipe", "(", "self", ",", "command", ",", "timeout", "=", "None", ",", "cwd", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "self", ".", "timeout", "if", "not", "self", ".", "was_run", ":", "self", ".", "run", "(", "b...
Runs the current command and passes its output to the next given process.
[ "Runs", "the", "current", "command", "and", "passes", "its", "output", "to", "the", "next", "given", "process", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/delegator.py#L266-L287
train
pypa/pipenv
pipenv/vendor/urllib3/packages/backports/makefile.py
backport_makefile
def backport_makefile(self, mode="r", buffering=None, encoding=None, errors=None, newline=None): """ Backport of ``socket.makefile`` from Python 3.5. """ if not set(mode) <= {"r", "w", "b"}: raise ValueError( "invalid mode %r (only r, w, b allowed)" % (mode,) ...
python
def backport_makefile(self, mode="r", buffering=None, encoding=None, errors=None, newline=None): """ Backport of ``socket.makefile`` from Python 3.5. """ if not set(mode) <= {"r", "w", "b"}: raise ValueError( "invalid mode %r (only r, w, b allowed)" % (mode,) ...
[ "def", "backport_makefile", "(", "self", ",", "mode", "=", "\"r\"", ",", "buffering", "=", "None", ",", "encoding", "=", "None", ",", "errors", "=", "None", ",", "newline", "=", "None", ")", ":", "if", "not", "set", "(", "mode", ")", "<=", "{", "\"...
Backport of ``socket.makefile`` from Python 3.5.
[ "Backport", "of", "socket", ".", "makefile", "from", "Python", "3", ".", "5", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/packages/backports/makefile.py#L14-L53
train
pypa/pipenv
pipenv/vendor/jinja2/debug.py
make_traceback
def make_traceback(exc_info, source_hint=None): """Creates a processed traceback object from the exc_info.""" exc_type, exc_value, tb = exc_info if isinstance(exc_value, TemplateSyntaxError): exc_info = translate_syntax_error(exc_value, source_hint) initial_skip = 0 else: initial...
python
def make_traceback(exc_info, source_hint=None): """Creates a processed traceback object from the exc_info.""" exc_type, exc_value, tb = exc_info if isinstance(exc_value, TemplateSyntaxError): exc_info = translate_syntax_error(exc_value, source_hint) initial_skip = 0 else: initial...
[ "def", "make_traceback", "(", "exc_info", ",", "source_hint", "=", "None", ")", ":", "exc_type", ",", "exc_value", ",", "tb", "=", "exc_info", "if", "isinstance", "(", "exc_value", ",", "TemplateSyntaxError", ")", ":", "exc_info", "=", "translate_syntax_error", ...
Creates a processed traceback object from the exc_info.
[ "Creates", "a", "processed", "traceback", "object", "from", "the", "exc_info", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L132-L140
train
pypa/pipenv
pipenv/vendor/jinja2/debug.py
translate_syntax_error
def translate_syntax_error(error, source=None): """Rewrites a syntax error to please traceback systems.""" error.source = source error.translated = True exc_info = (error.__class__, error, None) filename = error.filename if filename is None: filename = '<unknown>' return fake_exc_inf...
python
def translate_syntax_error(error, source=None): """Rewrites a syntax error to please traceback systems.""" error.source = source error.translated = True exc_info = (error.__class__, error, None) filename = error.filename if filename is None: filename = '<unknown>' return fake_exc_inf...
[ "def", "translate_syntax_error", "(", "error", ",", "source", "=", "None", ")", ":", "error", ".", "source", "=", "source", "error", ".", "translated", "=", "True", "exc_info", "=", "(", "error", ".", "__class__", ",", "error", ",", "None", ")", "filenam...
Rewrites a syntax error to please traceback systems.
[ "Rewrites", "a", "syntax", "error", "to", "please", "traceback", "systems", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L143-L151
train
pypa/pipenv
pipenv/vendor/jinja2/debug.py
ProcessedTraceback.render_as_text
def render_as_text(self, limit=None): """Return a string with the traceback.""" lines = traceback.format_exception(self.exc_type, self.exc_value, self.frames[0], limit=limit) return ''.join(lines).rstrip()
python
def render_as_text(self, limit=None): """Return a string with the traceback.""" lines = traceback.format_exception(self.exc_type, self.exc_value, self.frames[0], limit=limit) return ''.join(lines).rstrip()
[ "def", "render_as_text", "(", "self", ",", "limit", "=", "None", ")", ":", "lines", "=", "traceback", ".", "format_exception", "(", "self", ".", "exc_type", ",", "self", ".", "exc_value", ",", "self", ".", "frames", "[", "0", "]", ",", "limit", "=", ...
Return a string with the traceback.
[ "Return", "a", "string", "with", "the", "traceback", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L97-L101
train
pypa/pipenv
pipenv/vendor/jinja2/debug.py
ProcessedTraceback.render_as_html
def render_as_html(self, full=False): """Return a unicode string with the traceback as rendered HTML.""" from jinja2.debugrenderer import render_traceback return u'%s\n\n<!--\n%s\n-->' % ( render_traceback(self, full=full), self.render_as_text().decode('utf-8', 'replace')...
python
def render_as_html(self, full=False): """Return a unicode string with the traceback as rendered HTML.""" from jinja2.debugrenderer import render_traceback return u'%s\n\n<!--\n%s\n-->' % ( render_traceback(self, full=full), self.render_as_text().decode('utf-8', 'replace')...
[ "def", "render_as_html", "(", "self", ",", "full", "=", "False", ")", ":", "from", "jinja2", ".", "debugrenderer", "import", "render_traceback", "return", "u'%s\\n\\n<!--\\n%s\\n-->'", "%", "(", "render_traceback", "(", "self", ",", "full", "=", "full", ")", "...
Return a unicode string with the traceback as rendered HTML.
[ "Return", "a", "unicode", "string", "with", "the", "traceback", "as", "rendered", "HTML", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L103-L109
train
pypa/pipenv
pipenv/vendor/jinja2/debug.py
ProcessedTraceback.standard_exc_info
def standard_exc_info(self): """Standard python exc_info for re-raising""" tb = self.frames[0] # the frame will be an actual traceback (or transparent proxy) if # we are on pypy or a python implementation with support for tproxy if type(tb) is not TracebackType: tb = ...
python
def standard_exc_info(self): """Standard python exc_info for re-raising""" tb = self.frames[0] # the frame will be an actual traceback (or transparent proxy) if # we are on pypy or a python implementation with support for tproxy if type(tb) is not TracebackType: tb = ...
[ "def", "standard_exc_info", "(", "self", ")", ":", "tb", "=", "self", ".", "frames", "[", "0", "]", "# the frame will be an actual traceback (or transparent proxy) if", "# we are on pypy or a python implementation with support for tproxy", "if", "type", "(", "tb", ")", "is"...
Standard python exc_info for re-raising
[ "Standard", "python", "exc_info", "for", "re", "-", "raising" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/debug.py#L122-L129
train
pypa/pipenv
pipenv/vendor/click_didyoumean/__init__.py
DYMMixin.resolve_command
def resolve_command(self, ctx, args): """ Overrides clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the raised exception message. """ original_cmd_name = click.utils.make_str(args[0]) try: return super(DYMMixin, self).r...
python
def resolve_command(self, ctx, args): """ Overrides clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the raised exception message. """ original_cmd_name = click.utils.make_str(args[0]) try: return super(DYMMixin, self).r...
[ "def", "resolve_command", "(", "self", ",", "ctx", ",", "args", ")", ":", "original_cmd_name", "=", "click", ".", "utils", ".", "make_str", "(", "args", "[", "0", "]", ")", "try", ":", "return", "super", "(", "DYMMixin", ",", "self", ")", ".", "resol...
Overrides clicks ``resolve_command`` method and appends *Did you mean ...* suggestions to the raised exception message.
[ "Overrides", "clicks", "resolve_command", "method", "and", "appends", "*", "Did", "you", "mean", "...", "*", "suggestions", "to", "the", "raised", "exception", "message", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_didyoumean/__init__.py#L25-L42
train
pypa/pipenv
pipenv/vendor/plette/models/scripts.py
Script.cmdify
def cmdify(self, extra_args=None): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes be...
python
def cmdify(self, extra_args=None): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes be...
[ "def", "cmdify", "(", "self", ",", "extra_args", "=", "None", ")", ":", "parts", "=", "list", "(", "self", ".", "_parts", ")", "if", "extra_args", ":", "parts", ".", "extend", "(", "extra_args", ")", "return", "\" \"", ".", "join", "(", "arg", "if", ...
Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes before a quote are doubled, so they are all ...
[ "Encode", "into", "a", "cmd", "-", "executable", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/plette/models/scripts.py#L48-L79
train
pypa/pipenv
pipenv/patched/notpip/_internal/operations/prepare.py
make_abstract_dist
def make_abstract_dist(req): # type: (InstallRequirement) -> DistAbstraction """Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction. """ ...
python
def make_abstract_dist(req): # type: (InstallRequirement) -> DistAbstraction """Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction. """ ...
[ "def", "make_abstract_dist", "(", "req", ")", ":", "# type: (InstallRequirement) -> DistAbstraction", "if", "req", ".", "editable", ":", "return", "IsSDist", "(", "req", ")", "elif", "req", ".", "link", "and", "req", ".", "link", ".", "is_wheel", ":", "return"...
Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction.
[ "Factory", "to", "make", "an", "abstract", "dist", "object", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L34-L48
train
pypa/pipenv
pipenv/patched/notpip/_internal/operations/prepare.py
RequirementPreparer.prepare_linked_requirement
def prepare_linked_requirement( self, req, # type: InstallRequirement session, # type: PipSession finder, # type: PackageFinder upgrade_allowed, # type: bool require_hashes # type: bool ): # type: (...) -> DistAbstraction """Prepare a requirement ...
python
def prepare_linked_requirement( self, req, # type: InstallRequirement session, # type: PipSession finder, # type: PackageFinder upgrade_allowed, # type: bool require_hashes # type: bool ): # type: (...) -> DistAbstraction """Prepare a requirement ...
[ "def", "prepare_linked_requirement", "(", "self", ",", "req", ",", "# type: InstallRequirement", "session", ",", "# type: PipSession", "finder", ",", "# type: PackageFinder", "upgrade_allowed", ",", "# type: bool", "require_hashes", "# type: bool", ")", ":", "# type: (...) ...
Prepare a requirement that would be obtained from req.link
[ "Prepare", "a", "requirement", "that", "would", "be", "obtained", "from", "req", ".", "link" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L230-L347
train
pypa/pipenv
pipenv/patched/notpip/_internal/operations/prepare.py
RequirementPreparer.prepare_editable_requirement
def prepare_editable_requirement( self, req, # type: InstallRequirement require_hashes, # type: bool use_user_site, # type: bool finder # type: PackageFinder ): # type: (...) -> DistAbstraction """Prepare an editable requirement """ assert ...
python
def prepare_editable_requirement( self, req, # type: InstallRequirement require_hashes, # type: bool use_user_site, # type: bool finder # type: PackageFinder ): # type: (...) -> DistAbstraction """Prepare an editable requirement """ assert ...
[ "def", "prepare_editable_requirement", "(", "self", ",", "req", ",", "# type: InstallRequirement", "require_hashes", ",", "# type: bool", "use_user_site", ",", "# type: bool", "finder", "# type: PackageFinder", ")", ":", "# type: (...) -> DistAbstraction", "assert", "req", ...
Prepare an editable requirement
[ "Prepare", "an", "editable", "requirement" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L349-L381
train
pypa/pipenv
pipenv/patched/notpip/_internal/operations/prepare.py
RequirementPreparer.prepare_installed_requirement
def prepare_installed_requirement(self, req, require_hashes, skip_reason): # type: (InstallRequirement, bool, Optional[str]) -> DistAbstraction """Prepare an already-installed requirement """ assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason i...
python
def prepare_installed_requirement(self, req, require_hashes, skip_reason): # type: (InstallRequirement, bool, Optional[str]) -> DistAbstraction """Prepare an already-installed requirement """ assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason i...
[ "def", "prepare_installed_requirement", "(", "self", ",", "req", ",", "require_hashes", ",", "skip_reason", ")", ":", "# type: (InstallRequirement, bool, Optional[str]) -> DistAbstraction", "assert", "req", ".", "satisfied_by", ",", "\"req should have been satisfied but isn't\"",...
Prepare an already-installed requirement
[ "Prepare", "an", "already", "-", "installed", "requirement" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/prepare.py#L383-L406
train