forked from mirror/Archipelago
fix, maybe
This commit is contained in:
@@ -12,7 +12,7 @@ from dataclasses import dataclass
|
||||
|
||||
from schema import And, Optional, Or, Schema
|
||||
|
||||
from Utils import get_fuzzy_results, is_iterable_of_str
|
||||
from Utils import get_fuzzy_results, is_iterable_but_str
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from BaseClasses import PlandoOptions
|
||||
@@ -857,7 +857,7 @@ class OptionList(Option[typing.List[typing.Any]], VerifyKeys):
|
||||
|
||||
@classmethod
|
||||
def from_any(cls, data: typing.Any):
|
||||
if is_iterable_of_str(data):
|
||||
if is_iterable_but_str(data):
|
||||
cls.verify_keys(data)
|
||||
return cls(data)
|
||||
return cls.from_text(str(data))
|
||||
@@ -883,7 +883,7 @@ class OptionSet(Option[typing.Set[str]], VerifyKeys):
|
||||
|
||||
@classmethod
|
||||
def from_any(cls, data: typing.Any):
|
||||
if is_iterable_of_str(data):
|
||||
if is_iterable_but_str(data):
|
||||
cls.verify_keys(data)
|
||||
return cls(data)
|
||||
return cls.from_text(str(data))
|
||||
|
||||
4
Utils.py
4
Utils.py
@@ -713,7 +713,7 @@ def messagebox(title: str, text: str, error: bool = False) -> None:
|
||||
import ctypes
|
||||
style = 0x10 if error else 0x0
|
||||
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
|
||||
|
||||
|
||||
# fall back to tk
|
||||
try:
|
||||
import tkinter
|
||||
@@ -969,7 +969,7 @@ class RepeatableChain:
|
||||
return sum(len(iterable) for iterable in self.iterable)
|
||||
|
||||
|
||||
def is_iterable_of_str(obj: object) -> TypeGuard[typing.Iterable[str]]:
|
||||
def is_iterable_but_str(obj: object) -> TypeGuard[typing.Iterable[str]]:
|
||||
""" but not a `str` (because technically, `str` is `Iterable[str]`) """
|
||||
if isinstance(obj, str):
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user