-
Couldn't load subscription status.
- Fork 3
fix: enable tooltip in multiselect enum #812
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
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
recipes/CompareText2Img.py (1)
104-105: Move this import to the existing top‑level import block for claritystable_diffusion is already imported at module load (Lines 23–30), so a local import is redundant. Hoist model_pricing_tooltips into that block and drop this local import.
Apply within this hunk:
- from daras_ai_v2.stable_diffusion import model_pricing_tooltipsAdditionally update the top import list (outside this hunk):
from daras_ai_v2.stable_diffusion import ( Text2ImgModels, text2img, instruct_pix2pix, sd_upscale, Schedulers, LoraWeight, model_pricing_tooltips, # add this )daras_ai_v2/enum_selector_widget.py (2)
33-40: Minor: build names/labels/lookup via comprehensionsSame result with less code; keeps these derived structures in sync.
- enum_names = [] - enum_labels = {} - enum_lookup = {} - for e in enums: - enum_names.append(e.name) - enum_labels[e.name] = _default_format_func(e) - enum_lookup[e.name] = e + enum_names = [e.name for e in enums] + enum_labels = {e.name: _default_format_func(e) for e in enums} + enum_lookup = {e.name: e for e in enums}
1-12: Optional typing cleanup: TypeVar bound should be enum.Enum (not Type[enum.Enum])E represents Enum members, not the Enum class type. Adjusting improves static typing and avoids confusion in dict[E, str].
Outside this hunk:
E = TypeVar("E", bound=enum.Enum)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
daras_ai_v2/enum_selector_widget.py(3 hunks)daras_ai_v2/stable_diffusion.py(1 hunks)recipes/CompareText2Img.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
recipes/CompareText2Img.py (2)
daras_ai_v2/enum_selector_widget.py (1)
enum_multiselect(13-79)daras_ai_v2/stable_diffusion.py (1)
Text2ImgModels(45-78)
daras_ai_v2/enum_selector_widget.py (1)
components_doc.py (1)
checkbox(232-237)
🪛 Ruff (0.13.1)
daras_ai_v2/enum_selector_widget.py
19-19: PEP 484 prohibits implicit Optional
Convert to Optional[T]
(RUF013)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test (3.10.12, 1.8.3)
🔇 Additional comments (2)
daras_ai_v2/stable_diffusion.py (1)
99-104: LGTM: concise pricing tooltip mapKeys use Enum members (not names), which matches enum_multiselect’s lookup. Values align with get_raw_price logic. No runtime risk.
recipes/CompareText2Img.py (1)
133-138: Confirm underlying GUI's checkbox supports tooltip_placementWiring is correct — daras_ai_v2/enum_selector_widget.py and widgets/switch_with_section.py accept and forward tooltip_placement and recipes/CompareText2Img.py uses it; I could not find a local gui.checkbox implementation, so verify the external GUI (gooey_gui / whatever provides gui.checkbox) accepts a tooltip_placement kwarg to avoid an unexpected-kwarg error.
7a91f29 to
49e5a11
Compare
Q/A checklist
How to check import time?
You can visualize this using tuna:
To measure import time for a specific library:
To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:
Legal Boilerplate
Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.