Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_max_depth(self):
print ('Testing function: "{}"...'.format(timing.FUNC()))
tman = timing.timing_manager()
timing.toggle(True)
tman.clear()
def create_timer(n):
autotimer = timing.auto_timer('{}'.format(n))
fibonacci(30)
if n < 8:
create_timer(n + 1)
ntimers = 4
timing.set_max_depth(ntimers)
create_timer(0)
def test_pointer(self):
print ('Testing function: "{}"...'.format(timing.FUNC()))
nval = 4
def set_pointer_max(nmax):
tman = timing.timing_manager()
tman.set_max_depth(4)
return tman.get_max_depth()
def get_pointer_max():
return timing.timing_manager().get_max_depth()
ndef = get_pointer_max()
nnew = set_pointer_max(nval)
nchk = get_pointer_max()
self.assertEqual(nval, nchk)
def test_toggle(self):
print ('Testing function: "{}"...'.format(timing.FUNC()))
tman = timing.timing_manager()
timing.toggle(True)
timing.set_max_depth(timing.util.default_max_depth())
tman.clear()
timing.toggle(True)
if True:
autotimer = timing.auto_timer("on")
fibonacci(27)
del autotimer
self.assertEqual(tman.size(), 1)
tman.clear()
timing.toggle(False)
def test():
print ('test: func() {}'.format(tim.FUNC()))
print ('test: func(2) {}'.format(tim.FUNC(2)))
def test():
print ('test: func() {}'.format(tim.FUNC()))
print ('test: func(2) {}'.format(tim.FUNC(2)))
def __enter__(self, *args, **kwargs):
"""
Context manager entrance
"""
import timemory
_file = timemory.FILE(3)
_line = timemory.LINE(2)
_func = timemory.FUNC(2)
self.determine_signature(is_decorator=False, is_context_manager=True)
_key = ''
_args = self.arg_string(args, kwargs)
if self.signature == context.blank:
_key = '{}{}'.format(self.key, _args)
elif self.signature == context.basic:
_key = '{}/{}/{}'.format(_func, self.key, _args)
elif self.signature == context.full:
_key = '{}/{}:{}/{}{}'.format(
_func, _file, _line, self.key, _args)
_key = _key.strip('/')
self._self_obj = timemory.rss_usage(_key)
self._self_dif = timemory.rss_usage(_key)
self._self_dif.record()