Viewing File: /usr/lib/python2.7/site-packages/requestbuilder/mixins/__init__.pyo

ó
9!-Xc@sbddlZddlZddlmZdefd„ƒYZddlmZddlm	Z	dS(iÿÿÿÿN(tArgtRegionConfigurableMixincBs\eZdZeddddd
ddƒgZd
d
d„Zd
d
d„Zed	„ƒZ	RS(sG
    A mixin that allows the user to specify which user/region names to use
    for the configuration via a --region arg and, if a 'REGION_ENVVAR' class
    variable is set, an environment variable as well.  The included
    update_config_view method actually reads these data and updates
    self.config to point to them.
    s--regiontmetavarsUSER@REGIONtroute_tothelpsCregion and/or user names to search when looking up config file datacCs‘|r||j_n|r*||j_n|jjdƒro|jdj|jdƒ|j|jdƒŒnt|ddƒ}t
|ttfƒrèx¡|D]D}t
j|ƒr|jdj|ƒ|jt
j|ƒƒŒPqqWnRt
|tjƒr:t
j|ƒr:|jdj|ƒ|jt
j|ƒƒŒq:n|jdd|jjdƒƒ|jjdƒ\}}|jdj|ƒd|ƒdS(	Ntregions--region CLI option "{0}"t
REGION_ENVVARsenvironment variable "{0}"s%"default-region" global config optionsdefault-regiontusers%"user" config option for region "{0}"(tconfigRRtargstgett/_RegionConfigurableMixin__setdefault_view_attrstformatt&_RegionConfigurableMixin__parse_regiontgetattrtNonet
isinstancetlistttupletostgetenvtsixtstring_typestget_global_optiontget_region_option2(tselfRRt
region_envvartvartsection((sB/usr/lib/python2.7/site-packages/requestbuilder/mixins/__init__.pytupdate_config_view#s8
cCst|r8|jjr8|jjd||ƒ||j_n|rp|jjrp|jjd||ƒ||j_ndS(Nsselected region "%s" from %ssselected user "%s" from %s(RRtlogtinfoR(RtcauseRR((sB/usr/lib/python2.7/site-packages/requestbuilder/mixins/__init__.pyt__setdefault_view_attrsMscCsV|s
dS|jdƒr,|jdƒdfSd|krH|jddƒSd|fSdS(s|
        Given a string with pattern "[USER@][REGION]", return the user
        and region names that that string represents, if any, and None
        for the values it does not represent.

        Examples:
         - ""          -> (None, None)
         - "spam"      -> (None, "spam")
         - "eggs@"     -> ("eggs", None)
         - "eggs@spam" -> ("eggs", "spam")
        t@iN(NN(Rtendswithtrstriptsplit(t	regionish((sB/usr/lib/python2.7/site-packages/requestbuilder/mixins/__init__.pyt__parse_regionUsN(
t__name__t
__module__t__doc__RRtARGSRRtstaticmethodR
(((sB/usr/lib/python2.7/site-packages/requestbuilder/mixins/__init__.pyRs*i(tTabifyingMixin(tFileTransferProgressBarMixin(
RRtrequestbuilderRtobjectRt
formattingR-tprogressR.(((sB/usr/lib/python2.7/site-packages/requestbuilder/mixins/__init__.pyt<module>s
X
Back to Directory File Manager