From 81751c5e6cc0e7a02315a18d2a6e3a9d4c9d72bf Mon Sep 17 00:00:00 2001 From: Laurent LAPORTE Date: Fri, 1 Mar 2024 10:21:22 +0100 Subject: [PATCH] chore(study-filesystem): correct type and awkwardness in implementation --- antarest/study/storage/rawstudy/ini_reader.py | 2 +- .../study/storage/rawstudy/model/filesystem/folder_node.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/antarest/study/storage/rawstudy/ini_reader.py b/antarest/study/storage/rawstudy/ini_reader.py index f145b948a9..84be7c099b 100644 --- a/antarest/study/storage/rawstudy/ini_reader.py +++ b/antarest/study/storage/rawstudy/ini_reader.py @@ -109,7 +109,7 @@ def read(self, path: t.Any) -> JSON: sections = self._parse_ini_file(f) except FileNotFoundError: # If the file is missing, an empty dictionary is returned. - # This is required tp mimic the behavior of `configparser.ConfigParser`. + # This is required to mimic the behavior of `configparser.ConfigParser`. return {} elif hasattr(path, "read"): diff --git a/antarest/study/storage/rawstudy/model/filesystem/folder_node.py b/antarest/study/storage/rawstudy/model/filesystem/folder_node.py index 7d174cfbc6..64a8be00a2 100644 --- a/antarest/study/storage/rawstudy/model/filesystem/folder_node.py +++ b/antarest/study/storage/rawstudy/model/filesystem/folder_node.py @@ -1,7 +1,7 @@ import shutil from abc import ABC, abstractmethod from http import HTTPStatus -from typing import Dict, List, Optional, Tuple, Union +from typing import List, Optional, Tuple, Union from fastapi import HTTPException @@ -208,6 +208,6 @@ def extract_child(self, children: TREE, url: List[str]) -> Tuple[List[str], List for name in names: if name not in children: raise ChildNotFoundError(f"'{name}' not a child of {self.__class__.__name__}") - if type(children[name]) != child_class: + if not isinstance(children[name], child_class): raise FilterError("Filter selection has different classes") return names, sub_url