# pragma mypy relaxed from typing import Dict, Any, Callable class profile: stats : Dict[ str, int ] = {} @staticmethod def get() -> Dict[ str, int ]: return dict( profile.stats ) def __init__( self, fun: Callable[ ..., Any ] ) -> None: self.fun = fun def __call__( self, *args: Any, **kwargs: Any ) -> Any: profile.stats.setdefault( self.fun.__name__, 0 ) profile.stats[ self.fun.__name__ ] += 1 return self.fun( *args, **kwargs ) import run_tests