U
    ˜ARd½  ã                   @   sj   d dl mZmZmZmZ d dlmZ d dlmZ	 d dl
mZ edœdd„ZG dd	„ d	eeee f ƒZd
S )é    )ÚIteratorÚMappingÚNoReturnÚOptional©ÚStreamlitAPIException)Úget_script_run_ctx)ÚUserInfo©Úreturnc                  C   s   t ƒ } | d kri S | jS ©N)Ú_get_script_run_ctxZ	user_info)Úctx© r   ú7/tmp/pip-unpacked-wheel-b9et7o5g/streamlit/user_info.pyÚ_get_user_info   s    r   c                   @   s’   e Zd ZdZeee dœdd„Zeee dœdd„Zeee edœdd	„Z	eee edœd
d„Z
ee dœdd„Zedœdd„Zedœdd„ZdS )ÚUserInfoProxyzFA dict like proxy object for accessing information about current user.)Úkeyr   c                 C   s
   t ƒ | S r   ©r   ©Úselfr   r   r   r   Ú__getitem__!   s    zUserInfoProxy.__getitem__c                 C   s*   zt ƒ | W S  tk
r$   t‚Y nX d S r   )r   ÚKeyErrorÚAttributeErrorr   r   r   r   Ú__getattr__$   s    zUserInfoProxy.__getattr__)ÚnameÚvaluer   c                 C   s   t dƒ‚d S ©Nz'st.experimental_user cannot be modifiedr   ©r   r   r   r   r   r   Ú__setattr__*   s    zUserInfoProxy.__setattr__c                 C   s   t dƒ‚d S r   r   r   r   r   r   Ú__setitem__-   s    zUserInfoProxy.__setitem__r
   c                 C   s
   t tƒ ƒS r   )Úiterr   ©r   r   r   r   Ú__iter__0   s    zUserInfoProxy.__iter__c                 C   s
   t tƒ ƒS r   )Úlenr   r"   r   r   r   Ú__len__3   s    zUserInfoProxy.__len__c                 C   s   t ƒ S r   r   r"   r   r   r   Úto_dict6   s    zUserInfoProxy.to_dictN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r   r   r   r   r    r   r#   Úintr%   r	   r&   r   r   r   r   r      s   r   N)Útypingr   r   r   r   Zstreamlit.errorsr   Zstreamlit.runtime.scriptrunnerr   r   Z1streamlit.runtime.scriptrunner.script_run_contextr	   r   r+   r   r   r   r   r   Ú<module>   s
   