mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-26 17:02:28 +01:00
rf: use assertion in place of try/except to tell Mypy that something is
This is the way that this should have been done all along. See: https://github.com/python/mypy/issues/5528 for a reference (though not the source) of this concept
This commit is contained in:
@@ -245,10 +245,8 @@ def _parse_tile_layer(element: etree.Element,) -> objects.TileLayer:
|
||||
size = objects.Size(width, height)
|
||||
|
||||
data_element = element.find("./data")
|
||||
if data_element is not None:
|
||||
data: objects.LayerData = _parse_data(data_element, width)
|
||||
else:
|
||||
raise ValueError(f"{element} has no child data element.")
|
||||
assert data_element is not None
|
||||
data: objects.LayerData = _parse_data(data_element, width)
|
||||
|
||||
return objects.TileLayer(
|
||||
id_=id_,
|
||||
|
||||
Reference in New Issue
Block a user