Skip to content

Commit

Permalink
chore(component-factory): simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Aug 13, 2024
1 parent 737839e commit c575dbe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions neuroml/nml/generatedssupersuper.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,15 @@ def component_factory(cls, component_type, validate=True, **kwargs):
else:
comp_type_class = getattr(module_object, component_type.__name__)

comp = comp_type_class(**kwargs)

# handle component types that support __ANY__
try:
anytypevalue = kwargs["__ANY__"]
# first value, so put it in a list, otherwise each element of the
# string is taken to be a new object
comp = comp_type_class(anytypeobjs_=[anytypevalue], **kwargs)
# append value to anytypeobjs_ list
comp.anytypeobjs_.append(anytypevalue)
except KeyError:
comp = comp_type_class(**kwargs)
pass

# additional setups where required
if comp_type_class.__name__ == "Cell":
Expand Down

0 comments on commit c575dbe

Please sign in to comment.