Rename Entity type hint

This commit is contained in:
Lonami Exo 2022-03-02 12:38:59 +01:00
parent c3cefef37c
commit 68d07beb21
9 changed files with 77 additions and 77 deletions

View File

@ -10,10 +10,10 @@ if typing.TYPE_CHECKING:
async def inline_query(
self: 'TelegramClient',
bot: 'hints.EntityLike',
bot: 'hints.DialogLike',
query: str,
*,
dialog: 'hints.EntityLike' = None,
dialog: 'hints.DialogLike' = None,
offset: str = None,
geo_point: '_tl.GeoPoint' = None) -> _custom.InlineResults:
bot = await self.get_input_entity(bot)

View File

@ -372,7 +372,7 @@ class _ProfilePhotoIter(requestiter.RequestIter):
def get_participants(
self: 'TelegramClient',
chat: 'hints.EntityLike',
chat: 'hints.DialogLike',
limit: float = (),
*,
search: str = '',
@ -388,13 +388,13 @@ def get_participants(
def get_admin_log(
self: 'TelegramClient',
chat: 'hints.EntityLike',
chat: 'hints.DialogLike',
limit: float = (),
*,
max_id: int = 0,
min_id: int = 0,
search: str = None,
admins: 'hints.EntitiesLike' = None,
admins: 'hints.DialogsLike' = None,
join: bool = None,
leave: bool = None,
invite: bool = None,
@ -438,7 +438,7 @@ def get_admin_log(
def get_profile_photos(
self: 'TelegramClient',
profile: 'hints.EntityLike',
profile: 'hints.DialogLike',
limit: int = (),
*,
offset: int = 0,
@ -454,7 +454,7 @@ def get_profile_photos(
def action(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
action: 'typing.Union[str, _tl.TypeSendMessageAction]',
*,
delay: float = 4,
@ -466,8 +466,8 @@ def action(
async def edit_admin(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'hints.EntityLike',
chat: 'hints.DialogLike',
user: 'hints.DialogLike',
*,
change_info: bool = None,
post_messages: bool = None,
@ -529,8 +529,8 @@ async def edit_admin(
async def edit_permissions(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'typing.Optional[hints.EntityLike]' = None,
chat: 'hints.DialogLike',
user: 'typing.Optional[hints.DialogLike]' = None,
until_date: 'hints.DateLike' = None,
*,
view_messages: bool = True,
@ -583,8 +583,8 @@ async def edit_permissions(
async def kick_participant(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'typing.Optional[hints.EntityLike]'
chat: 'hints.DialogLike',
user: 'typing.Optional[hints.DialogLike]'
):
entity = await self.get_input_entity(chat)
user = await self.get_input_entity(user)
@ -617,8 +617,8 @@ async def kick_participant(
async def get_permissions(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'hints.EntityLike' = None
chat: 'hints.DialogLike',
user: 'hints.DialogLike' = None
) -> 'typing.Optional[_custom.ParticipantPermissions]':
entity = await self.get_entity(chat)
@ -650,7 +650,7 @@ async def get_permissions(
async def get_stats(
self: 'TelegramClient',
chat: 'hints.EntityLike',
chat: 'hints.DialogLike',
message: 'typing.Union[int, _tl.Message]' = None,
):
entity = await self.get_input_entity(chat)

View File

@ -146,7 +146,7 @@ def get_dialogs(
*,
offset_date: 'hints.DateLike' = None,
offset_id: int = 0,
offset_peer: 'hints.EntityLike' = _tl.InputPeerEmpty(),
offset_peer: 'hints.DialogLike' = _tl.InputPeerEmpty(),
ignore_pinned: bool = False,
ignore_migrated: bool = False,
folder: int = None,
@ -165,7 +165,7 @@ def get_dialogs(
def get_drafts(
self: 'TelegramClient',
dialog: 'hints.EntitiesLike' = None
dialog: 'hints.DialogsLike' = None
) -> _DraftsIter:
limit = None
if dialog:
@ -178,7 +178,7 @@ def get_drafts(
async def delete_dialog(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
*,
revoke: bool = False
):

View File

@ -178,7 +178,7 @@ class _GenericDownloadIter(_DirectDownloadIter):
async def download_profile_photo(
self: 'TelegramClient',
profile: 'hints.EntityLike',
profile: 'hints.DialogLike',
file: 'hints.FileLike' = None,
*,
thumb,

View File

@ -322,7 +322,7 @@ class _IDsIter(requestiter.RequestIter):
self.buffer.append(_custom.Message._new(self.client, message, entities, self._entity))
async def _get_peer(self: 'TelegramClient', input_peer: 'hints.EntityLike'):
async def _get_peer(self: 'TelegramClient', input_peer: 'hints.DialogLike'):
try:
return utils.get_peer(input_peer)
except TypeError:
@ -332,7 +332,7 @@ async def _get_peer(self: 'TelegramClient', input_peer: 'hints.EntityLike'):
def get_messages(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
limit: float = (),
*,
offset_date: 'hints.DateLike' = None,
@ -342,7 +342,7 @@ def get_messages(
add_offset: int = 0,
search: str = None,
filter: 'typing.Union[_tl.TypeMessagesFilter, typing.Type[_tl.TypeMessagesFilter]]' = None,
from_user: 'hints.EntityLike' = None,
from_user: 'hints.DialogLike' = None,
wait_time: float = None,
ids: 'typing.Union[int, typing.Sequence[int]]' = None,
reverse: bool = False,
@ -383,7 +383,7 @@ def get_messages(
async def _get_comment_data(
self: 'TelegramClient',
entity: 'hints.EntityLike',
entity: 'hints.DialogLike',
message: 'typing.Union[int, _tl.Message]'
):
r = await self(_tl.fn.messages.GetDiscussionMessage(
@ -396,7 +396,7 @@ async def _get_comment_data(
async def send_message(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'hints.MessageLike' = '',
*,
# - Message contents
@ -428,7 +428,7 @@ async def send_message(
ttl: int = None,
# - Send options
reply_to: 'typing.Union[int, _tl.Message]' = None,
send_as: 'hints.EntityLike' = None,
send_as: 'hints.DialogLike' = None,
clear_draft: bool = False,
background: bool = None,
noforwards: bool = None,
@ -525,9 +525,9 @@ async def send_message(
async def forward_messages(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
messages: 'typing.Union[typing.Sequence[hints.MessageIDLike]]',
from_dialog: 'hints.EntityLike' = None,
from_dialog: 'hints.DialogLike' = None,
*,
background: bool = None,
with_my_score: bool = None,
@ -535,7 +535,7 @@ async def forward_messages(
as_album: bool = None,
schedule: 'hints.DateLike' = None,
noforwards: bool = None,
send_as: 'hints.EntityLike' = None
send_as: 'hints.DialogLike' = None
) -> 'typing.Sequence[_tl.Message]':
if as_album is not None:
warnings.warn('the as_album argument is deprecated and no longer has any effect')
@ -588,7 +588,7 @@ async def forward_messages(
async def edit_message(
self: 'TelegramClient',
dialog: 'typing.Union[hints.EntityLike, _tl.Message]',
dialog: 'typing.Union[hints.DialogLike, _tl.Message]',
message: 'hints.MessageLike' = None,
text: str = None,
*,
@ -648,7 +648,7 @@ async def edit_message(
async def delete_messages(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
messages: 'typing.Union[typing.Sequence[hints.MessageIDLike]]',
*,
revoke: bool = True) -> 'typing.Sequence[_tl.messages.AffectedMessages]':
@ -677,7 +677,7 @@ async def delete_messages(
async def mark_read(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'hints.MessageIDLike' = None,
*,
clear_mentions: bool = False,
@ -707,7 +707,7 @@ async def mark_read(
async def pin_message(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'typing.Optional[hints.MessageIDLike]',
*,
notify: bool = False,
@ -717,7 +717,7 @@ async def pin_message(
async def unpin_message(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'typing.Optional[hints.MessageIDLike]' = None,
*,
notify: bool = False
@ -752,7 +752,7 @@ async def _pin(self, entity, message, *, unpin, notify=False, pm_oneside=False):
async def send_reaction(
self: 'TelegramClient',
entity: 'hints.EntityLike',
entity: 'hints.DialogLike',
message: 'hints.MessageIDLike',
reaction: typing.Optional[str] = None,
big: bool = False

View File

@ -701,10 +701,10 @@ class TelegramClient:
@forward_call(bots.inline_query)
async def inline_query(
self: 'TelegramClient',
bot: 'hints.EntityLike',
bot: 'hints.DialogLike',
query: str,
*,
dialog: 'hints.EntityLike' = None,
dialog: 'hints.DialogLike' = None,
offset: str = None,
geo_point: '_tl.GeoPoint' = None) -> _custom.InlineResults:
"""
@ -754,7 +754,7 @@ class TelegramClient:
@forward_call(chats.get_participants)
def get_participants(
self: 'TelegramClient',
chat: 'hints.EntityLike',
chat: 'hints.DialogLike',
limit: float = (),
*,
search: str = '',
@ -822,13 +822,13 @@ class TelegramClient:
@forward_call(chats.get_admin_log)
def get_admin_log(
self: 'TelegramClient',
chat: 'hints.EntityLike',
chat: 'hints.DialogLike',
limit: float = (),
*,
max_id: int = 0,
min_id: int = 0,
search: str = None,
admins: 'hints.EntitiesLike' = None,
admins: 'hints.DialogsLike' = None,
join: bool = None,
leave: bool = None,
invite: bool = None,
@ -957,7 +957,7 @@ class TelegramClient:
@forward_call(chats.get_profile_photos)
def get_profile_photos(
self: 'TelegramClient',
profile: 'hints.EntityLike',
profile: 'hints.DialogLike',
limit: int = (),
*,
offset: int = 0,
@ -1005,7 +1005,7 @@ class TelegramClient:
@forward_call(chats.action)
def action(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
action: 'typing.Union[str, _tl.TypeSendMessageAction]',
*,
delay: float = 4,
@ -1083,8 +1083,8 @@ class TelegramClient:
@forward_call(chats.edit_admin)
async def edit_admin(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'hints.EntityLike',
chat: 'hints.DialogLike',
user: 'hints.DialogLike',
*,
change_info: bool = None,
post_messages: bool = None,
@ -1189,8 +1189,8 @@ class TelegramClient:
@forward_call(chats.edit_permissions)
async def edit_permissions(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'typing.Optional[hints.EntityLike]' = None,
chat: 'hints.DialogLike',
user: 'typing.Optional[hints.DialogLike]' = None,
until_date: 'hints.DateLike' = None,
*,
view_messages: bool = True,
@ -1306,8 +1306,8 @@ class TelegramClient:
@forward_call(chats.kick_participant)
async def kick_participant(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'typing.Optional[hints.EntityLike]'
chat: 'hints.DialogLike',
user: 'typing.Optional[hints.DialogLike]'
):
"""
Kicks a user from a chat.
@ -1345,8 +1345,8 @@ class TelegramClient:
@forward_call(chats.get_permissions)
async def get_permissions(
self: 'TelegramClient',
chat: 'hints.EntityLike',
user: 'hints.EntityLike' = None
chat: 'hints.DialogLike',
user: 'hints.DialogLike' = None
) -> 'typing.Optional[_custom.ParticipantPermissions]':
"""
Fetches the permissions of a user in a specific chat or channel or
@ -1383,7 +1383,7 @@ class TelegramClient:
@forward_call(chats.get_stats)
async def get_stats(
self: 'TelegramClient',
chat: 'hints.EntityLike',
chat: 'hints.DialogLike',
message: 'typing.Union[int, _tl.Message]' = None,
):
"""
@ -1437,7 +1437,7 @@ class TelegramClient:
*,
offset_date: 'hints.DateLike' = None,
offset_id: int = 0,
offset_peer: 'hints.EntityLike' = _tl.InputPeerEmpty(),
offset_peer: 'hints.DialogLike' = _tl.InputPeerEmpty(),
ignore_pinned: bool = False,
ignore_migrated: bool = False,
folder: int = None,
@ -1523,7 +1523,7 @@ class TelegramClient:
@forward_call(dialogs.get_drafts)
def get_drafts(
self: 'TelegramClient',
dialog: 'hints.EntitiesLike' = None
dialog: 'hints.DialogsLike' = None
) -> dialogs._DraftsIter:
"""
Iterator over draft messages.
@ -1531,7 +1531,7 @@ class TelegramClient:
The order is unspecified.
Arguments
dialog (`hints.EntitiesLike`, optional):
dialog (`hints.DialogsLike`, optional):
The dialog or dialogs for which to fetch the draft messages.
If left unspecified, all draft messages will be returned.
@ -1557,7 +1557,7 @@ class TelegramClient:
@forward_call(dialogs.delete_dialog)
async def delete_dialog(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
*,
revoke: bool = False
):
@ -1606,7 +1606,7 @@ class TelegramClient:
@forward_call(downloads.download_profile_photo)
async def download_profile_photo(
self: 'TelegramClient',
profile: 'hints.EntityLike',
profile: 'hints.DialogLike',
file: 'hints.FileLike' = None,
*,
thumb: typing.Union[str, enums.Size] = (),
@ -1826,7 +1826,7 @@ class TelegramClient:
@forward_call(messages.get_messages)
def get_messages(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
limit: float = (),
*,
offset_date: 'hints.DateLike' = None,
@ -1836,7 +1836,7 @@ class TelegramClient:
add_offset: int = 0,
search: str = None,
filter: 'typing.Union[_tl.TypeMessagesFilter, typing.Type[_tl.TypeMessagesFilter]]' = None,
from_user: 'hints.EntityLike' = None,
from_user: 'hints.DialogLike' = None,
wait_time: float = None,
ids: 'typing.Union[int, typing.Sequence[int]]' = None,
reverse: bool = False,
@ -2025,7 +2025,7 @@ class TelegramClient:
@forward_call(messages.send_message)
async def send_message(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'hints.MessageLike' = '',
*,
# - Message contents
@ -2235,9 +2235,9 @@ class TelegramClient:
@forward_call(messages.forward_messages)
async def forward_messages(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
messages: 'typing.Union[typing.Sequence[hints.MessageIDLike]]',
from_dialog: 'hints.EntityLike' = None,
from_dialog: 'hints.DialogLike' = None,
*,
background: bool = None,
with_my_score: bool = None,
@ -2317,7 +2317,7 @@ class TelegramClient:
@forward_call(messages.edit_message)
async def edit_message(
self: 'TelegramClient',
dialog: 'typing.Union[hints.EntityLike, _tl.Message]',
dialog: 'typing.Union[hints.DialogLike, _tl.Message]',
message: 'hints.MessageLike',
text: str = None,
*,
@ -2446,7 +2446,7 @@ class TelegramClient:
@forward_call(messages.delete_messages)
async def delete_messages(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
messages: 'typing.Union[typing.Sequence[hints.MessageIDLike]]',
*,
revoke: bool = True) -> 'typing.Sequence[_tl.messages.AffectedMessages]':
@ -2498,7 +2498,7 @@ class TelegramClient:
@forward_call(messages.mark_read)
async def mark_read(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'hints.MessageIDLike' = None,
*,
clear_mentions: bool = False) -> bool:
@ -2550,7 +2550,7 @@ class TelegramClient:
@forward_call(messages.pin_message)
async def pin_message(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'typing.Optional[hints.MessageIDLike]',
*,
notify: bool = False,
@ -2591,7 +2591,7 @@ class TelegramClient:
@forward_call(messages.unpin_message)
async def unpin_message(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
message: 'typing.Optional[hints.MessageIDLike]' = None,
*,
notify: bool = False
@ -2968,7 +2968,7 @@ class TelegramClient:
@forward_call(uploads.send_file)
async def send_file(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
file: 'typing.Union[hints.FileLike, typing.Sequence[hints.FileLike]]',
*,
caption: typing.Union[str, typing.Sequence[str]] = None,
@ -3439,7 +3439,7 @@ class TelegramClient:
@forward_call(messages._get_comment_data)
async def _get_comment_data(
self: 'TelegramClient',
entity: 'hints.EntityLike',
entity: 'hints.DialogLike',
message: 'typing.Union[int, _tl.Message]'
):
pass

View File

@ -79,7 +79,7 @@ def _resize_photo_if_needed(
async def send_file(
self: 'TelegramClient',
dialog: 'hints.EntityLike',
dialog: 'hints.DialogLike',
file: typing.Optional[hints.FileLike] = None,
*,
# - Message contents
@ -114,7 +114,7 @@ async def send_file(
clear_draft: bool = False,
background: bool = None,
noforwards: bool = None,
send_as: 'hints.EntityLike' = None,
send_as: 'hints.DialogLike' = None,
schedule: 'hints.DateLike' = None,
comment_to: 'typing.Union[int, _tl.Message]' = None,
) -> '_tl.Message':

View File

@ -8,19 +8,19 @@ from ..types import _custom
Phone = str
Username = str
PeerID = int
Entity = typing.Union[_tl.User, _tl.Chat, _tl.Channel]
FullEntity = typing.Union[_tl.UserFull, _tl.messages.ChatFull, _tl.ChatFull, _tl.ChannelFull]
Dialog = typing.Union[_tl.User, _tl.Chat, _tl.Channel]
FullDialog = typing.Union[_tl.UserFull, _tl.messages.ChatFull, _tl.ChatFull, _tl.ChannelFull]
EntityLike = typing.Union[
DialogLike = typing.Union[
Phone,
Username,
PeerID,
_tl.TypePeer,
_tl.TypeInputPeer,
Entity,
FullEntity
Dialog,
FullDialog
]
EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]]
DialogsLike = typing.Union[DialogLike, typing.Sequence[DialogsLike]]
ButtonLike = typing.Union[_tl.TypeKeyboardButton, _custom.Button]
MarkupLike = typing.Union[

View File

@ -138,7 +138,7 @@ class Button:
If no `url` is specified, it will default to `text`.
Args:
bot (`hints.EntityLike`):
bot (`hints.DialogLike`):
The bot that requires this authorization. By default, this
is the bot that is currently logged in (itself), although
you may pass a different input peer.