ó FRTc@sddlZdefd„ƒYZy*ddlmZdefd„ƒYZWn'ek rudefd„ƒYZnXdefd „ƒYZd efd „ƒYZ d e fd „ƒYZ de fd„ƒYZ de fd„ƒYZ defd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZde fd„ƒYZde fd„ƒYZdefd„ƒYZd ee fd!„ƒYZd"efd#„ƒYZd$efd%„ƒYZd&efd'„ƒYZd(efd)„ƒYZd*efd+„ƒYZd,efd-„ƒYZd.efd/„ƒYZd0efd1„ƒYZd2efd3„ƒYZd4efd5„ƒYZd6efd7„ƒYZ dS(8iÿÿÿÿNtQuestioncBs2eZdZedd„Zdd„Zd„ZRS(s%(items)scCs|jjtƒƒ|`dS(N(t__dict__tupdatetvarstself(Rt identifiertcontentt answer_spect is_requiredt display_name((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyt__init__sRcCsi|jƒ|6S(N(t get_as_xml(Rtlabel((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyt get_as_params!scCs‘td|jƒtdt|jƒjƒƒ|j|jg}|jdk rj|j dtd|jƒƒndj d„|Dƒƒ}|j t ƒS(NtQuestionIdentifiert IsRequiredit DisplayNametcss|]}|jƒVqdS(N(R (t.0titem((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys -s( t SimpleFieldRtstrRtlowerRRR tNonetinserttjointtemplateR(Rtitems((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR $s N(t__name__t __module__RtFalseRR R R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRs (tetreet ValidatingXMLcBseZd„ZRS(cCsbddl}|j|jƒ}tj|ƒ}tj|ƒ}tj|jƒƒ}|j|ƒdS(Niÿÿÿÿ( turllib2turlopent schema_urlRtparset XMLSchemat fromstringR t assertValid(RR!tschema_src_filet schema_doctschematdoc((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pytvalidate5s  (RRR,(((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR 3scBseZd„ZRS(cCsdS(N((R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR,?s(RRR,(((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR =stExternalQuestioncBs?eZdZdZdeƒZd„Zdd„Zd„ZRS(s: An object for constructing an External Question. s`http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsds”%%(external_url)s%%(frame_height)scCs%tjjj|ƒ|_||_dS(N(txmltsaxtsaxutilstescapet external_urlt frame_height(RR2R3((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR JsR-cCsi|jƒ|6S(N(R (RR ((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR NscCs|jt|ƒS(N(RR(R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR Qs( RRt__doc__R#RRR R R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR-Cs    t XMLTemplatecBseZd„ZRS(cCs|jt|ƒS(N(RR(R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR Vs(RRR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR5UsRcBseZdZdZd„ZRS(s¢ A Simple name/value pair that can be easily rendered as XML. >>> SimpleField('Text', 'A text string').get_as_xml() 'A text string' s <%(field)s>%(value)scCs||_||_dS(N(tfieldtvalue(RR6R7((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR cs (RRR4RR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRZstBinarycBseZdZd„ZRS(s’%(type)s%(subtype)s%(url)s%(alt_text)scCs|jjtƒƒ|`dS(N(RRRR(Rttypetsubtypeturltalt_text((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ks(RRRR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR8hstListcBseZdZd„ZRS(s?A bulleted list suitable for OrderedContent or Overview contentcCs!djd„|Dƒƒ}d|S(NRcss|]}d|VqdS(s%sN((RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys sss%s(R(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR rs(RRR4R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR=pst ApplicationcBs/eZdZdZd„Zd„Zd„ZRS(s?<%(class_)s>%(content)ss-%(name)s%(value)scKs||_||_||_dS(N(twidththeightt parameters(RR?R@RA((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR {s  cCsj|jd|jƒ|jd|jƒx=|jjƒD],\}}|jtƒ}|jd|ƒq6WdS(NtWidthtHeighttApplicationParameter(t append_fieldR?R@RARtparameter_templateR(RRtnameR7((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pytget_inner_content€s cCs<tƒ}|j|ƒ|jƒ}|jj}|jtƒS(N(tOrderedContentRHR t __class__RRR(RRtclass_((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ‡s     (RRRRFR RHR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR>ws   t HTMLQuestioncBs9eZdZdeƒZd„Zdd„Zd„ZRS(s\http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsds¤%%(html_form)s]]>%%(frame_height)scCs||_||_dS(N(t html_formR3(RRMR3((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR “s RLcCsi|jƒ|6S(N(R (RR ((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR —scCs|jt|ƒS(N(RR(R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR šs(RRR#RRR R R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRLs    t JavaAppletcBseZd„Zd„ZRS(cOs/||_||_tt|ƒj||ŽdS(N(tpathtfilenametsuperRNR (RRORPtargstkwargs((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR Ÿs  cCsItƒ}|jd|jƒ|jd|jƒtt|ƒj|ƒdS(Nt AppletPathtAppletFilename(RIRERORPRQRNRH(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRH¤s (RRR RH(((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRNžs tFlashcBseZd„Zd„ZRS(cOs&||_tt|ƒj||ŽdS(N(R;RQRVR (RR;RRRS((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ¬s cCs6tƒ}|jd|jƒtt|ƒj|ƒdS(Nt FlashMovieURL(RIRER;RQRVRH(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRH°s (RRR RH(((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRV«s tFormattedContentcBseZdZdZd„ZRS(skhttp://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/FormattedContentXHTMLSubset.xsds<cCs ||_dS(N(R(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ºs(RRR#RR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRX¶sRIcBseZd„Zd„ZRS(cCs|jt||ƒƒdS(N(tappendR(RR6R7((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyREÀscCsdjd„|DƒƒS(NRcss|]}|jƒVqdS(N(R (RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys Äs(R(R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR Ãs(RRRER (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRI¾s tOverviewcBs#eZdZdd„Zd„ZRS(s %(content)sRZcCsi|jƒ|6S(N(R (RR ((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ÊscCs#tt|ƒjƒ}|jtƒS(N(RQRZR RR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR Ís(RRRR R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRZÇs t QuestionFormcBs3eZdZdZdeƒZd„Zd„ZRS(sõ From the AMT API docs: The top-most element of the QuestionForm data structure is a QuestionForm element. This element contains optional Overview elements and one or more Question elements. There can be any number of these two element types listed in any order. The following example structure has an Overview element and a Question element followed by a second Overview element and Question element--all within the same QuestionForm. :: [...] [...] [...] [...] [...] QuestionForm is implemented as a list, so to construct a QuestionForm, simply append Questions and Overviews (with at least one Question). s\http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsds>%%(items)scCs*td„|Dƒƒo)td„|DƒƒS(Ncss|]}t|tƒVqdS(N(t isinstanceR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys ùscss$|]}t|ttfƒVqdS(N(R\RRZ(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys ûs(tanytall(R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pytis_valid÷scCs?|jƒstdƒ‚djd„|Dƒƒ}|jtƒS(Ns&QuestionForm contains invalid elementsRcss|]}|jƒVqdS(N(R (RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys s(R_tAssertionErrorRt xml_templateR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR þs(RRR4R#RRaR_R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR[Òs !  tQuestionContentcBseZdZd„ZRS(s.%(content)scCs#tt|ƒjƒ}|jtƒS(N(RQRbR RR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR s(RRRR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRbstAnswerSpecificationcBs eZdZd„Zd„ZRS(s3%(spec)scCs ||_dS(N(tspec(RRd((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR scCs|jjƒ}|jtƒS(N(RdR RR(RRd((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR s(RRRR R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRc s t ConstraintscBseZdZd„ZRS(s&%(content)scCs#tt|ƒjƒ}|jtƒS(N(RQReR RR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR s(RRRR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRest ConstraintcBseZd„Zd„ZRS(cCs2t|j|jƒ}djd„|Dƒƒ}|S(Nt css1|]'\}}|dk rd||fVqdS(s%s="%d"N(R(RRGR7((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys #s (tziptattribute_namestattribute_valuesR(Rtpairstattrs((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pytget_attributes s  cCs|jƒ}|jtƒS(N(RmRR(RRl((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR )s (RRRmR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRfs tNumericConstraintcBs#eZdZdZddd„ZRS(tminValuetmaxValuescCs||f|_dS(N(Rj(Rt min_valuet max_value((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR 2s(RoRpN(RRRiRRR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRn.stLengthConstraintcBs#eZdZdZddd„ZRS(t minLengtht maxLengthscCs||f|_dS(N(Rj(Rt min_lengtht max_length((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR :s(RtRuN(RRRiRRR (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRs6stRegExConstraintcBs,eZdZdZddd„Zd„ZRS(tregext errorTexttflagsscCs|||f|_dS(N(Rj(Rtpatternt error_textR{((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR BscCs2t|j|jƒ}djd„|Dƒƒ}|S(NRgcss1|]'\}}|dk rd||fVqdS(s%s="%s"N(R(RRGR7((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys Hs (RhRiRjR(RRkRl((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRmEs  (sregexRzsflagsN(RRRiRRR Rm(((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyRx>stNumberOfLinesSuggestioncBs#eZdZdd„Zd„ZRS(s@%(num_lines)sicCs ||_dS(N(t num_lines(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR RscCs|j}|jtƒS(N(RRR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR Us (RRRR R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR~Os tFreeTextAnswercBs)eZdZdddd„Zd„ZRS(s*%(items)scCs@||_|dkr$tƒ|_nt|ƒ|_||_dS(N(tdefaultRRet constraintsR(RRR‚R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ]s   cCsz|jg}|jr1|jtd|jƒƒn|jrS|jt|jƒƒndjd„|Dƒƒ}|jtƒS(Nt DefaultTextRcss|]}|jƒVqdS(N(R (RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pys ks( R‚RRYRRR~RRR(RR((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR es   N(RRRRR R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR€ZstFileUploadAnswercBs eZdZd„Zd„ZRS(s‘%(max_bytes)d%(min_bytes)dcCsGd|ko&|ko&ddkns1t‚||_||_dS(Niii i iÊš;(R`t min_bytest max_bytes(RR…R†((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR rs1 cCs|jt|ƒS(N(RR(R((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ws(RRRR R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR„os tSelectionAnswercBsteZdZdZdZdZdZdZdZddd d d d gZ d Z ddddde d„Z d„ZRS(sw A class to generate SelectionAnswer XML data structures. Does not yet implement Binary selection options. sB%s%s%ssF%s%ss <%s>%ss%%ss)%ss)%st radiobuttontdropdowntcheckboxtlisttcomboboxt multichoosertOtherSelectionittextcCsÉ|dk rL|tjkr'||_qUtd|djtjƒfƒ‚n d|_|dkrptdƒ‚n ||_||_||_t |ƒ|jks³t d|jƒ‚||_ ||_ dS(Ns.style '%s' not recognized; should be one of %ss, s_SelectionAnswer.__init__(): selections must be a non-empty list of (content, identifier) tupless*# of selections is less than minimum of %d( RR‡tACCEPTED_STYLEStstyle_suggestiont ValueErrorRt selectionstmin_selectionstmax_selectionstlenR`R9tother(RtmintmaxtstyleR“R9R—((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ‰s  %     ( c Cs„|jdkrd}n1|jdkr0d}ntdt|jƒƒ‚d}xL|jD]A}tj||d|f}tj|d|f}||7}qYW|jrt|jd ƒrùt |jt ƒs×t d ƒ‚||jj ƒj d d ƒ7}q|d 7}n|jdk r(tj|j}nd}|jdkrdtj|j}|tj|j7}nd}tj|||f}|S(NRtTexttbinaryR8s3illegal type: %s; must be either 'text' or 'binary'RiiR s+OtherSelection can only be a FreeTextAnswerR€RŽsRˆ(R9R’RR“R‡tSELECTION_VALUE_XML_TEMPLATEtSELECTION_XML_TEMPLATER—thasattrR\R€R`R treplaceR‘RtSTYLE_XML_TEMPLATEt MIN_SELECTION_COUNT_XML_TEMPLATER”t MAX_SELECTION_COUNT_XML_TEMPLATER•tSELECTIONANSWER_XML_TEMPLATE( RtTYPE_TAGtselections_xmlttplt value_xmlt selection_xmlt style_xmlt count_xmltret((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR ¢s0   " N(RRR4R¤RžRR¡R¢R£RtOTHER_SELECTION_ELEMENT_NAMERRR R (((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyR‡{s(!txml.sax.saxutilsR.tobjectRtlxmlRR t ImportErrorR-R5RR8R‹R=R>RLRNRVRXRIRZR[RbRcReRfRnRsRxR~R€R„R‡(((s@/opt/freeware/lib/python2.7/site-packages/boto/mturk/question.pyts<      2