From 3fd2f2b4c4a546a95e1e558197107c32f58402d7 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 3 Feb 2026 09:12:56 +0000 Subject: [PATCH 1/5] :shirt: Tighten up the linting rules --- Makefile | 2 +- pyproject.toml | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7bf3099..09cba4c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ build := uv build publish := uv publish --username=__token__ --keyring-provider=subprocess python := $(run) python ruff := $(run) ruff -lint := $(ruff) check --select I +lint := $(ruff) check fmt := $(ruff) format mypy := $(run) mypy mkdocs := $(run) mkdocs diff --git a/pyproject.toml b/pyproject.toml index e3dce3f..6c7705d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,3 +81,26 @@ explicit = true venvPath="." venv=".venv" exclude=[".venv"] + +[tool.ruff.lint] +select = [ + # pycodestyle + "E", + # Pyflakes + "F", + # pyupgrade + "UP", + # flake8-bugbear + "B", + # flake8-simplify + "SIM", + # isort + "I", +] +ignore = [ + # I think try...expect...pass reads far better. + "SIM105", +] + +[tool.ruff.lint.pycodestyle] +max-line-length = 120 From eceb04a3569b234ccb38d060a11bd21b64f2d46d Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 3 Feb 2026 09:13:57 +0000 Subject: [PATCH 2/5] :shirt: Modernise some type hint imports --- src/complexitty/data/config.py | 2 +- src/complexitty/mandelbrot/colouring.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/complexitty/data/config.py b/src/complexitty/data/config.py index ce2dfa9..7430a87 100644 --- a/src/complexitty/data/config.py +++ b/src/complexitty/data/config.py @@ -2,12 +2,12 @@ ############################################################################## # Python imports. +from collections.abc import Iterator from contextlib import contextmanager from dataclasses import asdict, dataclass, field from functools import lru_cache from json import dumps, loads from pathlib import Path -from typing import Iterator ############################################################################## # Local imports. diff --git a/src/complexitty/mandelbrot/colouring.py b/src/complexitty/mandelbrot/colouring.py index 4429169..ee8557e 100644 --- a/src/complexitty/mandelbrot/colouring.py +++ b/src/complexitty/mandelbrot/colouring.py @@ -2,8 +2,9 @@ ############################################################################## # Python imports. +from collections.abc import Callable from functools import lru_cache -from typing import Callable, Final, TypeAlias +from typing import Final, TypeAlias ############################################################################## # Textual imports. From 2ff33b2731b3f361ff0e6e776a76a5f18c8a4930 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 3 Feb 2026 09:16:37 +0000 Subject: [PATCH 3/5] :art: Remove unnecessary () --- src/complexitty/mandelbrot/colouring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/complexitty/mandelbrot/colouring.py b/src/complexitty/mandelbrot/colouring.py index ee8557e..cc4f63d 100644 --- a/src/complexitty/mandelbrot/colouring.py +++ b/src/complexitty/mandelbrot/colouring.py @@ -52,7 +52,7 @@ def default_map(value: int, max_iteration: int) -> Color: ############################################################################## -@lru_cache() +@lru_cache def blue_brown_map(value: int, _: int) -> Color: """Calculate a colour for an escape value. From d4d9b0b6ecf89b2aab88f782570579c7e6179fa1 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 3 Feb 2026 09:17:05 +0000 Subject: [PATCH 4/5] :hammer: Swap lru_cache for cache --- src/complexitty/data/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/complexitty/data/config.py b/src/complexitty/data/config.py index 7430a87..206710a 100644 --- a/src/complexitty/data/config.py +++ b/src/complexitty/data/config.py @@ -5,7 +5,7 @@ from collections.abc import Iterator from contextlib import contextmanager from dataclasses import asdict, dataclass, field -from functools import lru_cache +from functools import cache from json import dumps, loads from pathlib import Path @@ -54,7 +54,7 @@ def save_configuration(configuration: Configuration) -> Configuration: ############################################################################## -@lru_cache(maxsize=None) +@cache def load_configuration() -> Configuration: """Load the configuration. From 39c1a2e5e91c71aafca3fc29109e81d6d247addd Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 3 Feb 2026 09:18:31 +0000 Subject: [PATCH 5/5] :art: Tidy up a couple of over-long lines --- src/complexitty/screens/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/complexitty/screens/main.py b/src/complexitty/screens/main.py index ae3f99e..dd2b1ad 100644 --- a/src/complexitty/screens/main.py +++ b/src/complexitty/screens/main.py @@ -206,7 +206,8 @@ def _update_situation(self, message: Mandelbrot.Plotted) -> None: else 0 ) message.mandelbrot.border_title = ( - f"X: {message.mandelbrot.x_position:.{x_precision + 2}f} | Y: {message.mandelbrot.y_position:.{y_precision + 2}f} " + f"X: {message.mandelbrot.x_position:.{x_precision + 2}f} | " + f"Y: {message.mandelbrot.y_position:.{y_precision + 2}f} " f"| Zoom: {message.mandelbrot.zoom:.4f}" ) message.mandelbrot.border_subtitle = ( @@ -315,7 +316,8 @@ async def action_go_to_command(self) -> None: ) else: self.notify( - "Please provide both the [i]x[/] and [i]y[/] coordinates separated by a comma or space. For example:\n\n" + "Please provide both the [i]x[/] and [i]y[/] coordinates " + "separated by a comma or space. For example:\n\n" "[i]0.1, 0.1[/]\n\nor:\n\n" "[i]0.1 0.1[/]", title="Invalid location input",