Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
ˍEYc@sàdZddlZddlZddlZddlZddlZddlZddlm	Zddl
mZddl
mZddl
mZejeƒZddd	d
„Zd„Zd„Zd
„Zd„Zd„ZdS(sUtilities and helper functions.iÿÿÿÿN(tlog(tencodeutils(tstrutils(t_iiicsn‡fd†‰‡‡fd†‰‡fd†‰ˆdkrUttdƒˆƒ‚n‡‡‡fd†}|S(Ncs
t|ˆƒS(N(t
isinstance(te(t
exceptions(sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt_retry_on_exception"scs5ˆ|}tdˆ|ƒ}tjd|ƒ|dS(NisSleeping for %s secondsg@@(tmaxtLOGtdebug(tprevious_attempt_numbertdelay_since_first_attempt_mstexptwait_for(tbackoff_ratetinterval(sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt_backoff_sleep%s
cs4|d}tjd|ƒtjd|ƒ|ˆkS(Ng@@sFailed attempt %ss Have been at this for %s seconds(R	R
(RRtdelay_since_first_attempt(tretries(sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt_print_stop+s

	is;Retries must be greater than or equal to 1 (received: %s). cs+tjˆƒ‡‡‡‡fd†ƒ}|S(Ncs1tjdˆdˆdˆƒ}|jˆ||ŽS(Ntretry_on_exceptiont	wait_funct	stop_func(tretryingtRetryingtcall(targstkwargstr(RRRtf(sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt_wrapper8s	(tsixtwraps(RR(RRR(RsC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt
_decorator6s'(t
ValueErrorR(RRRRR"((RRRRRRRsC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pytretry s
cCs<|jƒ}|jƒ}|dkr(tS||kr8tStS(NtALL(tuppertTruetFalse(tcurrent_platformtconnector_platformtcurr_ptconn_p((sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pytplatform_matchesDscCsH|jƒ}|jƒ}|dkr(tS||ks@||krDtStS(NR%(R&R'R((t
current_ostconnector_ostcurr_ostconn_os((sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt
os_matchesQscCs_t|ƒtk	r!tdƒ‚nt|ƒtk	rBtdƒ‚n|jƒ}|j|ƒ|S(s#Try to safely merge 2 dictionaries.sdict1 is not a dictionarysdict2 is not a dictionary(ttypetdictt	Exceptiontcopytupdate(tdict1tdict2tdict3((sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt
merge_dict_s
cs.ˆj‰tjˆƒ‡‡fd†ƒ}|S(sŠTrace calls to the decorated function.

    This decorator should always be defined as the outermost decorator so it
    is defined last. This is important so it does not interfere
    with other decorators.

    Using this decorator on a function will cause its execution to be logged at
    `DEBUG` level with arguments, return values, and exceptions.

    :returns: a function decorator
    c
sÚt|ƒdkr|d}n|jddƒ}|r[t|dƒr[tj|jƒ}nt}|jt	j
ƒs€ˆ||ŽStjˆ||Ž}|j
diˆd6tjtj|ƒƒd6ƒtjƒd}yˆ||Ž}Wn[tk
rE}tttjƒdƒƒ|}|j
diˆd6|d	6|d
6ƒ‚nXtttjƒdƒƒ|}t|tƒr‡tj|ƒ}	n*t|tjƒr«tj|ƒ}	n|}	|j
diˆd6|d	6|	d6ƒ|S(
Nitselft
__module__s==> %(func)s: call %(all_args)rtfunctall_argsiès,<== %(func)s: exception (%(time)dms) %(exc)rttimetexcs,<== %(func)s: return (%(time)dms) %(result)rtresult(tlentgettNonethasattrtloggingt	getLoggerR=R	tisEnabledFort
py_loggingtDEBUGtinspecttgetcallargsR
Rt
mask_passwordR t	text_typeR@R5tinttroundRR4tmask_dict_passwordtstring_types(
RRt
maybe_selftloggerR?t
start_timeRBRAt
total_timetmask_result(Rt	func_name(sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyttrace_logging_wrapperzsD

	
 	
 	
(t__name__t	functoolsR!(RRZ((RRYsC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyttraceks
	!2cCs:tjrtj|ƒSt|tƒr2|jdƒS|SdS(sðConvert to native string.

    Convert bytes and Unicode strings to native strings:

    * convert to bytes on Python 2:
      encode Unicode using encodeutils.safe_encode()
    * convert to Unicode on Python 3: decode bytes from UTF-8
    sutf-8N(R tPY2Rtto_utf8Rtbytestdecode(ttext((sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pytconvert_str¯s
		

(t__doc__R\RLRGRJRR R@toslo_logRt
oslo_utilsRRt
os_brick.i18nRRHR[R	R$R-R2R;R]Rc(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/os_brick/utils.pyt<module>
s"$	
			D