Skip to content

Commit cc7901a

Browse files
committed
Merge branch 'develop' into asyncio
2 parents 10f3829 + b07c13a commit cc7901a

File tree

11 files changed

+25
-75
lines changed

11 files changed

+25
-75
lines changed

compiler/api/compiler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,8 @@ def start():
172172

173173
with open("{}/source/auth_key.tl".format(HOME), encoding="utf-8") as auth, \
174174
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, \
176-
open("{}/source/pyrogram.tl".format(HOME), encoding="utf-8") as pyrogram:
177-
schema = (auth.read() + system.read() + api.read() + pyrogram.read()).splitlines()
175+
open("{}/source/main_api.tl".format(HOME), encoding="utf-8") as api:
176+
schema = (auth.read() + system.read() + api.read()).splitlines()
178177

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

compiler/api/source/pyrogram.tl

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = ~/PycharmProjects/pyrogram/venv3.6/bin/sphinx-build
6+
SPHINXBUILD = sphinx-build
77
SPHINXPROJ = Pyrogram
88
SOURCEDIR = source
99
BUILDDIR = build

docs/Makefile_

Lines changed: 0 additions & 20 deletions
This file was deleted.

pyrogram/api/core/primitives/bool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def read(cls, *args) -> bool:
3030
return cls.value
3131

3232
def __new__(cls) -> bytes:
33-
return int.to_bytes(cls.ID, 4, "little")
33+
return cls.ID.to_bytes(4, "little")
3434

3535

3636
class BoolTrue(BoolFalse):

pyrogram/api/core/primitives/bytes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __new__(cls, value: bytes) -> bytes:
4848
else:
4949
return (
5050
bytes([254])
51-
+ int.to_bytes(length, 3, "little")
51+
+ length.to_bytes(3, "little")
5252
+ value
5353
+ bytes(-length % 4)
5454
)

pyrogram/api/core/primitives/int.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@ def read(cls, b: BytesIO, signed: bool = True) -> int:
2929
return int.from_bytes(b.read(cls.SIZE), "little", signed=signed)
3030

3131
def __new__(cls, value: int, signed: bool = True) -> bytes:
32-
return int.to_bytes(value, cls.SIZE, "little", signed=signed)
32+
return value.to_bytes(cls.SIZE, "little", signed=signed)
3333

3434

3535
class Long(Int):
3636
SIZE = 8
3737

38-
def __new__(cls, *args):
39-
return super().__new__(cls, *args)
40-
4138

4239
class Int128(Int):
4340
SIZE = 16

pyrogram/api/core/primitives/null.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ def read(b: BytesIO, *args) -> None:
2929
return None
3030

3131
def __new__(cls) -> bytes:
32-
return int.to_bytes(cls.ID, 4, "little")
32+
return cls.ID.to_bytes(4, "little")

pyrogram/client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def fetch_peers(self, entities: list):
619619
if phone is not None:
620620
self.peers_by_phone[phone] = input_peer
621621

622-
if isinstance(entity, types.Chat):
622+
if isinstance(entity, (types.Chat, types.ChatForbidden)):
623623
chat_id = entity.id
624624
peer_id = -chat_id
625625

@@ -629,7 +629,7 @@ def fetch_peers(self, entities: list):
629629

630630
self.peers_by_id[peer_id] = input_peer
631631

632-
if isinstance(entity, types.Channel):
632+
if isinstance(entity, (types.Channel, types.ChannelForbidden)):
633633
channel_id = entity.id
634634
peer_id = int("-100" + str(channel_id))
635635

@@ -638,7 +638,7 @@ def fetch_peers(self, entities: list):
638638
if access_hash is None:
639639
continue
640640

641-
username = entity.username
641+
username = getattr(entity, "username", None)
642642

643643
input_peer = types.InputPeerChannel(
644644
channel_id=channel_id,

pyrogram/crypto/rsa.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,8 @@ class RSA:
206206

207207
@classmethod
208208
def encrypt(cls, data: bytes, fingerprint: int) -> bytes:
209-
return int.to_bytes(
210-
pow(
211-
int.from_bytes(data, "big"),
212-
cls.server_public_keys[fingerprint].e,
213-
cls.server_public_keys[fingerprint].m
214-
),
215-
256,
216-
"big"
217-
)
209+
return pow(
210+
int.from_bytes(data, "big"),
211+
cls.server_public_keys[fingerprint].e,
212+
cls.server_public_keys[fingerprint].m
213+
).to_bytes(256, "big")

0 commit comments

Comments
 (0)