From 00153d59dcc8682c46e8279da6c6a1d8857d673d Mon Sep 17 00:00:00 2001 From: Darren Eberly Date: Thu, 20 Aug 2020 21:48:31 -0400 Subject: [PATCH] refactor(tiled_map): Renamed Map class to TiledMap --- pytiled_parser/__init__.py | 2 +- pytiled_parser/tiled_map.py | 6 +++--- tests/test_data/map_tests/embedded_tileset/expected.py | 2 +- tests/test_data/map_tests/hexagonal/expected.py | 2 +- tests/test_data/map_tests/no_background_color/expected.py | 2 +- tests/test_data/map_tests/no_layers/expected.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pytiled_parser/__init__.py b/pytiled_parser/__init__.py index 3ce0b53..35d672b 100644 --- a/pytiled_parser/__init__.py +++ b/pytiled_parser/__init__.py @@ -5,5 +5,5 @@ from .common_types import OrderedPair, Size from .layer import Layer from .properties import Properties -from .tiled_map import Map +from .tiled_map import TiledMap from .tileset import Tileset diff --git a/pytiled_parser/tiled_map.py b/pytiled_parser/tiled_map.py index 61d9f89..dd907fa 100644 --- a/pytiled_parser/tiled_map.py +++ b/pytiled_parser/tiled_map.py @@ -18,7 +18,7 @@ TilesetDict = Dict[int, Tileset] @attr.s(auto_attribs=True) -class Map: +class TiledMap: """Object for storing a TMX with all associated layers and properties. See: https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map @@ -104,7 +104,7 @@ class _RawTiledMap(TypedDict): width: int -def cast(file: Path) -> Map: +def cast(file: Path) -> TiledMap: """ Cast the raw Tiled map into a pytiled_parser type Args: @@ -137,7 +137,7 @@ def cast(file: Path) -> Map: tilesets[raw_tileset["firstgid"]] = tileset.cast(raw_tileset) # `map` is a built-in function - map_ = Map( + map_ = TiledMap( infinite=raw_tiled_map["infinite"], layers=[layer.cast(layer_) for layer_ in raw_tiled_map["layers"]], map_size=Size(raw_tiled_map["width"], raw_tiled_map["height"]), diff --git a/tests/test_data/map_tests/embedded_tileset/expected.py b/tests/test_data/map_tests/embedded_tileset/expected.py index c64d2fb..cbabb9c 100644 --- a/tests/test_data/map_tests/embedded_tileset/expected.py +++ b/tests/test_data/map_tests/embedded_tileset/expected.py @@ -2,7 +2,7 @@ from pathlib import Path from pytiled_parser import common_types, tiled_map, tileset -EXPECTED = tiled_map.Map( +EXPECTED = tiled_map.TiledMap( infinite=False, layers=[], map_size=common_types.Size(8, 6), diff --git a/tests/test_data/map_tests/hexagonal/expected.py b/tests/test_data/map_tests/hexagonal/expected.py index 05a7f13..27a6741 100644 --- a/tests/test_data/map_tests/hexagonal/expected.py +++ b/tests/test_data/map_tests/hexagonal/expected.py @@ -2,7 +2,7 @@ from pathlib import Path from pytiled_parser import common_types, layer, tiled_map, tileset -EXPECTED = tiled_map.Map( +EXPECTED = tiled_map.TiledMap( hex_side_length=6, stagger_axis="y", stagger_index="odd", diff --git a/tests/test_data/map_tests/no_background_color/expected.py b/tests/test_data/map_tests/no_background_color/expected.py index 831356c..8419d33 100644 --- a/tests/test_data/map_tests/no_background_color/expected.py +++ b/tests/test_data/map_tests/no_background_color/expected.py @@ -2,7 +2,7 @@ from pathlib import Path from pytiled_parser import common_types, tiled_map, tileset -EXPECTED = tiled_map.Map( +EXPECTED = tiled_map.TiledMap( infinite=False, layers=[], map_size=common_types.Size(8, 6), diff --git a/tests/test_data/map_tests/no_layers/expected.py b/tests/test_data/map_tests/no_layers/expected.py index febd8fa..67a5287 100644 --- a/tests/test_data/map_tests/no_layers/expected.py +++ b/tests/test_data/map_tests/no_layers/expected.py @@ -2,7 +2,7 @@ from pathlib import Path from pytiled_parser import common_types, tiled_map, tileset -EXPECTED = tiled_map.Map( +EXPECTED = tiled_map.TiledMap( infinite=False, layers=[], map_size=common_types.Size(8, 6),