python类interrupt_main()的实例源码

bottle.py 文件源码 项目:base1k 作者: gumblex 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:Helix 作者: 3lackrush 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:installations-sportives-pdl 作者: sebprunier 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda path: os.stat(path).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:bigbottle 作者: opendiploma 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:autoscan 作者: b01u 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda path: os.stat(path).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:web-nlp-interface 作者: kanjirz50 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
events.py 文件源码 项目:wscelery 作者: johan-sports 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def run(self):
        # We don't want too frequent retries
        try_interval = 1
        while True:
            try:
                try_interval *= 2

                with self.capp.connection() as conn:
                    recv = EventReceiver(conn,
                                         handlers={'*': self.on_event},
                                         app=self.capp)
                    try_interval = 1
                    recv.capture(limit=None, timeout=None, wakeup=True)
            except (KeyboardInterrupt, SystemExit):
                import _thread
                _thread.interrupt_main()
            except Exception as e:
                logger.error('Failed to capture events: "%s", '
                             'trying again in %s seconds.',
                             e, try_interval)
                logger.debug(e, exc_info=True)
                time.sleep(try_interval)
bottle.py 文件源码 项目:pickymap 作者: tcmaps 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:DadosBicicletar 作者: paoloo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:mfa_slipstream_poc 作者: decidedlygray 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:RaspberryPiControllerQtPython 作者: take-iwiw 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:silvia-pi 作者: brycesub 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
bottle.py 文件源码 项目:jerrybuild 作者: fboender 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self):
        exists = os.path.exists
        mtime = lambda p: os.stat(p).st_mtime
        files = dict()

        for module in list(sys.modules.values()):
            path = getattr(module, '__file__', '')
            if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
            if path and exists(path): files[path] = mtime(path)

        while not self.status:
            if not exists(self.lockfile)\
            or mtime(self.lockfile) < time.time() - self.interval - 5:
                self.status = 'error'
                thread.interrupt_main()
            for path, lmtime in list(files.items()):
                if not exists(path) or mtime(path) > lmtime:
                    self.status = 'reload'
                    thread.interrupt_main()
                    break
            time.sleep(self.interval)
a3c.py 文件源码 项目:human-rl 作者: gsastry 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        try:
            with self.sess.as_default():
                self._run()
        except:
            traceback.print_exc()
            _thread.interrupt_main()
a3c.py 文件源码 项目:human-rl 作者: gsastry 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def run(self):
        try:
            with self.sess.as_default():
                self._run()
        except:
            traceback.print_exc()
            _thread.interrupt_main()
visualstudio_py_repl.py 文件源码 项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _cmd_abrt(self):
        """aborts the current running command"""
        # abort command, interrupts execution of the main thread.
        self.interrupt_main()
visualstudio_py_repl.py 文件源码 项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def interrupt_main(self):
        """aborts the current running command"""
        raise NotImplementedError
visualstudio_py_repl.py 文件源码 项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def interrupt_main(self):
        # acquire the send lock so we dont interrupt while we're communicting w/ the debugger
        with self.send_lock:
            if sys.platform == 'cli' and sys.version_info[:3] < (2, 7, 1):
                # IronPython doesn't get thread.interrupt_main until 2.7.1
                self.main_thread.Abort(ReplAbortException())
            else:
                thread.interrupt_main()
visualstudio_py_repl.py 文件源码 项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _cmd_abrt(self):
        """aborts the current running command"""
        # abort command, interrupts execution of the main thread.
        self.interrupt_main()
visualstudio_py_repl.py 文件源码 项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def interrupt_main(self):
        """aborts the current running command"""
        raise NotImplementedError


问题


面经


文章

微信
公众号

扫码关注公众号