Change Union[type1, None] to Optional[type1] · pyrogram/pyrogram@a26e648 · GitHub
Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit a26e648

Browse files
Change Union[type1, None] to Optional[type1]
1 parent 1db4855 commit a26e648

35 files changed

Lines changed: 89 additions & 89 deletions

pyrogram/client.py

Lines changed: 3 additions & 3 deletions

pyrogram/methods/chats/set_slow_mode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union
19+
from typing import Union, Optional
2020

2121
from pyrogram import raw
2222
from pyrogram.scaffold import Scaffold
@@ -26,7 +26,7 @@ class SetSlowMode(Scaffold):
2626
async def set_slow_mode(
2727
self,
2828
chat_id: Union[int, str],
29-
seconds: Union[int, None]
29+
seconds: Optional[int]
3030
) -> bool:
3131
"""Set the slow mode interval for a chat.
3232

pyrogram/methods/chats/update_chat_username.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union
19+
from typing import Union, Optional
2020

2121
from pyrogram import raw
2222
from pyrogram.scaffold import Scaffold
@@ -26,7 +26,7 @@ class UpdateChatUsername(Scaffold):
2626
async def update_chat_username(
2727
self,
2828
chat_id: Union[int, str],
29-
username: Union[str, None]
29+
username: Optional[str]
3030
) -> bool:
3131
"""Update a channel or a supergroup username.
3232

pyrogram/methods/messages/download_media.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import os
2121
import time
2222
from datetime import datetime
23-
from typing import Union
23+
from typing import Union, Optional
2424

2525
from pyrogram import types
2626
from pyrogram.file_id import FileId, FileType, PHOTO_TYPES
@@ -37,7 +37,7 @@ async def download_media(
3737
block: bool = True,
3838
progress: callable = None,
3939
progress_args: tuple = ()
40-
) -> Union[str, None]:
40+
) -> Optional[str]:
4141
"""Download the media from a message.
4242
4343
Parameters:

pyrogram/methods/messages/edit_inline_caption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union
19+
from typing import Optional
2020

2121
from pyrogram import types
2222
from pyrogram.scaffold import Scaffold
@@ -27,7 +27,7 @@ async def edit_inline_caption(
2727
self,
2828
inline_message_id: str,
2929
caption: str,
30-
parse_mode: Union[str, None] = object,
30+
parse_mode: Optional[str] = object,
3131
reply_markup: "types.InlineKeyboardMarkup" = None
3232
) -> bool:
3333
"""Edit the caption of inline media messages.

pyrogram/methods/messages/edit_inline_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union
19+
from typing import Optional
2020

2121
from pyrogram import raw
2222
from pyrogram import types
@@ -30,7 +30,7 @@ async def edit_inline_text(
3030
self,
3131
inline_message_id: str,
3232
text: str,
33-
parse_mode: Union[str, None] = object,
33+
parse_mode: Optional[str] = object,
3434
disable_web_page_preview: bool = None,
3535
reply_markup: "types.InlineKeyboardMarkup" = None
3636
) -> bool:

pyrogram/methods/messages/edit_message_caption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union, List
19+
from typing import Union, List, Optional
2020

2121
from pyrogram import types
2222
from pyrogram.scaffold import Scaffold
@@ -28,7 +28,7 @@ async def edit_message_caption(
2828
chat_id: Union[int, str],
2929
message_id: int,
3030
caption: str,
31-
parse_mode: Union[str, None] = object,
31+
parse_mode: Optional[str] = object,
3232
caption_entities: List["types.MessageEntity"] = None,
3333
reply_markup: "types.InlineKeyboardMarkup" = None
3434
) -> "types.Message":

pyrogram/methods/messages/edit_message_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union, List
19+
from typing import Union, List, Optional
2020

2121
from pyrogram import raw
2222
from pyrogram import types
@@ -30,7 +30,7 @@ async def edit_message_text(
3030
chat_id: Union[int, str],
3131
message_id: int,
3232
text: str,
33-
parse_mode: Union[str, None] = object,
33+
parse_mode: Optional[str] = object,
3434
entities: List["types.MessageEntity"] = None,
3535
disable_web_page_preview: bool = None,
3636
reply_markup: "types.InlineKeyboardMarkup" = None

pyrogram/methods/messages/send_animation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import os
2020
import re
21-
from typing import Union, BinaryIO, List
21+
from typing import Union, BinaryIO, List, Optional
2222

2323
from pyrogram import StopTransmission
2424
from pyrogram import raw
@@ -36,7 +36,7 @@ async def send_animation(
3636
animation: Union[str, BinaryIO],
3737
caption: str = "",
3838
unsave: bool = False,
39-
parse_mode: Union[str, None] = object,
39+
parse_mode: Optional[str] = object,
4040
caption_entities: List["types.MessageEntity"] = None,
4141
duration: int = 0,
4242
width: int = 0,
@@ -54,7 +54,7 @@ async def send_animation(
5454
] = None,
5555
progress: callable = None,
5656
progress_args: tuple = ()
57-
) -> Union["types.Message", None]:
57+
) -> Optional["types.Message"]:
5858
"""Send animation files (animation or H.264/MPEG-4 AVC video without sound).
5959
6060
Parameters:

pyrogram/methods/messages/send_audio.py

Lines changed: 3 additions & 3 deletions

0 commit comments

Comments
 (0)