bac@s>dZddlZddlmZddddddZdS(s backports.makefile ~~~~~~~~~~~~~~~~~~ Backports the Python 3 ``socket.makefile`` method for use with anything that wants to create a "fake" socket object. iN(tSocketIOtrc Cst|dddhks1td|fnd|k}d|kpM| }|sb|sbtd|k}d} |r| d7} n|r| d7} nt|| } |jd7_|d krd}n|dkrtj}n|dkr |std n| S|r.|r.tj| | |} n9|rItj | |} n|sUttj | |} |rq| Stj | |||} || _ | S( s: Backport of ``socket.makefile`` from Python 3.5. Rtwtbs&invalid mode %r (only r, w, b allowed)tiiis!unbuffered streams must be binaryN( tsett ValueErrortAssertionErrorRt_makefile_refstNonetiotDEFAULT_BUFFER_SIZEtBufferedRWPairtBufferedReadertBufferedWritert TextIOWrappertmode( tselfRt bufferingtencodingterrorstnewlinetwritingtreadingtbinarytrawmodetrawtbufferttext((sD/usr/lib/fence-agents/bundled/urllib3/packages/backports/makefile.pytbackport_makefile s@            (t__doc__R tsocketRR R(((sD/usr/lib/fence-agents/bundled/urllib3/packages/backports/makefile.pyts