/usr/lib/python2.6/site-packages/glanceclient/common
NameSizeModeActions
base.py11810644editdlrm
base.pyc7490644editdlrm
exceptions.py1740644editdlrm
exceptions.pyc2090644editdlrm
http.py128820644editdlrm
http.pyc123110644editdlrm
https.py132530644editdlrm
https.pyc124390644editdlrm
progressbar.py31730644editdlrm
progressbar.pyc34900644editdlrm
utils.py154120644editdlrm
utils.pyc165880644editdlrm
__init__.py00644editdlrm
__init__.pyc1600644editdlrm
Edit: /usr/lib/python2.6/site-packages/glanceclient/common/utils.pyc (16588B)
Ms s, (tjoin(tfieldsR((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytprepare_fieldsLscstdt|iD}|i}t|}|p t|oK|oDtdh|d6|pdd6}ti|n||S(Ncss,x%|]}|do |dVqqWdS(iiN((Rta((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pys Rs s/error: Must provide %(req)s when using %(opt)s.treqtstdintopt(tsettvarstitemst intersectiont get_data_fileRRt CommandError(tgcRRtpresenttmissingtmsg(RtrequiredR t data_fields(sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt func_wrapperPs" ((R R*(R(R)(RR sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytargs_decoratorKs ((R)R(R+((R(R)sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyton_data_require_fields<scsNpghtid6td6tid6td6fd}|S(Ntstringtintegertbooleantarrayc sL}|djo?d}hdd6}|iidgid|f|fn|idh}xti|D]\}}|joqwnd|idd }h}|id d }t|t o-x*|D]}|d jo |}PqqWn|d jo9|id} i| id |d sePlease run with connection parameters set to retrieve the schema for generating help for this commandthelpR it propertiess--RRttypeR-tnullR0R t+tnargsR/s [True|False]tmetavars<%s>t descriptionttenumt sValid values: s, (tNoneR R R tgettsixt iteritemsRt isinstancetlisttuppertlent text_typeR(R tschematparamRR2tnametpropertyttype_strttR R8t_[1]tvaltvals(ttypemapt schema_gettertomit(sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyRnsN           3   (Rt safe_decodetintRtbool_from_stringRA(RORPR((RPRORNsF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt schema_argses    s (R(tl((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytpretty_choice_listsc CsY|ph}|ph}tig}|D] }||q+~dt}d|_x|D]}g}x|D]} | |joAx>ti|| D]%\} } t|| } | | | R?tgetattrtappendtlowerRR<tadd_rowtprintRRQt get_string(tobjsRt formatterstfield_settingsRKtftpttotrowtfieldtsettingtvaluet setting_dictt field_nametdata((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt print_lists*  0    iPcCstiddgdt}d|_||_xYti|D]H\}}t|tt fot i |}n|i ||gq=Wt ti|idddS(NtPropertytValueRXRVtsortby(RYRZR[R\t max_widthR>R?R@tdictRAtjsontdumpsR`RaRRQRb(tdtmax_column_widthRgtktv((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt print_dicts   c CsCy5t|tp |io|it|SWntij onXy'titi ||i|SWnt tifj onXt |i dh|d6}t |}|djo/d|i ii|f}ti|nE|djo/d|i ii|f}ti|n |dSdS(sHelper for the _find_* methods.tfiltersRGis'No %s with a name or ID of '%s' exists.isBMultiple %s matches found for '%s', use an ID to be more specific.N(R@RRtisdigitR=RtNotFoundtuuidtUUIDRRQt ValueErrorRARCtresource_classt__name__R_R#(tmanagert name_or_idtmatchest num_matchesR'((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt find_resources,    cCs t|_|S(sDFunction decorator used to indicate a caller may be unauthenticated.(R[trequire_authentication(Rf((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytskip_authentications cCst|dtS(sChecks to see if the function requires authentication. Use the skip_authentication decorator to indicate a caller may skip the authentication step. R(R]tTrue(Rf((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytis_authentication_requiredscOsBx/|D]'}tii|d}|o|SqW|iddS(sSearch for the first defined of possibly many env vars. Returns the first environment variable defined in vars, or returns the default defined in kwargs. tdefaultR9N(tostenvironR=R<(RRR{Rl((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytenvs  cCs7d|}|odi||f}nti|S(Nsglanceclient.v%st.(RRt import_module(tversiont submoduletmodule((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytimport_versioned_modules R9icCs8|o tti|dtinti|dS(Ntfile(RaRRQtsyststderrtexit(R't exit_code((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyRs cCsn|djo ti}nt|d}z"x|D]}|i|q3WWd|dj o|inXdS(sSave an image to the specified path. :param data: binary data of the image :param path: path to save the image to twbN(R<Rtstdouttopentwritetclose(Rotpathtimagetchunk((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt save_image s   cCsddddddddg}d }d }x&||jo|d }||}q-Wd |}|id id}d|||fS(NtBtkBtMBtGBtTBtPBtEBtZBg@iis%.1ft0Rs%s%s(trstrip(tsizetsuffixtbasetindextpaddedtstripped((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytmake_size_human_readable2s   cCsyyti|}WnPtj oDyt|}Wqftj odh|iid6}qfXnXti|ddS(Ns!Caught '%(exception)s' exception.t exceptionterrorstignore(R>RDt UnicodeErrortstrt __class__RRRQ(Rterror((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytexception_to_strAscCst|dot|dotiptio|iowy@|i}|idti|i}|i||SWqt j o$}|i t i jodSqXndS(sAnalyze file-like object and attempt to determine its size. :param file_obj: file-like object. :retval The file's size or None if it cannot be determined. tseekttelliN( thasattrR>tPY2tPY3tseekableRRRtSEEK_ENDtIOErrorterrnotESPIPE(tfile_objtcurrRte((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt get_file_sizeMs !   cCs|iot|idSytidWntj odSXtiip/t o t i tii ti ntiSdSdS(Ntrbi( RRRtfstattOSErrorR<RRtisattytmsvcrttsetmodetfilenotO_BINARY(R((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyR"is   cCst|tiptdnd}|id}|id}tid|do0t |di d}di |d }n||fS(s=Strip version from the last component of endpoint if present.sExpected endpointt/s v\d+\.?\d*iR{N( R@R>t string_typesRR<RtsplittretmatchtfloattlstripR(tendpointRturl_bits((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt strip_versionscCsddddg}tg}ti|D]"}|d|jo ||q)q)~}|ot|d|dR?RRR~R|(t image_objthuman_readablet max_col_widthRRKtitemR((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt print_images(ccsti}xF|D]>}|Vt|tioti|}n|i|qW|i}||jo tt i d||fndS(s6Check image data integrity. :raises: IOError s3Corrupt image download. Checksum was %s expected %sN( thashlibtmd5R@R>Rtbtupdatet hexdigestRRtEPIPE(titertchecksumtmd5sumR((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytintegrity_iters    cs)ditfd}|S(Nt _lazy_once_c sqt|ot|Stiiz.t|pt||nWdQXt|SdS(N(RR]t_memoized_property_lockt__exit__t __enter__tsetattr(R(t attr_nametfn(sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt_memoized_propertys  (RRH(RR((RRsF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytmemoized_propertys  cCsa|dj oF|tjo9|id}ti|}|i}|d|fS||fSdS(Nsutf-8s{SHA1}%s(R<tSENSITIVE_HEADERStencodeRtsha1R(RGRlR{thRx((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt safe_headers  cCs9|o$t|\}}||p|fSd|fSdS(N(RR<(Rtdefault_versionR((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pytendpoint_version_from_urlstIterableWithLengthcBs,eZdZdZdZdZRS(cCs||_||_dS(N(titerabletlength(RRR((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt__init__s ccs2zx|iD] }|Vq WWd|iiXdS(N(RR(RR((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt__iter__s   cCs t|iS(N(tnextR(R((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyRscCs|iS(N(R(R((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyt__len__s(Rt __module__RRRR(((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyRs   (s X-Auth-Token(RR(5t __future__RRRRvRRRt threadingRt oslo_utilsRR>RGRR<RRRYt glanceclientRRRtLockRRtREQUIRED_FIELDS_ON_DATARR,RTRWRpR|RRRRRRRRRRR"RR[RRRRRtobjectR(((sF/tmp/pip-build-cD3xZi/python-glanceclient/glanceclient/common/utils.pyts\             ) H  "