diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70c7874..83d8563 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -11,16 +11,16 @@ repos: - id: check-added-large-files - id: requirements-txt-fixer - id: check-vcs-permalinks - - repo: https://github.com/psf/black - rev: 23.3.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.1.0 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.277 + rev: v0.15.1 hooks: - id: ruff - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.21.2 hooks: - id: pyupgrade args: ["--py38-plus"] diff --git a/pyflp/_descriptors.py b/pyflp/_descriptors.py index 22b5e34..49ae600 100644 --- a/pyflp/_descriptors.py +++ b/pyflp/_descriptors.py @@ -31,16 +31,14 @@ class ROProperty(Protocol[T_co]): """Protocol for a read-only descriptor.""" - def __get__(self, ins: Any, owner: Any = None) -> T_co | Self | None: - ... + def __get__(self, ins: Any, owner: Any = None) -> T_co | Self | None: ... @runtime_checkable class RWProperty(ROProperty[T], Protocol): """Protocol for a read-write descriptor.""" - def __set__(self, ins: Any, value: T) -> None: - ... + def __set__(self, ins: Any, value: T) -> None: ... class NamedPropMixin: @@ -59,12 +57,10 @@ def __init__(self, *ids: EventEnum, default: T | None = None, readonly: bool = F self._readonly = readonly @overload - def _get_event(self, ins: ItemModel[VE]) -> ItemModel[VE]: - ... + def _get_event(self, ins: ItemModel[VE]) -> ItemModel[VE]: ... @overload - def _get_event(self, ins: EventModel) -> AnyEvent | None: - ... + def _get_event(self, ins: EventModel) -> AnyEvent | None: ... def _get_event(self, ins: ItemModel[VE] | EventModel): if isinstance(ins, ItemModel): @@ -85,12 +81,10 @@ def default(self) -> T | None: # Configure version based defaults here return self._default @abc.abstractmethod - def _get(self, ev_or_ins: Any) -> T | None: - ... + def _get(self, ev_or_ins: Any) -> T | None: ... @abc.abstractmethod - def _set(self, ev_or_ins: Any, value: T) -> None: - ... + def _set(self, ev_or_ins: Any, value: T) -> None: ... @final def __get__(self, ins: Any, owner: Any = None) -> T | Self | None: diff --git a/pyflp/_models.py b/pyflp/_models.py index 52a5c91..9528310 100644 --- a/pyflp/_models.py +++ b/pyflp/_models.py @@ -89,24 +89,20 @@ def __eq__(self, o: object) -> bool: @runtime_checkable class ModelCollection(Iterable[MT_co], Protocol[MT_co]): @overload - def __getitem__(self, i: int | str) -> MT_co: - ... + def __getitem__(self, i: int | str) -> MT_co: ... @overload - def __getitem__(self, i: slice) -> Sequence[MT_co]: - ... + def __getitem__(self, i: slice) -> Sequence[MT_co]: ... def supports_slice(func: Callable[[ModelCollection[MT_co], str | int | slice], MT_co]): """Wraps a :meth:`ModelCollection.__getitem__` to return a sequence if required.""" @overload - def wrapper(self: ModelCollection[MT_co], i: int | str) -> MT_co: - ... + def wrapper(self: ModelCollection[MT_co], i: int | str) -> MT_co: ... @overload - def wrapper(self: ModelCollection[MT_co], i: slice) -> Sequence[MT_co]: - ... + def wrapper(self: ModelCollection[MT_co], i: slice) -> Sequence[MT_co]: ... @functools.wraps(func) def wrapper(self: Any, i: Any) -> MT_co | Sequence[MT_co]: diff --git a/tests/test_project.py b/tests/test_project.py index 8dec7be..7570e09 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -13,10 +13,7 @@ def test_project(project: Project): assert project.artists == "demberto" assert project.channel_count == 19 - assert ( - project.comments - == textwrap.dedent( - """\ + assert project.comments == textwrap.dedent("""\ This is a testing FLP used by PyFLP - An FL Studio project file parser. Notes for contributors: @@ -25,9 +22,7 @@ def test_project(project: Project): Terms: "item(s)": Refers to a channel, insert, slot, track, pattern, timemarker, etc. - """ - ).replace("\n", "\r") - ) # Who the hell uses \r? + """).replace("\n", "\r") # Who the hell uses \r? assert project.created_on == datetime.datetime(2022, 9, 16, 20, 47, 12, 746000) assert project.data_path == pathlib.Path("") assert project.format == FileFormat.Project