Massaging some code

This commit is contained in:
Ram Rachum 2019-09-08 21:51:20 +03:00
parent d6330dc6a6
commit bd72e6c786
2 changed files with 2 additions and 7 deletions

View file

@ -152,12 +152,7 @@ On multi-threaded apps identify which thread are snooped in output:
PySnooper supports decorating generators.
If the decorator is applied to a class, PySnooper will decorate all of its instance methods. If you use this feature, you should be aware
of the behaviour when snooping on decorated functions:
* If any methods have existing decorators, and those decorators return functions, it is the decorated method that will be snooped.
* Some decorators do not return functions (rather, they return an instance of a class with a `__call__` method).
This includes the `@property` builtin. In these cases, the decorated method will not be snooped at all.
If you decorate a class with `snoop`, it'll automatically apply the decorator to all the methods. (Not including properties and other special cases.)
You can also customize the repr of an object:

View file

@ -225,7 +225,7 @@ class Tracer:
def __call__(self, function_or_class):
if DISABLED:
return function
return function_or_class
if inspect.isclass(function_or_class):
return self._wrap_class(function_or_class)