Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def compute_repr(self, x):
orig_repr_func = pysnooper.utils.get_repr_function(x, self.orig_custom_repr)
if torch.is_tensor(x):
return self.tensor_format(x)
elif isinstance(x, numpy.ndarray):
return self.numpy_format(x)
elif self.is_return_types(x):
return self.return_types_repr(x)
elif orig_repr_func is not repr:
return orig_repr_func(x)
elif isinstance(x, (list, tuple)):
content = ''
for i in x:
if content != '':
content += ', '
content += self.compute_repr(i)
if isinstance(x, tuple) and len(x) == 1:
content += ','