-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Very trivial issue with a very trivial fix.
Currently when attempting this valid code:
PHONE_SPINNER = Spinner(["📞 ", " 📞"], 100)My linter screams this at me:
Argument of type "list[str]" cannot be assigned to parameter "frames" of type "str" in function "__init__"
"list[str]" is not assignable to "str"
I checked the source code and I found this
if isinstance(spinner.frames, str):
uframes = spinner.frames
# TODO (pavdmyt): support any type that implements iterable
if isinstance(spinner.frames, (list, tuple)):
# Empty ``spinner.frames`` is handled by ``Yaspin._set_spinner``
if spinner.frames and isinstance(spinner.frames[0], bytes):
uframes_seq = [to_unicode(frame) for frame in spinner.frames]
else:
uframes_seq = spinner.framesSo I recognise that it's a work in progress. However, as a very quick easy fix, I just added list[str] to the dataclass definition and it works fine, and doesn't break any code as far I could tell:
@dataclass
class Spinner:
frames: str | list[str]
interval: intLet me know if this is worth it and I'll submit a PR with my fix.
Metadata
Metadata
Assignees
Labels
No labels