Skip to content

Commit 046041d

Browse files
committed
Improve testing of elements availability
1 parent 7770592 commit 046041d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pymvr/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ def _read_xml(self):
3838
self.providerVersion: str = self._root.get("providerVersion", "")
3939

4040
layers_collect = self._scene.find("Layers")
41-
if layers_collect:
41+
if layers_collect is not None:
4242
self.layers: List["Layer"] = [Layer(xml_node=i) for i in layers_collect.findall("Layer")]
4343
else:
4444
self.layers = []
4545

4646
aux_data_collect = self._scene.find("AUXData")
4747

48-
if aux_data_collect:
48+
if aux_data_collect is not None:
4949
self.aux_data = AUXData(xml_node=aux_data_collect)
5050
else:
5151
self.aux_data = None
@@ -172,7 +172,7 @@ def _read_xml(self, xml_node: "Element"):
172172
if xml_node.find("FixtureID") is not None:
173173
self.fixture_id = xml_node.find("FixtureID").text
174174

175-
if xml_node.find("FixtureIDNumeric"):
175+
if xml_node.find("FixtureIDNumeric") is not None:
176176
self.fixture_id_numeric = int(xml_node.find("FixtureIDNumeric").text)
177177
if xml_node.find("UnitNumber") is not None:
178178
self.unit_number = int(xml_node.find("UnitNumber").text)
@@ -198,7 +198,7 @@ def _read_xml(self, xml_node: "Element"):
198198
self.alignments = [Alignment(xml_node=i) for i in xml_node.find("Alignments").findall("Alignment")]
199199
if xml_node.find("Connections"):
200200
self.connections = [Connection(xml_node=i) for i in xml_node.find("Connections").findall("Connection")]
201-
if xml_node.find("CustomCommands"):
201+
if xml_node.find("CustomCommands") is not None:
202202
self.custom_commands = [CustomCommand(xml_node=i) for i in xml_node.find("CustomCommands").findall("CustomCommand")]
203203
if xml_node.find("Overwrites"):
204204
self.overwrites = [Overwrite(xml_node=i) for i in xml_node.find("Overwrites").findall("Overwrite")]
@@ -367,7 +367,7 @@ def _read_xml(self, xml_node: "Element"):
367367

368368
if xml_node.find("Protocols"):
369369
self.protocols = [Protocol(xml_node=i) for i in xml_node.find("Protocols").findall("Protocol")]
370-
if xml_node.find("Mappings"):
370+
if xml_node.find("Mappings") is not None:
371371
self.mappings = [Mapping(xml_node=i) for i in xml_node.find("Mappings").findall("Mapping")]
372372
if xml_node.find("Gobo") is not None:
373373
self.gobo = Gobo(xml_node.attrib.get("Gobo"))
@@ -665,7 +665,7 @@ def _read_xml(self, xml_node: "Element"):
665665

666666
self.symbol = [Symbol(xml_node=i) for i in xml_node.findall("Symbol")]
667667
_geometry3d = [Geometry3D(xml_node=i) for i in xml_node.findall("Geometry3D")]
668-
if xml_node.find("ChildList"):
668+
if xml_node.find("ChildList") is not None:
669669
child_list = xml_node.find("ChildList")
670670

671671
symbols = [Symbol(xml_node=i) for i in child_list.findall("Symbol")]

0 commit comments

Comments
 (0)