Metadata-Version: 1.1
Name: threadio
Version: 0.1
Summary: ThreadIO, is good for capture stdout at multi-thread environment.
Home-page: UNKNOWN
Author: EcmaXp
Author-email: module-threadio@ecmaxp.pe.kr
License: UNKNOWN
Description: ThreadIO, is good for capture stdout at multi-thread environment.
        
        
        >>> # standard capture
        >>> from threadio import print_to_file
        >>> with print_to_file(TextIO()) as fp:
        ...     print("hello world")
        ...
        >>> fp.getvalue()
        'hello world\n'
        
        >>> # standard capture (but not stdout, stderr)
        >>> from threadio import ThreadIO
        >>> fp = ThreadIO(TextIO())
        >>> with fp.capture(TextIO()) as fp2:
        ...     print("hello world", file=fp)
        ...     with fp.capture(TextIO()) as fp3:
        ...         print("hello world3", file=fp)
        ...         # not captured fp3, stored fp2
        ...         print("fail captured", file=fp2)
        ...
        >>> fp.getvalue()
        ''
        >>> fp2.getvalue()
        'hello world\nfail captured\n'
        >>> fp3.getvalue()
        'hello world3\n'
        
        >>> # thread example
        >>> from threading import Thread
        >>> from threadio import print_to_file
        >>> th = Thread(target=print, args=("hello world!",))
        >>> with print_to_file(TextIO()) as fp:
        ...     th.start()
        ...     th.join()
        ...     print("HAYO!")
        ... 
        hello world!
        >>> fp.getvalue() # not capture other thread's print
        'HAYO!\n'
        
        
        >>> # note. print_to_xxx function change everything. 
        >>> a = sys.stdout
        >>> with print_to_file(TextIO()): pass
        >>> b = sys.stdout
        >>> a is b
        False
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
