From d11300f40005107ee610e0e2f3ec62e1535c58f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Mon, 16 Dec 2024 23:03:28 +0100 Subject: [PATCH] DEP: require inifix >= 5.1.0 and use its features --- nonos/_readers/ini.py | 22 +++++++++++----------- pyproject.toml | 2 +- uv.lock | 21 ++++----------------- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/nonos/_readers/ini.py b/nonos/_readers/ini.py index c5d08856..d2ab7121 100644 --- a/nonos/_readers/ini.py +++ b/nonos/_readers/ini.py @@ -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: @@ -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( @@ -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( @@ -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) @@ -102,7 +102,7 @@ def __init__( else: raise NotImplementedError - meta = inifix.load(file) + meta = inifix.load(file, sections="forbid") ini = Fargo3DIni(**meta) return IniData( @@ -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) @@ -145,7 +145,7 @@ def __init__( else: raise NotImplementedError - meta = inifix.load(file) + meta = inifix.load(file, sections="forbid") ini = FargoADSGIni(**meta) return IniData( diff --git a/pyproject.toml b/pyproject.toml index 3df69219..afb3d33b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/uv.lock b/uv.lock index ba3b4ecb..eaac214e 100644 --- a/uv.lock +++ b/uv.lock @@ -260,24 +260,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 }, ] -[[package]] -name = "inifix" -version = "4.5.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.11'", -] -sdist = { url = "https://files.pythonhosted.org/packages/f0/04/ac7d5d7581dc759c7dafbc0b67d84808e6c4712aab55d99837b6ceea2495/inifix-4.5.0.tar.gz", hash = "sha256:5a9144767b4c0b9465684cc411f488ed3b1eb8bb40c0ac54869d24492f568e8c", size = 33854 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c0/45/ebb2135c730200257b19c14ca7a1549dc1ea64a8c8dd0316a36a1079266e/inifix-4.5.0-py3-none-any.whl", hash = "sha256:cb23d663048a686ad5d8f91e7a34a60c96829d7aef9f8bbe8bd37a6e7658fc48", size = 27120 }, -] - [[package]] name = "inifix" version = "5.1.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.11'", +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/8e/7e/b1a9f3e5770d5b7d70edde8d4c2f9a70678f9c8fac8027dbd7eb8df47e00/inifix-5.1.2.tar.gz", hash = "sha256:47d23b58521fb94da31be0f532d51993250e57162dad8c67c6c6b592662c5668", size = 42486 } wheels = [ @@ -578,8 +566,7 @@ name = "nonos" version = "0.17.0" source = { editable = "." } dependencies = [ - { name = "inifix", version = "4.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "inifix", version = "5.1.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "inifix" }, { name = "loguru" }, { name = "matplotlib" }, { name = "numpy" }, @@ -621,7 +608,7 @@ requires-dist = [ { name = "cblind", marker = "extra == 'all'", specifier = ">=2.3.0" }, { name = "cmocean", marker = "extra == 'all'", specifier = ">=3.0.3" }, { name = "cmyt", marker = "extra == 'all'", specifier = ">=2.0.0" }, - { name = "inifix", specifier = ">=3.0.0" }, + { name = "inifix", specifier = ">=5.1.0" }, { name = "lick", marker = "extra == 'all'", specifier = ">=0.5.1" }, { name = "loguru", specifier = ">=0.5.3" }, { name = "matplotlib", specifier = ">=3.5.0" },