def run_if_posix(*args: Tuple, **kwargs: Dict) -> Optional[T]: if is_posix(): return func(*args, **kwargs) elif error_level == ErrorLevel.warn: log_warn(msg, func.__name__) elif error_level == ErrorLevel.error: log_error(msg, func.__name__) raise OSError(msg, func.__name__) else: return None
def run_if_linux(*args, **kwargs): if is_linux(releases=releases): return func(*args, **kwargs) elif error_level == ErrorLevel.warn: log_warn(msg, func.__name__) return None elif error_level == ErrorLevel.error: log_error(msg, func.__name__) raise OSNotSupportedError(msg, func.__name__) else: return None