Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- pandas >=2.2.0
- pint >=0.24.4
- platformdirs >=4.3.6
- pydantic >=2.0
- pydantic >=2.11
- pydap >=3.4.0,<3.5.5 # pydap 3.5.5 is not currently supported by `xarray` (v2025.3.1)
- pymetalink >=6.5.2
- pymbolic >=2024.2
Expand Down
2 changes: 1 addition & 1 deletion environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies:
- netCDF4 >=1.7.2
- numpy >=1.24.0
- notebook
- pydantic >=2.0
- pydantic >=2.11
- pymetalink >=6.5.2
- s3fs
- salib
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies = [
"pandas >=2.2.0",
"pint >=0.24.4",
"platformdirs >=4.3.6",
"pydantic >=2.0",
"pydantic >=2.11",
"pydap >=3.4.0,<3.5.5", # pydap 3.5.5 is not currently supported by `xarray` (v2025.3.1)
"pymbolic >=2024.2",
"scipy >=1.11.0",
Expand Down
8 changes: 5 additions & 3 deletions src/ravenpy/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def __subcommands__(self) -> tuple[dict[str, str], list]:
"""Return dictionary of class attributes that are Raven models."""
cmds = {}
recs = []
for key, field in self.model_fields.items():
cls = self.__class__
for key, field in cls.model_fields.items():
obj = self.__dict__[key]
if obj is not None:
if issubclass(obj.__class__, _Record):
Expand Down Expand Up @@ -225,8 +226,9 @@ class LineCommand(FlatCommand):
"""

def to_rv(self):
out = [f":{self.__class__.__name__:<20}"]
for field in self.model_fields.keys():
cls = self.__class__
out = [f":{cls.__name__:<20}"]
for field in cls.model_fields.keys():
out.append(str(getattr(self, field))) # noqa: PERF401

return " ".join(out) + "\n"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Test(RV):
a: bool = optfield(alias="a")

t = Test()
assert not t.model_fields["a"].is_required()
assert not t.__class__.model_fields["a"].is_required()


def test_rvi_datetime():
Expand Down
Loading