
    i                     V    S SK JrJr  S SKrS SKrS SKJrJr  S SKJ	r	   " S S\5      r
g)    )ABCabstractmethodN)ListTuple)rawc                      \ rS rSrSrSrSrSrSrSr	S\
4S	 jr\S
 5       r\S 5       r\S 5       r\S 5       r\S\\\\\
\
4      SS4S j5       r\S\\\\\
   4      SS4S j5       r\\4S\\\\\\4   S\\\\\\4   4S jj5       r\S\SS4S j5       r\S\
SS4S j5       r\S\
SS4S j5       r\\4S\S\4S jj5       r\\4S\S\4S jj5       r\\4S\
S\
4S  jj5       r\\4S\S\4S! jj5       r\\4S\S\4S" jj5       r \\4S\!S\!4S# jj5       r"\\4S\S\4S$ jj5       r#\\4S\S\4S% jj5       r$\\4S\S\4S& jj5       r%S\
4S' jr&S(r'g))Storage   zg
Abstract class for storage engines.

Parameters:
    name (``str``):
        The name of the session.
z	>B?256sI?z	>B?256sQ?i_  id  z
>BI?256sQ?namec                     Xl         g )Nr   )selfr   s     E/app/mltbenv/lib/python3.13/site-packages/pyrogram/storage/storage.py__init__Storage.__init__)   s    	    c                    #    [         e7f)zOpens the storage engine.NotImplementedErrorr   s    r   openStorage.open,         "!   	c                    #    [         e7f)z.Saves the current state of the storage engine.r   r   s    r   saveStorage.save1   r   r   c                    #    [         e7f)zCloses the storage engine.r   r   s    r   closeStorage.close6   r   r   c                    #    [         e7f)zDeletes the storage file.r   r   s    r   deleteStorage.delete;   r   r   peersreturnNc                    #    [         e7f)a  
Update the peers table with the provided information.

Parameters:
    peers (``List[Tuple[int, int, str, str]]``):
        A list of tuples containing the
        information of the peers to be updated. Each tuple must contain the following
        information:
        - ``int``: The peer id.
        - ``int``: The peer access hash.
        - ``str``: The peer type (user, chat or channel).
        - ``str``: The peer phone number (if any).
r   )r   r$   s     r   update_peersStorage.update_peers@   s      "!r   	usernamesc                    #    [         e7f)ag  
Update the usernames table with the provided information.

Parameters:
    usernames (``List[Tuple[int, List[str]]]``):
        A list of tuples containing the
        information of the usernames to be updated. Each tuple must contain the following
        information:
        - ``int``: The peer id.
        - List of ``str``: The peer username (if any).
r   )r   r)   s     r   update_usernamesStorage.update_usernamesQ   s      "!r   update_statec                    #    [         e7f)a|  Get or set the update state of the current session.

Parameters:
    update_state (``Tuple[int, int, int, int, int]``):
        A tuple containing the update state to set.
        Tuple must contain the following information:
        - ``int``: The id of the entity.
        - ``int``: The pts.
        - ``int``: The qts.
        - ``int``: The date.
        - ``int``: The seq.
r   )r   r-   s     r   r-   Storage.update_state`   s      "!r   peer_idzraw.base.InputPeerc                    #    [         e7f)zgRetrieve a peer by its ID.

Parameters:
    peer_id (``int``):
        The ID of the peer to retrieve.
r   )r   r0   s     r   get_peer_by_idStorage.get_peer_by_idp         "!r   usernamec                    #    [         e7f)ztRetrieve a peer by its username.

Parameters:
    username (``str``):
        The username of the peer to retrieve.
r   )r   r5   s     r   get_peer_by_usernameStorage.get_peer_by_usernamez   r4   r   phone_numberc                    #    [         e7f)zRetrieve a peer by its phone number.

Parameters:
    phone_number (``str``):
        The phone number of the peer to retrieve.
r   )r   r9   s     r   get_peer_by_phone_number Storage.get_peer_by_phone_number   r4   r   valuec                    #    [         e7f)zuGet or set the DC ID of the current session.

Parameters:
    value (``int``, *optional*):
        The DC ID to set.
r   r   r=   s     r   dc_idStorage.dc_id   r4   r   c                    #    [         e7f)zwGet or set the API ID of the current session.

Parameters:
    value (``int``, *optional*):
        The API ID to set.
r   r?   s     r   api_idStorage.api_id   r4   r   c                    #    [         e7f)zGet or set the server address of the current session.

Parameters:
    value (``str``, *optional*):
        The server address to set.
r   r?   s     r   server_addressStorage.server_address   r4   r   c                    #    [         e7f)zGet or set the server port of the current session.

Parameters:
    value (``int``, *optional*):
        The server port to set.
r   r?   s     r   portStorage.port   r4   r   c                    #    [         e7f)z~Get or set the test mode of the current session.

Parameters:
    value (``bool``, *optional*):
        The test mode to set.
r   r?   s     r   	test_modeStorage.test_mode   r4   r   c                    #    [         e7f)zGet or set the authorization key of the current session.

Parameters:
    value (``bytes``, *optional*):
        The authorization key to set.
r   r?   s     r   auth_keyStorage.auth_key   r4   r   c                    #    [         e7f)zsGet or set the date of the current session.

Parameters:
    value (``int``, *optional*):
        The date to set.
r   r?   s     r   dateStorage.date   r4   r   c                    #    [         e7f)zyGet or set the user ID of the current session.

Parameters:
    value (``int``, *optional*):
        The user ID to set.
r   r?   s     r   user_idStorage.user_id   r4   r   c                    #    [         e7f)z|Get or set the bot flag of the current session.

Parameters:
    value (``bool``, *optional*):
        The bot flag to set.
r   r?   s     r   is_botStorage.is_bot   r4   r   c                   #    [         R                  " U R                  U R                  5       I Sh  vN U R	                  5       I Sh  vN U R                  5       I Sh  vN U R                  5       I Sh  vN U R                  5       I Sh  vN U R                  5       I Sh  vN 5      n[        R                  " U5      R                  5       R                  S5      $  N N N No NZ NE7f)zwExports the session string for the current session.

Returns:
    ``str``: The session string for the current session.
N=)structpackSESSION_STRING_FORMATr@   rC   rL   rO   rU   rX   base64urlsafe_b64encodedecoderstrip)r   packeds     r   export_session_stringStorage.export_session_string   s      &&**,++-..""--/!,,. ++-
 ''/668??DD "! si   /C,C 
C,C"	C,C$ C,6C&7C,C(C,$C*%<C,"C,$C,&C,(C,*C,r   )(__name__
__module____qualname____firstlineno____doc__OLD_SESSION_STRING_FORMATOLD_SESSION_STRING_FORMAT_64SESSION_STRING_SIZESESSION_STRING_SIZE_64r^   strr   r   r   r   r   r"   r   r   intr'   r+   objectr-   r2   r7   r;   r@   rC   rF   rI   boolrL   bytesrO   rR   rU   rX   rd   __static_attributes__ r   r   r	   r	      s    !,#.  (S  " " " " " " " " "U3S#3E-F(G "D " "  "U3S	>5J0K "PT " " PV "uS#sC5L/M "[`adfiknpsuxax[y " " "C "4H " " "3 ";O " " "3 "CW " " '- " "# " " (. "# "3 " " 06 "# "3 " " &, " " " " ,2 "T "t " " ,2 "E "u " " &, " " " " )/ "3 "C " " )/ "$ "D " "ES Er   r	   )abcr   r   r_   r\   typingr   r   pyrogramr   r	   ru   r   r   <module>ry      s&   & $    ^Ec ^Er   