Let us walk on the 3-isogeny graph
|
Data Structures | |
class | ConfiguredBuildBackendHookCaller |
class | HiddenText |
class | StreamWrapper |
Functions | |
str | get_pip_version () |
Tuple[int, int, int] | normalize_version_info (Tuple[int,...] py_version_info) |
None | ensure_dir (str path) |
str | get_prog () |
None | rmtree (str dir, bool ignore_errors=False) |
None | rmtree_errorhandler (Callable[..., Any] func, str path, Union[ExcInfo, BaseException] exc_info) |
str | display_path (str path) |
str | backup_dir (str dir, str ext=".bak") |
str | ask_path_exists (str message, Iterable[str] options) |
None | _check_no_input (str message) |
str | ask (str message, Iterable[str] options) |
str | ask_input (str message) |
str | ask_password (str message) |
int | strtobool (str val) |
str | format_size (float bytes) |
Tuple[List[str], List[int]] | tabulate (Iterable[Iterable[Any]] rows) |
bool | is_installable_dir (str path) |
Generator[bytes, None, None] | read_chunks (BinaryIO file, int size=io.DEFAULT_BUFFER_SIZE) |
str | normalize_path (str path, bool resolve_symlinks=True) |
Tuple[str, str] | splitext (str path) |
None | renames (str old, str new) |
bool | is_local (str path) |
None | write_output (Any msg, *Any args) |
Generator[StreamWrapper, None, None] | captured_output (str stream_name) |
ContextManager[StreamWrapper] | captured_stdout () |
ContextManager[StreamWrapper] | captured_stderr () |
Type[Any] | enum (*Any sequential, **Any named) |
str | build_netloc (str host, Optional[int] port) |
str | build_url_from_netloc (str netloc, str scheme="https") |
Tuple[Optional[str], Optional[int]] | parse_netloc (str netloc) |
NetlocTuple | split_auth_from_netloc (str netloc) |
str | redact_netloc (str netloc) |
Tuple[str, NetlocTuple] | _transform_url (str url, Callable[[str], Tuple[Any,...]] transform_netloc) |
NetlocTuple | _get_netloc (str netloc) |
Tuple[str] | _redact_netloc (str netloc) |
Tuple[str, str, Tuple[Optional[str], Optional[str]]] | split_auth_netloc_from_url (str url) |
str | remove_auth_from_url (str url) |
str | redact_auth_from_url (str url) |
HiddenText | hide_value (str value) |
HiddenText | hide_url (str url) |
None | protect_pip_from_modification_on_windows (bool modifying_pip) |
None | check_externally_managed () |
bool | is_console_interactive () |
Tuple[Any, int] | hash_file (str path, int blocksize=1<< 20) |
Iterator[Tuple[Any, Any]] | pairwise (Iterable[Any] iterable) |
Tuple[Iterable[T], Iterable[T]] | partition (Callable[[T], bool] pred, Iterable[T] iterable) |
Variables | |
logger = logging.getLogger(__name__) | |
T = TypeVar("T") | |
ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] | |
VersionInfo = Tuple[int, int, int] | |
NetlocTuple = Tuple[str, Tuple[Optional[str], Optional[str]]] | |
|
protected |
Raise an error if no input is allowed.
Definition at line 182 of file misc.py.
References i.
Referenced by pip._internal.utils.misc.ask(), pip._internal.utils.misc.ask_input(), and pip._internal.utils.misc.ask_password().
|
protected |
|
protected |
Definition at line 507 of file misc.py.
References pip._internal.utils.misc.redact_netloc().
|
protected |
Transform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1.
Definition at line 483 of file misc.py.
References i.
Referenced by pip._internal.utils.misc.redact_auth_from_url(), pip._internal.utils.misc.remove_auth_from_url(), and pip._internal.utils.misc.split_auth_netloc_from_url().
str ask | ( | str | message, |
Iterable[str] | options | ||
) |
Ask the message interactively, with the given possible responses
Definition at line 190 of file misc.py.
References pip._internal.utils.misc._check_no_input(), and i.
str ask_input | ( | str | message | ) |
Ask for input interactively.
Definition at line 205 of file misc.py.
References pip._internal.utils.misc._check_no_input().
str ask_password | ( | str | message | ) |
Ask for a password interactively.
Definition at line 211 of file misc.py.
References pip._internal.utils.misc._check_no_input(), and i.
str ask_path_exists | ( | str | message, |
Iterable[str] | options | ||
) |
str backup_dir | ( | str | dir, |
str | ext = ".bak" |
||
) |
Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc)
Definition at line 164 of file misc.py.
References i.
str build_netloc | ( | str | host, |
Optional[int] | port | ||
) |
Build a netloc from a host-port pair
Definition at line 401 of file misc.py.
str build_url_from_netloc | ( | str | netloc, |
str | scheme = "https" |
||
) |
Build a full URL from a netloc.
Definition at line 413 of file misc.py.
References i.
Generator[StreamWrapper, None, None] captured_output | ( | str | stream_name | ) |
Return a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo.
Definition at line 360 of file misc.py.
References i.
Referenced by pip._internal.utils.misc.captured_stderr(), and pip._internal.utils.misc.captured_stdout().
ContextManager[StreamWrapper] captured_stderr | ( | ) |
See captured_stdout().
Definition at line 386 of file misc.py.
References pip._internal.utils.misc.captured_output().
ContextManager[StreamWrapper] captured_stdout | ( | ) |
Capture the output of sys.stdout: with captured_stdout() as stdout: print('hello') self.assertEqual(stdout.getvalue(), 'hello\n') Taken from Lib/support/__init__.py in the CPython repo.
Definition at line 374 of file misc.py.
References pip._internal.utils.misc.captured_output().
None check_externally_managed | ( | ) |
Check whether the current environment is externally managed. If the ``EXTERNALLY-MANAGED`` config file is found, the current environment is considered externally managed, and an ExternallyManagedEnvironment is raised.
Definition at line 591 of file misc.py.
References i.
str display_path | ( | str | path | ) |
None ensure_dir | ( | str | path | ) |
os.path.makedirs without EEXIST.
Definition at line 101 of file misc.py.
References i.
Type[Any] enum | ( | *Any | sequential, |
**Any | named | ||
) |
str format_size | ( | float | bytes | ) |
Definition at line 233 of file misc.py.
str get_pip_version | ( | ) |
Definition at line 71 of file misc.py.
References i.
str get_prog | ( | ) |
Definition at line 111 of file misc.py.
References i.
Tuple[Any, int] hash_file | ( | str | path, |
int | blocksize = 1 << 20 |
||
) |
Return (hash, length) for path using hashlib.sha256()
Definition at line 611 of file misc.py.
References i.
HiddenText hide_url | ( | str | url | ) |
HiddenText hide_value | ( | str | value | ) |
bool is_console_interactive | ( | ) |
bool is_installable_dir | ( | str | path | ) |
Is path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which are already covered by the pyproject.toml check.
Definition at line 258 of file misc.py.
References i.
bool is_local | ( | str | path | ) |
Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path.
Definition at line 325 of file misc.py.
References i.
str normalize_path | ( | str | path, |
bool | resolve_symlinks = True |
||
) |
Convert a path to its canonical, case-normalized, absolute version.
Definition at line 286 of file misc.py.
References i.
Tuple[int, int, int] normalize_version_info | ( | Tuple[int, ...] | py_version_info | ) |
Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None).
Definition at line 82 of file misc.py.
References i.
Iterator[Tuple[Any, Any]] pairwise | ( | Iterable[Any] | iterable | ) |
Return paired elements. For example: s -> (s0, s1), (s2, s3), (s4, s5), ...
Definition at line 623 of file misc.py.
Tuple[Optional[str], Optional[int]] parse_netloc | ( | str | netloc | ) |
Return the host-port pair from a netloc.
Definition at line 423 of file misc.py.
References i.
Use a predicate to partition entries into false entries and true entries, like partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9
Definition at line 634 of file misc.py.
None protect_pip_from_modification_on_windows | ( | bool | modifying_pip | ) |
Protection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ...
Definition at line 565 of file misc.py.
References i.
Yield pieces of data from a file-like object until EOF.
Definition at line 275 of file misc.py.
References i.
str redact_auth_from_url | ( | str | url | ) |
Replace the password in a given url with ****.
Definition at line 530 of file misc.py.
References pip._internal.utils.misc._transform_url().
str redact_netloc | ( | str | netloc | ) |
Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com"
Definition at line 461 of file misc.py.
References i.
Referenced by pip._internal.utils.misc._redact_netloc().
str remove_auth_from_url | ( | str | url | ) |
Return a copy of url with 'username:password@' removed.
Definition at line 523 of file misc.py.
References pip._internal.utils.misc._transform_url().
None renames | ( | str | old, |
str | new | ||
) |
Like os.renames(), but handles renaming across devices.
Definition at line 308 of file misc.py.
References i.
None rmtree | ( | str | dir, |
bool | ignore_errors = False |
||
) |
Definition at line 126 of file misc.py.
References i.
None rmtree_errorhandler | ( | Callable[..., Any] | func, |
str | path, | ||
Union[ExcInfo, BaseException] | exc_info | ||
) |
On Windows, the files in .svn are read-only, so when rmtree() tries to remove them, an exception is thrown. We catch that here, remove the read-only attribute, and hopefully continue without problems.
Definition at line 133 of file misc.py.
References i.
NetlocTuple split_auth_from_netloc | ( | str | netloc | ) |
Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)).
Definition at line 432 of file misc.py.
References i.
Tuple[str, str, Tuple[Optional[str], Optional[str]]] split_auth_netloc_from_url | ( | str | url | ) |
Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password))
Definition at line 511 of file misc.py.
References pip._internal.utils.misc._transform_url().
Tuple[str, str] splitext | ( | str | path | ) |
Like os.path.splitext, but take off .tar too
Definition at line 299 of file misc.py.
References i.
int strtobool | ( | str | val | ) |
Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else.
Definition at line 217 of file misc.py.
References i.
Tuple[List[str], List[int]] tabulate | ( | Iterable[Iterable[Any]] | rows | ) |
Return a list of formatted rows and a list of column sizes. For example:: >>> tabulate([['foobar', 2000], [0xdeadbeef]]) (['foobar 2000', '3735928559'], [10, 4])
Definition at line 244 of file misc.py.
References i.
ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] |
NetlocTuple = Tuple[str, Tuple[Optional[str], Optional[str]]] |