Fix initialization of local variable "data" (#1813)

Co-authored-by: Nitsch Alexander <alexander.nitsch@scs.ch>
This commit is contained in:
Alexander Nitsch
2021-10-20 10:57:13 +02:00
committed by GitHub
parent 575de12d79
commit ba9c2a3280
+3 -2
View File
@@ -645,9 +645,10 @@ class BcfXml:
def get_comments(self, guid):
comments = {}
data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd")
if "Comments" not in data["Topics"]:
return comments
data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd")
for item in data["Topic"]["Comments"].get("Comment", []):
comment = bcf.v3.data.Comment()
mandatory_keys = {
@@ -675,9 +676,9 @@ class BcfXml:
def get_viewpoints(self, guid):
viewpoints = {}
data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd")
if "Viewpoints" not in data["Topic"]:
return viewpoints
data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd")
for item in data["Topic"]["Viewpoints"]:
viewpoint = self.get_viewpoint(item, guid)
viewpoints[viewpoint.guid] = viewpoint