3
uQhใ  ใ               @   s$   d dl mZmZ G dd deZdS )้    )ฺABCฺabstractmethodc               @   s  e Zd Zdd Zd*ddZedd Zeedd	 Zeed
d Z	eedd Z
eedd Zejedd Zeedd Zejedd Zedd Zedd Zedd Zdd Zedd Zedd Zed d! Zed"d# Zed$d% Zed&d' Zed(d) ZdS )+ฺSessionc             C   s   d S )Nฉ )ฺselfr   r   ๚>/tmp/pip-build-2nz6shyl/telethon/telethon/sessions/abstract.pyฺ__init__   s    zSession.__init__Nc             C   s   |p
| j  S )z7
        Creates a clone of this session file.
        )ฺ	__class__)r   Zto_instancer   r   r   ฺclone   s    zSession.clonec             C   s   t dS )zธ
        Sets the information of the data center address and port that
        the library should connect to, as well as the data center ID,
        which is currently unused.
        N)ฺNotImplementedError)r   ฺdc_idฺserver_addressฺportr   r   r   ฺset_dc   s    zSession.set_dcc             C   s   t dS )z<
        Returns the currently-used data center ID.
        N)r   )r   r   r   r   r      s    zSession.dc_idc             C   s   t dS )zQ
        Returns the server address where the library should connect to.
        N)r   )r   r   r   r   r      s    zSession.server_addressc             C   s   t dS )zJ
        Returns the port to which the library should connect to.
        N)r   )r   r   r   r   r   '   s    zSession.portc             C   s   t dS )z
        Returns an ``AuthKey`` instance associated with the saved
        data center, or `None` if a new one should be generated.
        N)r   )r   r   r   r   ฺauth_key/   s    zSession.auth_keyc             C   s   t dS )zL
        Sets the ``AuthKey`` to be used for the saved data center.
        N)r   )r   ฺvaluer   r   r   r   8   s    c             C   s   t dS )z
        Returns an ID of the takeout process initialized for this session,
        or `None` if there's no were any unfinished takeout requests.
        N)r   )r   r   r   r   ฺ
takeout_id@   s    zSession.takeout_idc             C   s   t dS )zQ
        Sets the ID of the unfinished takeout process for this session.
        N)r   )r   r   r   r   r   r   I   s    c             C   s   t dS )a	  
        Returns the ``UpdateState`` associated with the given `entity_id`.
        If the `entity_id` is 0, it should return the ``UpdateState`` for
        no specific channel (the "general" state). If no state is known
        it should ``return None``.
        N)r   )r   ฺ	entity_idr   r   r   ฺget_update_stateQ   s    zSession.get_update_statec             C   s   t dS )zร
        Sets the given ``UpdateState`` for the specified `entity_id`, which
        should be 0 if the ``UpdateState`` is the "general" state (and not
        for any specific channel).
        N)r   )r   r   ฺstater   r   r   ฺset_update_state[   s    zSession.set_update_statec             C   s   dS )z\
        Returns an iterable over all known pairs of ``(entity ID, update state)``.
        Nr   )r   r   r   r   ฺget_update_statesd   s    zSession.get_update_statesc             C   s   dS )z
        Called on client disconnection. Should be used to
        free any used resources. Can be left empty if none.
        Nr   )r   r   r   r   ฺclosej   s    zSession.closec             C   s   t dS )z
        Called whenever important properties change. It should
        make persist the relevant session information to disk.
        N)r   )r   r   r   r   ฺsavep   s    zSession.savec             C   s   t dS )z
        Called upon client.log_out(). Should delete the stored
        information from disk since it's not valid anymore.
        N)r   )r   r   r   r   ฺdeletex   s    zSession.deletec             C   s   g S )zK
        Lists available sessions. Not used by the library itself.
        r   )ฺclsr   r   r   ฺlist_sessions   s    zSession.list_sessionsc             C   s   t dS )z
        Processes the input ``TLObject`` or ``list`` and saves
        whatever information is relevant (e.g., ID or access hash).
        N)r   )r   Ztlor   r   r   ฺprocess_entities   s    zSession.process_entitiesc             C   s   t dS )a  
        Turns the given key into an ``InputPeer`` (e.g. ``InputPeerUser``).
        The library uses this method whenever an ``InputPeer`` is needed
        to suit several purposes (e.g. user only provided its ID or wishes
        to use a cached username to avoid extra RPC).
        N)r   )r   ฺkeyr   r   r   ฺget_input_entity   s    zSession.get_input_entityc             C   s   t dS )a"  
        Caches the given file information persistently, so that it
        doesn't need to be re-uploaded in case the file is used again.

        The ``instance`` will be either an ``InputPhoto`` or ``InputDocument``,
        both with an ``.id`` and ``.access_hash`` attributes.
        N)r   )r   ฺ
md5_digestฺ	file_sizeฺinstancer   r   r   ฺ
cache_file   s    	zSession.cache_filec             C   s   t dS )a  
        Returns an instance of ``cls`` if the ``md5_digest`` and ``file_size``
        match an existing saved record. The class will either be an
        ``InputPhoto`` or ``InputDocument``, both with two parameters
        ``id`` and ``access_hash`` in that order.
        N)r   )r   r    r!   r   r   r   r   ฺget_fileค   s    zSession.get_file)N)ฺ__name__ฺ
__module__ฺ__qualname__r   r
   r   r   ฺpropertyr   r   r   r   ฺsetterr   r   r   r   r   r   r   ฺclassmethodr   r   r   r#   r$   r   r   r   r   r      s8   
	
	
r   N)ฺabcr   r   r   r   r   r   r   ฺ<module>   s   