From cf92e5602cb90de53ec9f5e0e725045047f9a402 Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Fri, 16 Feb 2024 10:10:49 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=20Update=20type=20hints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/arpes/endstations/plugin/fallback.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/arpes/endstations/plugin/fallback.py b/src/arpes/endstations/plugin/fallback.py index d09d54cc..398c923b 100644 --- a/src/arpes/endstations/plugin/fallback.py +++ b/src/arpes/endstations/plugin/fallback.py @@ -11,6 +11,7 @@ if TYPE_CHECKING: from pathlib import Path + import xarray as xr from _typeshed import Incomplete from arpes.endstations import SCANDESC @@ -79,8 +80,8 @@ def determine_associated_loader( endstation_cls = resolve_endstation(retry=False, location=location) if endstation_cls.is_file_accepted(file): return endstation_cls - except Exception as err: - logger.info(f"Exception occurs. {err=}, {type(err)=}") + except BaseException: + logger.exception("Exception occurs.") msg = f"PyARPES failed to find a plugin acceptable for {file}." raise ValueError(msg) @@ -90,7 +91,7 @@ def load( scan_desc: SCANDESC | None = None, file: str | Path = "", **kwargs: Incomplete, - ): + ) -> xr.Dataset: """Delegates to a dynamically chosen plugin for loading.""" if scan_desc is None: scan_desc = {} @@ -98,10 +99,7 @@ def load( assert scan_desc is not None file = scan_desc["file"] assert isinstance(file, str) - associated_loader = FallbackEndstation.determine_associated_loader( - file, - scan_desc, - ) + associated_loader = FallbackEndstation.determine_associated_loader(file) try: file_number = int(file) file = associated_loader.find_first_file(file_number) @@ -120,6 +118,6 @@ def find_first_file(cls: type[FallbackEndstation], file_number: int) -> Path: which loading pluging should be used. Then, we delegate to that class to find the first associated file. """ - associated_loader = cls.determine_associated_loader(file_number) + associated_loader = cls.determine_associated_loader(str(file_number)) warnings.warn(AUTOLOAD_WARNING.format(associated_loader), stacklevel=2) return associated_loader.find_first_file(file_number)