B C_@sddlZddlZddlZddlmZddlZyejdZWnek rRdZYnXej rddlm Z m Z ddZ dd Z d d Zndd lm Z d d Z dd ZdddZddZddZddZy ejZWn ek rddlmZYnXGdddeZdS)N)update_wrapperi?)WRAPPER_ASSIGNMENTSWRAPPER_UPDATEScCs$dd}tj|||t||tdS)aQDo the same as six.wraps but only copy attributes that exist. For example, object instances don't have __name__ attribute, so six.wraps fails. This is fixed in Python 3 (https://bugs.python.org/issue3445), but didn't get backported to six. Also, see https://github.com/benjaminp/six/issues/250. cstfdd|DS)Nc3s|]}t|r|VqdS)N)hasattr).0a)obji/private/var/folders/fw/jsxvvqfs4sz4tdnfdvg5typ5vk77qg/T/pip-install-pio4sg6z/tenacity/tenacity/_utils.py ,sz0wraps..filter_hasattr..)tuple)r attrsr )r r filter_hasattr+szwraps..filter_hasattr)assignedupdated)sixwrapsrr)fnrr r r r"s rcCs||d|ddS)Nr)Zset_exception_info)futtbr r r capture2srcCs t|S)N)inspect getargspec)funcr r r r7sr)rcCs||ddS)Nr)Z set_exception)rrr r r r=scCs t|S)N)rgetfullargspec)rr r r r@scCs<|dkr i}x*t|D]\}}|dr,q|||<qW|S)N_)r getmembers startswith)r r attr_nameattrr r r visible_attrsDs  r"cCsT|dkr dS|dkrdS|dkr$dS|dkr0dS|d krD|d krDdSt|d SdS) NrthrstrZndrd ) find_ordinal)pos_numr r r r*Nsr*cCsd|t|fS)Nz%i%s)r*)r+r r r to_ordinal^sr,c Csg}y||jWnntk ryD||jt|rfy|d|jjWntk rdYnXWntk r|YnXYnX|st|Sy|j r|d|j Wntk rYnXd |SdS)znGet a callback fully-qualified name. If no name can be produced ``repr(cb)`` is called and returned. r.N) append __qualname__AttributeError__name__rismethodinsertZim_classrepr __module__join)cbsegmentsr r r get_callback_namebs*    r9) monotonicc@s eZdZdZddZddZdS)cached_propertyaA property that is computed once per instance. Upon being computed it replaces itself with an ordinary attribute. Deleting the attribute resets the property. Source: https://github.com/bottlepy/bottle/blob/1de24157e74a6971d136550afe1b63eec5b0df2b/bottle.py#L234-L246 cCst||||_dS)N)rr)selfrr r r __init__s zcached_property.__init__cCs(|dkr |S||}|j|jj<|S)N)r__dict__r1)r<r clsvaluer r r __get__szcached_property.__get__N)r1r5r/__doc__r=rAr r r r r;sr;)N)rsystime functoolsrrZmaxintMAX_WAITr0PY2rrrrrr"r*r,r9r:nowobjectr;r r r r s2     !