ó õ^‚Rc@sndZddlZddlZddgZdefd„ƒYZddd„ƒYZedkrjeƒGHndS( s-An object-oriented interface to .netrc files.iÿÿÿÿNtnetrctNetrcParseErrorcBs&eZdZddd„Zd„ZRS(s5Exception raised on syntax errors in the .netrc file.cCs/||_||_||_tj||ƒdS(N(tfilenametlinenotmsgt Exceptiont__init__(tselfRRR((s/usr/lib/python2.7/netrc.pyR s   cCsd|j|j|jfS(Ns%s (%s, line %s)(RRR(R((s/usr/lib/python2.7/netrc.pyt__str__sN(t__name__t __module__t__doc__tNoneRR(((s/usr/lib/python2.7/netrc.pyR scBs/eZdd„Zd„Zd„Zd„ZRS(cCsŠ|dkrOy tjjtjddƒ}WqOtk rKtdƒ‚qOXni|_i|_t |ƒ}|j ||ƒWdQXdS(NtHOMEs.netrcs'Could not find .netrc: $HOME is not set( R tostpathtjointenvirontKeyErrortIOErrorthoststmacrostopent_parse(Rtfiletfp((s/usr/lib/python2.7/netrc.pyRs     c Cs‹tj|ƒ}|jd7_|jjddƒ|_xN|jƒ}}|sSPn |ddkršt|ƒd}|jj| dƒ|jjƒq9nÆ|dkrµ|jƒ}n«|dkrÊd}n–|dkrG|jƒ}g|j |?@[\]^_`{|}~t#tiitmachinetdefaulttmacdefs s s sbad toplevel token %rs&malformed %s entry %s terminated by %stlogintusertaccounttpasswordsbad follower token %r(tshlext wordcharst commenterstreplacet get_tokentlentinstreamtseektreadlineRt whitespacetappendRRR Rt startswitht push_tokentrepr( RRRtlexerttoplevelttttpost entrynametlineRR!R"((s/usr/lib/python2.7/netrc.pyR"sh                cCs<||jkr|j|Sd|jkr4|jdSdSdS(s8Return a (user, account, password) tuple for given host.RN(RR (Rthost((s/usr/lib/python2.7/netrc.pytauthenticators`s   cCsîd}x‰|jjƒD]x}|j|}|d|dt|dƒd}|drr|dt|dƒ}n|dt|d ƒd}qWxU|jjƒD]D}|d |d}x|j|D]}||}qÈW|d}q¢W|S( s3Dump the class data in the format of a .netrc file.Rsmachine s login is isaccount s password ismacdef (RtkeysR0R(RtrepR7tattrstmacroR6((s/usr/lib/python2.7/netrc.pyt__repr__is $  N(R R R RRR8R=(((s/usr/lib/python2.7/netrc.pyRs > t__main__((R RR#t__all__RRRR (((s/usr/lib/python2.7/netrc.pyts   c