o
    rMf                     @   s   G d d de ZG dd de ZG dd deZG dd deZG dd	 d	eZG d
d deZG dd deZG dd deZG dd deZ	G dd deZ
dS )c                   @   s&   e Zd ZdddZdd Zdd ZdS )	QualificationsNc                 C   s   |d u rg }|| _ d S N)requirements)selfr    r   Z/var/www/html/analyze/labelStudio/lib/python3.10/site-packages/boto/mturk/qualification.py__init__   s   
zQualifications.__init__c                 C   s   | j | d S r   )r   append)r   reqr   r   r   add   s   zQualifications.addc                 C   sX   i }t | jdksJ t| jD ]\}}| }|D ]}|| |d|d |f < qq|S )N
   zQualificationRequirement.%s.%s   )lenr   	enumerateget_as_params)r   paramsnr	   	reqparamsrpr   r   r   r       s   zQualifications.get_as_paramsr   )__name__
__module____qualname__r   r
   r   r   r   r   r   r      s    
r   c                   @   s"   e Zd ZdZdddZdd ZdS )	Requirementz0
    Representation of a single requirement
    NFc                 C   s   || _ || _|| _|| _d S r   qualification_type_id
comparatorinteger_valuerequired_to_preview)r   r   r   r   r   r   r   r   r   /   s   
zRequirement.__init__c                 C   sl   | j | jd}| jdv rt| jdD ]
\}}||d| < qn| jdvr-| jd ur-| j|d< | jr4d|d< |S )	NQualificationTypeId
ComparatorInNotInr   zIntegerValue.%d)ExistsDoesNotExistIntegerValuetrueRequiredToPreview)r   r   r   r   r   )r   r   ir   r   r   r   r   5   s   

zRequirement.get_as_params)NF)r   r   r   __doc__r   r   r   r   r   r   r   *   s    
r   c                       "   e Zd ZdZd fdd	Z  ZS )&PercentAssignmentsSubmittedRequirementz
    The percentage of assignments the Worker has submitted, over all assignments the Worker has accepted. The value is an integer between 0 and 100.
    Fc                       t t| jd|||d d S )N00000000000000000000r   )superr+   r   r   r   r   r   	__class__r   r   r   H      z/PercentAssignmentsSubmittedRequirement.__init__Fr   r   r   r)   r   __classcell__r   r   r0   r   r+   C       r+   c                       r*   )&PercentAssignmentsAbandonedRequirementz
    The percentage of assignments the Worker has abandoned (allowed the deadline to elapse), over all assignments the Worker has accepted. The value is an integer between 0 and 100.
    Fc                    r,   )N00000000000000000070r   )r.   r7   r   r/   r0   r   r   r   P   r2   z/PercentAssignmentsAbandonedRequirement.__init__r3   r4   r   r   r0   r   r7   K   r6   r7   c                       r*   )%PercentAssignmentsReturnedRequirementz
    The percentage of assignments the Worker has returned, over all assignments the Worker has accepted. The value is an integer between 0 and 100.
    Fc                    r,   )N000000000000000000E0r   )r.   r9   r   r/   r0   r   r   r   X   r2   z.PercentAssignmentsReturnedRequirement.__init__r3   r4   r   r   r0   r   r9   S   r6   r9   c                       r*   )%PercentAssignmentsApprovedRequirementz
    The percentage of assignments the Worker has submitted that were subsequently approved by the Requester, over all assignments the Worker has submitted. The value is an integer between 0 and 100.
    Fc                    r,   )N000000000000000000L0r   )r.   r;   r   r/   r0   r   r   r   `   r2   z.PercentAssignmentsApprovedRequirement.__init__r3   r4   r   r   r0   r   r;   [   r6   r;   c                       r*   )%PercentAssignmentsRejectedRequirementz
    The percentage of assignments the Worker has submitted that were subsequently rejected by the Requester, over all assignments the Worker has submitted. The value is an integer between 0 and 100.
    Fc                    r,   )N000000000000000000S0r   )r.   r=   r   r/   r0   r   r   r   h   r2   z.PercentAssignmentsRejectedRequirement.__init__r3   r4   r   r   r0   r   r=   c   r6   r=   c                       r*   )NumberHitsApprovedRequirementa  
    Specifies the total number of HITs submitted by a Worker that have been approved. The value is an integer greater than or equal to 0.

    If specifying a Country and Subdivision, use a tuple of valid  ISO 3166 country code and ISO 3166-2 subdivision code, e.g. ('US', 'CA') for the US State of California.

    When using the 'In' and 'NotIn', locale should be a list of Countries and/or (Country, Subdivision) tuples.

    Fc                    r,   )N00000000000000000040r   )r.   r?   r   r/   r0   r   r   r   u   r2   z&NumberHitsApprovedRequirement.__init__r3   r4   r   r   r0   r   r?   k   s    	r?   c                       s*   e Zd ZdZd fdd	Zdd Z  ZS )LocaleRequirementz
    A Qualification requirement based on the Worker's location. The Worker's location is specified by the Worker to Mechanical Turk when the Worker creates his account.
    Fc                    s"   t t| jd|d |d || _d S )N00000000000000000071r   )r.   rA   r   locale)r   r   rC   r   r0   r   r   r   }   s   
zLocaleRequirement.__init__c                 C   s   | j | jd}| jdv r4t| jdD ] \}}t|tr,|d |d| < |d |d| < q||d| < qnt| jtrI| jd |d< | jd |d< n| j|d< | jrUd	|d
< |S )Nr   r    r       zLocaleValue.%d.CountryzLocaleValue.%d.SubdivisionzLocaleValue.CountryzLocaleValue.Subdivisionr&   r'   )r   r   r   rC   
isinstancetupler   )r   r   r(   rC   r   r   r   r      s"   


zLocaleRequirement.get_as_paramsr3   )r   r   r   r)   r   r   r5   r   r   r0   r   rA   x   s    rA   c                       r*   )AdultRequirementz
    Requires workers to acknowledge that they are over 18 and that they agree to work on potentially offensive content. The value type is boolean, 1 (required), 0 (not required, the default).
    Fc                    r,   )N00000000000000000060r   )r.   rG   r   r/   r0   r   r   r      r2   zAdultRequirement.__init__r3   r4   r   r   r0   r   rG      r6   rG   N)objectr   r   r+   r7   r9   r;   r=   r?   rA   rG   r   r   r   r   <module>   s   