@@ -97,9 +97,7 @@ def __init__(
9797 """
9898 Синоним для класса Name.
9999 """
100- super ().__init__ (
101- name = name , first_name = first_name , last_name = last_name , type = type
102- )
100+ super ().__init__ (name = name , first_name = first_name , last_name = last_name , type = type )
103101
104102
105103class Contact :
@@ -219,7 +217,7 @@ class StickerAttach:
219217 def __init__ (
220218 self ,
221219 author_type : str ,
222- lottie_url : str ,
220+ lottie_url : str | None ,
223221 url : str ,
224222 sticker_id : int ,
225223 tags : list [str ] | None ,
@@ -248,7 +246,7 @@ def __init__(
248246 def from_dict (cls , data : dict [str , Any ]) -> Self :
249247 return cls (
250248 author_type = data ["authorType" ],
251- lottie_url = data [ "lottieUrl" ] ,
249+ lottie_url = data . get ( "lottieUrl" ) ,
252250 url = data ["url" ],
253251 sticker_id = data ["stickerId" ],
254252 tags = data .get ("tags" ),
@@ -443,9 +441,7 @@ def __str__(self) -> str:
443441
444442
445443class FileAttach :
446- def __init__ (
447- self , file_id : int , name : str , size : int , token : str , type : AttachType
448- ) -> None :
444+ def __init__ (self , file_id : int , name : str , size : int , token : str , type : AttachType ) -> None :
449445 self .file_id = file_id
450446 self .name = name
451447 self .size = size
@@ -553,9 +549,7 @@ def __str__(self) -> str:
553549
554550
555551class Element :
556- def __init__ (
557- self , type : FormattingType | str , length : int , from_ : int | None = None
558- ) -> None :
552+ def __init__ (self , type : FormattingType | str , length : int , from_ : int | None = None ) -> None :
559553 self .type = type
560554 self .length = length
561555 self .from_ = from_
@@ -566,9 +560,7 @@ def from_dict(cls, data: dict[Any, Any]) -> Self:
566560
567561 @override
568562 def __repr__ (self ) -> str :
569- return (
570- f"Element(type={ self .type !r} , length={ self .length !r} , from_={ self .from_ !r} )"
571- )
563+ return f"Element(type={ self .type !r} , length={ self .length !r} , from_={ self .from_ !r} )"
572564
573565 @override
574566 def __str__ (self ) -> str :
@@ -591,7 +583,9 @@ def from_dict(cls, data: dict[str, Any]) -> Self:
591583
592584 @override
593585 def __repr__ (self ) -> str :
594- return f"MessageLink(chat_id={ self .chat_id !r} , message={ self .message !r} , type={ self .type !r} )"
586+ return (
587+ f"MessageLink(chat_id={ self .chat_id !r} , message={ self .message !r} , type={ self .type !r} )"
588+ )
595589
596590 @override
597591 def __str__ (self ) -> str :
@@ -678,9 +672,7 @@ def __init__(
678672 @classmethod
679673 def from_dict (cls , data : dict [Any , Any ]) -> Self :
680674 message = data ["message" ] if data .get ("message" ) else data
681- attaches : list [
682- PhotoAttach | VideoAttach | FileAttach | ControlAttach | StickerAttach
683- ] = []
675+ attaches : list [PhotoAttach | VideoAttach | FileAttach | ControlAttach | StickerAttach ] = []
684676 for a in message .get ("attaches" , []):
685677 if a ["_type" ] == AttachType .PHOTO :
686678 attaches .append (PhotoAttach .from_dict (a ))
@@ -778,9 +770,7 @@ def from_dict(cls, data: dict[Any, Any]) -> Self:
778770 join_time = data ["joinTime" ],
779771 created = data ["created" ],
780772 last_message = (
781- Message .from_dict (data ["lastMessage" ])
782- if data .get ("lastMessage" )
783- else None
773+ Message .from_dict (data ["lastMessage" ]) if data .get ("lastMessage" ) else None
784774 ),
785775 type = ChatType (data ["type" ]),
786776 last_fire_delayed_error_time = data ["lastFireDelayedErrorTime" ],
@@ -865,14 +855,10 @@ def __init__(
865855 @classmethod
866856 def from_dict (cls , data : dict [Any , Any ]) -> Self :
867857 raw_admins = data .get ("adminParticipants" , {}) or {}
868- admin_participants : dict [int , dict [Any , Any ]] = {
869- int (k ): v for k , v in raw_admins .items ()
870- }
858+ admin_participants : dict [int , dict [Any , Any ]] = {int (k ): v for k , v in raw_admins .items ()}
871859 raw_participants = data .get ("participants" , {}) or {}
872860 participants : dict [int , int ] = {int (k ): v for k , v in raw_participants .items ()}
873- last_msg = (
874- Message .from_dict (data ["lastMessage" ]) if data .get ("lastMessage" ) else None
875- )
861+ last_msg = Message .from_dict (data ["lastMessage" ]) if data .get ("lastMessage" ) else None
876862 return cls (
877863 participants_count = data .get ("participantsCount" , 0 ),
878864 access = AccessType (data .get ("access" , AccessType .PUBLIC .value )),
@@ -1051,7 +1037,9 @@ def __repr__(self) -> str:
10511037
10521038 @override
10531039 def __str__ (self ) -> str :
1054- return f"Session: { self .client } from { self .location } at { self .time } (current={ self .current } )"
1040+ return (
1041+ f"Session: { self .client } from { self .location } at { self .time } (current={ self .current } )"
1042+ )
10551043
10561044
10571045class Folder :
0 commit comments