Skip to content

Commit def3bda

Browse files
committed
Reformat code
1 parent c3470b2 commit def3bda

12 files changed

Lines changed: 116 additions & 128 deletions

File tree

compiler/api/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ def start():
171171
shutil.rmtree("{}/functions".format(DESTINATION), ignore_errors=True)
172172

173173
with open("{}/source/auth_key.tl".format(HOME), encoding="utf-8") as auth, \
174-
open("{}/source/sys_msgs.tl".format(HOME), encoding="utf-8") as system, \
175-
open("{}/source/main_api.tl".format(HOME), encoding="utf-8") as api:
174+
open("{}/source/sys_msgs.tl".format(HOME), encoding="utf-8") as system, \
175+
open("{}/source/main_api.tl".format(HOME), encoding="utf-8") as api:
176176
schema = (auth.read() + system.read() + api.read()).splitlines()
177177

178178
with open("{}/template/mtproto.txt".format(HOME), encoding="utf-8") as f:

compiler/error/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def start():
7373
f_init.write("from .{}_{} import *\n".format(name.lower(), code))
7474

7575
with open("{}/source/{}".format(HOME, i), encoding="utf-8") as f_csv, \
76-
open("{}/{}_{}.py".format(DEST, name.lower(), code), "w", encoding="utf-8") as f_class:
76+
open("{}/{}_{}.py".format(DEST, name.lower(), code), "w", encoding="utf-8") as f_class:
7777
reader = csv.reader(f_csv, delimiter="\t")
7878

7979
super_class = caml(name)

pyrogram/client/methods/chats/restrict_chat.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525

2626
class RestrictChat(BaseClient):
2727
def restrict_chat(
28-
self,
29-
chat_id: Union[int, str],
30-
can_send_messages: bool = False,
31-
can_send_media_messages: bool = False,
32-
can_send_other_messages: bool = False,
33-
can_add_web_page_previews: bool = False,
34-
can_send_polls: bool = False,
35-
can_change_info: bool = False,
36-
can_invite_users: bool = False,
37-
can_pin_messages: bool = False
28+
self,
29+
chat_id: Union[int, str],
30+
can_send_messages: bool = False,
31+
can_send_media_messages: bool = False,
32+
can_send_other_messages: bool = False,
33+
can_add_web_page_previews: bool = False,
34+
can_send_polls: bool = False,
35+
can_change_info: bool = False,
36+
can_invite_users: bool = False,
37+
can_pin_messages: bool = False
3838
) -> Chat:
3939
"""Use this method to restrict a chat.
4040
Pass True for all boolean parameters to lift restrictions from a chat.

pyrogram/client/methods/chats/restrict_chat_member.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525

2626
class RestrictChatMember(BaseClient):
2727
def restrict_chat_member(
28-
self,
29-
chat_id: Union[int, str],
30-
user_id: Union[int, str],
31-
until_date: int = 0,
32-
can_send_messages: bool = False,
33-
can_send_media_messages: bool = False,
34-
can_send_other_messages: bool = False,
35-
can_add_web_page_previews: bool = False,
36-
can_send_polls: bool = False,
37-
can_change_info: bool = False,
38-
can_invite_users: bool = False,
39-
can_pin_messages: bool = False
28+
self,
29+
chat_id: Union[int, str],
30+
user_id: Union[int, str],
31+
until_date: int = 0,
32+
can_send_messages: bool = False,
33+
can_send_media_messages: bool = False,
34+
can_send_other_messages: bool = False,
35+
can_add_web_page_previews: bool = False,
36+
can_send_polls: bool = False,
37+
can_change_info: bool = False,
38+
can_invite_users: bool = False,
39+
can_pin_messages: bool = False
4040
) -> Chat:
4141
"""Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for
4242
this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift

pyrogram/client/methods/chats/update_chat_username.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def update_chat_username(self,
4545
"""
4646

4747
peer = self.resolve_peer(chat_id)
48-
48+
4949
if isinstance(peer, types.InputPeerChannel):
5050
return bool(
5151
self.send(

pyrogram/client/methods/messages/download_media.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ def download_media(self,
106106
else:
107107
raise ValueError(error_message)
108108
elif isinstance(message, (
109-
pyrogram.Photo,
110-
pyrogram.PhotoSize,
111-
pyrogram.Audio,
112-
pyrogram.Document,
113-
pyrogram.Video,
114-
pyrogram.Voice,
115-
pyrogram.VideoNote,
116-
pyrogram.Sticker,
117-
pyrogram.Animation
109+
pyrogram.Photo,
110+
pyrogram.PhotoSize,
111+
pyrogram.Audio,
112+
pyrogram.Document,
113+
pyrogram.Video,
114+
pyrogram.Voice,
115+
pyrogram.VideoNote,
116+
pyrogram.Sticker,
117+
pyrogram.Animation
118118
)):
119119
if isinstance(message, pyrogram.Photo):
120120
media = pyrogram.Document(

pyrogram/client/methods/messages/send_cached_media.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@
2828

2929
class SendCachedMedia(BaseClient):
3030
def send_cached_media(
31-
self,
32-
chat_id: Union[int, str],
33-
file_id: str,
34-
caption: str = "",
35-
parse_mode: str = "",
36-
disable_notification: bool = None,
37-
reply_to_message_id: int = None,
38-
reply_markup: Union[
39-
"pyrogram.InlineKeyboardMarkup",
40-
"pyrogram.ReplyKeyboardMarkup",
41-
"pyrogram.ReplyKeyboardRemove",
42-
"pyrogram.ForceReply"
43-
] = None
31+
self,
32+
chat_id: Union[int, str],
33+
file_id: str,
34+
caption: str = "",
35+
parse_mode: str = "",
36+
disable_notification: bool = None,
37+
reply_to_message_id: int = None,
38+
reply_markup: Union[
39+
"pyrogram.InlineKeyboardMarkup",
40+
"pyrogram.ReplyKeyboardMarkup",
41+
"pyrogram.ReplyKeyboardRemove",
42+
"pyrogram.ForceReply"
43+
] = None
4444
) -> Union["pyrogram.Message", None]:
4545
"""Use this method to send any media stored on the Telegram servers using a file_id.
4646

pyrogram/client/types/user_and_chats/chat_members.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import pyrogram
2222
from pyrogram.api import types
2323
from .chat_member import ChatMember
24-
from .user import User
2524
from ..pyrogram_type import PyrogramType
2625

2726

pyrogram/client/types/user_and_chats/chat_permissions.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,27 @@ class ChatPermissions(PyrogramType):
9595
"""
9696

9797
def __init__(
98-
self,
99-
*,
100-
until_date: int = None,
101-
102-
# Admin permissions
103-
can_be_edited: bool = None,
104-
can_change_info: bool = None,
105-
can_post_messages: bool = None, # Channels only
106-
can_edit_messages: bool = None, # Channels only
107-
can_delete_messages: bool = None,
108-
can_restrict_members: bool = None,
109-
can_invite_users: bool = None,
110-
can_pin_messages: bool = None, # Supergroups only
111-
can_promote_members: bool = None,
112-
113-
# Restricted user permissions
114-
can_send_messages: bool = None, # Text, contacts, locations and venues
115-
can_send_media_messages: bool = None, # Audios, documents, photos, videos, video notes and voice notes
116-
can_send_other_messages: bool = None, # Animations (GIFs), games, stickers, inline bot results
117-
can_add_web_page_previews: bool = None,
118-
can_send_polls: bool = None
98+
self,
99+
*,
100+
until_date: int = None,
101+
102+
# Admin permissions
103+
can_be_edited: bool = None,
104+
can_change_info: bool = None,
105+
can_post_messages: bool = None, # Channels only
106+
can_edit_messages: bool = None, # Channels only
107+
can_delete_messages: bool = None,
108+
can_restrict_members: bool = None,
109+
can_invite_users: bool = None,
110+
can_pin_messages: bool = None, # Supergroups only
111+
can_promote_members: bool = None,
112+
113+
# Restricted user permissions
114+
can_send_messages: bool = None, # Text, contacts, locations and venues
115+
can_send_media_messages: bool = None, # Audios, documents, photos, videos, video notes and voice notes
116+
can_send_other_messages: bool = None, # Animations (GIFs), games, stickers, inline bot results
117+
can_add_web_page_previews: bool = None,
118+
can_send_polls: bool = None
119119
):
120120
super().__init__(None)
121121

@@ -139,11 +139,11 @@ def __init__(
139139

140140
@staticmethod
141141
def _parse(
142-
entity: Union[
143-
types.ChannelParticipantAdmin,
144-
types.ChannelParticipantBanned,
145-
types.ChatBannedRights
146-
]
142+
entity: Union[
143+
types.ChannelParticipantAdmin,
144+
types.ChannelParticipantBanned,
145+
types.ChatBannedRights
146+
]
147147
) -> "ChatPermissions":
148148
if isinstance(entity, types.ChannelParticipantAdmin):
149149
permissions = entity.admin_rights
@@ -171,8 +171,8 @@ def _parse(
171171
can_send_messages=not denied_permissions.send_messages,
172172
can_send_media_messages=not denied_permissions.send_media,
173173
can_send_other_messages=(
174-
not denied_permissions.send_stickers or not denied_permissions.send_gifs or
175-
not denied_permissions.send_games or not denied_permissions.send_inline
174+
not denied_permissions.send_stickers or not denied_permissions.send_gifs or
175+
not denied_permissions.send_games or not denied_permissions.send_inline
176176
),
177177
can_add_web_page_previews=not denied_permissions.embed_links,
178178
can_send_polls=not denied_permissions.send_polls,

pyrogram/connection/transport/tcp/tcp_abridged_o.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def connect(self, address: tuple):
4040
while True:
4141
nonce = bytearray(os.urandom(64))
4242

43-
if (nonce[0] != b"\xef"
44-
and nonce[:4] not in self.RESERVED
45-
and nonce[4:4] != b"\x00" * 4):
43+
if nonce[0] != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:4] != b"\x00" * 4:
4644
nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xef
4745
break
4846

0 commit comments

Comments
 (0)