o
    [h	                     @   s   d dl mZ G dd deZdd ZG dd deZG dd	 d	eZG d
d dedZ	defddZ
dd ZdZdZdZdZdZdZedZdZdZdS )    )core_gettextc                   @   s   e Zd ZdS )MustCopyErrorN)__name__
__module____qualname__ r   r   v/home/ubuntu/experiments/live_experiments/Pythonexperiments/Otree/venv/lib/python3.10/site-packages/otree/constants.pyr      s    r   c                  O   s   d}t |)NzCannot modify a list that originated in your constants class. First, you must make a copy of it, e.g. mylist.copy() This is to prevent accidentally modifying the original list. )r   )argskwargsmsgr   r   r   _raise_must_copy   s   r   c                   @   s<   e Zd ZeZeZeZeZeZeZ	eZ
eZeZeZeZeZdS )ConstantsListN)r   r   r   r   __setitem____delitem__clear__iadd____imul__appendextendinsertpopremovereversesortr   r   r   r   r      s    r   c                       s$   e Zd Zdd Z fddZ  ZS )BaseConstantsMetac                 C   s   t d)NzConstants are read-only.)AttributeError)clsattrvaluer   r   r   __setattr__"   s   zBaseConstantsMeta.__setattr__c                    s<   |  D ]\}}t|tkrt|||< qt | |||S )N)itemstypelistr   super__new__)mcsnamebasesattrskv	__class__r   r   r$   %   s
   zBaseConstantsMeta.__new__)r   r   r   r   r$   __classcell__r   r   r+   r   r   !   s    r   c                   @   s   e Zd Zedd ZdS )BaseConstantsc                 C   s"   | j dkrt| | S t| |S )NC)r   getattrupper)r   r   r   r   r   get_normalized/   s   

zBaseConstants.get_normalizedN)r   r   r   classmethodr2   r   r   r   r   r.   .   s    r.   )	metaclassreturnc                 C   s^   g }| j  D ]%\}}| ds| dr,t|ts'| d}t||| q|S )NZ_ROLEZROLE_z[: any Constant that ends with '_role' must be a string, for example: sender_role = 'Sender')	__dict__r    r1   endswith
startswith
isinstancestr	Exceptionr   )Z	Constantsrolesr)   r*   r   r   r   r   	get_roles6   s   


r=   c                 C   s    | rt | |kr| |d  S dS )z:this is split apart from get_roles_ as a perf optimization    )len)r<   Zid_in_groupr   r   r   get_roleB   s   rA   1admin_secret_codetimeout_happenedparticipant_labelzoTree-Wait-PagezoTree-Redisplay-With-ErrorszThis field is required.Z	auto_name   N)Z
otree.i18nr   r;   r   r   r"   r   r!   r   r.   r=   rA   Zget_param_truth_valuerC   rD   rE   Zwait_page_http_headerZ!redisplay_with_errors_http_headerZfield_required_msgZAUTO_NAME_BOTS_EXPORT_FOLDERZADVANCE_SLOWEST_BATCH_SIZEr   r   r   r   <module>   s"    	