From 0e75342788624a691755a889db7293b39308eb3c Mon Sep 17 00:00:00 2001 From: Lachlan Grose Date: Mon, 5 Aug 2024 14:21:23 +1000 Subject: [PATCH] fix: linting --- LoopStructural/modelling/core/geological_model.py | 10 +++++----- .../modelling/features/_base_geological_feature.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LoopStructural/modelling/core/geological_model.py b/LoopStructural/modelling/core/geological_model.py index 7e7eca0f..bbd4907a 100644 --- a/LoopStructural/modelling/core/geological_model.py +++ b/LoopStructural/modelling/core/geological_model.py @@ -371,7 +371,7 @@ def from_file(cls, file): logger.error("Cannot import from file, dill not installed") return None model = pickle.load(open(file, "rb")) - if type(model) == GeologicalModel: + if isinstance(model, GeologicalModel): logger.info("GeologicalModel initialised from file") return model else: @@ -423,7 +423,7 @@ def faults(self): """ faults = [] for f in self.features: - if type(f) == FaultSegment: + if isinstance(f, FaultSegment): faults.append(f) return faults @@ -556,7 +556,7 @@ def data(self, data: pd.DataFrame): """ if data is None: return - if type(data) != pd.DataFrame: + if not issubclass(type(data), pd.DataFrame): logger.warning("Data is not a pandas data frame, trying to read data frame " "from csv") try: data = pd.read_csv(data) @@ -821,7 +821,7 @@ def create_and_add_folded_foliation( if fold_frame is None: logger.info("Using last feature as fold frame") fold_frame = self.features[-1] - assert type(fold_frame) == FoldFrame, "Please specify a FoldFrame" + assert isinstance(fold_frame, FoldFrame), "Please specify a FoldFrame" fold = FoldEvent(fold_frame, name=f"Fold_{foliation_data}", invert_norm=invert_fold_norm) @@ -908,7 +908,7 @@ def create_and_add_folded_fold_frame( if fold_frame is None: logger.info("Using last feature as fold frame") fold_frame = self.features[-1] - assert type(fold_frame) == FoldFrame, "Please specify a FoldFrame" + assert isinstance(fold_frame, FoldFrame), "Please specify a FoldFrame" fold = FoldEvent(fold_frame, name=f"Fold_{fold_frame_data}") interpolatortypes = [ diff --git a/LoopStructural/modelling/features/_base_geological_feature.py b/LoopStructural/modelling/features/_base_geological_feature.py index 1042191e..58c51f48 100644 --- a/LoopStructural/modelling/features/_base_geological_feature.py +++ b/LoopStructural/modelling/features/_base_geological_feature.py @@ -110,7 +110,7 @@ def model(self, model): from LoopStructural import GeologicalModel # causes circular import, could delay import? - if type(model) == GeologicalModel: + if isinstance(model, GeologicalModel): self._model = model elif not model: self._model = None