seonglae-holistic commited on
Commit
49acf54
·
1 Parent(s): dac45ce

fox: iso dates & height error

Browse files
src/display/css_html_js.py CHANGED
@@ -38,6 +38,14 @@ custom_css = """
38
  padding: 0px;
39
  }
40
 
 
 
 
 
 
 
 
 
41
  /* Limit the width of the first AutoEvalColumn so that names don't expand too much */
42
  #leaderboard-table td:nth-child(2),
43
  #leaderboard-table th:nth-child(2) {
 
38
  padding: 0px;
39
  }
40
 
41
+ .gradio-container {
42
+ max-height: fit-content;
43
+ }
44
+
45
+ .container {
46
+ height: fit-content;
47
+ }
48
+
49
  /* Limit the width of the first AutoEvalColumn so that names don't expand too much */
50
  #leaderboard-table td:nth-child(2),
51
  #leaderboard-table th:nth-child(2) {
src/leaderboard/read_evals.py CHANGED
@@ -8,6 +8,13 @@ from src.display.formatting import make_clickable_library, make_clickable_report
8
  from src.display.utils import auto_eval_column_attrs, LibraryType, Tasks, Language
9
 
10
 
 
 
 
 
 
 
 
11
  class AssessmentResult(BaseModel):
12
  """Represents one full vulnerability assessment. Built from a combination of the result and request file for a given library.
13
  """
@@ -73,7 +80,7 @@ class AssessmentResult(BaseModel):
73
  if last_update:
74
  try:
75
  # Format date for display
76
- dt = datetime.fromisoformat(last_update)
77
  last_update = dt.strftime("%Y-%m-%d")
78
  except Exception as e:
79
  print(e)
@@ -212,7 +219,7 @@ def get_raw_assessment_results(results_path: str, requests_path: str) -> list[As
212
 
213
  # Sort the files by date if they have date info
214
  try:
215
- files.sort(key=lambda x: datetime.fromisoformat(json.loads(open(os.path.join(root, x)).read())["assessment"]["completed_time"]), reverse=True)
216
  except Exception as e:
217
  print(e)
218
  pass
 
8
  from src.display.utils import auto_eval_column_attrs, LibraryType, Tasks, Language
9
 
10
 
11
+ def parse_iso_datetime(datetime_str: str) -> datetime:
12
+ """Parse ISO format datetime string, handling 'Z' UTC timezone indicator"""
13
+ if datetime_str.endswith('Z'):
14
+ datetime_str = datetime_str[:-1] + '+00:00'
15
+ return datetime.fromisoformat(datetime_str)
16
+
17
+
18
  class AssessmentResult(BaseModel):
19
  """Represents one full vulnerability assessment. Built from a combination of the result and request file for a given library.
20
  """
 
80
  if last_update:
81
  try:
82
  # Format date for display
83
+ dt = parse_iso_datetime(last_update)
84
  last_update = dt.strftime("%Y-%m-%d")
85
  except Exception as e:
86
  print(e)
 
219
 
220
  # Sort the files by date if they have date info
221
  try:
222
+ files.sort(key=lambda x: parse_iso_datetime(json.loads(open(os.path.join(root, x)).read())["assessment"]["completed_time"]), reverse=True)
223
  except Exception as e:
224
  print(e)
225
  pass