From f2d7a2ecdc1984fcf37cdd0420865834cbfc7b85 Mon Sep 17 00:00:00 2001 From: Niki Date: Fri, 8 May 2026 21:14:07 +0800 Subject: [PATCH] fix: replace 3 bare except clauses with except Exception Changed: utils/cleaners.py, inference/auto_model.py, fix_mismatch.py --- examples/mfa_extraction/fix_mismatch.py | 2 +- tensorflow_tts/inference/auto_model.py | 2 +- tensorflow_tts/utils/cleaners.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/mfa_extraction/fix_mismatch.py b/examples/mfa_extraction/fix_mismatch.py index 501524c0..3817acba 100755 --- a/examples/mfa_extraction/fix_mismatch.py +++ b/examples/mfa_extraction/fix_mismatch.py @@ -62,7 +62,7 @@ def fix(base_path: str, dur_path: str, trimmed_dur_path: str, use_norm: str): dur = np.load( os.path.join(trimmed_dur_path, f"{i.split('-')[0]}-durations.npy") ) - except: + except Exception: dur = np.load( os.path.join(dur_path, f"{i.split('-')[0]}-durations.npy") ) diff --git a/tensorflow_tts/inference/auto_model.py b/tensorflow_tts/inference/auto_model.py index 3d5f3923..2d1b38b8 100644 --- a/tensorflow_tts/inference/auto_model.py +++ b/tensorflow_tts/inference/auto_model.py @@ -105,7 +105,7 @@ def from_pretrained(cls, pretrained_path=None, config=None, **kwargs): if pretrained_path is not None and ".h5" in pretrained_path: try: model.load_weights(pretrained_path) - except: + except Exception: model.load_weights( pretrained_path, by_name=True, skip_mismatch=True ) diff --git a/tensorflow_tts/utils/cleaners.py b/tensorflow_tts/utils/cleaners.py index 5532f5f9..25bd4121 100755 --- a/tensorflow_tts/utils/cleaners.py +++ b/tensorflow_tts/utils/cleaners.py @@ -27,7 +27,7 @@ try: from german_transliterate.core import GermanTransliterate -except: +except Exception: pass # Regular expression matching whitespace: