MCPcopy Index your code
hub / github.com/RustPython/RustPython / collect_time

Function collect_time

Lib/test/pythoninfo.py:458–482  ·  view source on GitHub ↗
(info_add)

Source from the content-addressed store, hash-verified

456
457
458def collect_time(info_add):
459 import time
460
461 info_add('time.time', time.time())
462
463 attributes = (
464 'altzone',
465 'daylight',
466 'timezone',
467 'tzname',
468 )
469 copy_attributes(info_add, time, 'time.%s', attributes)
470
471 if hasattr(time, 'get_clock_info'):
472 for clock in ('clock', 'monotonic', 'perf_counter',
473 'process_time', 'thread_time', 'time'):
474 try:
475 # prevent DeprecatingWarning on get_clock_info('clock')
476 with warnings.catch_warnings(record=True):
477 clock_info = time.get_clock_info(clock)
478 except ValueError:
479 # missing clock like time.thread_time()
480 pass
481 else:
482 info_add('time.get_clock_info(%s)' % clock, clock_info)
483
484
485def collect_curses(info_add):

Callers

nothing calls this directly

Calls 3

copy_attributesFunction · 0.85
hasattrFunction · 0.85
timeMethod · 0.45

Tested by

no test coverage detected