Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: move OptionGroup definition to Options.py #3325

Merged
merged 3 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading