Source code for lidar_prod.commons.commons

import logging
import time
import warnings
from typing import Callable

import rich.syntax
import rich.tree
from omegaconf import DictConfig, OmegaConf


[docs] def extras(config: DictConfig): log = logging.getLogger(__name__) if config.ignore_warnings: log.debug("Disabling python warnings! <config.ignore_warnings=True>") ignore_warnings() if config.print_config: print_config(config)
[docs] def ignore_warnings(): warnings.filterwarnings("ignore")
[docs] def eval_time(function: Callable): """decorator to log the duration of the decorated method""" def timed(*args, **kwargs): log = logging.getLogger(__name__) time_start = time.time() result = function(*args, **kwargs) time_elapsed = round(time.time() - time_start, 2) log.info(f"Processing time of {function.__name__}: {time_elapsed}s") return result return timed