本文整理汇总了Python中common.Common.utc_get_datetime_as_string方法的典型用法代码示例。如果您正苦于以下问题:Python Common.utc_get_datetime_as_string方法的具体用法?Python Common.utc_get_datetime_as_string怎么用?Python Common.utc_get_datetime_as_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Common
的用法示例。
在下文中一共展示了Common.utc_get_datetime_as_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import utc_get_datetime_as_string [as 别名]
def verify(self):
self.project.log("transaction", "Verifying all downloaded files...", "highlight", True)
verification_file = os.path.join(self.project.working_dir, Common.timely_filename("verification", ".csv"))
errors = 0
pct = 0
tot_hashes = 0
with open(verification_file, 'w') as f:
f.write("TIME_PROCESSED,REMOTE_FILE,LOCAL_FILE,REMOTE_HASH,LOCAL_HASH,MATCH\n")
for item in self.verification:
rh = ""
match = ""
lh = Common.hashfile(open(item['local_file'], 'rb'), hashlib.md5())
lf = item['local_file']
rf = item['remote_file']
if 'remote_hash' in item:
tot_hashes += 1
rh = item['remote_hash']
if lh == item['remote_hash']:
match = "YES"
else:
match = "NO"
errors += 1
self.project.log("exception", "Verification failed for remote file {} and local file {}".format(rf,lf), "critical", True)
else:
rh = "NONE PROVIDED"
match = "N/A"
f.write('"{date}","{rf}","{lf}","{rh}","{lh}","{m}"\n'.format(date=Common.utc_get_datetime_as_string(),rf=rf,lf=lf,rh=rh,lh=lh,m=match))
pct = ((tot_hashes - errors) / tot_hashes) * 100
self.project.log("transaction", "Verification of {} items completed with {} errors. ({:.2f}% Success rate)".format(tot_hashes, errors, pct), "highlight", True)