本文整理汇总了Python中pipeline.Pipeline.read_input方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.read_input方法的具体用法?Python Pipeline.read_input怎么用?Python Pipeline.read_input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.read_input方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_extension_input_resource_file
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import read_input [as 别名]
def test_add_extension_input_resource_file(self):
input_file1 = '/tmp/data/example1.txt.bgz.foo'
p = Pipeline()
in1 = p.read_input(input_file1, extension='.txt.bgz.foo')
with self.assertRaises(Exception):
in1.add_extension('.baz')
assert in1._value.endswith('.txt.bgz.foo')
示例2: test_read_input_and_write_output
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import read_input [as 别名]
def test_read_input_and_write_output(self):
with tempfile.NamedTemporaryFile('w') as input_file, \
tempfile.NamedTemporaryFile('w') as output_file:
input_file.write('abc')
input_file.flush()
p = Pipeline()
input = p.read_input(input_file.name)
p.write_output(input, output_file.name)
p.run()
self.assert_same_file(input_file.name, output_file.name)
示例3: test_single_task_w_input
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import read_input [as 别名]
def test_single_task_w_input(self):
with tempfile.NamedTemporaryFile('w') as input_file, \
tempfile.NamedTemporaryFile('w') as output_file:
msg = 'abc'
input_file.write(msg)
input_file.flush()
p = Pipeline()
input = p.read_input(input_file.name)
t = p.new_task()
t.command(f'cat {input} > {t.ofile}')
p.write_output(t.ofile, output_file.name)
p.run()
assert self.read(output_file.name) == msg
示例4: test_file_name_space
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import read_input [as 别名]
def test_file_name_space(self):
with tempfile.NamedTemporaryFile('w', prefix="some file name with (foo) spaces") as input_file, \
tempfile.NamedTemporaryFile('w', prefix="another file name with (foo) spaces") as output_file:
input_file.write('abc')
input_file.flush()
p = Pipeline()
input = p.read_input(input_file.name)
t = p.new_task()
t.command(f'cat {input} > {t.ofile}')
p.write_output(t.ofile, output_file.name)
p.run()
self.assert_same_file(input_file.name, output_file.name)