Lines Matching full:setup

17   -s/--setup S: statement to be executed once initially (default 'pass')
78 # in Timer.__init__() depend on setup being indented 4 spaces and stmt
82 %(setup)s
94 def _template_func(setup, func): argument
97 setup()
109 statement used for setup, and a timer function. Both statements
121 def __init__(self, stmt="pass", setup="pass", timer=default_timer): argument
127 if isinstance(setup, basestring):
128 compile(setup, dummy_src_name, "exec")
129 compile(setup + '\n' + stmt, dummy_src_name, "exec")
133 if isinstance(setup, basestring):
134 setup = reindent(setup, 4)
135 src = template % {'stmt': stmt, 'setup': setup, 'init': ''}
136 elif hasattr(setup, '__call__'):
137 src = template % {'stmt': stmt, 'setup': '_setup()',
139 ns['_setup'] = setup
141 raise ValueError("setup is neither a string nor callable")
148 if isinstance(setup, basestring):
149 _setup = setup
150 def setup(): function
152 elif not hasattr(setup, '__call__'):
153 raise ValueError("setup is neither a string nor callable")
154 self.inner = _template_func(setup, stmt)
188 To be precise, this executes the setup statement once, and
192 to one million. The main statement, the setup statement and
234 def timeit(stmt="pass", setup="pass", timer=default_timer, argument
237 return Timer(stmt, setup, timer).timeit(number)
239 def repeat(stmt="pass", setup="pass", timer=default_timer, argument
242 return Timer(stmt, setup, timer).repeat(repeat, number)
266 ["number=", "setup=", "repeat=",
275 setup = []
282 if o in ("-s", "--setup"):
283 setup.append(a)
299 setup = "\n".join(setup) or "pass"
307 t = Timer(stmt, setup, timer)