Skip to content

Commit

Permalink
improve typing for storagemodel
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Jan 27, 2025
1 parent 3d8f0cb commit 4cbc09d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ert/gui/tools/manage_experiments/storage_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _Column(IntEnum):


class RealizationModel:
def __init__(self, realization: int, parent: Any) -> None:
def __init__(self, realization: int, parent: "EnsembleModel") -> None:
self._parent = parent
self._name = f"Realization {realization}"
self._ensemble_id = parent._id
Expand Down Expand Up @@ -58,7 +58,7 @@ def data(self, index: QModelIndex, role: Qt.ItemDataRole) -> Any:


class EnsembleModel:
def __init__(self, ensemble: Ensemble, parent: Any):
def __init__(self, ensemble: Ensemble, parent: "ExperimentModel"):
self._parent = parent
self._name = ensemble.name
self._id = ensemble.id
Expand Down Expand Up @@ -191,9 +191,8 @@ def parent(self, child: QModelIndex | None = None) -> QObject | QModelIndex:
child_item = cast(ChildModel, child.internalPointer())
parentItem = child_item._parent

if parentItem == self:
if isinstance(parentItem, StorageModel):
return QModelIndex()

return self.createIndex(parentItem.row(), 0, parentItem)

@override
Expand Down

0 comments on commit 4cbc09d

Please sign in to comment.