From 8778db51c72e8595938389f0a57b5c9900984b22 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 5 Dec 2024 14:48:17 +0100 Subject: [PATCH] DOC: Fix docstring and inline comment --- src/linkahead/common/models.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index 6f37c21..6cafad9 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -1232,7 +1232,7 @@ class Entity: xml: Optional[etree._Element] = None, add_properties: INHERITANCE = "ALL", local_serialization: bool = False, - visited_entities: Optional[Union[list, None]] = None + visited_entities: Optional[list] = None ) -> etree._Element: """Generate an xml representation of this entity. If the parameter xml is given, all attributes, parents, properties, and messages of this @@ -1240,15 +1240,25 @@ class Entity: Raise an error if xml is not a lxml.etree.Element - @param xml: an xml element to which all attributes, parents, - properties, and messages - are to be added. - @param visited_entities: recursion check, should never be set manually - - FIXME: Add documentation for the add_properties parameter. - FIXME: Add documentation for the local_serialization parameter. + Parameters + ---------- + xml : etree._Element, optional + an xml element to which all attributes, parents, + properties, and messages are to be added. Default is None. + visited_entities : list, optional + list of enties that are being printed for recursion check, + should never be set manually. Default is None. + add_properties : INHERITANCE, optional + FIXME: Add documentation for the add_properties + parameter. Default is "ALL". + local_serialization : bool, optional + FIXME: Add documentation for the local_serialization + parameter. Default is False. - @return: xml representation of this entity. + Returns + ------- + xml : etree._Element + xml representation of this entity. """ if xml is None: @@ -1282,8 +1292,10 @@ class Entity: xml.set("description", str(self.description)) if self.version is not None: - # Does version.to_xml need visited_entities support? - # It does have some recursion with predecessors / successors. + # If this ever causes problems, we might add + # visited_entities support here since it does have some + # recursion with predecessors / successors. But should be + # fine for now, since it is always set by the server. xml.append(self.version.to_xml()) if self.value is not None: -- GitLab