From b7263edfd0512949c0dbfef86e1e48bd43c13890 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 9 Apr 2025 19:41:07 -0400 Subject: [PATCH] Lingo: Removed unnecessary "global" keywords (#4854) --- worlds/lingo/items.py | 2 -- worlds/lingo/locations.py | 2 -- worlds/lingo/utils/pickle_static_data.py | 21 ++------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/worlds/lingo/items.py b/worlds/lingo/items.py index b773caeb..338ddffa 100644 --- a/worlds/lingo/items.py +++ b/worlds/lingo/items.py @@ -58,8 +58,6 @@ def get_prog_item_classification(item_name: str): def load_item_data(): - global ALL_ITEM_TABLE, ITEMS_BY_GROUP - for color in ["Black", "Red", "Blue", "Yellow", "Green", "Orange", "Gray", "Brown", "Purple"]: ALL_ITEM_TABLE[color] = ItemData(get_special_item_id(color), get_prog_item_classification(color), ItemType.COLOR, False, []) diff --git a/worlds/lingo/locations.py b/worlds/lingo/locations.py index c527e522..bcd14fc5 100644 --- a/worlds/lingo/locations.py +++ b/worlds/lingo/locations.py @@ -35,8 +35,6 @@ LOCATIONS_BY_GROUP: Dict[str, List[str]] = {} def load_location_data(): - global ALL_LOCATION_TABLE, LOCATIONS_BY_GROUP - for room_name, panels in PANELS_BY_ROOM.items(): for panel_name, panel in panels.items(): location_name = f"{room_name} - {panel_name}" if panel.location_name is None else panel.location_name diff --git a/worlds/lingo/utils/pickle_static_data.py b/worlds/lingo/utils/pickle_static_data.py index df82a128..740e129b 100644 --- a/worlds/lingo/utils/pickle_static_data.py +++ b/worlds/lingo/utils/pickle_static_data.py @@ -58,8 +58,7 @@ def hash_file(path): def load_static_data(ll1_path, ids_path): - global PAINTING_EXITS, SPECIAL_ITEM_IDS, PANEL_LOCATION_IDS, DOOR_LOCATION_IDS, DOOR_ITEM_IDS, \ - DOOR_GROUP_ITEM_IDS, PROGRESSIVE_ITEM_IDS, PANEL_DOOR_ITEM_IDS, PANEL_GROUP_ITEM_IDS + global PAINTING_EXITS # Load in all item and location IDs. These are broken up into groups based on the type of item/location. with open(ids_path, "r") as file: @@ -128,7 +127,7 @@ def load_static_data(ll1_path, ids_path): def process_single_entrance(source_room: str, room_name: str, door_obj) -> RoomEntrance: - global PAINTING_ENTRANCES, PAINTING_EXIT_ROOMS + global PAINTING_ENTRANCES entrance_type = EntranceType.NORMAL if "painting" in door_obj and door_obj["painting"]: @@ -175,8 +174,6 @@ def process_entrance(source_room, doors, room_obj): def process_panel_door(room_name, panel_door_name, panel_door_data): - global PANEL_DOORS_BY_ROOM, PANEL_DOOR_BY_PANEL_BY_ROOM - panels: List[RoomAndPanel] = list() for panel in panel_door_data["panels"]: if isinstance(panel, dict): @@ -215,8 +212,6 @@ def process_panel_door(room_name, panel_door_name, panel_door_data): def process_panel(room_name, panel_name, panel_data): - global PANELS_BY_ROOM - # required_room can either be a single room or a list of rooms. if "required_room" in panel_data: if isinstance(panel_data["required_room"], list): @@ -310,8 +305,6 @@ def process_panel(room_name, panel_name, panel_data): def process_door(room_name, door_name, door_data): - global DOORS_BY_ROOM - # The item name associated with a door can be explicitly specified in the configuration. If it is not, it is # generated from the room and door name. if "item_name" in door_data: @@ -409,8 +402,6 @@ def process_door(room_name, door_name, door_data): def process_painting(room_name, painting_data): - global PAINTINGS, REQUIRED_PAINTING_ROOMS, REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS - # Read in information about this painting and store it in an object. painting_id = painting_data["id"] @@ -468,8 +459,6 @@ def process_painting(room_name, painting_data): def process_sunwarp(room_name, sunwarp_data): - global SUNWARP_ENTRANCES, SUNWARP_EXITS - if sunwarp_data["direction"] == "enter": SUNWARP_ENTRANCES[sunwarp_data["dots"] - 1] = room_name else: @@ -477,8 +466,6 @@ def process_sunwarp(room_name, sunwarp_data): def process_progressive_door(room_name, progression_name, progression_doors): - global PROGRESSIVE_ITEMS, PROGRESSIVE_DOORS_BY_ROOM - # Progressive items are configured as a list of doors. PROGRESSIVE_ITEMS.add(progression_name) @@ -497,8 +484,6 @@ def process_progressive_door(room_name, progression_name, progression_doors): def process_progressive_panel(room_name, progression_name, progression_panel_doors): - global PROGRESSIVE_ITEMS, PROGRESSIVE_PANELS_BY_ROOM - # Progressive items are configured as a list of panel doors. PROGRESSIVE_ITEMS.add(progression_name) @@ -517,8 +502,6 @@ def process_progressive_panel(room_name, progression_name, progression_panel_doo def process_room(room_name, room_data): - global ALL_ROOMS - room_obj = Room(room_name, []) if "entrances" in room_data: