/usr/lib/python2.6/site-packages/keystoneclient
NameSizeModeActions
apiclient/-0755rm
auth/-0755rm
common/-0755rm
contrib/-0755rm
fixture/-0755rm
generic/-0755rm
hacking/-0755rm
locale/-0755rm
middleware/-0755rm
openstack/-0755rm
tests/-0755rm
v2_0/-0755rm
v3/-0755rm
access.py247750644editdlrm
access.pyc331160644editdlrm
adapter.py84010644editdlrm
adapter.pyc91980644editdlrm
base.py179510644editdlrm
base.pyc207410644editdlrm
baseclient.py13130644editdlrm
baseclient.pyc21330644editdlrm
client.py29130644editdlrm
client.pyc29130644editdlrm
discover.py160230644editdlrm
discover.pyc162010644editdlrm
exceptions.py149840644editdlrm
exceptions.pyc243890644editdlrm
httpclient.py385470644editdlrm
httpclient.pyc332640644editdlrm
i18n.py11620644editdlrm
i18n.pyc5580644editdlrm
service_catalog.py166100644editdlrm
service_catalog.pyc150700644editdlrm
session.py406950644editdlrm
session.pyc358510644editdlrm
shell.py195880644editdlrm
shell.pyc148680644editdlrm
utils.py115890644editdlrm
utils.pyc127330644editdlrm
_discover.py111260644editdlrm
_discover.pyc109290644editdlrm
__init__.py24350644editdlrm
__init__.pyc19940644editdlrm
Edit: /usr/lib/python2.6/site-packages/keystoneclient/utils.pyc (12733B)
Ñò *s (tjoin(tl((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytpretty_choice_list)sc Cs^tig}|D] }||q~dtdtƒ}g}|D] }|dqA~|_x¨|D] }g} x„|D]|} | |jo| i|| |ƒƒqt| iƒiddƒ} t|| dƒ} | djo d} n| i| ƒqtW|i | ƒqaW|djo|d}nt i |i d|ƒƒ} t io| iƒ} n| GHdS( Ntcachingt print_emptyRt t_titsortby(t prettytablet PrettyTabletFalsetalignstappendtlowertreplacetgetattrtNonetadd_rowRt safe_encodet get_stringtsixtPY3tdecode(tobjstfieldst formatterstorder_byt_[1]tftptt_[2]totrowtfieldt field_nametdatatencoded((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt print_list-s,'$     icCsW|djo|Sdig}tdt|ƒ|ƒD]}|||||!q5~ƒS(s2wrap long strings to be no longer than max_length.is (Rtrangetlen(tstringt max_lengthR*R ((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt _word_wrapGs  cCsÊtiddgdtdtƒ}ddg|_xYti|ƒD]H\}}|d jo d}nt|d|ƒ}|i||gƒq@Wt i |i ddƒƒ}ti o|i ƒ}n|GHd S( sTpretty table prints dictionaries. Wrap values to max_length wrap if wrap>0 tPropertytValueRRRRR8RN(RRRRR#t iteritemsRR9R RR!R"R$R%(tdtwrapR,tproptvalueR3((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt print_dictOs    c Csïy|i|ƒSWntij onXy=t|tiƒo|iddƒ}n|id|ƒSWntij o2d|ii i ƒ|f}ti |ƒ‚nBti j o2d|ii i ƒ|f}ti |ƒ‚nXdS(sHelper for the _find_* methods.sutf-8tstricttnames'No %s with a name or ID of '%s' exists.sBMultiple %s matches found for '%s', use an ID to be more specific.N( tgetRtNotFoundt isinstanceR#t binary_typeR%tfindtresource_classt__name__Rt CommandErrort NoUniqueMatch(tmanagert name_or_idtmsg((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt find_resourcebs" cCs t|_|S(sŒAdds 'unauthenticated' attribute to decorated function. Usage:: @unauthenticated def mymethod(f): ... (tTruetunauthenticated(R+((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyRR{s cCst|dtƒS(sµChecks to see if the function is marked as not requiring authentication with the @unauthenticated decorator. Returns True if decorator is set to True, False otherwise. RR(RR(R+((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytisunauthenticatedˆstmd5cCs&ti|ƒ}|i|ƒ|iƒS(N(thashlibtnewtupdatet hexdigest(t signed_texttmodethash_((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pythash_signed_token‘s cCsZd}ttidƒo=tiiƒo-ytidƒ}WqVtj oqVXn|S(sMPrompt user for a password Prompt for a password if stdin is a tty. tisattys Password: N(RthasattrtsyststdinR]tgetpasstEOFError(tpassword((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytprompt_user_password—s# cCs†ttidƒo tiiƒpdSxWtoOy4tidƒ}tidƒ}||jo|SWq+tj odSXq+WdS(sfPrompt user for password if not provided so the password doesn't show up in the bash history. R]NsNew Password: sRepeat New Password: (R^R_R`R]RQRaRb(t new_passwdt rep_passwd((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytprompt_for_password©s#  t positionalcBsVeZdZdZdZded„Zeded„ƒZed„ƒZd„Z RS(sŠ A decorator which enforces only some args may be passed positionally. This idea and some of the code was taken from the oauth2 client of the google-api client. This decorator makes it easy to support Python 3 style key-word only parameters. For example, in Python 3 it is possible to write:: def fn(pos1, *, kwonly1, kwonly2=None): ... All named parameters after * must be a keyword:: fn(10, 'kw1', 'kw2') # Raises exception. fn(10, kwonly1='kw1', kwonly2='kw2') # Ok. To replicate this behaviour with the positional decorator you simply specify how many arguments may be passed positionally. To replicate the example above:: @positional(1) def fn(pos1, kwonly1=None, kwonly2=None): ... If no default value is provided to a keyword argument, it becomes a required keyword argument:: @positional(0) def fn(required_kw): ... This must be called with the keyword parameter:: fn() # Raises exception. fn(10) # Raises exception. fn(required_kw=10) # Ok. When defining instance or class methods always remember that in python the first positional argument passed is always the instance so you will need to account for `self` and `cls`:: class MyClass(object): @positional(2) def my_method(self, pos1, kwonly1=None): ... @classmethod @positional(2) def my_method(cls, pos1, kwonly1=None): ... If you would prefer not to account for `self` and `cls` you can use the `method` and `classmethod` helpers which do not consider the initial positional argument. So the following class is exactly the same as the one above:: class MyClass(object): @positional.method(1) def my_method(self, pos1, kwonly1=None): ... @positional.classmethod(1) def my_method(cls, pos1, kwonly1=None): ... If a value isn't provided to the decorator then it will enforce that every variable without a default value will be required to be a kwarg:: @positional() def fn(pos1, kwonly1=None): ... fn(10) # Ok. fn(10, 20) # Raises exception. fn(10, kwonly1=20) # Ok. This behaviour will work with the `positional.method` and `positional.classmethod` helper functions as well:: class MyClass(object): @positional.classmethod() def my_method(cls, pos1, kwonly1=None): ... MyClass.my_method(10) # Ok. MyClass.my_method(10, 20) # Raises exception. MyClass.my_method(10, kwonly1=20) # Ok. For compatibility reasons you may wish to not always raise an exception so a WARN mode is available. Rather than raise an exception a warning message will be logged:: @positional(1, enforcement=positional.WARN): def fn(pos1, kwonly=1): ... Available modes are: - positional.EXCEPT - the default, raise an exception. - positional.WARN - log a warning on mistake. texcepttwarncCs||_||_dS(N(t_max_positional_argst _enforcement(tselftmax_positional_argst enforcement((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt__init__(s cs4ˆdj oˆd7‰n‡‡‡fd†}|S(Nicsˆˆˆƒ|ƒS(N((R(RoRntcls(sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyR+1s(R(RqRnRoR+((RoRnRqsC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytmethod,s cs‡‡‡fd†}|S(NcstˆiˆˆŽ|ƒƒS(N(t classmethodRr(R(R RRq(sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyR+7s((RqRR R+((R RRqsC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyRs5scs‡ˆidjo2tiˆƒ}t|iƒt|iƒˆ_nˆidjodnd‰tiˆƒ‡‡‡fd†ƒ}|S(NiRtscs t|ƒˆijo}dhˆid6ˆid6t|ƒd6ˆd6}ˆiˆijot|ƒ‚q“ˆiˆijoti|ƒq“nˆ||ŽS(NsN%(name)s takes at most %(max)d positional argument%(plural)s (%(given)d given)RCtmaxtgiventplural( R6RkRJRltEXCEPTt TypeErrortWARNtloggertwarning(RR tmessage(RmRRw(sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytinnerBs    ( RkRtinspectt getargspecR6Rtdefaultst functoolstwraps(RmRtspecR~((RmRRwsC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt__call__;s #$N( RJt __module__t__doc__RxRzRRpRsRrR…(((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyRh»shs%Y-%m-%dT%H:%M:%S.%fs%Y-%m-%dT%H:%M:%ScCsy|ptiƒ}n|i|ptntƒ}|io|iidƒnd}||djodn|7}|S(s"Stringify time in ISO 8601 format.tUTCtZN(Rtutcnowtstrftimet_ISO8601_TIME_FORMATt_ISO8601_TIME_FORMAT_SUBSECONDttzinfottznameR(tatt subsecondtstttz((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytisotimeZs #cCs#|p tiƒ}|itiƒS(N(RRŠR‹tPERFECT_TIME_FORMAT(R((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pytstrtimess(#R‚RaRURtloggingR_t oslo_utilsRRRR#tkeystoneclientRt getLoggerRJR{R RRR4R9RARPRRRSR\RdRgtobjectRhRRŒRR”R–(((sC/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/utils.pyt s6               ›