From 1a6de25ab6b83fe28ec3031a5bd4815f72182da1 Mon Sep 17 00:00:00 2001 From: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Date: Mon, 21 Apr 2025 00:43:31 +0200 Subject: [PATCH] Core, all worlds: Hard-deprecate old options API (by August 10th 2024) (#3284) * Core: deprecate old options API * also deprecate assigning options via option_definitions --------- Co-authored-by: alwaysintreble --- BaseClasses.py | 2 +- worlds/AutoWorld.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index ec3fa9ce..bf115e3f 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -223,7 +223,7 @@ class MultiWorld(): AutoWorld.AutoWorldRegister.world_types[self.game[player]].options_dataclass.type_hints} for option_key in all_keys: option = Utils.DeprecateDict(f"Getting options from multiworld is now deprecated. " - f"Please use `self.options.{option_key}` instead.") + f"Please use `self.options.{option_key}` instead.", True) option.update(getattr(args, option_key, {})) setattr(self, option_key, option) diff --git a/worlds/AutoWorld.py b/worlds/AutoWorld.py index d1f4a772..b4ff2419 100644 --- a/worlds/AutoWorld.py +++ b/worlds/AutoWorld.py @@ -12,6 +12,7 @@ from typing import (Any, Callable, ClassVar, Dict, FrozenSet, Iterable, List, Ma from Options import item_and_loc_options, ItemsAccessibility, OptionGroup, PerGameCommonOptions from BaseClasses import CollectionState +from Utils import deprecate if TYPE_CHECKING: from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance @@ -75,9 +76,8 @@ class AutoWorldRegister(type): # TODO - remove this once all worlds use options dataclasses if "options_dataclass" not in dct and "option_definitions" in dct: # TODO - switch to deprecate after a version - if __debug__: - logging.warning(f"{name} Assigned options through option_definitions which is now deprecated. " - "Please use options_dataclass instead.") + deprecate(f"{name} Assigned options through option_definitions which is now deprecated. " + "Please use options_dataclass instead.") dct["options_dataclass"] = make_dataclass(f"{name}Options", dct["option_definitions"].items(), bases=(PerGameCommonOptions,))