本文整理匯總了Python中scripts.core.base.Paths.filesize方法的典型用法代碼示例。如果您正苦於以下問題:Python Paths.filesize方法的具體用法?Python Paths.filesize怎麽用?Python Paths.filesize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scripts.core.base.Paths
的用法示例。
在下文中一共展示了Paths.filesize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_comparisons
# 需要導入模塊: from scripts.core.base import Paths [as 別名]
# 或者: from scripts.core.base.Paths import filesize [as 別名]
def create_comparisons(self):
comparisons = ComparisonMultiThread(self.case.fs.ndiff_log)
comparisons.thread_name_property = True
for check_rule in self.case.check_rules:
method = str(check_rule.keys()[0])
module = getattr(file_comparison, 'Compare{}'.format(method.capitalize()), None)
comp_data = check_rule[method]
if not module:
Printer.all.err('Warning! No module for check_rule method "{}"', method)
continue
pairs = self._get_ref_output_files(comp_data)
if pairs:
for pair in pairs:
command = module.get_command(*pair, **comp_data)
pm = PyPy(BinExecutor(command), progress=True)
# if we fail, set error to 13
pm.custom_error = 13
pm.start_monitor.deactivate()
pm.end_monitor.deactivate()
pm.progress_monitor.deactivate()
pm.limit_monitor.deactivate() # TODO: maybe some time limit would be useful
pm.output_monitor.policy = pm.output_monitor.POLICY_ERROR_ONLY
pm.error_monitor.message = 'Comparison using method {} failed!'.format(method)
pm.error_monitor.indent = 1
# catch output
pm.executor.output = OutputMode.variable_output()
pm.full_output = self.case.fs.ndiff_log
path = Paths.path_end_until(pair[0], REF_OUTPUT_DIR)
test_name = Paths.basename(Paths.dirname(Paths.dirname(self.case.fs.ref_output)))
size = Paths.filesize(pair[0], True)
pm.name = '{}: {} ({})'.format(test_name, path, size)
comparisons.add(pm)
return comparisons