Skip to content

Commit

Permalink
improve type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Sep 27, 2024
1 parent d38f73f commit 114489f
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 39 deletions.
4 changes: 2 additions & 2 deletions tgram/bound/callback_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def answer(
async def edit_message_text(
self: "tgram.types.CallbackQuery",
text: str,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
entities: List["tgram.types.MessageEntity"] = None,
link_preview_options: "tgram.types.LinkPreviewOptions" = None,
reply_markup: "tgram.types.InlineKeyboardMarkup" = None,
Expand All @@ -43,7 +43,7 @@ async def edit_message_text(
async def edit_message_caption(
self: "tgram.types.CallbackQuery",
caption: str = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
reply_markup: "tgram.types.InlineKeyboardMarkup" = None,
Expand Down
24 changes: 12 additions & 12 deletions tgram/bound/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def reply_text(
self: "tgram.types.Message",
text: str,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
entities: List["tgram.types.MessageEntity"] = None,
link_preview_options: "tgram.types.LinkPreviewOptions" = None,
disable_notification: bool = None,
Expand Down Expand Up @@ -91,7 +91,7 @@ async def reply_photo(
photo: Union[Path, bytes, str],
caption: str = None,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
Expand Down Expand Up @@ -129,7 +129,7 @@ async def reply_audio(
audio: Union[Path, bytes, str],
caption: str = None,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
duration: int = None,
performer: str = None,
Expand Down Expand Up @@ -172,7 +172,7 @@ async def reply_document(
message_thread_id: int = None,
thumbnail: Union[Path, bytes, str] = None,
caption: str = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
disable_content_type_detection: bool = None,
disable_notification: bool = None,
Expand Down Expand Up @@ -213,7 +213,7 @@ async def reply_video(
height: int = None,
thumbnail: Union[Path, bytes, str] = None,
caption: str = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
Expand Down Expand Up @@ -261,7 +261,7 @@ async def reply_animation(
height: int = None,
thumbnail: Union[Path, bytes, str] = None,
caption: str = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
Expand Down Expand Up @@ -303,7 +303,7 @@ async def reply_voice(
voice: Union[Path, bytes, str],
caption: str = None,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
duration: int = None,
disable_notification: bool = None,
Expand Down Expand Up @@ -432,7 +432,7 @@ async def reply_paid_media(
star_count: int,
media: List["tgram.types.InputPaidMedia"],
caption: str = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
Expand Down Expand Up @@ -671,7 +671,7 @@ async def reply_media_from_file_id(
file_id: str,
caption: str = None,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
Expand Down Expand Up @@ -707,7 +707,7 @@ async def copy(
chat_id: Union[int, str],
caption: str = None,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
Expand Down Expand Up @@ -740,7 +740,7 @@ async def copy(
async def edit_text(
self: "tgram.types.Message",
text: str,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
entities: List["tgram.types.MessageEntity"] = None,
link_preview_options: "tgram.types.LinkPreviewOptions" = None,
reply_markup: "tgram.types.InlineKeyboardMarkup" = None,
Expand All @@ -761,7 +761,7 @@ async def edit_text(
async def edit_caption(
self: "tgram.types.Message",
caption: str = None,
parse_mode: str = None,
parse_mode: "tgram.types.ParseMode" = None,
caption_entities: List["tgram.types.MessageEntity"] = None,
show_caption_above_media: bool = None,
reply_markup: "tgram.types.InlineKeyboardMarkup" = None,
Expand Down
3 changes: 2 additions & 1 deletion tgram/methods/copy_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ParseMode


class CopyMessage:
Expand All @@ -18,7 +19,7 @@ async def copy_message(
message_id: int,
message_thread_id: int = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
Expand Down
3 changes: 2 additions & 1 deletion tgram/methods/edit_message_caption.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from tgram.types import InlineKeyboardMarkup
from tgram.types import Message
from tgram.types import MessageEntity
from tgram.types import ParseMode


class EditMessageCaption:
Expand All @@ -14,7 +15,7 @@ async def edit_message_caption(
message_id: int = None,
inline_message_id: str = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
reply_markup: InlineKeyboardMarkup = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/edit_message_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from tgram.types import InlineKeyboardMarkup
from tgram.types import LinkPreviewOptions
from tgram.types import Message
from tgram.types import MessageEntity
from tgram.types import MessageEntity, ParseMode


class EditMessageText:
Expand All @@ -15,7 +15,7 @@ async def edit_message_text(
chat_id: Union[int, str] = None,
message_id: int = None,
inline_message_id: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
entities: List[MessageEntity] = None,
link_preview_options: LinkPreviewOptions = None,
reply_markup: InlineKeyboardMarkup = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode
from pathlib import Path
from tgram.utils import get_file_path

Expand All @@ -24,7 +24,7 @@ async def send_animation(
height: int = None,
thumbnail: Union[Path, bytes, str] = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode
from pathlib import Path
from tgram.utils import get_file_path

Expand All @@ -20,7 +20,7 @@ async def send_audio(
business_connection_id: str = None,
message_thread_id: int = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
duration: int = None,
performer: str = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode
from pathlib import Path
from tgram.utils import get_file_path

Expand All @@ -21,7 +21,7 @@ async def send_document(
message_thread_id: int = None,
thumbnail: Union[Path, bytes, str] = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
disable_content_type_detection: bool = None,
disable_notification: bool = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_media_from_file_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode

from tgram import utils

Expand All @@ -20,7 +20,7 @@ async def send_media_from_file_id(
business_connection_id: str = None,
message_thread_id: int = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode


class SendMessage:
Expand All @@ -18,7 +18,7 @@ async def send_message(
text: str,
business_connection_id: str = None,
message_thread_id: int = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
entities: List[MessageEntity] = None,
link_preview_options: LinkPreviewOptions = None,
disable_notification: bool = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_paid_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode

from tgram.utils import convert_input_media

Expand All @@ -21,7 +21,7 @@ async def send_paid_media(
media: List[InputPaidMedia],
payload: str = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
disable_notification: bool = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode
from pathlib import Path
from tgram.utils import get_file_path

Expand All @@ -20,7 +20,7 @@ async def send_photo(
business_connection_id: str = None,
message_thread_id: int = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
Expand Down
6 changes: 3 additions & 3 deletions tgram/methods/send_poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode


class SendPoll:
Expand All @@ -19,14 +19,14 @@ async def send_poll(
options: List[InputPollOption],
business_connection_id: str = None,
message_thread_id: int = None,
question_parse_mode: str = None,
question_parse_mode: ParseMode = None,
question_entities: List[MessageEntity] = None,
is_anonymous: bool = None,
type: str = None,
allows_multiple_answers: bool = None,
correct_option_id: int = None,
explanation: str = None,
explanation_parse_mode: str = None,
explanation_parse_mode: ParseMode = None,
explanation_entities: List[MessageEntity] = None,
open_period: int = None,
close_date: int = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode
from pathlib import Path
from tgram.utils import get_file_path

Expand All @@ -24,7 +24,7 @@ async def send_video(
height: int = None,
thumbnail: Union[Path, bytes, str] = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
show_caption_above_media: bool = None,
has_spoiler: bool = None,
Expand Down
4 changes: 2 additions & 2 deletions tgram/methods/send_voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tgram.types import MessageEntity
from tgram.types import ReplyKeyboardMarkup
from tgram.types import ReplyKeyboardRemove
from tgram.types import ReplyParameters
from tgram.types import ReplyParameters, ParseMode
from pathlib import Path
from tgram.utils import get_file_path

Expand All @@ -20,7 +20,7 @@ async def send_voice(
business_connection_id: str = None,
message_thread_id: int = None,
caption: str = None,
parse_mode: str = None,
parse_mode: ParseMode = None,
caption_entities: List[MessageEntity] = None,
duration: int = None,
disable_notification: bool = None,
Expand Down
1 change: 1 addition & 0 deletions tgram/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,5 @@
"WebAppInfo",
"WebhookInfo",
"WriteAccessAllowed",
"ParseMode",
]

0 comments on commit 114489f

Please sign in to comment.