Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/N] Fix type annnotations on UnetApplyConds #3564

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

huchenlei
Copy link
Contributor

This PR comes from doctorpangloss's comment:

it is great that you are doing this 7718ada
please take a look at https://github.com/hiddenswitch/ComfyUI/blob/master/comfy/model_management_types.py
generally for python you should not declare a single typings file because something like what you wrote is transitively importing torch which is usually undesired for type annotations

for TypedDict you meant to use NotRequired[...], which means you must import from typing_extensions for python 3.10 compatibility. while it's unlikely you will ever want to use that particular typings file without having imported torch earlier, you will in other cases

This PR:

  • Rename types.py to model_patcher_types.py
  • Use NotRequired to replace Optional to represent optional dict entry
  • Add from __future__ import annotations

@huchenlei huchenlei changed the title Fix type annnotations on UnetApplyConds [1/N] Fix type annnotations on UnetApplyConds May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant