- for config_section in config_sections:
- if config_section == "empty":
- # Found a empty section marker. Actually append the section at the
- # timestamp of the next concrete section.
- append_empty_section = True
- else:
- assert type(config_section) is dict
- line = config_section.get("line")
- ts = config_section.get("timestamp")
-
- if type(line) is not int:
- raise RuntimeError("`line` is not an integer")
-
- if type(ts) is not int:
- raise RuntimeError("`timestamp` is not an integer")
+ for section in metadata_sections_json:
+ if isinstance(section, tjson.StrVal):
+ if section.val == "empty":
+ # Found a empty section marker. Actually append the section at the
+ # timestamp of the next concrete section.
+ append_empty_section = True
+ else:
+ raise ValueError("Invalid string value at {}.".format(section.path))
+ elif isinstance(section, tjson.ObjVal):
+ line = section.at("line", tjson.IntVal).val
+ ts = section.at("timestamp", tjson.IntVal).val