diff --git a/noxfile.py b/noxfile.py index c1c40be..4870e86 100644 --- a/noxfile.py +++ b/noxfile.py @@ -206,6 +206,7 @@ def lint_code(session: nox.Session) -> None: "flake8-executable", "flake8-implicit-str-concat", "flake8-logging", + "flake8-pie", "flake8-pyproject", "flake8-pytest-style", "flake8-quotes", diff --git a/pyproject.toml b/pyproject.toml index 8126fb3..4a23a27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,6 +106,7 @@ dev = [ "flake8-executable (>=2.1.3,<3.0.0)", "flake8-implicit-str-concat (>=0.7.0,<0.8.0)", "flake8-logging (>=1.8.0,<2.0.0)", + "flake8-pie (>=0.16.0,<0.17.0)", "flake8-pyproject (>=1.2.4,<2.0.0)", "flake8-pytest-style (>=2.2.0,<3.0.0)", "flake8-quotes (>=3.4.0,<4.0.0)", @@ -238,6 +239,8 @@ select = [ "ISC", # flake8-logging => Correct use of `logging` "LOG", + # flake8-pie => No unnecessary constructs + "PIE", # flake8-pytest-style => Enforce a consistent style with pytest "PT0", # flake8-quotes => Use double quotes everywhere (complying with black) @@ -307,6 +310,8 @@ extend-ignore = [ "FBT003", # Every `.add()` looks like `pandas` to this rule (`ruff` omits it). "PD005", + # `len()` is needed for `pandas` objects, as their truth value is ambiguous. + "PIE787", # Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`. "PT023", # `ruff`'s RET504 does this better, as it allows statements in between. @@ -546,6 +551,8 @@ select = [ "N", # pandas-vet => Idiomatic `pandas` "PD", + # flake8-pie => No unnecessary constructs + "PIE", # flake8-pytest-style => Enforce a consistent style with pytest "PT", # flake8-quotes => Use double quotes everywhere diff --git a/src/velofy/forecasts/methods/arima.py b/src/velofy/forecasts/methods/arima.py index 4e62769..9391063 100644 --- a/src/velofy/forecasts/methods/arima.py +++ b/src/velofy/forecasts/methods/arima.py @@ -48,7 +48,7 @@ def predict( frequency=frequency, ) - seasonal = "TRUE" if bool(seasonal_fit) else "FALSE" + seasonal = "TRUE" if seasonal_fit else "FALSE" n_steps_ahead = len(forecast_interval) # Make the predictions in R. diff --git a/src/velofy/forecasts/methods/ets.py b/src/velofy/forecasts/methods/ets.py index 98ffbf4..58a11ad 100644 --- a/src/velofy/forecasts/methods/ets.py +++ b/src/velofy/forecasts/methods/ets.py @@ -49,7 +49,7 @@ def predict( frequency=frequency, ) - model = "ZZZ" if bool(seasonal_fit) else "ZZN" + model = "ZZZ" if seasonal_fit else "ZZN" n_steps_ahead = len(forecast_interval) # Make the predictions in R. diff --git a/uv.lock b/uv.lock index f1cdc71..5ae4aff 100644 --- a/uv.lock +++ b/uv.lock @@ -1063,6 +1063,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7d/a3/0192ec49e7fe062130d545f4f6188142ca448b9b63a2622a4ba8ce7e728d/flake8_logging-1.8.0-py3-none-any.whl", hash = "sha256:bb3fcf0fb2b4f35d7ebb0c1dc02af16db00c7c858c5a018370172e939dd6f225", size = 11114, upload-time = "2025-09-08T23:44:43.32Z" }, ] +[[package]] +name = "flake8-pie" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ae/11/cebfe54fda9897188ca40d1cd755d1be13908ceedfea9e500fae162f06a9/flake8-pie-0.16.0.tar.gz", hash = "sha256:b8dcb7b92706fa33d05d92a4b3e49b7a9fd3f0041849166275b646ba50e515ba", size = 28334, upload-time = "2022-08-08T23:51:12.62Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/83/4c/e953c2402b663155525faba5315df8abe6c02ea7f989cbf43327f5088fc3/flake8_pie-0.16.0-py3-none-any.whl", hash = "sha256:24cd7849b0eee22e2328b9e9d2a1dea40013b0a3106864bbadd06a4b05dbb71f", size = 49171, upload-time = "2022-08-08T23:51:14.535Z" }, +] + [[package]] name = "flake8-plugin-utils" version = "1.3.3" @@ -3896,6 +3908,7 @@ dev = [ { name = "flake8-executable" }, { name = "flake8-implicit-str-concat" }, { name = "flake8-logging" }, + { name = "flake8-pie" }, { name = "flake8-pyproject" }, { name = "flake8-pytest-style" }, { name = "flake8-quotes" }, @@ -3971,6 +3984,7 @@ dev = [ { name = "flake8-executable", specifier = ">=2.1.3,<3.0.0" }, { name = "flake8-implicit-str-concat", specifier = ">=0.7.0,<0.8.0" }, { name = "flake8-logging", specifier = ">=1.8.0,<2.0.0" }, + { name = "flake8-pie", specifier = ">=0.16.0,<0.17.0" }, { name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" }, { name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" }, { name = "flake8-quotes", specifier = ">=3.4.0,<4.0.0" },