本文整理汇总了Python中exe.engine.path.Path.stat方法的典型用法代码示例。如果您正苦于以下问题:Python Path.stat方法的具体用法?Python Path.stat怎么用?Python Path.stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exe.engine.path.Path
的用法示例。
在下文中一共展示了Path.stat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_copy_list_mod_time
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import stat [as 别名]
def check_copy_list_mod_time(cls, copy_list, test_case = None):
"""Return a tuple (if all files equal, total file number)
Check that the files in the copy list all have the same
modification time
Parameters
copy_list : list
copy_list as per package.make_system_copy_list
test_case : TestUnit
If not None run the assertEquals on it
"""
file_count = 0
all_time_equal = True
for copy_item in copy_list:
src = copy_item[0]
dst = copy_item[1]
if isinstance(src, Path):
#this is a straight file to file copy
time_diff = abs(src.stat().st_mtime - dst.stat().st_mtime)
all_time_equal = (all_time_equal and time_diff == 0)
file_count += 1
if test_case is not None:
test_case.assertEquals(time_diff, 0,
"mtime diff %s / %s is 0.1" % (str(src), str(dst)))
else:
for src_file in src:
file_count += 1
dst_file = Path(dst/src_file.basename())
time_diff = abs(src_file.stat().st_mtime -
dst_file.stat().st_mtime)
all_time_equal = (all_time_equal and time_diff < 0.1)
if test_case is not None:
test_case.assertTrue(time_diff < 0.1,
"mtime diff %s / %s is < 0.1" % \
(str(src_file), str(dst_file)))
return (all_time_equal, file_count)