diff --git a/pip_manage/__init__.py b/pip_manage/__init__.py index d8720a2b..e05d690c 100644 --- a/pip_manage/__init__.py +++ b/pip_manage/__init__.py @@ -3,6 +3,6 @@ from __future__ import annotations __version__: Final[str] = "1.0.3" -__title__: Final[str] = "pip-manage" +__title__: Literal["pip-manage"] = "pip-manage" -from typing import Final +from typing import Final, Literal diff --git a/pip_manage/_logging.py b/pip_manage/_logging.py index 8ce34b4a..8ed23af9 100644 --- a/pip_manage/_logging.py +++ b/pip_manage/_logging.py @@ -36,7 +36,11 @@ def format(self, record: logging.LogRecord) -> str: return super().format(record) -def setup_logging(logger_name: str, *, verbose: bool) -> None: +def setup_logging( + logger_name: Literal["pip-review", "pip-purge"], + *, + verbose: bool, +) -> None: level: Literal["DEBUG", "INFO"] = "DEBUG" if verbose else "INFO" logging.config.dictConfig( { diff --git a/pip_manage/pip_purge.py b/pip_manage/pip_purge.py index 3d08f0ea..e837dca2 100755 --- a/pip_manage/pip_purge.py +++ b/pip_manage/pip_purge.py @@ -2,13 +2,13 @@ """pip-purge lets you smoothly uninstall packages and their dependencies.""" from __future__ import annotations -__title__: Final[str] = "pip-purge" +__title__: Literal["pip-purge"] = "pip-purge" import argparse import importlib.metadata import logging from pathlib import Path -from typing import TYPE_CHECKING, Final, NamedTuple +from typing import TYPE_CHECKING, Final, Literal, NamedTuple from pip_manage._logging import setup_logging from pip_manage._pip_interface import ( diff --git a/pip_manage/pip_review.py b/pip_manage/pip_review.py index 10d04759..83c0e0e6 100755 --- a/pip_manage/pip_review.py +++ b/pip_manage/pip_review.py @@ -2,13 +2,13 @@ """pip-review lets you smoothly manage all available PyPI updates.""" from __future__ import annotations -__title__: Final[str] = "pip-review" +__title__: Literal["pip-review"] = "pip-review" import argparse import logging import os from pathlib import Path -from typing import TYPE_CHECKING, Final, NamedTuple +from typing import TYPE_CHECKING, Final, Literal, NamedTuple from pip_manage._logging import setup_logging from pip_manage._pip_interface import (