(func: Callable[T_In, T_Out])
| 145 | |
| 146 | |
| 147 | def IgnoreException(func: Callable[T_In, T_Out]) -> Callable[T_In, Optional[T_Out]]: |
| 148 | @wraps(func) |
| 149 | def wrapped(*args, **kwargs) -> Optional[T_Out]: |
| 150 | try: |
| 151 | result = func(*args, **kwargs) |
| 152 | except KeyboardInterrupt as e: |
| 153 | raise e from None |
| 154 | except Exception as e: |
| 155 | Logger.show_exception() |
| 156 | Logger.write("warn", f"Failed to execute function {func.__name__} due to exception:\n{e}") |
| 157 | result = None |
| 158 | return result |
| 159 | return wrapped |
| 160 | |
| 161 | def tensor_safe_asdict(obj): |
| 162 | if is_dataclass(obj): |
nothing calls this directly
no outgoing calls
no test coverage detected