Lines Matching +full:repeat +full:- +full:string
12 python timeit.py [-n N] [-r N] [-s S] [-p] [-h] [--] [statement]
15 -n/--number N: how many times to execute 'statement' (default: see below)
16 -r/--repeat N: how many times to repeat the timer (default 5)
17 -s/--setup S: statement to be executed once initially (default 'pass').
19 -p/--process: use time.process_time() (default is time.perf_counter())
20 -v/--verbose: print raw timing results; repeat for more digits precision
21 -u/--unit: set the output time unit (nsec, usec, msec, or sec)
22 -h/--help: print this usage message and exit
23 --: separate options from statement, use when statement starts with -
26 A multi-line statement may be given by specifying each line as a
28 argument in quotes and using leading spaces. Multiple -s options are
31 If -n is not given, a suitable number of loops is calculated by trying
46 timeit(string, string) -> float
47 repeat(string, string) -> list
48 default_timer() -> float
57 __all__ = ["Timer", "timeit", "repeat", "default_timer"]
59 dummy_src_name = "<timeit-src>"
77 return _t1 - _t0
81 """Helper to reindent a multi-line statement."""
89 default to 'pass'; the timer function is platform-dependent (see
90 module doc string). If 'globals' is specified, the code will be
95 timeit() method. The repeat() method is a convenience to call
99 multi-line string literals.
104 """Constructor. See class doc string."""
120 raise ValueError("setup is neither a string nor callable")
130 raise ValueError("stmt is neither a string nor callable")
144 t.timeit(...) # or t.repeat(...)
174 it = itertools.repeat(None, number)
184 def repeat(self, repeat=default_repeat, number=default_number): member in Timer
205 for i in range(repeat):
236 def repeat(stmt="pass", setup="pass", timer=default_timer, function
237 repeat=default_repeat, number=default_number, globals=None):
238 """Convenience function to create Timer object and call repeat method."""
239 return Timer(stmt, setup, timer, globals).repeat(repeat, number)
263 ["number=", "setup=", "repeat=",
268 print("use -h/--help for command line help")
273 number = 0 # auto-determine
275 repeat = default_repeat
278 units = {"nsec": 1e-9, "usec": 1e-6, "msec": 1e-3, "sec": 1.0}
281 if o in ("-n", "--number"):
283 if o in ("-s", "--setup"):
285 if o in ("-u", "--unit"):
292 if o in ("-r", "--repeat"):
293 repeat = int(a)
294 if repeat <= 0:
295 repeat = 1
296 if o in ("-p", "--process"):
298 if o in ("-v", "--verbose"):
302 if o in ("-h", "--help"):
321 msg = "{num} loop{s} -> {secs:.{prec}g} secs"
335 raw_timings = t.repeat(repeat, number)
362 repeat, format_time(best)))