def read_json_log()

in compile_table.py [0:0]


def read_json_log(filename):
    """
    Reads a json log as output from a given model run. Does simple filtering
    to prevent bad plots (e.g. drop NaN lines), and flattens the dictionary.
    """
    output = []
    if filename == "-" or "":
        f = sys.stdin
    else:
        f = open(filename)  # noqa: P201

    for i, line in enumerate(f, 1):
        line = line.strip()
        if not line:
            continue

        line = line.replace("NaN", "null")
        line = line.replace("-Infinity", "null")
        line = line.replace("Infinity", "null")
        try:
            d = json.loads(line)
            output.append(dict(__flatten_dict(d)))
        except ValueError:
            logging.warning("Warning: Line {} of {} didn't parse: ".format(i, filename))

    f.close()
    return pd.DataFrame(output)