diff --git a/bidsmreye/bidsutils.py b/bidsmreye/bidsutils.py index 2d7332a..d0f4bf3 100644 --- a/bidsmreye/bidsutils.py +++ b/bidsmreye/bidsutils.py @@ -207,9 +207,7 @@ def create_bidsname( """ if isinstance(filename, dict): entities = filename - elif isinstance(filename, Path): - entities = layout.parse_file_entities(filename) - elif isinstance(filename, str): + elif isinstance(filename, (Path, str)): entities = layout.parse_file_entities(filename) else: raise TypeError(f"filename must be a dict or a Path, not {type(filename)}") diff --git a/bidsmreye/utils.py b/bidsmreye/utils.py index 9ad82f7..92798dd 100644 --- a/bidsmreye/utils.py +++ b/bidsmreye/utils.py @@ -57,16 +57,13 @@ def check_argument(self, attribute, layout_in: BIDSLayout): elif attribute == "space": value = layout_in.get(return_type="id", target="space") - if not getattr(self, attribute): - setattr(self, attribute, value) - else: + if getattr(self, attribute): if missing_values := list(set(getattr(self, attribute)) - set(value)): warnings.warn( f"{attribute}(s) {missing_values} not found in {self.input_folder}" ) value = list(set(getattr(self, attribute)) & set(value)) - setattr(self, attribute, value) - + setattr(self, attribute, value) if not getattr(self, attribute): raise RuntimeError(f"No {attribute} not found in {self.input_folder}")