Skip to content

Commit

Permalink
resolved an issues raised by mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaasRostock committed Nov 8, 2024
1 parent f160eb2 commit e8133fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/sim_explorer/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,14 @@ def _init_new(self, case: Case, file: str | Path | None = ""):
self.res = Json5(str(self._header_make())) # instantiate the results object
self._header_transform(tostring=False)

def _header_make(self):
def _header_make(self) -> dict[str, dict[str, Any]]:
"""Make a standard header for the results of 'case' as dict.
This function is used as starting point when a new results file is created.
"""
assert self.case is not None, "Case object not defined"
assert self.file is not None, "File name not defined"
_ = self.case.cases.js.jspath("$.header.name", str, True)
results = {
results: dict[str, dict[str, Any]] = {
"header": {
"case": self.case.name,
"dateTime": datetime.today().isoformat(),
Expand Down
3 changes: 1 addition & 2 deletions src/sim_explorer/utils/paths.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from pathlib import Path


def relative_path(p1: Path, p2: Path | None) -> str:
def relative_path(p1: Path, p2: Path) -> str:
"""Identify the path of p1 relative to the file p2."""
assert p1.exists() # Note: the second path does not need to exist
assert isinstance(p2, Path)
if p1.parent == p2.parent:
return "./" + p1.name
else:
Expand Down

0 comments on commit e8133fa

Please sign in to comment.