Skip to content

Commit b97e2d5

Browse files
committed
fix(info): correct logic and remove unneeded set argument
1 parent eccf8e3 commit b97e2d5

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

neuroml/nml/generatedssupersuper.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ def info(self, show_contents=False, return_format="string"):
344344
By default, this will only show the members, and not their contents.
345345
To see contents that have been set, use `show_contents=True`. This will
346346
not show empty/unset contents. To see all contents, set
347-
`show_contents="all"`. To only show members that have values set, use
348-
`show_contents="set"`.
347+
`show_contents="all"`.
349348
350349
Note that not all members will have ids (since not all NeuroML2
351350
ComponentTypes have ids). For members that do not have ids, the object
@@ -362,10 +361,10 @@ def info(self, show_contents=False, return_format="string"):
362361
If "dict" or "list" is provided, the information is returned as a
363362
dict/list instead of being printed. Note that if `show_contents` is
364363
`False`, only a list of members is available and will be returned
365-
even if "dict" is supplied. If `show_contents` is `True`, "all", or
366-
"set" but "list" is provided, only the list of members will be
367-
returned. If something other than "string", "list", or "dict" is
368-
provided, the string representation is returned and printed.
364+
even if "dict" is supplied. If `show_contents` is `True`, or "all"
365+
but "list" is provided, only the list of members will be returned.
366+
If something other than "string", "list", or "dict" is provided,
367+
the string representation is returned and printed.
369368
:type return_format: str
370369
:returns: info string, or list of members or dict with members as keys
371370
and member values as values
@@ -438,22 +437,17 @@ def info(self, show_contents=False, return_format="string"):
438437
contents_id
439438
)
440439

441-
member_val = getattr(self, member.get_name(), None)
442-
443440
# if all, show everything
444441
if show_contents == "all":
445442
info_str += member_str + contents_str
446-
info_ret[member.get_name()]["members"] = member_val
447-
443+
info_ret[member.get_name()]["members"] = contents
448444
# if set, only show members where contents exist
449-
elif show_contents == "set":
445+
else:
450446
if len(contents_str) > 0:
451447
info_str += member_str + contents_str
452-
if member_val is not None:
453-
info_ret[member.get_name()]["members"] = member_val
454-
else:
455-
info_str += member_str + contents_str
456-
info_ret[member.get_name()]["members"] = member_val
448+
info_ret[member.get_name()]["members"] = contents
449+
else:
450+
info_ret.pop(member.get_name())
457451

458452
else:
459453
info_ret.append(member.get_name())

0 commit comments

Comments
 (0)