How to use the pysnooper.utils.WritableStream function in PySnooper

To help you get started, we’ve selected a few PySnooper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexmojaki / snoop / pysnooper / View on Github external
except UnicodeEncodeError:
                 # God damn Python 2
        truncate = None
    elif isinstance(output, (pycompat.PathLike, str)):
        def write(s):
            with open(six.text_type(output), 'a') as output_file:
        def truncate():
            with open(six.text_type(output), 'w') as output_file:
    elif callable(output):
        write = output
        truncate = None
        assert isinstance(output, utils.WritableStream)
        def write(s):
        truncate = None

    return (write, truncate)