check if field is a dict before treating using it like a dict

#12
by WeMoveOn - opened
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -68,7 +68,7 @@ def parse_metrics_rows(meta):
68
  if "dataset" not in result or "metrics" not in result:
69
  continue
70
  dataset = result["dataset"]["type"]
71
- if "args" in result["dataset"] and "language" in result["dataset"]["args"]:
72
  lang = result["dataset"]["args"]["language"]
73
  else:
74
  lang = meta["language"]
 
68
  if "dataset" not in result or "metrics" not in result:
69
  continue
70
  dataset = result["dataset"]["type"]
71
+ if "args" in result["dataset"] and "language" in result["dataset"]["args"] and isinstance(result["dataset"]["args"], dict):
72
  lang = result["dataset"]["args"]["language"]
73
  else:
74
  lang = meta["language"]