B t `' ã@sVddlZyddlmZWnddlmZYnXGdd„deƒZGdd„deƒZdS)éN)ÚStringIOc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú TeeStreamz¥This class implements a simple 'Tee' of the specified python stream. Since this presents a full file interface, TeeStream objects may be arbitrarily nested.cCs||_tƒ|_dS)N)ÚstreamrÚbuffer)Úselfr©rú8/tmp/pip-unpacked-wheel-cqckmaqz/pyutilib/misc/tee_io.pyÚ__init__szTeeStream.__init__cCs|j |¡|j |¡dS)N)rÚwriter)rÚdatarrrr s zTeeStream.writecCsx|D]}| |¡qWdS)N)r )rÚsequenceÚxrrrÚ writeliness zTeeStream.writelinescCs tƒ|_dS)N)rr)rrrrÚreset"szTeeStream.resetN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r r rrrrrrrs rc@s8eZdZdZGdd„deƒZdd„Zdd„Zdd „Zd S) Ú ConsoleBuffera­This class implements a simple 'Tee' of the python stdout and stderr so the output can be captured and reported programmatically. We need a specialized class here because other applications / methods explicitly write to sys.stderr and sys.stdout, so it is insufficient to 'wrap' the streams like the TeeStream class; instead, we must replace the standard stdout and stderr objects with our own duplicator.c@seZdZdd„Zdd„ZdS)zConsoleBuffer._DuplicatecCs||_||_dS)N)ÚaÚb)rrrrrrr 1sz!ConsoleBuffer._Duplicate.__init__cCs|j |¡|j |¡dS)N)rr r)rr rrrr 5s zConsoleBuffer._Duplicate.writeN)rrrr r rrrrÚ _Duplicate/srcCs(d|_|_tj|_tj|_| ¡dS)N)Ú_dup_outÚ_dup_errÚsysÚstdoutÚ_raw_outÚstderrÚ_raw_errr)rrrrr 9s zConsoleBuffer.__init__cCsP|jdk r|jtjk rtdƒ‚|jdk r<|jtjk r s