def TestBuild(registry, out_dir): foo_path = os.path.join(SCRIPT_DIR, 'foo.txt') bar_path = os.path.join(SCRIPT_DIR, 'bar.txt') foo_foo_path = os.path.join(out_dir, 'foofoo.txt') bar_bar_path = os.path.join(out_dir, 'barbar.txt') foo_bar_path = os.path.join(out_dir, 'foofoobarbar.txt') registry.SystemCommand( inputs=[foo_path], outputs=[foo_foo_path], command=utils.CatCommand([foo_path, foo_path], foo_foo_path)) registry.SystemCommand( inputs=[bar_path], outputs=[bar_bar_path], command=utils.CatCommand([bar_path, bar_path], bar_bar_path, os.path.join(out_dir, 'bar_bar.count'))) registry.SystemCommand( inputs=[foo_foo_path, bar_bar_path], outputs=[foo_bar_path], command=utils.CatCommand([foo_foo_path, bar_bar_path], foo_bar_path)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'single_function.count'))
def TestBuild(registry, out_dir): stdin_path = os.path.join(out_dir, 'stdin.txt') stdout_path = os.path.join(out_dir, 'stdout.txt') stderr_path = os.path.join(out_dir, 'stderr.txt') final_path = os.path.join(out_dir, 'final.txt') registry.SystemCommand( inputs=[], outputs=[stdin_path], command=utils.EchoCommand('in', stdin_path)) registry.SystemCommand( inputs=[], outputs=[], command=utils.EchoCommand('out', 'stdout'), stdout=stdout_path) registry.SystemCommand( inputs=[], outputs=[], command=utils.EchoCommand('err', 'stderr'), stderr=stderr_path) registry.SystemCommand( inputs=[stdout_path, stderr_path], outputs=[final_path], command=utils.CatCommand( [stdout_path, stderr_path, 'stdin'], final_path, os.path.join(out_dir, 'final.count')), stdin=stdin_path) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'stdouterrin_function.count'))
def CatFiles(registry, out_dir, inputs, output_file): utils.AddCount(os.path.join(out_dir, 'CatFiles.count')) registry.SystemCommand( inputs=inputs, outputs=[output_file], command=utils.CatCommand(inputs, output_file)) return output_file
def ResolveReturnedObject(registry, out_dir, c): out_file = os.path.join(out_dir, 'returned_file.txt') registry.SystemCommand(inputs=[], outputs=[out_file], command=utils.EchoCommand( str(c.GetA().GetA()) + '_' + str(c.d['hello']), out_file))
def WriteAsString(registry, out_dir, contents, out_file): registry.SystemCommand(inputs=[], outputs=[out_file], command=utils.EchoCommand(str(contents), out_file)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'WriteAsString.count'))
def GenerateBottom(registry, out_dir, out_file): registry.SystemCommand(inputs=[], outputs=[out_file], command=utils.EchoCommand('TheBottom', out_file)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'GenerateBottom.count')) return out_file
def WriteResults(registry, out_dir, results, out_file): registry.SystemCommand(inputs=[], outputs=[out_file], command=utils.EchoCommand(str(results[1][1][0][1]), out_file)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'WriteResults.count'))
def WriteObjectValueWithoutImport(registry, out_dir, a): out_file = os.path.join(out_dir, 'value_without_import.txt') utils.AddCount( os.path.join(out_dir, 'write_object_value_without_import.count')) registry.SystemCommand(inputs=[], outputs=[out_file], command=utils.EchoCommand(a.GetValue(), out_file))
def SendObject(registry, out_dir, a, b): out_file = os.path.join(out_dir, 'sent_file.txt') registry.SystemCommand(inputs=[], outputs=[out_file], command=utils.EchoCommand( str(a.GetA()) + '_' + str(b.GetA().b), out_file)) b.d['hello'] += '_ghoul' return b
def WriteOutFunctionOutput(registry, out_dir, f, b): out_file = os.path.join(out_dir, 'sent_file.txt') f_2_output = f(2) registry.SystemCommand( inputs=[], outputs=[out_file], command=utils.EchoCommand( f_2_output + '_' + b(lambda x: 'bar-' * x), out_file)) return out_file
def GenerateFoo(registry, out_dir): foo_filepath = os.path.join(out_dir, 'foo.txt') registry.SystemCommand(inputs=[], outputs=[foo_filepath], command=utils.EchoCommand(get_foo_value.foo_value, foo_filepath)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'GenerateFoo.count')) return foo_filepath
def GenerateBar(registry, out_dir): bar_filepath = os.path.join(out_dir, 'bar.txt') registry.SystemCommand( inputs=[], outputs=[bar_filepath], command=utils.EchoCommand('bar', bar_filepath)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'GenerateBar.count')) return bar_filepath
def Chain(registry, out_dir, input, number, base_out_file): out_file = base_out_file + str(number) + '.txt' registry.SystemCommand(inputs=[input], outputs=[out_file], command=utils.CatCommand([input, input], out_file)) return_value = [[out_file, number]] if number > 1: return_value.append( registry.SubRespire(Chain, input=out_file, base_out_file=base_out_file, number=number - 1, out_dir=out_dir)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'Chain.count')) return return_value
def TestBuild(registry, out_dir): foo_path = os.path.join(SCRIPT_DIR, 'foo.txt') bar_path = os.path.join(SCRIPT_DIR, 'bar.txt') foo_foo_path = os.path.join(out_dir, 'foofoo.txt') bar_bar_path = os.path.join(out_dir, 'barbar.txt') foo_bar_path = os.path.join(out_dir, 'foofoobarbar.txt') registry.SystemCommand(inputs=[foo_path], outputs=[foo_foo_path], command=utils.CatCommand([foo_path, foo_path], foo_foo_path)) registry.PythonFunction(inputs=[bar_path], outputs=[bar_bar_path], function=_DoubleFile, my_input=bar_path, my_output=bar_bar_path) registry.PythonFunction(inputs=[foo_foo_path, bar_bar_path], outputs=[foo_bar_path], function=_ConcatenateFiles) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'python_function.count'))
def DoubleInput(registry, out_dir, input, output): registry.SystemCommand(inputs=[input], outputs=[output], command=utils.CatCommand([input, input], output)) # Track how many times this python is executed. utils.AddCount(os.path.join(out_dir, 'DoubleInput.count'))