Skip to content

Commit

Permalink
fix: somehow attribute classes got broken, fix them
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Dec 13, 2024
1 parent ce1cdba commit 04ce9f1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions playa/structtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _make_attributes(
if aobj == revision and prev_obj is not None:
attr_objs.append(prev_obj)
prev_obj = None
elif isinstance(aobj, dict):
elif isinstance(aobj, dict) or isinstance(aobj, PSLiteral):
if prev_obj is not None:
attr_objs.append(prev_obj)
prev_obj = aobj
Expand All @@ -244,14 +244,20 @@ def _make_attributes(
logger.warning("Unknown attribute class %s", key)
continue
obj = self.class_map[key]
elif isinstance(obj, dict):
for k, v in obj.items():
if isinstance(v, PSLiteral):
attr[k] = decode_text(v.name)
else:
attr[k] = obj[k]
else:
logger.warning("Unexpected attribute object type: %r", obj)
for obj in attr_objs:
assert not isinstance(obj, ObjRef)
# An attribute dict
if isinstance(obj, dict):
for k, v in obj.items():
if isinstance(v, PSLiteral):
attr[k] = decode_text(v.name)
else:
attr[k] = obj[k]
return attr

def _make_element(self, obj: Any) -> Tuple[Union[StructElement, None], List[Any]]:
Expand Down

0 comments on commit 04ce9f1

Please sign in to comment.