-
Notifications
You must be signed in to change notification settings - Fork 819
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
Clean render return type #4264
Clean render return type #4264
Conversation
Use the type hint that is talked about in the documentation. Fixes Textualize#4063.
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.
Looking at this “simple” PR, I can't help but feel like you spent a lot of time making sure you were getting all of the instances and to make sure you don't mix the app and Rich's RenderResult
😬
) | ||
from rich.console import RenderResult as RichRenderResult |
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.
Why are these two imports separated from the other rich.console
imports?
Why not the suggestion I show below?
from rich.console import (
Console,
ConsoleOptions,
ConsoleRenderable,
JustifyMethod,
RenderableType,
RenderResult as RichRenderResult,
RichCast,
)
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.
I'll let you have that argument with black and/or whatever else it is that rewrote my code from that.
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.
Ah ok, I understand 🤣
Yup, that was fun. As I worked through this too I also got to thinking that, in retrospect, it might have been nicer if |
Co-authored-by: Rodrigo Girão Serrão <[email protected]>
This PR tweaks the type hinting for the
render
methods of various widgets, to ensure they follow the same hinting as is used in our documentation; the aim being to make the code a little less surprising to the reader and also to ensure that any type hint information shown in an IDE, or auto-completed when inheriting from a Textual widget and overriding therender
method, matches what would be expected.Fixes #4063.