当前位置: 首页>>代码示例>>Python>>正文


Python Timer.elapsed方法代码示例

本文整理汇总了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)
开发者ID:prestocore,项目名称:browser,代码行数:29,代码来源:auto.py

示例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)
开发者ID:prestocore,项目名称:browser,代码行数:45,代码来源:auto.py


注:本文中的Timer.Timer.elapsed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。