88"""
99
1010from __future__ import annotations
11+ from itertools import zip_longest
1112import re
1213import pathlib
13- from itertools import zip_longest
14+ import typing
1415
1516import numpy as np
1617
1718from . import conf , error , parfile , phyvars , stagyyparsers , _helpers , _step
1819from ._helpers import CachedReadOnlyProperty as crop
1920from .datatypes import Rprof , Tseries , Vart
2021
22+ if typing .TYPE_CHECKING :
23+ from typing import Tuple , List
24+ from pandas import DataFrame
25+
2126
2227def _as_view_item (obj ):
2328 """Return None or a suitable iterable to build a _StepsView."""
@@ -107,24 +112,26 @@ class _Refstate:
107112 object.
108113
109114 Args:
110- sdat (:class:`StagyyData`): the StagyyData instance owning the
111- :class:`_Steps` instance.
115+ sdat: the StagyyData instance owning the :class:`_Refstate` instance.
112116 """
113117
114- def __init__ (self , sdat ):
118+ def __init__ (self , sdat : StagyyData ):
115119 self ._sdat = sdat
116120
117121 @crop
118- def _data (self ):
122+ def _data (self ) -> Tuple [ List [ List [ DataFrame ]], List [ DataFrame ]] :
119123 """Read reference state profile."""
120124 reffile = self ._sdat .filename ('refstat.dat' )
121125 if self ._sdat .hdf5 and not reffile .is_file ():
122126 # check legacy folder as well
123127 reffile = self ._sdat .filename ('refstat.dat' , force_legacy = True )
124- return stagyyparsers .refstate (reffile )
128+ data = stagyyparsers .refstate (reffile )
129+ if data is None :
130+ raise error .NoRefstateError (self ._sdat )
131+ return data
125132
126133 @property
127- def systems (self ):
134+ def systems (self ) -> List [ List [ DataFrame ]] :
128135 """Reference state profiles of phases.
129136
130137 It is a list of list of :class:`pandas.DataFrame` containing
@@ -139,7 +146,7 @@ def systems(self):
139146 return self ._data [0 ]
140147
141148 @property
142- def adiabats (self ):
149+ def adiabats (self ) -> List [ DataFrame ] :
143150 """Adiabatic reference state profiles.
144151
145152 It is a list of :class:`pandas.DataFrame` containing the reference
0 commit comments