2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Reword some method return type docstrings

This commit is contained in:
Dan 2019-05-17 13:44:44 +02:00
parent 23d0ef3cf9
commit b6ea451ee5
29 changed files with 48 additions and 78 deletions

View File

@ -38,26 +38,10 @@ it.
RawUpdateHandler RawUpdateHandler
.. autoclass:: MessageHandler() .. autoclass:: MessageHandler()
:members:
.. autoclass:: DeletedMessagesHandler() .. autoclass:: DeletedMessagesHandler()
:members:
.. autoclass:: CallbackQueryHandler() .. autoclass:: CallbackQueryHandler()
:members:
.. autoclass:: InlineQueryHandler() .. autoclass:: InlineQueryHandler()
:members:
.. autoclass:: UserStatusHandler() .. autoclass:: UserStatusHandler()
:members:
.. autoclass:: PollHandler() .. autoclass:: PollHandler()
:members:
.. autoclass:: DisconnectHandler() .. autoclass:: DisconnectHandler()
:members:
.. autoclass:: RawUpdateHandler() .. autoclass:: RawUpdateHandler()
:members:

View File

@ -90,7 +90,6 @@ Chats
pin_chat_message pin_chat_message
unpin_chat_message unpin_chat_message
get_chat get_chat
get_chat_preview
get_chat_member get_chat_member
get_chat_members get_chat_members
get_chat_members_count get_chat_members_count
@ -217,7 +216,6 @@ Bots
.. automethod:: pyrogram.Client.pin_chat_message() .. automethod:: pyrogram.Client.pin_chat_message()
.. automethod:: pyrogram.Client.unpin_chat_message() .. automethod:: pyrogram.Client.unpin_chat_message()
.. automethod:: pyrogram.Client.get_chat() .. automethod:: pyrogram.Client.get_chat()
.. automethod:: pyrogram.Client.get_chat_preview()
.. automethod:: pyrogram.Client.get_chat_member() .. automethod:: pyrogram.Client.get_chat_member()
.. automethod:: pyrogram.Client.get_chat_members() .. automethod:: pyrogram.Client.get_chat_members()
.. automethod:: pyrogram.Client.get_chat_members_count() .. automethod:: pyrogram.Client.get_chat_members_count()

View File

@ -72,6 +72,7 @@ Keyboards
ForceReply ForceReply
CallbackQuery CallbackQuery
GameHighScore GameHighScore
GameHighScores
CallbackGame CallbackGame
Input Media Input Media
@ -155,6 +156,7 @@ InputMessageContent
.. autoclass:: ForceReply() .. autoclass:: ForceReply()
.. autoclass:: CallbackQuery() .. autoclass:: CallbackQuery()
.. autoclass:: GameHighScore() .. autoclass:: GameHighScore()
.. autoclass:: GameHighScores()
.. autoclass:: CallbackGame() .. autoclass:: CallbackGame()
.. Input Media .. Input Media

View File

@ -17,7 +17,7 @@ Welcome to Pyrogram
GitHub GitHub
</a> </a>
<a href="https://t.me/PyrogramChat"> <a href="https://t.me/Pyrogram">
Community Community
</a> </a>

View File

@ -44,5 +44,5 @@ In the next few pages of the introduction, we'll take a much more in-depth look
Feeling eager to continue? You can take a shortcut to `Calling Methods`_ and come back later to learn some more details. Feeling eager to continue? You can take a shortcut to `Calling Methods`_ and come back later to learn some more details.
.. _community: //t.me/pyrogramchat .. _community: //t.me/Pyrogram
.. _Calling Methods: ../start/invoking .. _Calling Methods: ../start/invoking

View File

@ -130,4 +130,4 @@ high-level method.
.. _plenty of them: ../api/methods .. _plenty of them: ../api/methods
.. _raw functions: ../telegram/functions .. _raw functions: ../telegram/functions
.. _raw types: ../telegram/types .. _raw types: ../telegram/types
.. _Community: https://t.me/PyrogramChat .. _Community: https://t.me/Pyrogram

View File

@ -73,7 +73,7 @@ class AnswerInlineQuery(BaseClient):
where they wanted to use the bot's inline capabilities. where they wanted to use the bot's inline capabilities.
Returns: Returns:
``bool``: On success, True is returned. ``bool``: True, on success.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -58,7 +58,7 @@ class SendInlineBotResult(BaseClient):
Sends the message with *via @bot* hidden. Sends the message with *via @bot* hidden.
Returns: Returns:
On success, the sent Message is returned. :obj:`Message`: On success, the sent inline result message is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -32,7 +32,7 @@ class SetGameScore(BaseClient):
disable_edit_message: bool = None, disable_edit_message: bool = None,
chat_id: Union[int, str] = None, chat_id: Union[int, str] = None,
message_id: int = None message_id: int = None
): ) -> Union["pyrogram.Message", bool]:
# inline_message_id: str = None): TODO Add inline_message_id # inline_message_id: str = None): TODO Add inline_message_id
"""Set the score of the specified user in a game. """Set the score of the specified user in a game.
@ -63,8 +63,8 @@ class SetGameScore(BaseClient):
Required if inline_message_id is not specified. Required if inline_message_id is not specified.
Returns: Returns:
On success, if the message was sent by the bot, returns the edited :obj:`Message`, :obj:`Message` | ``bool``: On success, if the message was sent by the bot, the edited message is returned,
otherwise returns True. True otherwise.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -34,7 +34,7 @@ class GetChatMembersCount(BaseClient):
Unique identifier (int) or username (str) of the target chat. Unique identifier (int) or username (str) of the target chat.
Returns: Returns:
On success, an integer is returned. ``int``: On success, the chat members count is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -29,7 +29,7 @@ class GetDialogsCount(BaseClient):
Defaults to False. Defaults to False.
Returns: Returns:
``int``: On success, an integer is returned. ``int``: On success, the dialogs count is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -54,9 +54,8 @@ class KickChatMember(BaseClient):
considered to be banned forever. Defaults to 0 (ban forever). considered to be banned forever. Defaults to 0 (ban forever).
Returns: Returns:
:obj:`Message`: On success, a service message will be returned (when applicable). :obj:`Message` | ``bool``: On success, a service message will be returned (when applicable), otherwise, in
case a message object couldn't be returned, True is returned.
``bool`` -- True, in case a message object couldn't be returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -30,6 +30,7 @@ log = logging.getLogger(__name__)
class GetContacts(BaseClient): class GetContacts(BaseClient):
def get_contacts(self) -> List["pyrogram.User"]: def get_contacts(self) -> List["pyrogram.User"]:
# TODO: Create a Users object and return that
"""Get contacts from your Telegram address book. """Get contacts from your Telegram address book.
Returns: Returns:

View File

@ -25,7 +25,7 @@ class GetContactsCount(BaseClient):
"""Get the total count of contacts from your Telegram address book. """Get the total count of contacts from your Telegram address book.
Returns: Returns:
``int``: On success, an integer is returned. ``int``: On success, the contacts count is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -73,9 +73,8 @@ class DownloadMedia(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
``str``: On success, the absolute path of the downloaded file is returned. ``str`` | ``None``: On success, the absolute path of the downloaded file is returned, otherwise, in case
the download failed or was deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the download is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -45,9 +45,8 @@ class EditMessageReplyMarkup(BaseClient):
An InlineKeyboardMarkup object. An InlineKeyboardMarkup object.
Returns: Returns:
:obj:`Message`: In case the edited message is sent by the bot. :obj:`Message` | ``bool``: In case the edited message is sent by the bot, the edited message is returned,
otherwise, True is returned in case the edited message is send by the user.
``bool`` -- True, in case the edited message is sent by the user.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -64,11 +64,9 @@ class ForwardMessages(BaseClient):
Defaults to False. Defaults to False.
Returns: Returns:
:obj:`Message`: In case *message_ids* was an integer, the single forwarded message is :obj:`Message` | :obj:`Messages`: In case *message_ids* was an integer, the single forwarded message is
returned. returned, otherwise, in case *message_ids* was an iterable, the returned value will be an object containing
a list of messages, even if such iterable contained just a single element.
:obj:`Messages` -- In case *message_ids* was an iterable, the returned value will be an
object containing a list of messages, even if such iterable contained just a single element.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -45,7 +45,7 @@ class GetHistoryCount(BaseClient):
Unique identifier (int) or username (str) of the target chat. Unique identifier (int) or username (str) of the target chat.
Returns: Returns:
``int``: On success, an integer is returned. ``int``: On success, the chat history count is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -60,11 +60,9 @@ class GetMessages(BaseClient):
Defaults to 1. Defaults to 1.
Returns: Returns:
:obj:`Message`: In case *message_ids* was an integer, the single forwarded message is :obj:`Message` | :obj:`Messages`: In case *message_ids* was an integer, the single requested message is
returned. returned, otherwise, in case *message_ids* was an iterable, the returned value will be an object containing
a list of messages, even if such iterable contained just a single element.
:obj:`Messages` -- In case *message_ids* was an iterable, the returned value will be an
object containing a list of messages, even if such iterable contained just a single element.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -120,9 +120,8 @@ class SendAnimation(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent animation message is returned. :obj:`Message` | ``None``: On success, the sent animation message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -122,9 +122,8 @@ class SendAudio(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent audio message is returned. :obj:`Message` | ``None``: On success, the sent audio message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -108,9 +108,8 @@ class SendDocument(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent document message is returned. :obj:`Message` | ``None``: On success, the sent document message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -107,9 +107,8 @@ class SendPhoto(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent photo message is returned. :obj:`Message` | ``None``: On success, the sent photo message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -92,10 +92,8 @@ class SendSticker(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent sticker message is returned. :obj:`Message` | ``None``: On success, the sent sticker message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """

View File

@ -124,9 +124,8 @@ class SendVideo(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent video message is returned. :obj:`Message` | ``None``: On success, the sent video message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -107,9 +107,8 @@ class SendVideoNote(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent video note message is returned. :obj:`Message` | ``None``: On success, the sent video note message is returned, otherwise, in case the
pload is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -105,9 +105,8 @@ class SendVoice(BaseClient):
You can either keep *\*args* or add every single extra argument in your function signature. You can either keep *\*args* or add every single extra argument in your function signature.
Returns: Returns:
:obj:`Message`: On success, the sent voice message is returned. :obj:`Message` | ``None``: On success, the sent voice message is returned, otherwise, in case the upload
is deliberately stopped with :meth:`stop_transmission`, None is returned.
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -33,7 +33,7 @@ class GetUserProfilePhotosCount(BaseClient):
For a contact that exists in your Telegram address book you can use his phone number (str). For a contact that exists in your Telegram address book you can use his phone number (str).
Returns: Returns:
``int``: On success, an integer is returned. ``int``: On success, the user profile photos count is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.

View File

@ -24,6 +24,7 @@ from ...ext import BaseClient
class GetUsers(BaseClient): class GetUsers(BaseClient):
# TODO: Add Users type and use that
def get_users( def get_users(
self, self,
user_ids: Union[Iterable[Union[int, str]], int, str] user_ids: Union[Iterable[Union[int, str]], int, str]
@ -38,9 +39,9 @@ class GetUsers(BaseClient):
Iterators and Generators are also accepted. Iterators and Generators are also accepted.
Returns: Returns:
:obj:`User`: In case *user_ids* was an integer or string. :obj:`User` | List of :obj:`User`: In case *user_ids* was an integer or string the single requested user is
returned, otherwise, in case *user_ids* was an iterable a list of users is returned, even if the iterable
List of :obj:`User` -- In case *user_ids* was an iterable, even if the iterable contained one item only. contained one item only.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.