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 45ef5f0 commit d11300f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 29 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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
requires-python = ">=3.10"

dependencies = [
"inifix>=3.0.0",
"inifix>=5.1.0",
"loguru>=0.5.3",
"matplotlib>=3.5.0",
"numpy>=1.21.2",
Expand Down
21 changes: 4 additions & 17 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d11300f

Please sign in to comment.