-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add detailed docstrings for row and width properties in the Item class #10057
base: master
Are you sure you want to change the base?
Conversation
Commit was changed to original should not be in PR at all.
@@ -113,6 +123,16 @@ def row(self, value: Optional[int]) -> None: | |||
|
|||
@property | |||
def width(self) -> int: | |||
"""int: The width of this item in a Discord UI layout. |
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.
"""int: The width of this item in a Discord UI layout. | |
""":class:`int`: Returns the width of this item in a Discord UI layout. |
@@ -100,6 +100,16 @@ def __repr__(self) -> str: | |||
|
|||
@property | |||
def row(self) -> Optional[int]: | |||
"""Optional[:class:`int`]: The action row this item belongs to. |
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.
"""Optional[:class:`int`]: The action row this item belongs to. | |
"""Optional[:class:`int`]: Returns the action row this item belongs to. |
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.
"""Optional[:class:`int`]: The action row this item belongs to. | |
"""Optional[:class:`int`]: Returns the row this item belongs to. |
Returns | ||
------- | ||
:class:`int` | ||
The width of the item, defaulting to 1. |
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.
Returns | |
------- | |
:class:`int` | |
The width of the item, defaulting to 1. |
Properties don't have this Return, as their return type are stated above.
An action row can have up to 5 components. Valid values for the row are | ||
integers in the range 0–4 or ``None`` to indicate no specific row. |
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.
An action row can have up to 5 components. Valid values for the row are | |
integers in the range 0–4 or ``None`` to indicate no specific row. |
This is already documented on the row
parameter on each different Item
subclass, so it is not needed.
@@ -100,6 +100,16 @@ def __repr__(self) -> str: | |||
|
|||
@property | |||
def row(self) -> Optional[int]: | |||
"""Optional[:class:`int`]: The action row this item belongs to. |
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.
"""Optional[:class:`int`]: The action row this item belongs to. | |
"""Optional[:class:`int`]: Returns the row this item belongs to. |
"""int: The width of this item in a Discord UI layout. | ||
|
||
The width determines how much space this item occupies in an action row. | ||
This value is primarily used internally by Discord.py to calculate layout constraints. |
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 don't think mentioning this is necessary?
Summary
This pull request adds detailed docstrings to the
row
andwidth
properties of theItem
class in the Discord.py library. These docstrings provide clear explanations of their purpose, valid values, constraints, and usage within the framework, improving overall code clarity and documentation.Checklist