Add list hidden results with different colors

This commit is contained in:
2022-03-14 11:15:57 +01:00
parent 40459d97d3
commit 120ab9aeba
3 changed files with 41 additions and 10 deletions

View File

@@ -937,11 +937,12 @@ class StubReport(BaseReport):
class Summary:
def __init__(self) -> None:
self.results = Files().get_all_results()
def __init__(self, hidden=False) -> None:
self.results = Files().get_all_results(hidden=hidden)
self.data = []
self.datasets = {}
self.models = set()
self.hidden = hidden
def get_models(self):
return sorted(self.models)
@@ -959,7 +960,14 @@ class Summary:
) = Files().split_file_name(result)
if given_score in ("any", score):
self.models.add(model)
report = StubReport(os.path.join(Folders.results, result))
report = StubReport(
os.path.join(
Folders.hidden_results
if self.hidden
else Folders.results,
result,
)
)
report.report()
entry = dict(
score=score,
@@ -1000,7 +1008,13 @@ class Summary:
data = data[:number]
max_file = max(len(x["file"]) for x in data)
max_title = max(len(x["title"]) for x in data)
print(TextColor.LINE1, end="")
if self.hidden:
color1 = TextColor.GREEN
color2 = TextColor.YELLOW
else:
color1 = TextColor.LINE1
color2 = TextColor.LINE2
print(color1, end="")
print(
f"{'Date':10s} {'File':{max_file}s} {'Score':7s} {'Time(h)':7s} "
f"{'Title':s}"
@@ -1019,7 +1033,7 @@ class Summary:
print(
"\n".join(
[
(TextColor.LINE2 if n % 2 == 0 else TextColor.LINE1)
(color2 if n % 2 == 0 else color1)
+ f"{x['date']} {x['file']:{max_file}s} "
f"{x['metric']:8.5f} "
f"{x['duration']/3600:7.3f} "

View File

@@ -8,6 +8,7 @@ BEST_ACCURACY_STREE = 40.282203
class Folders:
data = "data"
results = "results"
hidden_results = "hidden_results"
src = "src"
exreport = "exreport"
report = os.path.join(exreport, "exreport_output")
@@ -93,9 +94,11 @@ class Files:
)
subprocess.run([command, name])
def get_all_results(self) -> list[str]:
def get_all_results(self, hidden) -> list[str]:
first_path = "."
first_try = os.path.join(first_path, Folders.results)
first_try = os.path.join(
first_path, Folders.hidden_results if hidden else Folders.results
)
second_path = ".."
second_try = os.path.join(second_path, first_try)
if os.path.isdir(first_try):

View File

@@ -37,6 +37,13 @@ def parse_arguments():
default="date",
help="key to sort results",
)
ap.add_argument(
"--hidden",
type=str,
required=False,
default=False,
help="Show hidden results",
)
ap.add_argument(
"-n",
"--number",
@@ -47,11 +54,18 @@ def parse_arguments():
)
args = ap.parse_args()
return (args.excel, args.score, args.model, args.key, args.number)
return (
args.excel,
args.score,
args.model,
args.key,
args.number,
args.hidden,
)
(excel, score, model, key, number) = parse_arguments()
(excel, score, model, key, number, hidden) = parse_arguments()
data = Summary()
data = Summary(hidden=hidden)
data.acquire()
data.list_results(score=score, model=model, sort_key=key, number=number)