How to use the pysnooper.third_party.decorator 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 / pysnooper.py View on Github external
def decorate(function):
        target_code_object = function.__code__
        tracer = Tracer(
            target_code_object=target_code_object, write=write,
            truncate=truncate, watch=watch, watch_explode=watch_explode,
            depth=depth, prefix=prefix, overwrite=overwrite
        )

        def inner(function_, *args, **kwargs):
            with tracer:
                return function(*args, **kwargs)
        return decorator.decorate(function, inner)