@@ -11,7 +11,7 @@ def __init__( # pylint: disable=too-many-arguments
1111 identifier : str ,
1212 spec_object : str ,
1313 level : int ,
14- children : Optional [List ] = None ,
14+ children : Optional [List [ "ReqIFSpecHierarchy" ] ] = None ,
1515 long_name : Optional [str ] = None ,
1616 ref_then_children_order : bool = True ,
1717 last_change : Optional [str ] = None ,
@@ -28,8 +28,8 @@ def __init__( # pylint: disable=too-many-arguments
2828 # Not part of ReqIF, but helpful to calculate the section depth levels.
2929 self .level = level
3030
31- # Optional fields.
32- self .children : Optional [List ] = children
31+ # Optional fields
32+ self .children : Optional [List [ ReqIFSpecHierarchy ] ] = children
3333 self .long_name : Optional [str ] = long_name
3434 # Not part of REqIF, but helpful for printing the
3535 # <OBJECT> and <CHILDREN> tags depending on which tool produced the
@@ -42,6 +42,8 @@ def __init__( # pylint: disable=too-many-arguments
4242 self .xml_node = xml_node
4343
4444 def add_child (self , spec_hierarchy ):
45+ if self .children is None :
46+ self .children = []
4547 assert (self .level + 1 ) == spec_hierarchy .level , (
4648 f"Broken parent-child level relationship.\n "
4749 f"Parent: { self } \n Child: { spec_hierarchy } "
0 commit comments