Skip to content

Commit

Permalink
Cleanup deprecation warnings for etree.Element comparisons in TMX parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Cleptomania committed Aug 23, 2024
1 parent e0d88ee commit 407c3c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pytiled_parser/parsers/tmx/tiled_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def parse(file: Path) -> TiledMap:
map_.hex_side_length = int(raw_map.attrib["hexsidelength"])

properties_element = raw_map.find("./properties")
if properties_element:
if properties_element is not None:
map_.properties = parse_properties(properties_element)

if raw_map.attrib.get("staggeraxis") is not None:
Expand Down
2 changes: 1 addition & 1 deletion pytiled_parser/parsers/tmx/tiled_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _parse_common(raw_object: etree.Element) -> TiledObject:
common.class_ = raw_object.attrib["class"]

properties_element = raw_object.find("./properties")
if properties_element:
if properties_element is not None:
common.properties = parse_properties(properties_element)

return common
Expand Down
4 changes: 2 additions & 2 deletions pytiled_parser/parsers/tmx/wang_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _parse_wang_color(raw_wang_color: etree.Element) -> WangColor:
wang_color.class_ = raw_wang_color.attrib["class"]

properties = raw_wang_color.find("./properties")
if properties:
if properties is not None:
wang_color.properties = parse_properties(properties)

return wang_color
Expand Down Expand Up @@ -74,7 +74,7 @@ def parse(raw_wangset: etree.Element) -> WangSet:
wangset.class_ = raw_wangset.attrib["class"]

properties = raw_wangset.find("./properties")
if properties:
if properties is not None:
wangset.properties = parse_properties(properties)

return wangset

0 comments on commit 407c3c4

Please sign in to comment.