From 256b6fbf9cd0e5f62f8602b0501ba2b05463fd7e Mon Sep 17 00:00:00 2001 From: EmoonX Date: Sat, 18 Jan 2025 13:14:31 -0300 Subject: [PATCH] cleanup: minor `midi.py` changes for consistency --- .pre-commit-config.yaml | 2 +- bottles/backend/utils/midi.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a75accd478..440e1dd93f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,4 +36,4 @@ repos: hooks: - id: mypy args: ["--pretty"] - additional_dependencies: ["pygobject-stubs", "types-PyYAML", "types-Markdown", "types-requests", "types-pycurl", "types-chardet", "pytest-stub", "types-orjson", "pathvalidate", "requirements-parser", "icoextract", "fvs", "patool", "git+https://gitlab.com/TheEvilSkeleton/vkbasalt-cli.git@main"] + additional_dependencies: ["pygobject-stubs", "types-PyYAML", "types-Markdown", "types-requests", "types-pycurl", "types-chardet", "pytest-stub", "types-orjson", "pathvalidate", "requirements-parser", "icoextract", "fvs", "patool", "pyfluidsynth", "git+https://gitlab.com/TheEvilSkeleton/vkbasalt-cli.git@main"] diff --git a/bottles/backend/utils/midi.py b/bottles/backend/utils/midi.py index f01a128f84..e571e07a6d 100644 --- a/bottles/backend/utils/midi.py +++ b/bottles/backend/utils/midi.py @@ -1,5 +1,7 @@ +from typing import Self + from ctypes import c_void_p -from fluidsynth import cfunc, Synth # type: ignore[import-not-found] +from fluidsynth import cfunc, Synth # type: ignore [import-untyped] from bottles.backend.logger import Logger from bottles.backend.models.config import BottleConfig @@ -11,11 +13,11 @@ class FluidSynth: """Manages a FluidSynth instance bounded to an unique SoundFont (.sf2, .sf3) file.""" - __active_instances: dict[int, "FluidSynth"] = {} + __active_instances: dict[int, Self] = {} """Active FluidSynth instances (i.e currently in use by one or more programs).""" @classmethod - def find_or_create(cls, soundfont_path: str) -> "FluidSynth": + def find_or_create(cls, soundfont_path: str) -> Self: """ Search for running FluidSynth instance and return it. If nonexistent, create and add it to active ones beforehand.