Skip to content

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

Merged
Chaoses-Ib merged 2 commits intoChaoses-Ib:mainfrom
dwgrth:node-stubs
Sep 23, 2024
Merged

feat(runtime): change StrEnum stub type to StrEnum | str#71
Chaoses-Ib merged 2 commits intoChaoses-Ib:mainfrom
dwgrth:node-stubs

Conversation

@dwgrth
Copy link
Contributor

@dwgrth dwgrth commented Sep 22, 2024

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]: ...

@Chaoses-Ib Chaoses-Ib added enhancement New feature or request runtime labels Sep 22, 2024
Co-authored-by: Chaoses-Ib <Chaos-es@outlook.com>
@Chaoses-Ib Chaoses-Ib merged commit 7af9570 into Chaoses-Ib:main Sep 23, 2024
@Chaoses-Ib Chaoses-Ib changed the title change StrEnum stub type to 'StrEnum | str' feat(runtime): change StrEnum stub type to StrEnum | str Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants