-
Notifications
You must be signed in to change notification settings - Fork 147
docs: Unify description of components' .id attribute; add Raises section to @ui.button()/@ui.*_select()
#1472
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
|
Hmm, about the
doesn't make that much sense |
.id attribute; add Raises section to ui.button/ui.*_select decorators.id attribute; add Raises section to @ui.button()/@ui.*_select()
disnake/ui/button.py
Outdated
| TypeError | ||
| The decorated function was not a coroutine function, | ||
| the ``cls`` parameter was not a callable or a subclass of :class:`Button`, | ||
| or an invalid value for the ``emoji`` parameter was passed. |
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'm not sure about this. There are no issubclass checks on cls anymore, and the emoji value check technically happens at a later point on View instantiation, not immediately, it's kind of tough to document that properly.
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.
There are no
issubclasschecks onclsanymore
That is true; I deliberately left it in, as to say that a subclass would work here
[off-scope] We could re-introduce the subclass checks, by doing
if not callable(cls) or (isinstance(cls, type) and not issubclass(cls, Button)): ...the emoji value check technically happens at a later point on View instantiation, not immediately, it's kind of tough to document that properly.
Yea, what we want to say is that passing incorrect value for emoji will result in an exception at a later point.
I wanna say that's fine, many classes don't usually have attributes and parameters documented for brevity when they're (near) identical, otherwise there'd be a lot of copy-pasting the same list of field over and over again. |
Co-authored-by: vi <[email protected]> Signed-off-by: Eneg <[email protected]>
Summary
Raisesdocstring section toui.buttonandui.*_selectdecorators.idattribute of components. This includes:ui/membersid=0forcomponents/membersChecklist
uv run nox -s lintuv run nox -s pyright