Chaoses-Ib / ComfyScript

A Python frontend and library for ComfyUI
https://discord.gg/arqJbtEg7w
MIT License
422 stars 24 forks source link

feat(runtime): change StrEnum stub type to `StrEnum | str` #71

Closed dwgrth closed 1 month ago

dwgrth commented 1 month ago

Hello!

The rationale behind this change is to shut up my typechecker when I'm working with ComfyScript and I'm not able to generate stubs for all known files ahead of time. A good example is when working with Modal, as in examples/modal.py.

One downside to this change is that it also adds '| str' to the enums that are completely known ahead of time, like Samplers or Schedulers, since I wasn't sure how to differentiate them.

Before: def __new__(cls, ckpt_name: Checkpoints) -> tuple[Model, Clip, Vae]: ... After: def __new__(cls, ckpt_name: Checkpoints | str) -> tuple[Model, Clip, Vae]: ...