Fix async generator typehints

This commit is contained in:
KurimuzonAkuma 2023-11-24 01:32:14 +03:00
parent eeb1a6cf42
commit bb80e176bf
19 changed files with 20 additions and 20 deletions

View File

@ -821,7 +821,7 @@ class Client(Methods):
offset: int = 0,
progress: Callable = None,
progress_args: tuple = ()
) -> Optional[AsyncGenerator[bytes, None]]:
) -> AsyncGenerator[bytes, None]:
async with self.get_file_semaphore:
file_type = file_id.file_type

View File

@ -32,7 +32,7 @@ class GetChatEventLog:
limit: int = 0,
filters: "types.ChatEventFilter" = None,
user_ids: List[Union[int, str]] = None
) -> Optional[AsyncGenerator["types.ChatEvent", None]]:
) -> AsyncGenerator["types.ChatEvent", None]:
"""Get the actions taken by chat members and administrators in the last 48h.
Only available for supergroups and channels. Requires administrator rights.

View File

@ -64,7 +64,7 @@ class GetChatMembers:
query: str = "",
limit: int = 0,
filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH
) -> Optional[AsyncGenerator["types.ChatMember", None]]:
) -> AsyncGenerator["types.ChatMember", None]:
"""Get the members list of a chat.
A chat can be either a basic group, a supergroup or a channel.

View File

@ -26,7 +26,7 @@ class GetDialogs:
async def get_dialogs(
self: "pyrogram.Client",
limit: int = 0
) -> Optional[AsyncGenerator["types.Dialog", None]]:
) -> AsyncGenerator["types.Dialog", None]:
"""Get a user's dialogs sequentially.
.. include:: /_includes/usable-by/users.rst

View File

@ -25,7 +25,7 @@ from pyrogram import types, raw
class GetFolders:
async def get_folders(
self: "pyrogram.Client",
) -> Optional[AsyncGenerator["types.Folder", None]]:
) -> AsyncGenerator["types.Folder", None]:
"""Get a user's folders with chats sequentially.
.. include:: /_includes/usable-by/users.rst

View File

@ -28,7 +28,7 @@ class GetForumTopics:
self: "pyrogram.Client",
chat_id: Union[int, str],
limit: int = 0
) -> Optional[AsyncGenerator["types.ForumTopic", None]]:
) -> AsyncGenerator["types.ForumTopic", None]:
"""Get one or more topic from a chat.
.. include:: /_includes/usable-by/users.rst

View File

@ -30,7 +30,7 @@ class GetChatAdminInviteLinks:
admin_id: Union[int, str],
revoked: bool = False,
limit: int = 0,
) -> Optional[AsyncGenerator["types.ChatInviteLink", None]]:
) -> AsyncGenerator["types.ChatInviteLink", None]:
"""Get the invite links created by an administrator in a chat.
.. note::

View File

@ -29,7 +29,7 @@ class GetChatInviteLinkJoiners:
chat_id: Union[int, str],
invite_link: str,
limit: int = 0
) -> Optional[AsyncGenerator["types.ChatJoiner", None]]:
) -> AsyncGenerator["types.ChatJoiner", None]:
"""Get the members who joined the chat with the invite link.
.. include:: /_includes/usable-by/users.rst

View File

@ -29,7 +29,7 @@ class GetChatJoinRequests:
chat_id: Union[int, str],
limit: int = 0,
query: str = ""
) -> Optional[AsyncGenerator["types.ChatJoiner", None]]:
) -> AsyncGenerator["types.ChatJoiner", None]:
"""Get the pending join requests of a chat.
.. include:: /_includes/usable-by/users.rst

View File

@ -57,7 +57,7 @@ class GetChatHistory:
offset: int = 0,
offset_id: int = 0,
offset_date: datetime = utils.zero_datetime()
) -> Optional[AsyncGenerator["types.Message", None]]:
) -> AsyncGenerator["types.Message", None]:
"""Get messages from a chat history.
The messages are returned in reverse chronological order.

View File

@ -28,7 +28,7 @@ class GetDiscussionReplies:
chat_id: Union[int, str],
message_id: int,
limit: int = 0,
) -> Optional[AsyncGenerator["types.Message", None]]:
) -> AsyncGenerator["types.Message", None]:
"""Get the message replies of a discussion thread.
.. include:: /_includes/usable-by/users.rst

View File

@ -30,7 +30,7 @@ class SearchGlobal:
query: str = "",
filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
limit: int = 0,
) -> Optional[AsyncGenerator["types.Message", None]]:
) -> AsyncGenerator["types.Message", None]:
"""Search messages globally from all of your chats.
If you want to get the messages count only, see :meth:`~pyrogram.Client.search_global_count`.

View File

@ -67,7 +67,7 @@ class SearchMessages:
filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
limit: int = 0,
from_user: Union[int, str] = None
) -> Optional[AsyncGenerator["types.Message", None]]:
) -> AsyncGenerator["types.Message", None]:
"""Search for text and media messages inside a specific chat.
If you want to get the messages count only, see :meth:`~pyrogram.Client.search_messages_count`.

View File

@ -29,7 +29,7 @@ class GetAllStories:
next: Optional[bool] = None,
hidden: Optional[bool] = None,
state: Optional[str] = None,
) -> Optional[AsyncGenerator["types.Story", None]]:
) -> AsyncGenerator["types.Story", None]:
"""Get all active stories.
.. include:: /_includes/usable-by/users.rst

View File

@ -27,7 +27,7 @@ class GetPeerStories:
async def get_peer_stories(
self: "pyrogram.Client",
chat_id: Union[int, str]
) -> Optional[AsyncGenerator["types.Story", None]]:
) -> AsyncGenerator["types.Story", None]:
"""Get all active stories from an user by using user identifiers.
.. include:: /_includes/usable-by/users.rst

View File

@ -30,7 +30,7 @@ class GetPinnedStories:
chat_id: Union[int, str],
offset_id: int = 0,
limit: int = 0,
) -> Optional[AsyncGenerator["types.Story", None]]:
) -> AsyncGenerator["types.Story", None]:
"""Get pinned stories stories.
.. include:: /_includes/usable-by/users.rst

View File

@ -29,7 +29,7 @@ class GetStoriesArchive:
chat_id: Union[int, str],
limit: int = 0,
offset_id: int = 0
) -> Optional[AsyncGenerator["types.Story", None]]:
) -> AsyncGenerator["types.Story", None]:
"""Get stories archive.
.. include:: /_includes/usable-by/users.rst

View File

@ -27,7 +27,7 @@ class GetChatPhotos:
self: "pyrogram.Client",
chat_id: Union[int, str],
limit: int = 0,
) -> Optional[AsyncGenerator["types.Photo", None]]:
) -> AsyncGenerator["types.Photo", None]:
"""Get a chat or a user profile photos sequentially.
.. include:: /_includes/usable-by/users-bots.rst

View File

@ -895,7 +895,7 @@ class Chat(Object):
query: str = "",
limit: int = 0,
filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH
) -> Optional[AsyncGenerator["types.ChatMember", None]]:
) -> AsyncGenerator["types.ChatMember", None]:
"""Bound method *get_members* of :obj:`~pyrogram.types.Chat`.
Use as a shortcut for: