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(dZddlZddlZddlZddlZddlZddlmZddlmZddl	Z	ddl
mZddlm
Z
dZd„Zd	„Zd
„Zd„Zddd„Zd
„Zddd„Zddd„Zd„Zd„Zd„Zd„Zd„Zd„ZdS(sUtilities and helper functions.iÿÿÿÿN(tencodeutils(timportutils(t_(t
exceptionssX-Auth-TokencOs=x*|D]"}tjj|ƒ}|r|SqW|jddƒS(ssReturns the first environment variable set.

    If none are non-empty, defaults to '' or keyword arg default.
    tdefaultt(tostenvirontget(tvarstkwargstvtvalue((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytenv$s

cCs
|jƒS(N(tupper(tstring((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytconvert_to_uppercase0scCs
|jƒS(N(tlower(R((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytconvert_to_lowercase4scCs„y|t|ƒ}Wn`ttfk
rvtdƒ}|i|d6|d6dj|jƒƒd6}tj|ƒ‚nXtj	|ƒS(s-Returns the client class for the requested API version.

    :param api_name: the name of the API, e.g. 'compute', 'image', etc
    :param version: the requested API version
    :param version_map: a dict of client classes keyed by version
    :rtype: a client class for the requested API version
    sOInvalid %(api_name)s client version '%(version)s'. must be one of: %(map_keys)stapi_nametversions, tmap_keys(
tstrtKeyErrort
ValueErrorRtjointkeysRtUnsupportedVersionRtimport_class(RRtversion_maptclient_pathtmsg((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytget_client_class8scCsõ|dkri}ng}xÍ|D]Å}||krN|j|||ƒƒq"||kro|jddƒ}n|jƒjddƒ}t||ƒr³t|tƒr³||}nt||dƒ}|dkrÚd}n|j|ƒq"Wt|ƒS(s[Return a tuple containing the item properties.

    :param item: a single item resource (e.g. Server, Tenant, etc)
    :param fields: tuple of strings with the desired field names
    :param mixed_case_fields: tuple of field names to preserve case
    :param formatters: dictionary mapping field names to callables
       to format the values
    t RRN(	tNonetappendtreplaceRthasattrt
isinstancetdicttgetattrttuple(titemtfieldstmixed_case_fieldst
formatterstrowtfieldt
field_nametdata((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytget_item_propertiesLs 		

	cCs |dkrdS|jƒdkS(Nttrue(R"R(tstrbool((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytstr2boollscCsi}|rd}g}x‹|jdƒD]z}d|krT|j|ƒ|d7}q(|dkr‚tdƒ}tj||ƒ‚q(d||d|f||d<q(Wx[|D]P}|jdƒ\}}	}
|	sótdƒ}tj||ƒ‚n|
||<q­Wnt|pgƒt|pgƒB}|r¨g|D]}||kr3|^q3}
|
r¨tdƒ}tj|id	jt|
ƒƒd
6d	jt|ƒƒd6ƒ‚q¨n|rg|D]}||krµ|^qµ}|rtdƒ}tj|d	j|ƒƒ‚qn|S(
s~Convert key1=value1,key2=value2,... string into dictionary.

    :param strdict: string in the form of key1=value1,key2=value2
    :param required_keys: list of required keys. All keys in this list must be
                       specified. Otherwise ArgumentTypeError will be raised.
                       If this parameter is unspecified, no required key check
                       will be done.
    :param optional_keys: list of optional keys.
                       This parameter is used for valid key check.
                       When at least one of required_keys and optional_keys,
                       a key must be a member of either of required_keys or
                       optional_keys. Otherwise, ArgumentTypeError will be
                       raised. When both required_keys and optional_keys are
                       unspecified, no valid key check will be done.
    it,t=ismissing value for key '%s's%s,%ss2invalid key-value '%s', expected format: key=valuesLInvalid key(s) '%(invalid_keys)s' specified. Valid key(s): '%(valid_keys)s'.s, tinvalid_keyst
valid_keyss#Required key(s) '%s' not specified.(	tsplitR#RtargparsetArgumentTypeErrort	partitiontsetRtsorted(tstrdictt
required_keyst
optional_keystresulttitkvlisttkvRtkeytsepRR9tkR8tnot_found_keys((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytstr2dictrs@

$
"%#%"cCstjtd|d|ƒS(NRBRA(t	functoolstpartialRK(RBRA((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pyt
str2dict_type¦scCs?|jtjƒsdSdg}x?|D]7}|dkrL|jd|ƒq&|jd|ƒq&Wxtj|dƒD]l\}}|tkrÄ|jd	ƒ}tj	|ƒ}|j
ƒ}	d
|	}nd||f}
|j|
ƒquWd|kr|dr|jd
|dƒntjdj
|ƒƒ}|jd|ƒdS(Nscurl -itGETtPOSTtDELETEtPUTs -X %ss %stheaderssutf-8s{SHA1}%ss -H "%s: %s"tbodys -d '%s'RsREQ: %s(sGETsPOSTsDELETEsPUT(tisEnabledFortloggingtDEBUGR#tsixt	iteritemstSENSITIVE_HEADERStencodethashlibtsha1t	hexdigestRtsafe_encodeRtdebug(t_loggertargsR
tstring_partstelementRGRRthtdtheadertreq((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pythttp_log_req¬s&	
 
cCsE|jtjƒsdS|jdi|jd6|jd6|d6ƒdS(Ns#RESP: %(code)s %(headers)s %(body)stcodeRSRT(RURVRWR`tstatus_codeRS(RatrespRT((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pyt
http_log_respÆs	

cCs#t|tjƒrtj|ƒS|S(N(R&RXtstring_typesRR_(R1((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pyt_safe_encode_without_objÏs
cCsttt|ƒƒS(N(tlisttmapRo(R1((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytsafe_encode_listÕscCs(d„}ttt||jƒƒƒƒS(NcSsZ|\}}t|tƒr+|t|ƒfSt|tƒrJ|t|ƒfS|t|ƒfS(N(R&RpRrR'tsafe_encode_dictRo(R*RIR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pyt_encode_itemÚs(R'RpRqtitems(R1Rt((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pyRsÙs	c	Kshxd	D]}|j|dƒqW|jdtjƒ}|j|dddddddgd||dS(
NtmetavartchoicesRs{True,False}tTrueR3tFalsetfalse(smetavarschoices(tpopR"R;tSUPPRESStadd_argument(tparsertnameR
tkeywordR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pytadd_boolean_argumentås
(sX-Auth-Token((t__doc__R;RLR\RVRt
oslo_utilsRRRXtneutronclient._i18nRtneutronclient.commonRRZR
RRR R"R2R5RKRNRiRmRoRrRsR(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/neutronclient/common/utils.pyt<module>s2				 	4