ruff: enable B warnings (mainly suppressed exceptions and unused variables)

This commit is contained in:
Dima Gerasimov 2024-08-28 01:13:18 +01:00
parent f563dee215
commit 8b1ec35286
30 changed files with 83 additions and 67 deletions

View file

@ -15,7 +15,7 @@ def test() -> None:
## prepare exception for later
try:
None.whatever # type: ignore[attr-defined]
None.whatever # type: ignore[attr-defined] # noqa: B018
except Exception as e:
ex = e
##
@ -146,7 +146,7 @@ def _setup_handlers_and_formatters(name: str) -> None:
# try colorlog first, so user gets nice colored logs
import colorlog
except ModuleNotFoundError:
warnings.warn("You might want to 'pip install colorlog' for nice colored logs")
warnings.warn("You might want to 'pip install colorlog' for nice colored logs", stacklevel=1)
formatter = logging.Formatter(FORMAT_NOCOLOR)
else:
# log_color/reset are specific to colorlog
@ -233,7 +233,7 @@ def get_enlighten():
try:
import enlighten # type: ignore[import-untyped]
except ModuleNotFoundError:
warnings.warn("You might want to 'pip install enlighten' for a nice progress bar")
warnings.warn("You might want to 'pip install enlighten' for a nice progress bar", stacklevel=1)
return Mock()