Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed May 1, 2024
1 parent df875cd commit 88bf8f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions WDL/Value.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ def from_json(type: Type.Base, value: Any) -> Base:
raise Error.InputError(
f"couldn't initialize struct {str(type)} {type.members[k]} {k} from {json.dumps(v)}"
) from None
# Struct.__init__ will populate null for any omitted optional members
return Struct(type, items, extra=extra)
if type.optional and value is None:
return Null()
Expand Down
4 changes: 3 additions & 1 deletion WDL/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ def left_name(self, meta, items) -> Expr.Base:
return Expr.Get(self._sp(meta), Expr._LeftName(self._sp(meta), items[0]), None)

def get_name(self, meta, items) -> Expr.Base:
assert len(items) == 2 and isinstance(items[0], Expr.Base) and isinstance(items[1].value, str)
assert (
len(items) == 2 and isinstance(items[0], Expr.Base) and isinstance(items[1].value, str)
)
return Expr.Get(self._sp(meta), items[0], items[1].value)


Expand Down

0 comments on commit 88bf8f5

Please sign in to comment.