@@ -754,7 +754,7 @@ def __init__(self, value: int) -> None:
754754 elif value > self .range_end and value not in self .special_range_names .values ():
755755 raise Exception (f"{ value } is higher than maximum { self .range_end } for option { self .__class__ .__name__ } " +
756756 f"and is also not one of the supported named special values: { self .special_range_names } " )
757-
757+
758758 # See docstring
759759 for key in self .special_range_names :
760760 if key != key .lower ():
@@ -1180,7 +1180,7 @@ def __len__(self) -> int:
11801180class Accessibility (Choice ):
11811181 """
11821182 Set rules for reachability of your items/locations.
1183-
1183+
11841184 **Full:** ensure everything can be reached and acquired.
11851185
11861186 **Minimal:** ensure what is needed to reach your goal can be acquired.
@@ -1198,7 +1198,7 @@ class Accessibility(Choice):
11981198class ItemsAccessibility (Accessibility ):
11991199 """
12001200 Set rules for reachability of your items/locations.
1201-
1201+
12021202 **Full:** ensure everything can be reached and acquired.
12031203
12041204 **Minimal:** ensure what is needed to reach your goal can be acquired.
@@ -1249,12 +1249,16 @@ class CommonOptions(metaclass=OptionsMetaProperty):
12491249 progression_balancing : ProgressionBalancing
12501250 accessibility : Accessibility
12511251
1252- def as_dict (self , * option_names : str , casing : str = "snake" ) -> typing .Dict [str , typing .Any ]:
1252+ def as_dict (self ,
1253+ * option_names : str ,
1254+ casing : typing .Literal ["snake" , "camel" , "pascal" , "kebab" ] = "snake" ,
1255+ toggles_as_bools : bool = False ) -> typing .Dict [str , typing .Any ]:
12531256 """
12541257 Returns a dictionary of [str, Option.value]
12551258
12561259 :param option_names: names of the options to return
12571260 :param casing: case of the keys to return. Supports `snake`, `camel`, `pascal`, `kebab`
1261+ :param toggles_as_bools: whether toggle options should be output as bools instead of strings
12581262 """
12591263 assert option_names , "options.as_dict() was used without any option names."
12601264 option_results = {}
@@ -1276,6 +1280,8 @@ def as_dict(self, *option_names: str, casing: str = "snake") -> typing.Dict[str,
12761280 value = getattr (self , option_name ).value
12771281 if isinstance (value , set ):
12781282 value = sorted (value )
1283+ elif toggles_as_bools and issubclass (type (self ).type_hints [option_name ], Toggle ):
1284+ value = bool (value )
12791285 option_results [display_name ] = value
12801286 else :
12811287 raise ValueError (f"{ option_name } not found in { tuple (type (self ).type_hints )} " )
0 commit comments