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 diff --git a/src/complexitty/data/config.py b/src/complexitty/data/config.py index ce2dfa9..206710a 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 functools import cache from json import dumps, loads from pathlib import Path -from typing import Iterator ############################################################################## # Local imports. @@ -54,7 +54,7 @@ def save_configuration(configuration: Configuration) -> Configuration: ############################################################################## -@lru_cache(maxsize=None) +@cache def load_configuration() -> Configuration: """Load the configuration. diff --git a/src/complexitty/mandelbrot/colouring.py b/src/complexitty/mandelbrot/colouring.py index 4429169..cc4f63d 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. @@ -51,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. 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",