ó •abc@@s ddlmZddlZddlZddlZddlZddlmZej dej ƒZ d„Z yddlm Z Wnek ržd„Z nXdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZeZd„ZdS(i(tabsolute_importN(tsixs^[a-z_][a-z0-9_]*$cC@s,tj|ƒ}|s(td|ƒ‚ntS(Ns!Not a valid Python identifier: %r(t IDENTIFIERtmatcht ValueErrortTrue(tstm((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyt valid_ident"s(t _checkLevelcC@spt|tƒr|}nTt|ƒ|kr\|tjkrLtd|ƒ‚ntj|}ntd|ƒ‚|S(NsUnknown level: %rs*Level not an integer or a valid string: %r(t isinstancetinttstrtloggingt _levelNamesRt TypeError(tleveltrv((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyR .s  tConvertingDictcB@s/eZdZd„Zdd„Zdd„ZRS(s A converting dictionary wrapper.cC@sqtj||ƒ}|jj|ƒ}||k rm|||[a-z]+)://(?P.*)$s ^\s*(\w+)\s*s^\.\s*(\w+)\s*s^\[\s*(\w+)\s*\]\s*s^\d+$t ext_converttextt cfg_converttcfgcC@st|ƒ|_||j_dS(N(RtconfigR(RR.((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyt__init__£sc C@sô|jdƒ}|jdƒ}yy|j|ƒ}x_|D]W}|d|7}yt||ƒ}Wq7tk r|j|ƒt||ƒ}q7Xq7W|SWnVtk rïtjƒd\}}td||fƒ}|||_ |_ |‚nXdS(s` Resolve strings to objects using standard import and attribute syntax. t.iisCannot resolve %r: %sN( tsplitR!timportertgetattrtAttributeErrort ImportErrortsystexc_infoRt __cause__t __traceback__( RRtnametusedtfoundtfragtettbtv((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pytresolve§s"    cC@s |j|ƒS(s*Default converter for the ext:// protocol.(RA(RR((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyR*¾scC@sO|}|jj|ƒ}|dkr7td|ƒ‚n||jƒ}|j|jƒd}xê|rJ|jj|ƒ}|r–||jƒd}n‚|jj|ƒ}|r|jƒd}|j j|ƒsÝ||}qyt |ƒ}||}Wqt k r||}qXn|r1||jƒ}qatd||fƒ‚qaW|S(s*Default converter for the cfg:// protocol.sUnable to convert %risUnable to convert %r at %rN( t WORD_PATTERNRR%RtendR.tgroupst DOT_PATTERNt INDEX_PATTERNt DIGIT_PATTERNR R(RRtrestRtdR'tn((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyR,Âs2     cC@s2t|tƒ r7t|tƒr7t|ƒ}||_n÷t|tƒ rnt|tƒrnt|ƒ}||_nÀt|tƒ r¥t|tƒr¥t|ƒ}||_n‰t|tj ƒr.|j j |ƒ}|r.|j ƒ}|d}|j j|dƒ}|r+|d}t||ƒ}||ƒ}q+q.n|S(sé Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. tprefixtsuffixN(R RRRRR&RR(Rt string_typestCONVERT_PATTERNRt groupdicttvalue_convertersRR%R3(RRRRIRKt converterRL((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRäs*         c@sɈjdƒ}t|dƒ rUttdƒrUt|ƒtjkrU|j|ƒ}nˆjddƒ}t‡fd†ˆDƒƒ}||}|rÅx-|jƒD]\}}t |||ƒq¢Wn|S(s1Configure an object with a user-supplied factory.s()t__call__t ClassTypeR0c3@s+|]!}t|ƒr|ˆ|fVqdS(N(R(t.0tk(R.(s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pys sN( R!thasattrttypesRRSRAR%Rtitemstsetattr(RR.tctpropstkwargsRR:R((R.s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pytconfigure_customs4 cC@s"t|tƒrt|ƒ}n|S(s0Utility function which converts lists to tuples.(R R&R((RR((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pytas_tuples(R"R#R$tretcompileRNRBRERFRGRPt __import__R2R/RAR*R,RR]R^(((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyR)s"     "  tDictConfiguratorcB@sheZdZd„Zd„Zd„Zd„Zd„Zd„Ze d„Z e d„Z e d „Z RS( s] Configure logging using a dictionary-like object to describe the configuration. cC@sq|j}d|kr$tdƒ‚n|ddkrKtd|dƒ‚n|jdtƒ}i}tjƒzò|r|jd|ƒ}tjd dkrFx¨|D]}|tj krÊtd |ƒ‚q¢yItj |}||}|jd dƒ}|r|j t |ƒƒnWq¢t k r>} td || fƒ‚q¢Xq¢Wn|jd |ƒ} xU| D]M}y|j|| |tƒWq_t k r«} td || fƒ‚q_Xq_W|jddƒ} | r^y|j| tƒWqt k r} td| ƒ‚qXq^nV|jdtƒ} tj jƒtj2|jd|ƒ} xU| D]M}y|j| |ƒ| |RfRgtdisable_existingRiRjtexistingt child_loggerstitprefixedtpflent num_existingtlogtlogger((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyt configuresÐ                         cC@sÀd|kr†|d}y|j|ƒ}Wq¼tk r‚}dt|ƒkrS‚n|jdƒ|d<||d<|j|ƒ}q¼Xn6|jddƒ}|jddƒ}tj||ƒ}|S(s(Configure a formatter from a dictionary.s()s'format'tformattfmttdatefmtN(R]RR R!RR%R t Formatter(RR.tfactoryRtteR’tdfmt((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRu­s   cC@sCd|kr|j|ƒ}n!|jddƒ}tj|ƒ}|S(s%Configure a filter from a dictionary.s()R:t(R]RR tFilter(RR.RR:((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRvÃs  cC@s]xV|D]N}y|j|jd|ƒWqtk rT}td||fƒ‚qXqWdS(s/Add filters to a filterer from a list of names.RjsUnable to add filter %r: %sN(t addFilterR.RpR(RtfiltererRjtfR>((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyt add_filtersÌs  c @s½ˆjddƒ}|r\y|jd|}Wq\tk rX}td||fƒ‚q\Xnˆjddƒ}ˆjddƒ}dˆkrêˆjdƒ}t|dƒ ráttdƒrát|ƒtjkrá|j |ƒ}n|}n|j ˆjd ƒƒ}t |t j j ƒrsd ˆkrsy|jd ˆd ˆd õss'stream'tstreamtstrmN(R!R%R.RpRRVRWRRSRAt issubclassR Ret MemoryHandlert SMTPHandlerR^t SysLogHandlerRRR t setFormatterRoR R( RR.RžR>RRjRZR•tklassR\RR–((R.s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRxÔsX 4     cC@s]xV|D]N}y|j|jd|ƒWqtk rT}td||fƒ‚qXqWdS(s.Add handlers to a logger from a list of names.ResUnable to add handler %r: %sN(t addHandlerR.RpR(RRRethR>((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyt add_handlers s  cC@s¹|jddƒ}|dk r4|jt|ƒƒn|sµx|jD]}|j|ƒqEW|jddƒ}|r‡|j||ƒn|jddƒ}|rµ|j||ƒqµndS(sU Perform configuration which is common to root and non-root loggers. RReRjN(RR%RoR Ret removeHandlerR­R(RRR.RdRR¬ReRj((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pytcommon_logger_configs cC@sPtj|ƒ}|j|||ƒ|jddƒ}|dk rL||_ndS(s.Configure a non-root logger from a dictionary.RN(R t getLoggerR¯RR%R(RR:R.RdRR((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRq#s  cC@s#tjƒ}|j|||ƒdS(s*Configure a root logger from a dictionary.N(R R°R¯(RR.RdRg((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRr+s ( R"R#R$RRuRvRRxR­RkR¯RqRr(((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyRbs ’   5   cC@st|ƒjƒdS(s%Configure logging using a dictionary.N(tdictConfigClassR(R.((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyt dictConfig3s(t __future__Rtlogging.handlersR R_R6RWt pip._vendorRR`tIRRR R5RRR&RR(RtobjectR)RbR±R²(((s9/usr/lib/python2.7/site-packages/pip/compat/dictconfig.pyts&       & †ÿ