Skip to content

Commit

Permalink
Use 3.9 syntax for now to keep mypy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ecomodeller committed Jan 10, 2025
1 parent b062b24 commit a1bfac6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
34 changes: 20 additions & 14 deletions modelskill/comparison/_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,13 +1259,16 @@ def save(self, filename: Union[str, Path], name: Optional[str] = None) -> None:
"""
ext = Path(filename).suffix

match ext:
case ".db":
self._save_to_duckdb(filename, name)
case ".nc":
self._save_to_netcdf(filename)
case _:
raise NotImplementedError(f"Unknown extension: {ext}")
# match ext:
# case ".db":
if ext == ".db":
self._save_to_duckdb(filename, name)
elif ext == ".nc":
# case ".nc":
self._save_to_netcdf(filename)
else:
# case _:
raise NotImplementedError(f"Unknown extension: {ext}")

def _save_to_netcdf(self, filename) -> None:
ds = self.data
Expand Down Expand Up @@ -1353,13 +1356,16 @@ def load(filename: Union[str, Path], name: Optional[str] = None) -> "Comparer":
# get extension
ext = Path(filename).suffix

match ext:
case ".db":
return Comparer._load_from_duckdb(filename, name)
case ".nc":
return Comparer._load_from_netcdf(filename)
case _:
raise NotImplementedError(f"Unknown extension: {ext}")
# match ext:
# case ".db":
if ext == ".db":
return Comparer._load_from_duckdb(filename, name)
elif ext == ".nc":
# case ".nc":
return Comparer._load_from_netcdf(filename)
else:
# case _:
raise NotImplementedError(f"Unknown extension: {ext}")

@staticmethod
def _load_from_duckdb(filename, name: Optional[str]) -> "Comparer":
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ignore = ["E501"]
select = ["E4", "E7", "E9", "F", "D200", "D205"]

[tool.mypy]
python_version = "3.10"
python_version = "3.9"
ignore_missing_imports = true
warn_unreachable = false
no_implicit_optional = true

0 comments on commit a1bfac6

Please sign in to comment.