From e94906039cd7c50cc30f2b6c11256080928567ca Mon Sep 17 00:00:00 2001 From: Darren Eberly Date: Sun, 7 Jun 2020 20:05:25 -0400 Subject: [PATCH] changed width and height to not check if they are truthy, as they should always be expected to be so --- pytiled_parser/tiled_object.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/pytiled_parser/tiled_object.py b/pytiled_parser/tiled_object.py index a96141e..c21a383 100644 --- a/pytiled_parser/tiled_object.py +++ b/pytiled_parser/tiled_object.py @@ -207,29 +207,13 @@ def _get_common_attributes(raw_tiled_object: RawTiledObject) -> TiledObject: # required attributes id_ = raw_tiled_object["id"] coordinates = OrderedPair(x=raw_tiled_object["x"], y=raw_tiled_object["y"]) + size = Size(raw_tiled_object["width"], raw_tiled_object["height"]) visible = raw_tiled_object["visible"] common_attributes = TiledObject( - id=id_, coordinates=coordinates, visible=visible, properties={} + id=id_, coordinates=coordinates, visible=visible, size=size ) - # optional attributes - if any([raw_tiled_object.get("width"), raw_tiled_object.get("height")]): - # we have to check if either are truthy before we proceed to create Size - _width = raw_tiled_object.get("width") - if _width: - width = _width - else: - width = 0 - - _height = raw_tiled_object.get("height") - if _height: - height = _height - else: - height = 0 - - common_attributes.size = Size(width, height) - if raw_tiled_object.get("rotation") is not None: common_attributes.rotation = raw_tiled_object["rotation"]