ó U!¶\c@súddlZddlZddlZddlmZddlmZddlmZm Z m Z ddl m Z ej eƒZd„Zdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdS(iÿÿÿÿN(tget_service_module_name(tWaiterDocstringi(t WaiterErrort ClientErrortWaiterConfigError(t xform_namec CsÀ|j|ƒ}t|jƒ}tt||ƒƒ}d„}td|d|jjd|jjd|dt ƒ|_ t dt |jjƒ|fƒ}t |tfi|d6ƒ}||||ƒS( s :type waiter_name: str :param waiter_name: The name of the waiter. The name should match the name (including the casing) of the key name in the waiter model file (typically this is CamelCasing). :type waiter_model: botocore.waiter.WaiterModel :param waiter_model: The model for the waiter configuration. :type client: botocore.client.BaseClient :param client: The botocore client associated with the service. :rtype: botocore.waiter.Waiter :return: The waiter object. c[stj||dS(N(tWaitertwait(tselftkwargs((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR4st waiter_namet event_emittert service_modeltservice_waiter_modeltinclude_signatures %s.Waiter.%sR(t get_waiterRt operationtNormalizedOperationMethodtgetattrRtmetateventsR tFalset__doc__tstrRttypeR( R t waiter_modeltclienttsingle_waiter_configtoperation_nametoperation_methodRtwaiter_class_nametdocumented_waiter_cls((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pytcreate_waiter_with_clients$     RcBseZd„Zd„ZRS(cCs ||_dS(N(t_client_method(Rt client_method((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyt__init__OscKs/y|j|SWntk r*}|jSXdS(N(R!Rtresponse(RR te((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyt__call__Rs(t__name__t __module__R#R&(((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRNs t WaiterModelcBs)eZdZd„Zd„Zd„ZRS(icCsX|d|_|jddƒ}|j|ƒ||_tt|djƒƒƒ|_dS(sÙ Note that the WaiterModel takes ownership of the waiter_config. It may or may not mutate the waiter_config. If this is a concern, it is best to make a copy of the waiter config before passing it to the WaiterModel. :type waiter_config: dict :param waiter_config: The loaded waiter config from the *.waiters.json file. This can be obtained from a botocore Loader object as well. twaiterstversiontunknownN(t_waiter_configtgett_verify_supported_versionR+tlisttsortedtkeyst waiter_names(Rt waiter_configR+((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR#\s    cCs2||jkr.tdd|j|fƒ‚ndS(Nt error_msgs^Unsupported waiter version, supported version must be: %s, but version of waiter config is: %s(tSUPPORTED_VERSIONR(RR+((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR/ts cCs?y|j|}Wn!tk r4td|ƒ‚nXt|ƒS(NsWaiter does not exist: %s(R-tKeyErrort ValueErrortSingleWaiterConfig(RR R((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR|s  (R'R(R6R#R/R(((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR)Ys  R9cBs&eZdZd„Zed„ƒZRS(s¼Represents the waiter configuration for a single waiter. A single waiter is considered the configuration for a single value associated with a named waiter (i.e TableExists). cCsI||_|jddƒ|_|d|_|d|_|d|_dS(Nt descriptiontRtdelayt maxAttempts(t_configR.R:RR<t max_attempts(RR((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR#‹s    cCs;g}x.|jdD]}t|ƒ}|j|ƒqW|S(Nt acceptors(R>tAcceptorConfigtappend(RR@tacceptor_configtacceptor((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR@•s  (R'R(RR#tpropertyR@(((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR9„s RAcBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsL|d|_|d|_|d|_|jdƒ|_|jƒ|_dS(Ntstatetmatchertexpectedtargument(RFRGRHR.RIt_create_matcher_funct matcher_func(Rtconfig((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR#Ÿs    cCs—|jdkr|jƒS|jdkr2|jƒS|jdkrK|jƒS|jdkrd|jƒS|jdkr}|jƒStdd|jƒ‚dS(NtpathtpathAlltpathAnytstatusterrorR5sUnknown acceptor: %s(RGt_create_path_matchert_create_path_all_matchert_create_path_any_matchert_create_status_matchert_create_error_matcherR(R((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRJ¦s      cs1tj|jƒ‰|j‰‡‡fd†}|S(Ncs#d|krdSˆj|ƒˆkS(NtError(tsearch(R$(RHt expression(s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pytacceptor_matchesÁs (tjmespathtcompileRIRH(RRZ((RHRYs3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRR½s cs1tj|jƒ‰|j‰‡‡fd†}|S(Ncs_d|krdSˆj|ƒ}t|tƒ s6| r:tSx|D]}|ˆkrAtSqAWtS(NRW(RXt isinstanceR0RtTrue(R$tresulttelement(RHRY(s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRZËs   (R[R\RIRH(RRZ((RHRYs3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRSÇs cs1tj|jƒ‰|j‰‡‡fd†}|S(Ncs_d|krdSˆj|ƒ}t|tƒ s6| r:tSx|D]}|ˆkrAtSqAWtS(NRW(RXR]R0RR^(R$R_R`(RHRY(s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRZßs   (R[R\RIRH(RRZ((RHRYs3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRTÛs cs|j‰‡fd†}|S(Ncs%|jdiƒjdƒ}|ˆkS(NtResponseMetadatatHTTPStatusCode(R.(R$t status_code(RH(s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRZòs (RH(RRZ((RHs3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRUïs cs|j‰‡fd†}|S(Ncs"|jdiƒjddƒˆkS(NRWtCodeR;(R.(R$(RH(s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRZþs(RH(RRZ((RHs3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRVûs ( R'R(R#RJRRRSRTRURV(((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRAžs     RcBseZd„Zd„ZRS(cCs||_||_||_dS(sœ :type name: string :param name: The name of the waiter :type config: botocore.waiter.SingleWaiterConfig :param config: The configuration for the waiter. :type operation_method: callable :param operation_method: A callable that accepts **kwargs and returns a response. For example, this can be a method from a botocore client. N(t_operation_methodtnameRL(RRfRLR((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR# s  c Ksxt|jjƒ}d}|jdiƒ}|jd|jjƒ}|jd|jjƒ}d}xtrs|j|}|d7}xg|D]"} | j |ƒr‰| j }Pq‰q‰Wd|krìt d|j d |djd d ƒd |ƒ‚n|d kr t jdƒdS|dkr6t d|j d dd |ƒ‚n||krct d|j d dd |ƒ‚ntj|ƒqcWdS(Ntwaitingt WaiterConfigtDelayt MaxAttemptsiiRWRftreasontMessagetUnknownt last_responsetsuccesss3Waiting complete, waiter matched the success state.tfailures+Waiter encountered a terminal failure statesMax attempts exceeded(R0RLR@tpopR.R<R?R^ReRKRFRRftloggertdebugttimetsleep( RR R@t current_stateRLt sleep_amountR?t num_attemptsR$RD((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyRs@               (R'R(R#R(((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyR s (R[tloggingRttbotocore.utilsRtbotocore.docs.docstringRt exceptionsRRRR;Rt getLoggerR'RrR tobjectRR)R9RAR(((s3/tmp/pip-install-usGedi/botocore/botocore/waiter.pyt s    4 +k