本文整理汇总了Python中tempfile.NamedTemporaryFile.getvalue方法的典型用法代码示例。如果您正苦于以下问题:Python NamedTemporaryFile.getvalue方法的具体用法?Python NamedTemporaryFile.getvalue怎么用?Python NamedTemporaryFile.getvalue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tempfile.NamedTemporaryFile
的用法示例。
在下文中一共展示了NamedTemporaryFile.getvalue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_command
# 需要导入模块: from tempfile import NamedTemporaryFile [as 别名]
# 或者: from tempfile.NamedTemporaryFile import getvalue [as 别名]
def run_command(args):
if DotNetSystem is None:
# cpython
stdout = NamedTemporaryFile()
stderr = NamedTemporaryFile()
res = subprocess.call(args, stdin=PIPE, stdout=stdout, stderr=stderr)
return stdout.read(), stderr.read(), res
else:
# IronPython
stdout = StringIO()
stderr = StringIO()
res = subprocess.call(args, stdin=PIPE, stdout=stdout, stderr=stderr)
return stdout.getvalue(), stderr.getvalue(), res
示例2: test_cons_recomb
# 需要导入模块: from tempfile import NamedTemporaryFile [as 别名]
# 或者: from tempfile.NamedTemporaryFile import getvalue [as 别名]
def test_cons_recomb(self):
vcf_fpath = os.path.join(TEST_DATA_DIR, "scaff000025.vcf.gz")
snvs = VCFReader(open(vcf_fpath)).parse_snvs()
snv_filter = WeirdRecombFilter(pop_type="ril_self")
flt_snvs = snv_filter.filter_snvs(snvs)
assert len(list(flt_snvs)) == 258
assert snv_filter.not_fitted_counter["no close region left"] == 10
fhand = NamedTemporaryFile(suffix=".png")
flt_snvs = snv_filter.plot_recomb_at_0_dist_hist(fhand)
assert len(snv_filter.recomb_rates["ok"]) == 245
assert len(snv_filter.recomb_rates["ok_conf_is_None"]) == 13
assert len(snv_filter.recomb_rates["not_ok"]) == 14
snvs = VCFReader(open(vcf_fpath)).parse_snvs()
snv_filter = WeirdRecombFilter(pop_type="ril_self", max_zero_dist_recomb=0.07, alpha_recomb_0=None)
flt_snvs = snv_filter.filter_snvs(snvs)
assert len(list(flt_snvs)) == 266
assert snv_filter.not_fitted_counter["no close region left"] == 10
fhand = NamedTemporaryFile(suffix=".png")
flt_snvs = snv_filter.plot_recomb_at_0_dist_hist(fhand)
assert len(snv_filter.recomb_rates["ok"]) == 0
assert len(snv_filter.recomb_rates["ok_conf_is_None"]) == 266
assert len(snv_filter.recomb_rates["not_ok"]) == 6
fhand = StringIO()
snv_filter.write_log(fhand)
assert "SNVs processed: 282" in fhand.getvalue()