Verified Commit 733689b9 authored by Sebastian Endres's avatar Sebastian Endres
Browse files

Fix scripts for UrlOrPath

parent cad73a37
......@@ -65,7 +65,8 @@ def collect_plots(
for meas in result.get_all_measuements_of_type("SAT", succeeding=True):
files = [
meas.log_dir_for_test / f"time_{mode.value}_plot.png" for mode in plot_modes
meas.log_dir_for_test.path / f"time_{mode.value}_plot.png"
for mode in plot_modes
]
for png in files:
......
......@@ -115,13 +115,13 @@ class PlotAllCli:
) -> list[str]:
"""Generate plot for for this test case."""
assert self._current_log_dir
test_case_dir = measurement_result.log_dir_for_test
test_case_dir = measurement_result.log_dir_for_test.path
if not measurement_result.succeeded and not self.include_failed:
cprint(
(
"✔ Measurement "
f"{measurement_result.log_dir_for_test.relative_to(self._current_log_dir)} "
f"{measurement_result.log_dir_for_test.path.relative_to(self._current_log_dir)} "
"Failed. Skipping. Use --include-failed to include it anyway."
),
file=sys.stderr,
......@@ -272,7 +272,7 @@ class PlotAllCli:
attrs=["bold"],
)
self._current_log_dir = result.log_dir
self._current_log_dir = result.log_dir.path
plot_results = defaultdict[str, set[str]](set[str])
......
......@@ -281,7 +281,7 @@ class PostProcessor:
if test_result.result == "unsupported":
continue
self.post_process_test_repetition_run_dir(test_result.log_dir_for_test)
self.post_process_test_repetition_run_dir(test_result.log_dir_for_test.path)
for meas_result in result.all_measurement_results:
if meas_result.result == "unsupported":
......
......@@ -320,37 +320,46 @@ class UrlOrPath:
@property
def parent(self) -> "UrlOrPath":
return UrlOrPath(
Url(
scheme=self.scheme,
auth=self.auth,
host=self.host,
port=self.port,
path=str(self.path.parent),
if isinstance(self.src, Path):
return UrlOrPath(self.path.parent)
else:
return UrlOrPath(
Url(
scheme=self.scheme,
auth=self.auth,
host=self.host,
port=self.port,
path=str(self.path.parent),
)
)
)
def __truediv__(self, other: Union[str, Path]) -> "UrlOrPath":
return UrlOrPath(
Url(
scheme=self.scheme,
auth=self.auth,
host=self.host,
port=self.port,
path=str(self.path / other),
if isinstance(self.src, Path):
return UrlOrPath(self.path / other)
else:
return UrlOrPath(
Url(
scheme=self.scheme,
auth=self.auth,
host=self.host,
port=self.port,
path=str(self.path / other),
)
)
)
def __rtruediv__(self, other: Union[str, Path]) -> "UrlOrPath":
return UrlOrPath(
Url(
scheme=self.scheme,
auth=self.auth,
host=self.host,
port=self.port,
path=str(other / self.path),
if isinstance(self.src, Path):
return UrlOrPath(Path(other) / self.path)
else:
return UrlOrPath(
Url(
scheme=self.scheme,
auth=self.auth,
host=self.host,
port=self.port,
path=str(other / self.path),
)
)
)
def is_dir(self) -> bool:
return self.path.is_dir()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment