Add flake8-bugbear

This commit is contained in:
Alexander Hess 2026-11-28 02:39:58 +01:00
commit cb110267f0
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
6 changed files with 27 additions and 4 deletions

View file

@ -185,6 +185,7 @@ def lint_code(session: Session) -> None:
'flake8-bandit', 'flake8-bandit',
'flake8-black', 'flake8-black',
'flake8-broken-line', 'flake8-broken-line',
'flake8-bugbear',
'flake8-pyproject', 'flake8-pyproject',
'flake8-pytest-style', 'flake8-pytest-style',
'isort', 'isort',

View file

@ -94,6 +94,7 @@ dev = [
"flake8-bandit (>=4.1.1,<5.0.0)", "flake8-bandit (>=4.1.1,<5.0.0)",
"flake8-black (>=0.5.0,<0.6.0)", "flake8-black (>=0.5.0,<0.6.0)",
"flake8-broken-line (>=1.0.0,<2.0.0)", "flake8-broken-line (>=1.0.0,<2.0.0)",
"flake8-bugbear (>=26.11.22,<27.0.0)",
"flake8-pyproject (>=1.2.4,<2.0.0)", "flake8-pyproject (>=1.2.4,<2.0.0)",
"flake8-pytest-style (>=2.2.0,<3.0.0)", "flake8-pytest-style (>=2.2.0,<3.0.0)",
"mypy (>=2.4.1,<3.0.0)", "mypy (>=2.4.1,<3.0.0)",

View file

@ -124,13 +124,19 @@ def make_config(env: str = 'production') -> Config:
# the warning is only emitted if the code is not run by pytest. # the warning is only emitted if the code is not run by pytest.
# We see the bad configuration immediately as all "db" tests fail. # We see the bad configuration immediately as all "db" tests fail.
if config.DATABASE_URI is None and not os.getenv('TESTING'): if config.DATABASE_URI is None and not os.getenv('TESTING'):
warnings.warn('Bad configuration: no DATABASE_URI set in the environment') warnings.warn(
'Bad configuration: no DATABASE_URI set in the environment',
stacklevel=2,
)
# Some functionalities require R and some packages installed. # Some functionalities require R and some packages installed.
# To ensure isolation and reproducibility, the projects keeps the R dependencies # To ensure isolation and reproducibility, the projects keeps the R dependencies
# in a project-local folder that must be set in the environment. # in a project-local folder that must be set in the environment.
if config.R_LIBS_PATH is None and not os.getenv('TESTING'): if config.R_LIBS_PATH is None and not os.getenv('TESTING'):
warnings.warn('Bad configuration: no R_LIBS set in the environment') warnings.warn(
'Bad configuration: no R_LIBS set in the environment',
stacklevel=2,
)
return config return config

View file

@ -90,7 +90,7 @@ def tactical_heuristic( # noqa:C901
click.echo( click.echo(
'Parameters: ' 'Parameters: '
+ f'city="{city}", grid.side_length={side_length}, ' + f'city={city}, grid.side_length={side_length}, '
+ f'time_step={time_step}, train_horizon={train_horizon}', + f'time_step={time_step}, train_horizon={train_horizon}',
) )

View file

@ -56,7 +56,7 @@ def predict(
f""" f"""
as.data.frame( as.data.frame(
forecast( forecast(
ets(data, model = "{model:s}"), ets(data, model = "{model:s}"), # noqa:B907
h = {n_steps_ahead:d} h = {n_steps_ahead:d}
) )
) )

15
uv.lock generated
View file

@ -925,6 +925,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/31/ff/57d0101933527b5202cc9f80bc15aa85b207916c722a00e7adde0e33f413/flake8_broken_line-1.0.0-py3-none-any.whl", hash = "sha256:96c964336024a5030dc536a9f6fb02aa679e2d2a6b35b80a558b5136c35832a9", size = 4202, upload-time = "2023-05-31T10:09:10.027Z" }, { url = "https://files.pythonhosted.org/packages/31/ff/57d0101933527b5202cc9f80bc15aa85b207916c722a00e7adde0e33f413/flake8_broken_line-1.0.0-py3-none-any.whl", hash = "sha256:96c964336024a5030dc536a9f6fb02aa679e2d2a6b35b80a558b5136c35832a9", size = 4202, upload-time = "2023-05-31T10:09:10.027Z" },
] ]
[[package]]
name = "flake8-bugbear"
version = "26.11.22"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "attrs" },
{ name = "flake8" },
]
sdist = { url = "https://files.pythonhosted.org/packages/26/b4/2d6c97486396d8ab985537ce01de9048cff21b6c3f9d0029d261e1017132/flake8_bugbear-26.11.22.tar.gz", hash = "sha256:df1a764570a3047deb99c6c1309679277815ef48d7c9dada7e04973e2b327a10", size = 148709, upload-time = "2026-11-22T14:25:52.305Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/46/ba/da7d4108baed185aecfc0c8cc8e64b2964f92a1897d3310b79c168ac94d3/flake8_bugbear-26.11.22-py3-none-any.whl", hash = "sha256:bc10d62be1dc512dc7825ee34c20492425370b209e47fb09a1dedd29eba49aca", size = 65763, upload-time = "2026-11-22T14:25:51.217Z" },
]
[[package]] [[package]]
name = "flake8-plugin-utils" name = "flake8-plugin-utils"
version = "1.3.3" version = "1.3.3"
@ -3578,6 +3591,7 @@ dev = [
{ name = "flake8-bandit" }, { name = "flake8-bandit" },
{ name = "flake8-black" }, { name = "flake8-black" },
{ name = "flake8-broken-line" }, { name = "flake8-broken-line" },
{ name = "flake8-bugbear" },
{ name = "flake8-pyproject" }, { name = "flake8-pyproject" },
{ name = "flake8-pytest-style" }, { name = "flake8-pytest-style" },
{ name = "isort" }, { name = "isort" },
@ -3631,6 +3645,7 @@ dev = [
{ name = "flake8-bandit", specifier = ">=4.1.1,<5.0.0" }, { name = "flake8-bandit", specifier = ">=4.1.1,<5.0.0" },
{ name = "flake8-black", specifier = ">=0.5.0,<0.6.0" }, { name = "flake8-black", specifier = ">=0.5.0,<0.6.0" },
{ name = "flake8-broken-line", specifier = ">=1.0.0,<2.0.0" }, { name = "flake8-broken-line", specifier = ">=1.0.0,<2.0.0" },
{ name = "flake8-bugbear", specifier = ">=26.11.22,<27.0.0" },
{ name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" }, { name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" },
{ name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" }, { name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" },
{ name = "isort", specifier = ">=9.0.2,<10.0.0" }, { name = "isort", specifier = ">=9.0.2,<10.0.0" },