本文整理汇总了Python中Timer.Timer.elapsed方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.elapsed方法的具体用法?Python Timer.elapsed怎么用?Python Timer.elapsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer.Timer
的用法示例。
在下文中一共展示了Timer.elapsed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: widget
# 需要导入模块: from Timer import Timer [as 别名]
# 或者: from Timer.Timer import elapsed [as 别名]
def widget(self, d):
LOGFP = open("log.create-test-case.txt", "a")
LOGFP.write("\n")
LOGFP.write("-----------------------------------------------\n")
LOGFP.write("%s/tools/create-test-case.sh ocsp-1 %s\n" % (self._pwd, d))
LOGFP.write("-----------------------------------------------\n")
LOGFP.close()
LOGFP = open("log.sign-widget.txt", "a")
handle = Popen("%s/tools/create-test-case-modified.sh ocsp-1 %s" % (self._pwd, d), shell=True, stdout=LOGFP, stderr=LOGFP, cwd="%s/tools" % (self._pwd), close_fds=True)
runTimer = Timer()
while True:
if (runTimer.elapsed() > 60):
handle.terminate()
# if
handle.poll()
if (handle.returncode != None):
break
# if
# while
LOGFP.write("-------------------- done --------------------\n")
LOGFP.close()
print " - created widget [returncode: %d]" % (handle.returncode)
示例2: _sign
# 需要导入模块: from Timer import Timer [as 别名]
# 或者: from Timer.Timer import elapsed [as 别名]
def _sign(self, f, d, cert):
p12 = "%s/keys/%s.rsa.p12" % (self._pwd, cert)
if (f == "author-signature.xml"):
sig = "-a"
sid = "%s-author" % (d)
else:
sig = "-o %s" % (f)
if (f[9] == "1"): sid = "%s" % (d)
else: sid = "%s-%s" % (d, f[9])
# if elif
crt = "%s/keys/2.rsa.cert.pem" % (self._pwd)
wgt = "%s/test-cases/ocsp-1/%s" % (self._pwd, d)
LOGFP = open("log.sign-widget.txt", "a")
LOGFP.write("\n")
LOGFP.write("----------------------------------------------\n")
LOGFP.write("%s/tools/sign-widget.sh --pwd secret --pkcs12 %s %s -i w3c-testsuite-id-ocsp-1-%s -c %s %s" % (self._pwd, p12, sig, sid, crt, wgt))
LOGFP.write("----------------------------------------------\n")
LOGFP.close()
LOGFP = open("log.sign-widget.txt", "a")
# print " - run: %s/tools/sign-widget.sh --pwd secret --pkcs12 %s %s -i w3c-testsuite-id-ocsp-1-%s -c %s %s" % (self._pwd, p12, sig, sid, crt, wgt)
handle = Popen("%s/tools/sign-widget-modified.sh --pwd secret --pkcs12 %s %s -i w3c-testsuite-id-ocsp-1-%s -c %s %s" % (self._pwd, p12, sig, sid, crt, wgt), shell=True, stdout=LOGFP, stderr=LOGFP, cwd="%s/tools" % (self._pwd), close_fds=True)
runTimer = Timer()
while True:
if (runTimer.elapsed() > 60):
handle.terminate()
# if
handle.poll()
if (handle.returncode != None):
break
# if
# while
LOGFP.write("-------------------- done --------------------\n")
LOGFP.close()
print " - %s [returncode: %d]" % (f, handle.returncode)