The Witness: mypy compliance (#3112)

* Make witness apworld mostly pass mypy

* Fix all remaining mypy errors except the core ones

* I'm a goofy stupid poopoo head

* Two more fixes

* ruff after merge

* Mypy for new stuff

* Oops

* Stricter ruff rules (that I already comply with :3)

* Deprecated ruff thing

* wait no i lied

* lol super nevermind

* I can actually be slightly more specific

* lint
This commit is contained in:
NewSoupVi
2024-07-02 23:59:26 +02:00
committed by GitHub
parent b6925c593e
commit 93617fa546
12 changed files with 299 additions and 269 deletions

View File

@@ -1,4 +1,4 @@
from typing import Dict, List
from typing import Dict, List, Set
from BaseClasses import ItemClassification
@@ -7,7 +7,7 @@ from .item_definition_classes import DoorItemDefinition, ItemCategory, ItemData
from .static_locations import ID_START
ITEM_DATA: Dict[str, ItemData] = {}
ITEM_GROUPS: Dict[str, List[str]] = {}
ITEM_GROUPS: Dict[str, Set[str]] = {}
# Useful items that are treated specially at generation time and should not be automatically added to the player's
# item list during get_progression_items.
@@ -22,13 +22,13 @@ def populate_items() -> None:
if definition.category is ItemCategory.SYMBOL:
classification = ItemClassification.progression
ITEM_GROUPS.setdefault("Symbols", []).append(item_name)
ITEM_GROUPS.setdefault("Symbols", set()).add(item_name)
elif definition.category is ItemCategory.DOOR:
classification = ItemClassification.progression
ITEM_GROUPS.setdefault("Doors", []).append(item_name)
ITEM_GROUPS.setdefault("Doors", set()).add(item_name)
elif definition.category is ItemCategory.LASER:
classification = ItemClassification.progression_skip_balancing
ITEM_GROUPS.setdefault("Lasers", []).append(item_name)
ITEM_GROUPS.setdefault("Lasers", set()).add(item_name)
elif definition.category is ItemCategory.USEFUL:
classification = ItemClassification.useful
elif definition.category is ItemCategory.FILLER:
@@ -47,7 +47,7 @@ def populate_items() -> None:
def get_item_to_door_mappings() -> Dict[int, List[int]]:
output: Dict[int, List[int]] = {}
for item_name, item_data in ITEM_DATA.items():
if not isinstance(item_data.definition, DoorItemDefinition):
if not isinstance(item_data.definition, DoorItemDefinition) or item_data.ap_code is None:
continue
output[item_data.ap_code] = [int(hex_string, 16) for hex_string in item_data.definition.panel_id_hexes]
return output