Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lobster/tools/json/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, msg, data):
self.data = data


def get_item(root, path, required):
def get_item(root, path: str, required: bool):
assert isinstance(path, str)
assert isinstance(required, bool)

Expand All @@ -51,12 +51,11 @@ def get_item(root, path, required):
if field in root:
return get_item(root[field], tail, required)
elif required:
raise Malformed_Input("object does not contain %s" % field,
root)
raise Malformed_Input(f"object does not contain {field}", root)
return None

elif required:
raise Malformed_Input("not an object", root)
raise Malformed_Input("not a dictionary", root)
return None


Expand Down Expand Up @@ -170,6 +169,7 @@ def process(cls, options, file_name) -> Tuple[bool, List[Activity]]:
else:
item_name = "%s.%u" % (syn_test_name(PurePath(file_name)),
item_id)

if not isinstance(item_name, str):
raise Malformed_Input("name is not a string",
item_name)
Expand Down
Loading