Add ruff linting

Configure ruff in pyproject.toml and apply its fixes: modern annotations
(X | None, builtin generics, collections.abc), sorted imports, explicit
stacklevel in test warnings.
This commit is contained in:
Fuxino
2026-10-16 13:47:24 +02:00
parent 7dbb1bcaee
commit 17c104c6c8
6 changed files with 65 additions and 57 deletions
+3 -2
View File
@@ -2,9 +2,10 @@
import io
import os
from collections.abc import Callable, Iterator
from datetime import datetime, timedelta
from pathlib import Path
from typing import Any, Callable, Iterator, Optional
from typing import Any
import pytest
@@ -52,7 +53,7 @@ def out(tmp_path: Path) -> Path:
return out
def make_backup(out: Path, inputs: list[str], keep: int = -1, exclude: Optional[list[str]] = None,
def make_backup(out: Path, inputs: list[str], keep: int = -1, exclude: list[str] | None = None,
remove_before: bool = False, progress: bool = False) -> sb.Backup:
backup = sb.Backup(inputs, str(out), exclude or [], keep, OPTIONS, remove_before=remove_before,
progress=progress)