mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core: typing for Option.default
and a few other ClassVars (#2899)
* Core: typing for `Option.default` and a few other `Option` class variables This is a replacement for https://github.com/ArchipelagoMW/Archipelago/pull/2173 You can read discussion there for issues we found for why we can't have more specific typing on `default` instead of setting a default in `Option` (where we don't know the type), we check in the metaclass to make sure they have a default. * NumericOption doesn't need the type annotation that brings out the mypy bug * SoE default ClassVar
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from dataclasses import dataclass, fields
|
||||
from typing import Any, cast, Dict, Iterator, List, Tuple, Protocol
|
||||
from typing import Any, ClassVar, cast, Dict, Iterator, List, Tuple, Protocol
|
||||
|
||||
from Options import AssembleOptions, Choice, DeathLink, DefaultOnToggle, Option, PerGameCommonOptions, \
|
||||
ProgressionBalancing, Range, Toggle
|
||||
@@ -8,13 +8,13 @@ from Options import AssembleOptions, Choice, DeathLink, DefaultOnToggle, Option,
|
||||
# typing boilerplate
|
||||
class FlagsProtocol(Protocol):
|
||||
value: int
|
||||
default: int
|
||||
default: ClassVar[int]
|
||||
flags: List[str]
|
||||
|
||||
|
||||
class FlagProtocol(Protocol):
|
||||
value: int
|
||||
default: int
|
||||
default: ClassVar[int]
|
||||
flag: str
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user