Skip to content

Commit

Permalink
Bundle slots into a list if use_attributes is True
Browse files Browse the repository at this point in the history
In this way, the slot definition in `slots` can be added
to the class as an attribute, better than raising an
exception
  • Loading branch information
candleindark committed Sep 29, 2024
1 parent ba0a94f commit 9cc06b2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions linkml_runtime/utils/schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def add_class(
self.schema.classes[cls.name] = cls
if use_attributes:
if not isinstance(slots, list):
raise ValueError(
"If `use_attributes=True`, then `slots` must be a list."
)
slots = [slots]
for s in slots:
if isinstance(s, SlotDefinition):
cls.attributes[s.name] = s
Expand Down

0 comments on commit 9cc06b2

Please sign in to comment.