Server IP : 85.214.239.14 / Your IP : 18.117.101.250 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/self/root/srv/automx/env/lib64/python3.5/site-packages/pip/_internal/commands/ |
Upload File : |
""" Package containing all pip commands """ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False # There is currently a bug in python/typeshed mentioned at # https://github.com/python/typeshed/issues/3906 which causes the # return type of difflib.get_close_matches to be reported # as List[Sequence[str]] whereas it should have been List[str] from __future__ import absolute_import import importlib from collections import OrderedDict, namedtuple from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Any from pip._internal.cli.base_command import Command CommandInfo = namedtuple('CommandInfo', 'module_path, class_name, summary') # The ordering matters for help display. # Also, even though the module path starts with the same # "pip._internal.commands" prefix in each case, we include the full path # because it makes testing easier (specifically when modifying commands_dict # in test setup / teardown by adding info for a FakeCommand class defined # in a test-related module). # Finally, we need to pass an iterable of pairs here rather than a dict # so that the ordering won't be lost when using Python 2.7. commands_dict = OrderedDict([ ('install', CommandInfo( 'pip._internal.commands.install', 'InstallCommand', 'Install packages.', )), ('download', CommandInfo( 'pip._internal.commands.download', 'DownloadCommand', 'Download packages.', )), ('uninstall', CommandInfo( 'pip._internal.commands.uninstall', 'UninstallCommand', 'Uninstall packages.', )), ('freeze', CommandInfo( 'pip._internal.commands.freeze', 'FreezeCommand', 'Output installed packages in requirements format.', )), ('list', CommandInfo( 'pip._internal.commands.list', 'ListCommand', 'List installed packages.', )), ('show', CommandInfo( 'pip._internal.commands.show', 'ShowCommand', 'Show information about installed packages.', )), ('check', CommandInfo( 'pip._internal.commands.check', 'CheckCommand', 'Verify installed packages have compatible dependencies.', )), ('config', CommandInfo( 'pip._internal.commands.configuration', 'ConfigurationCommand', 'Manage local and global configuration.', )), ('search', CommandInfo( 'pip._internal.commands.search', 'SearchCommand', 'Search PyPI for packages.', )), ('cache', CommandInfo( 'pip._internal.commands.cache', 'CacheCommand', "Inspect and manage pip's wheel cache.", )), ('wheel', CommandInfo( 'pip._internal.commands.wheel', 'WheelCommand', 'Build wheels from your requirements.', )), ('hash', CommandInfo( 'pip._internal.commands.hash', 'HashCommand', 'Compute hashes of package archives.', )), ('completion', CommandInfo( 'pip._internal.commands.completion', 'CompletionCommand', 'A helper command used for command completion.', )), ('debug', CommandInfo( 'pip._internal.commands.debug', 'DebugCommand', 'Show information useful for debugging.', )), ('help', CommandInfo( 'pip._internal.commands.help', 'HelpCommand', 'Show help for commands.', )), ]) # type: OrderedDict[str, CommandInfo] def create_command(name, **kwargs): # type: (str, **Any) -> Command """ Create an instance of the Command class with the given name. """ module_path, class_name, summary = commands_dict[name] module = importlib.import_module(module_path) command_class = getattr(module, class_name) command = command_class(name=name, summary=summary, **kwargs) return command def get_similar_commands(name): """Command name auto-correct.""" from difflib import get_close_matches name = name.lower() close_commands = get_close_matches(name, commands_dict.keys()) if close_commands: return close_commands[0] else: return False