def METHOD_NAME(self, args: List[str]) -> int:
    # We must initialize this before the tempdir manager, otherwise the
    # configuration would not be accessible by the time we clean up the
    # tempdir manager.
    self.tempdir_registry = self.enter_context(tempdir_registry())
    # Intentionally set as early as possible so globally-managed temporary
    # directories are available to the rest of the code.
    self.enter_context(global_tempdir_manager())
    options, args = self.parse_args(args)
    # Set verbosity so that it can be used elsewhere.
    self.verbosity = options.verbose - options.quiet
    level_number = setup_logging(
        verbosity=self.verbosity,
        no_color=options.no_color,
        user_log_file=options.log,
    )
    # TODO: Try to get these passing down from the command?
    #       without resorting to os.environ to hold these.
    #       This also affects isolated builds and it should.
    if options.no_input:
        os.environ["PIP_NO_INPUT"] = "1"
    if options.exists_action:
        os.environ["PIP_EXISTS_ACTION"] = " ".join(options.exists_action)
    if options.require_venv and not self.ignore_require_venv:
        # If a venv is required check if it can really be found
        if not running_under_virtualenv():
            logger.critical("Could not find an activated virtualenv (required).")
            sys.exit(VIRTUALENV_NOT_FOUND)
    if options.cache_dir:
        options.cache_dir = normalize_path(options.cache_dir)
        if not check_path_owner(options.cache_dir):
            logger.warning(
                "The directory '%s' or its parent directory is not owned "
                "or is not writable by the current user. The cache "
                "has been disabled. Check the permissions and owner of "
                "that directory. If executing pip with sudo, you should "
                "use sudo's -H flag.",
                options.cache_dir,
            )
            options.cache_dir = None
    def intercepts_unhandled_exc(
        run_func: Callable[..., int]
    ) -> Callable[..., int]:
        @functools.wraps(run_func)
        def exc_logging_wrapper(*args: Any) -> int:
            try:
                status = run_func(*args)
                assert isinstance(status, int)
                return status
            except DiagnosticPipError as exc:
                logger.error("[present-rich] %s", exc)
                logger.debug("Exception information:", exc_info=True)
                return ERROR
            except PreviousBuildDirError as exc:
                logger.critical(str(exc))
                logger.debug("Exception information:", exc_info=True)
                return PREVIOUS_BUILD_DIR_ERROR
            except (
                InstallationError,
                UninstallationError,
                BadCommand,
                NetworkConnectionError,
            ) as exc:
                logger.critical(str(exc))
                logger.debug("Exception information:", exc_info=True)
                return ERROR
            except CommandError as exc:
                logger.critical("%s", exc)
                logger.debug("Exception information:", exc_info=True)
                return ERROR
            except BrokenStdoutLoggingError:
                # Bypass our logger and write any remaining messages to
                # stderr because stdout no longer works.
                print("ERROR: Pipe to stdout was broken", file=sys.stderr)
                if level_number <= logging.DEBUG:
                    traceback.print_exc(file=sys.stderr)
                return ERROR
            except KeyboardInterrupt:
                logger.critical("Operation cancelled by user")
                logger.debug("Exception information:", exc_info=True)
                return ERROR
            except BaseException:
                logger.critical("Exception:", exc_info=True)
                return UNKNOWN_ERROR
        return exc_logging_wrapper
    try:
        if not options.debug_mode:
            run = intercepts_unhandled_exc(self.run)
        else:
            run = self.run
            rich_traceback.install(show_locals=True)
        return run(options, args)
    finally:
        self.handle_pip_version_check(options)