<s> __author__ = '<STR_LIT>' <EOL> from time import time <EOL> from . tools import convert_time_units <EOL> timer_format = "<STR_LIT>" <EOL> def timer ( func ) : <EOL> def _timed_function ( * args , ** kwargs ) : <EOL> t1 = time ( ) <EOL> result = func ( * args , ** kwargs ) <EOL> t2 = time ( ) <EOL> delta = t2 - t1 <EOL> _timed_function . _total_time += delta <EOL> _timed_function . _call_count += <NUM_LIT:1> <EOL> _timed_function . _average_time = convert_time_units ( _timed_function . _total_time / _timed_function . _call_count ) <EOL> print ( timer_format . format ( name = func . __name__ , recent_time = convert_time_units ( delta ) , avg_time = _timed_function . _average_time ) ) <EOL> return result <EOL> _timed_function . _total_time = <NUM_LIT:0> <EOL> _timed_function . _call_count = <NUM_LIT:0> <EOL> _timed_function . __name__ = "<STR_LIT>" . format ( func . __name__ ) <EOL> return _timed_function </s>
