Skip to content

docs: Add type for icon property of guild #2137

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ def owner(self) -> Member | None:

@property
def icon(self) -> Asset | None:
"""Returns the guild's icon asset, if available."""
"""Returns the guild's icon asset of type :class:`asset.Asset`, if available."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like :class:~discord.Asset should work fine. But I can't see any place in the PyCord docs where poperty return types are mentioned in the docstring.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be :type:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, :type: isn't a thing by default, and types are mostly classes ^^

Copy link
Contributor

@OmLanke OmLanke Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:type <param>: directive is to specify the type of a parameter. :rtype is to specify the return type.

See this https://www.sphinx-doc.org/en/master/tutorial/describing-code.html#documenting-python-objects

if self._icon is None:
return None
return Asset._from_guild_icon(self._state, self.id, self._icon)
Expand Down