From f1febba3a6cd8590c8a6126d540e7b763fb2e8e2 Mon Sep 17 00:00:00 2001 From: bbye98 Date: Mon, 19 Aug 2024 21:39:29 -0400 Subject: [PATCH] Fix missing imports --- src/minim/audio.py | 3 ++- src/minim/utility.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/minim/audio.py b/src/minim/audio.py index 3b47ee9..2a22cd9 100644 --- a/src/minim/audio.py +++ b/src/minim/audio.py @@ -26,7 +26,8 @@ if FOUND_FFMPEG: from . import FFMPEG_CODECS -FOUND_PILLOW = find_spec("PIL") is not None +if (FOUND_PILLOW = find_spec("PIL") is not None): + from PIL import Image __all__ = ["Audio", "FLACAudio", "MP3Audio", "MP4Audio", "OggAudio", "WAVEAudio"] diff --git a/src/minim/utility.py b/src/minim/utility.py index 32af8a8..8c73636 100644 --- a/src/minim/utility.py +++ b/src/minim/utility.py @@ -10,8 +10,10 @@ from importlib.util import find_spec from typing import Any, Union -FOUND_LEVENSHTEIN = find_spec("Levenshtein") is not None -FOUND_NUMPY = find_spec("numpy") is not None +if (FOUND_LEVENSHTEIN := find_spec("Levenshtein") is not None): + import Levenshtein +if (FOUND_NUMPY := find_spec("numpy") is not None): + import numpy as np __all__ = ["format_multivalue", "gestalt_ratio", "levenshtein_ratio"]