diff --git a/pyhealth/calib/predictionset/favmac/core.py b/pyhealth/calib/predictionset/favmac/core.py index 7e9b7d354..700a80a46 100644 --- a/pyhealth/calib/predictionset/favmac/core.py +++ b/pyhealth/calib/predictionset/favmac/core.py @@ -116,7 +116,7 @@ def _greedy_sequence(self, pred:np.ndarray): if self.proxy_fn.is_additive(): Ss, _ = self.util_fn.greedy_maximize_seq(pred=pred, d_proxy = self.proxy_fn.values * (1-pred)) return Ss, list(map(proxy_fn, Ss)) - except: + except Exception: pass Ss = [np.zeros(len(pred), dtype=int)] diff --git a/pyhealth/calib/predictionset/scrib/quicksearch.py b/pyhealth/calib/predictionset/scrib/quicksearch.py index 09ebf910f..0910a2b34 100644 --- a/pyhealth/calib/predictionset/scrib/quicksearch.py +++ b/pyhealth/calib/predictionset/scrib/quicksearch.py @@ -9,7 +9,7 @@ pyximport.install() from . import quicksearch_cython as cdc _CYTHON_ENABLED = True -except: +except ImportError: print("This is a warning of potentially slow compute. You could uncomment this line and use the Python implementation instead of Cython.") __all__ = ['loss_overall', 'loss_classspecific', diff --git a/pyhealth/datasets/base_dataset.py b/pyhealth/datasets/base_dataset.py index 0e4280aab..a264c3d01 100644 --- a/pyhealth/datasets/base_dataset.py +++ b/pyhealth/datasets/base_dataset.py @@ -832,7 +832,7 @@ def _task_transform( while not result.ready(): try: progress.update(queue.get(timeout=1)) - except: + except Exception: pass # remaining items @@ -897,7 +897,7 @@ def _proc_transform( while not result.ready(): try: progress.update(queue.get(timeout=1)) - except: + except Exception: pass # remaining items diff --git a/pyhealth/metrics/ranking.py b/pyhealth/metrics/ranking.py index b19f5107d..1f2e4612c 100644 --- a/pyhealth/metrics/ranking.py +++ b/pyhealth/metrics/ranking.py @@ -33,7 +33,7 @@ def ranking_metrics_fn(qrels: Dict[str, Dict[str, int]], """ try: import pytrec_eval - except: + except ImportError: raise ImportError("pytrec_eval is not installed. Please install it manually by running \ 'pip install pytrec_eval'.") ret = {}