Skip to content

Commit

Permalink
DEP: require inifix >= 5.1.0 and use its features
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Dec 16, 2024
1 parent db2ca17 commit bc8ca49
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions nonos/_readers/ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class IdefixVTKReader(ReaderMixin):
@staticmethod
def read(file: PathT, /) -> IniData:
class IdefixIniOutput:
def __init__(self, *, vtk, **_kwargs) -> None:
def __init__(self, *, vtk: float | int, **_kwargs) -> None:
self.vtk = float(vtk)

class IdefixIniHydro:
Expand All @@ -35,7 +35,7 @@ def __init__(self, *, Hydro, Output, **_kwargs) -> None:
self.hydro = IdefixIniHydro(**Hydro)
self.output = IdefixIniOutput(**Output)

meta = inifix.load(file)
meta = inifix.load(file, sections="require")
ini = IdefixIni(**meta)

return IniData(
Expand All @@ -52,14 +52,14 @@ class PlutoVTKReader(ReaderMixin):
@staticmethod
def read(file: PathT, /) -> IniData:
class PlutoIniOutput:
def __init__(self, *, vtk, **_kwargs) -> None:
self.vtk = float(list(vtk)[0])
def __init__(self, *, vtk: list, **_kwargs) -> None:
self.vtk = float(vtk[0])

class PlutoIni:
def __init__(self, **kwargs) -> None:
self.output = PlutoIniOutput(**kwargs["Static Grid Output"])

meta = inifix.load(file)
meta = inifix.load(file, sections="require", parse_scalars_as_lists=True)
ini = PlutoIni(**meta)

return IniData(
Expand All @@ -81,8 +81,8 @@ def __init__(
*,
NINTERM,
DT,
FRAME: str = "F",
OMEGAFRAME: float = 0.0,
FRAME="F",
OMEGAFRAME=0.0,
**_kwargs,
) -> None:
self.NINTERM = int(NINTERM)
Expand All @@ -102,7 +102,7 @@ def __init__(
else:
raise NotImplementedError

meta = inifix.load(file)
meta = inifix.load(file, sections="forbid")
ini = Fargo3DIni(**meta)

return IniData(
Expand All @@ -124,8 +124,8 @@ def __init__(
*,
Ninterm,
DT,
Frame: str = "F",
OmegaFrame: float = 0.0,
Frame="F",
OmegaFrame=0.0,
**_kwargs,
) -> None:
self.NINTERM = int(Ninterm)
Expand All @@ -145,7 +145,7 @@ def __init__(
else:
raise NotImplementedError

meta = inifix.load(file)
meta = inifix.load(file, sections="forbid")
ini = FargoADSGIni(**meta)

return IniData(
Expand Down

0 comments on commit bc8ca49

Please sign in to comment.