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
3 changed files with 27 additions and 4 deletions

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.
# We see the bad configuration immediately as all "db" tests fail.
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.
# To ensure isolation and reproducibility, the projects keeps the R dependencies
# in a project-local folder that must be set in the environment.
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

View file

@ -90,7 +90,7 @@ def tactical_heuristic( # noqa:C901
click.echo(
'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}',
)

View file

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