ó õùPc@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..\python\lib\netrc.pyR s   cCsd|j|j|jfS(Ns%s (%s, line %s)(RRR(R((s..\python\lib\netrc.pyt__str__sN(t__name__t __module__t__doc__tNoneRR(((s..\python\lib\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..\python\lib\netrc.pyRs     c Cs5tj|ƒ}|jd7_x|jƒ}}|s;PnÆ|dkrV|jƒ}n«|dkrkd}n–|dkrè|jƒ}g|j|?@[\]^_`{|}~tmachinetdefaulttmacdefs s s sbad toplevel token %rts&malformed %s entry %s terminated by %stlogintusertaccounttpasswordsbad follower token %r(tshlext wordcharst get_tokenRt whitespacetinstreamtreadlinetappendRRR Rt push_tokentrepr( RRRtlexerttopleveltttt entrynametlineRR R!((s..\python\lib\netrc.pyR"s\               cCs<||jkr|j|Sd|jkr4|jdSdSdS(s8Return a (user, account, password) tuple for given host.RN(RR (Rthost((s..\python\lib\netrc.pytauthenticatorsXs   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 (RtkeysR*R(RtrepR0tattrstmacroR/((s..\python\lib\netrc.pyt__repr__as $  N(R R R RRR1R6(((s..\python\lib\netrc.pyRs 6 t__main__((R RR"t__all__RRRR (((s..\python\lib\netrc.pyts   [