From 039c00279660239bacc7d4ccd749d23b3faa1d62 Mon Sep 17 00:00:00 2001 From: mbsantiago Date: Sun, 10 Nov 2024 22:37:57 +0000 Subject: [PATCH] Remove unnecessary imports --- batdetect2/train/train_utils.py | 2 -- batdetect2/types.py | 3 ++- batdetect2/utils/detector_utils.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/batdetect2/train/train_utils.py b/batdetect2/train/train_utils.py index 62441a7..9b3b4eb 100644 --- a/batdetect2/train/train_utils.py +++ b/batdetect2/train/train_utils.py @@ -1,7 +1,5 @@ import glob import json -import os -import random import numpy as np diff --git a/batdetect2/types.py b/batdetect2/types.py index 2941c51..57a60b4 100644 --- a/batdetect2/types.py +++ b/batdetect2/types.py @@ -1,4 +1,5 @@ """Types used in the code base.""" + from typing import List, NamedTuple, Optional, Union import numpy as np @@ -17,7 +18,7 @@ try: - from typing import NotRequired + from typing import NotRequired # type: ignore except ImportError: from typing_extensions import NotRequired diff --git a/batdetect2/utils/detector_utils.py b/batdetect2/utils/detector_utils.py index bb613eb..66b9b19 100644 --- a/batdetect2/utils/detector_utils.py +++ b/batdetect2/utils/detector_utils.py @@ -11,7 +11,7 @@ try: from numpy.exceptions import AxisError except ImportError: - from numpy import AxisError + from numpy import AxisError # type: ignore import batdetect2.detector.compute_features as feats import batdetect2.detector.post_process as pp @@ -759,7 +759,7 @@ def process_file( # Get original sampling rate file_samp_rate = librosa.get_samplerate(audio_file) - orig_samp_rate = file_samp_rate * config.get("time_expansion", 1) or 1 + orig_samp_rate = file_samp_rate * (config.get("time_expansion") or 1) # load audio file sampling_rate, audio_full = au.load_audio(