Skip to content

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
clot27 committed Dec 15, 2022
1 parent a454dff commit 99d2456
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 31 deletions.
2 changes: 1 addition & 1 deletion telegram/_bot.py
Expand Up @@ -1805,7 +1805,7 @@ async def send_media_group(
caption: Optional[str] = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Sequence["MessageEntity"] = None,
) -> List[Message]:
) -> Tuple[Message, ...]:
"""Use this method to send a group of photos or videos as an album.
Note:
Expand Down
4 changes: 2 additions & 2 deletions telegram/_chat.py
Expand Up @@ -20,7 +20,7 @@
"""This module contains an object that represents a Telegram Chat."""
from datetime import datetime
from html import escape
from typing import TYPE_CHECKING, ClassVar, List, Optional, Sequence, Union
from typing import TYPE_CHECKING, ClassVar, List, Optional, Sequence, Tuple, Union

from telegram import constants
from telegram._chatlocation import ChatLocation
Expand Down Expand Up @@ -1292,7 +1292,7 @@ async def send_media_group(
caption: Optional[str] = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Sequence["MessageEntity"] = None,
) -> List["Message"]:
) -> Tuple["Message", ...]:
"""Shortcut for::
await bot.send_media_group(update.effective_chat.id, *args, **kwargs)
Expand Down
44 changes: 25 additions & 19 deletions telegram/_files/inputmedia.py
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""Base class for Telegram InputMedia Objects."""
from typing import List, Optional, Tuple, Union
from typing import Optional, Sequence, Union

from telegram._files.animation import Animation
from telegram._files.audio import Audio
Expand Down Expand Up @@ -55,15 +55,16 @@ class InputMedia(TelegramObject):
caption (:obj:`str`, optional): Caption of the media to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities
parsing.
caption_entities (List[:class:`telegram.MessageEntity`], optional): |caption_entities|
caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
|caption_entities|
parse_mode (:obj:`str`, optional): |parse_mode|
Attributes:
type (:obj:`str`): Type of the input media.
media (:obj:`str` | :class:`telegram.InputFile`): Media to send.
caption (:obj:`str`): Optional. Caption of the media to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional. List of special
entities that appear in the caption.
"""

Expand All @@ -74,7 +75,7 @@ def __init__(
media_type: str,
media: Union[str, InputFile, MediaType],
caption: str = None,
caption_entities: Union[List[MessageEntity], Tuple[MessageEntity, ...]] = None,
caption_entities: Sequence[MessageEntity] = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
*,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -124,7 +125,8 @@ class InputMediaAnimation(InputMedia):
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
parse_mode (:obj:`str`, optional): |parse_mode|
caption_entities (List[:class:`telegram.MessageEntity`], optional): |caption_entities|
caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
|caption_entities|
width (:obj:`int`, optional): Animation width.
height (:obj:`int`, optional): Animation height.
duration (:obj:`int`, optional): Animation duration in seconds.
Expand All @@ -134,7 +136,7 @@ class InputMediaAnimation(InputMedia):
media (:obj:`str` | :class:`telegram.InputFile`): Animation to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional. List of special
entities that appear in the caption.
thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send.
width (:obj:`int`): Optional. Animation width.
Expand All @@ -154,7 +156,7 @@ def __init__(
width: int = None,
height: int = None,
duration: int = None,
caption_entities: Union[List[MessageEntity], Tuple[MessageEntity, ...]] = None,
caption_entities: Sequence[MessageEntity] = None,
filename: str = None,
*,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -202,14 +204,15 @@ class InputMediaPhoto(InputMedia):
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
entities parsing.
parse_mode (:obj:`str`, optional): |parse_mode|
caption_entities (List[:class:`telegram.MessageEntity`], optional): |caption_entities|
caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
|caption_entities|
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.PHOTO`.
media (:obj:`str` | :class:`telegram.InputFile`): Photo to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional. List of special
entities that appear in the caption.
"""
Expand All @@ -221,7 +224,7 @@ def __init__(
media: Union[FileInput, PhotoSize],
caption: str = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Union[List[MessageEntity], Tuple[MessageEntity, ...]] = None,
caption_entities: Sequence[MessageEntity] = None,
filename: str = None,
*,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -266,7 +269,8 @@ class InputMediaVideo(InputMedia):
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
entities parsing.
parse_mode (:obj:`str`, optional): |parse_mode|
caption_entities (List[:class:`telegram.MessageEntity`], optional): |caption_entities|
caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
|caption_entities|
width (:obj:`int`, optional): Video width.
height (:obj:`int`, optional): Video height.
duration (:obj:`int`, optional): Video duration in seconds.
Expand All @@ -283,7 +287,7 @@ class InputMediaVideo(InputMedia):
media (:obj:`str` | :class:`telegram.InputFile`): Video file to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional. List of special
entities that appear in the caption.
width (:obj:`int`): Optional. Video width.
height (:obj:`int`): Optional. Video height.
Expand All @@ -306,7 +310,7 @@ def __init__(
supports_streaming: bool = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
caption_entities: Union[List[MessageEntity], Tuple[MessageEntity, ...]] = None,
caption_entities: Sequence[MessageEntity] = None,
filename: str = None,
*,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -361,7 +365,8 @@ class InputMediaAudio(InputMedia):
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
entities parsing.
parse_mode (:obj:`str`, optional): |parse_mode|
caption_entities (List[:class:`telegram.MessageEntity`], optional): |caption_entities|
caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
|caption_entities|
duration (:obj:`int`): Duration of the audio in seconds as defined by sender.
performer (:obj:`str`, optional): Performer of the audio as defined by sender or by audio
tags.
Expand All @@ -377,7 +382,7 @@ class InputMediaAudio(InputMedia):
media (:obj:`str` | :class:`telegram.InputFile`): Audio file to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional. List of special
entities that appear in the caption.
duration (:obj:`int`): Duration of the audio in seconds.
performer (:obj:`str`): Optional. Performer of the audio as defined by sender or by audio
Expand All @@ -398,7 +403,7 @@ def __init__(
duration: int = None,
performer: str = None,
title: str = None,
caption_entities: Union[List[MessageEntity], Tuple[MessageEntity, ...]] = None,
caption_entities: Sequence[MessageEntity] = None,
filename: str = None,
*,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -446,7 +451,8 @@ class InputMediaDocument(InputMedia):
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
entities parsing.
parse_mode (:obj:`str`, optional): |parse_mode|
caption_entities (List[:class:`telegram.MessageEntity`], optional): |caption_entities|
caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
|caption_entities|
thumb (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`, \
optional): |thumbdocstringnopath|
Expand All @@ -461,7 +467,7 @@ class InputMediaDocument(InputMedia):
media (:obj:`str` | :class:`telegram.InputFile`): File to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional. List of special
entities that appear in the caption.
thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send.
disable_content_type_detection (:obj:`bool`): Optional. Disables automatic server-side
Expand All @@ -479,7 +485,7 @@ def __init__(
caption: str = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
disable_content_type_detection: bool = None,
caption_entities: Union[List[MessageEntity], Tuple[MessageEntity, ...]] = None,
caption_entities: Sequence[MessageEntity] = None,
filename: str = None,
*,
api_kwargs: JSONDict = None,
Expand Down
4 changes: 2 additions & 2 deletions telegram/_message.py
Expand Up @@ -21,7 +21,7 @@
import datetime
import sys
from html import escape
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, Union

from telegram._chat import Chat
from telegram._dice import Dice
Expand Down Expand Up @@ -1095,7 +1095,7 @@ async def reply_media_group(
caption: Optional[str] = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Sequence["MessageEntity"] = None,
) -> List["Message"]:
) -> Tuple["Message", ...]:
"""Shortcut for::
await bot.send_media_group(update.effective_message.chat_id, *args, **kwargs)
Expand Down
21 changes: 18 additions & 3 deletions telegram/_poll.py
Expand Up @@ -89,11 +89,16 @@ class PollAnswer(TelegramObject):
option_ids (Sequence[:obj:`int`]): 0-based identifiers of answer options, chosen by the
user. May be empty if the user retracted their vote.
.. versionchanged:: 20.0
|sequenceclassargs|
Attributes:
poll_id (:obj:`str`): Unique poll identifier.
user (:class:`telegram.User`): The user, who changed the answer to the poll.
option_ids (Sequence[:obj:`int`]): Identifiers of answer options, chosen by the user.
.. versionchanged:: 20.0
|tupleclassattrs|
"""

__slots__ = ("option_ids", "user", "poll_id")
Expand Down Expand Up @@ -136,6 +141,10 @@ class Poll(TelegramObject):
question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
:tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
options (Sequence[:class:`PollOption`]): List of poll options.
.. versionchanged:: 20.0
|sequenceclassargs|
is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`.
Expand All @@ -162,7 +171,10 @@ class Poll(TelegramObject):
id (:obj:`str`): Unique poll identifier.
question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
:tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
options (Sequence[:class:`PollOption`]): List of poll options.
options (Tuple[:class:`PollOption`]): List of poll options.
.. versionchanged:: 20.0
|tupleclassattrs|
total_voter_count (:obj:`int`): Total number of users that voted in the poll.
is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
Expand All @@ -174,12 +186,15 @@ class Poll(TelegramObject):
explanation (:obj:`str`): Optional. Text that is shown when a user chooses an incorrect
answer or taps on the lamp icon in a quiz-style poll,
0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters.
explanation_entities (Sequence[:class:`telegram.MessageEntity`]): Special entities
explanation_entities (Tuple[:class:`telegram.MessageEntity`]): Special entities
like usernames, URLs, bot commands, etc. that appear in the :attr:`explanation`.
This list is empty if the message does not contain explanation entities.
.. versionchanged:: 20.0
This attribute is now always a (possibly empty) list and never :obj:`None`.
|tupleclassattrs|
.. versionchanged:: 20.0
This attribute is now always a (possibly empty) tuple and never :obj:`None`.
open_period (:obj:`int`): Optional. Amount of time in seconds the poll will be active
after creation.
close_date (:obj:`datetime.datetime`): Optional. Point in time when the poll will be
Expand Down
4 changes: 2 additions & 2 deletions telegram/_user.py
Expand Up @@ -19,7 +19,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram User."""
from datetime import datetime
from typing import TYPE_CHECKING, List, Optional, Sequence, Union
from typing import TYPE_CHECKING, List, Optional, Sequence, Tuple, Union

from telegram._inline.inlinekeyboardbutton import InlineKeyboardButton
from telegram._menubutton import MenuButton
Expand Down Expand Up @@ -482,7 +482,7 @@ async def send_media_group(
caption: Optional[str] = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Sequence["MessageEntity"] = None,
) -> List["Message"]:
) -> Tuple["Message", ...]:
"""Shortcut for::
await bot.send_media_group(update.effective_user.id, *args, **kwargs)
Expand Down
7 changes: 6 additions & 1 deletion telegram/_videochat.py
Expand Up @@ -91,9 +91,14 @@ class VideoChatParticipantsInvited(TelegramObject):
Args:
users (Sequence[:class:`telegram.User`]): New members that were invited to the video chat.
.. versionchanged:: 20.0
|sequenceclassargs|
Attributes:
users (Sequence[:class:`telegram.User`]): New members that were invited to the video chat.
users (Tuple[:class:`telegram.User`]): New members that were invited to the video chat.
.. versionchanged:: 20.0
|tupleclassattrs|
"""

__slots__ = ("users",)
Expand Down
11 changes: 10 additions & 1 deletion telegram/_webhookinfo.py
Expand Up @@ -58,6 +58,10 @@ class WebhookInfo(TelegramObject):
allowed_updates (Sequence[:obj:`str`], optional): A list of update types the bot is
subscribed to. Defaults to all update types, except
:attr:`telegram.Update.chat_member`.
.. versionchanged:: 20.0
|sequenceclassargs|
last_synchronization_error_date (:obj:`int`, optional): Unix time of the most recent error
that happened when trying to synchronize available updates with Telegram datacenters.
Expand All @@ -74,9 +78,14 @@ class WebhookInfo(TelegramObject):
most recent error that happened when trying to deliver an update via webhook.
max_connections (:obj:`int`): Optional. Maximum allowed number of simultaneous HTTPS
connections to the webhook for update delivery.
allowed_updates (Sequence[:obj:`str`]): Optional. A list of update types the bot is
allowed_updates (Tuple[:obj:`str`]): Optional. A list of update types the bot is
subscribed to. Defaults to all update types, except
:attr:`telegram.Update.chat_member`.
.. versionchanged:: 20.0
* |tupleclassattrs|
* |alwaystuple|
last_synchronization_error_date (:obj:`int`): Optional. Unix time of the most recent error
that happened when trying to synchronize available updates with Telegram datacenters.
Expand Down

0 comments on commit 99d2456

Please sign in to comment.