Spaces:
Build error
Build error
File size: 1,026 Bytes
d61b9c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#!/usr/bin/env python3
try:
from captum.log.fb.internal_log import (
log,
log_usage,
patch_methods,
set_environment,
TimedLog,
)
__all__ = ["log", "log_usage", "TimedLog", "set_environment"]
except ImportError:
from functools import wraps
def log(*args, **kwargs):
pass
# bug with mypy: https://github.com/python/mypy/issues/1153
class TimedLog: # type: ignore
def __init__(self, *args, **kwargs):
pass
def __enter__(self):
return self
def __exit__(self, exception_type, exception_value, traceback):
return exception_value is not None
def log_usage(*log_args, **log_kwargs):
def _log_usage(func):
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper
return _log_usage
def set_environment(env):
pass
def patch_methods(tester, patch_log=True):
pass
|