Skip to content

Commit

Permalink
Core: move OptionGroup definition to Options.py (ArchipelagoMW#3325)
Browse files Browse the repository at this point in the history
  • Loading branch information
beauxq authored and sflavelle committed Jun 20, 2024
1 parent ce0cf1a commit 200bcd9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 0 additions & 8 deletions BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,14 +1453,6 @@ class Tutorial(NamedTuple):
authors: List[str]


class OptionGroup(NamedTuple):
"""Define a grouping of options"""
name: str
"""Name of the group to categorize this option in for display on the WebHost and in generated YAMLS."""
options: List[Type[Options.Option]]
"""Options to be in the defined group. """


class PlandoOptions(IntFlag):
none = 0b0000
items = 0b0001
Expand Down
8 changes: 8 additions & 0 deletions Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,14 @@ class DeathLinkMixin:
death_link: DeathLink


class OptionGroup(typing.NamedTuple):
"""Define a grouping of options."""
name: str
"""Name of the group to categorize these options in for display on the WebHost and in generated YAMLS."""
options: typing.List[typing.Type[Option[typing.Any]]]
"""Options to be in the defined group."""


def generate_yaml_templates(target_folder: typing.Union[str, "pathlib.Path"], generate_hidden: bool = True):
import os

Expand Down
2 changes: 1 addition & 1 deletion docs/options api.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ group.

```python
from worlds.AutoWorld import WebWorld
from BaseClasses import OptionGroup
from Options import OptionGroup

class MyWorldWeb(WebWorld):
option_groups = [
Expand Down
10 changes: 5 additions & 5 deletions worlds/AutoWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from typing import (Any, Callable, ClassVar, Dict, FrozenSet, List, Mapping,
Optional, Set, TextIO, Tuple, TYPE_CHECKING, Type, Union)

from Options import ExcludeLocations, ItemLinks, LocalItems, NonLocalItems, PerGameCommonOptions, \
PriorityLocations, \
StartHints, \
StartInventory, StartInventoryPool, StartLocationHints
from BaseClasses import CollectionState, OptionGroup
from Options import (
ExcludeLocations, ItemLinks, LocalItems, NonLocalItems, OptionGroup, PerGameCommonOptions,
PriorityLocations, StartHints, StartInventory, StartInventoryPool, StartLocationHints
)
from BaseClasses import CollectionState

if TYPE_CHECKING:
from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance
Expand Down

0 comments on commit 200bcd9

Please sign in to comment.