Skip to content

Commit beaf88a

Browse files
committed
Remove imports, use namespaces
1 parent e397c4d commit beaf88a

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

pyrogram/client/client.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
PasswordHashInvalid, FloodWait, PeerIdInvalid, FilePartMissing,
4646
ChatAdminRequired, FirstnameInvalid, PhoneNumberBanned,
4747
VolumeLocNotFound, UserMigrate)
48-
from pyrogram.api.types import (
49-
User, Chat, Channel,
50-
InputPeerEmpty, InputPeerSelf,
51-
InputPeerUser, InputPeerChat, InputPeerChannel
52-
)
5348
from pyrogram.crypto import AES
5449
from pyrogram.session import Auth, Session
5550
from pyrogram.session.internals import MsgId
@@ -447,7 +442,7 @@ def authorize_user(self):
447442

448443
def fetch_peers(self, entities: list):
449444
for entity in entities:
450-
if isinstance(entity, User):
445+
if isinstance(entity, types.User):
451446
user_id = entity.id
452447

453448
if user_id in self.peers_by_id:
@@ -461,7 +456,7 @@ def fetch_peers(self, entities: list):
461456
username = entity.username
462457
phone = entity.phone
463458

464-
input_peer = InputPeerUser(
459+
input_peer = types.InputPeerUser(
465460
user_id=user_id,
466461
access_hash=access_hash
467462
)
@@ -474,20 +469,20 @@ def fetch_peers(self, entities: list):
474469
if phone is not None:
475470
self.peers_by_phone[phone] = input_peer
476471

477-
if isinstance(entity, Chat):
472+
if isinstance(entity, types.Chat):
478473
chat_id = entity.id
479474
peer_id = -chat_id
480475

481476
if peer_id in self.peers_by_id:
482477
continue
483478

484-
input_peer = InputPeerChat(
479+
input_peer = types.InputPeerChat(
485480
chat_id=chat_id
486481
)
487482

488483
self.peers_by_id[peer_id] = input_peer
489484

490-
if isinstance(entity, Channel):
485+
if isinstance(entity, types.Channel):
491486
channel_id = entity.id
492487
peer_id = int("-100" + str(channel_id))
493488

@@ -501,7 +496,7 @@ def fetch_peers(self, entities: list):
501496

502497
username = entity.username
503498

504-
input_peer = InputPeerChannel(
499+
input_peer = types.InputPeerChannel(
505500
channel_id=channel_id,
506501
access_hash=access_hash
507502
)
@@ -880,7 +875,7 @@ def parse_dialogs(d):
880875

881876
dialogs = self.send(
882877
functions.messages.GetDialogs(
883-
0, 0, InputPeerEmpty(),
878+
0, 0, types.InputPeerEmpty(),
884879
self.DIALOGS_AT_ONCE, True
885880
)
886881
)
@@ -926,7 +921,7 @@ def resolve_peer(self, peer_id: int or str):
926921
"""
927922
if type(peer_id) is str:
928923
if peer_id in ("self", "me"):
929-
return InputPeerSelf()
924+
return types.InputPeerSelf()
930925

931926
match = self.INVITE_LINK_RE.match(peer_id)
932927

@@ -982,7 +977,7 @@ def get_me(self):
982977
"""
983978
return self.send(
984979
functions.users.GetFullUser(
985-
InputPeerSelf()
980+
types.InputPeerSelf()
986981
)
987982
)
988983

@@ -2439,7 +2434,7 @@ def join_chat(self, chat_id: str):
24392434
)
24402435
)
24412436

2442-
channel = InputPeerChannel(
2437+
channel = types.InputPeerChannel(
24432438
channel_id=resolved_peer.chats[0].id,
24442439
access_hash=resolved_peer.chats[0].access_hash
24452440
)

0 commit comments

Comments
 (0)