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


Python CUT.detach方法代码示例

本文整理汇总了Python中Core.chanusertracker.CUT.detach方法的典型用法代码示例。如果您正苦于以下问题:Python CUT.detach方法的具体用法?Python CUT.detach怎么用?Python CUT.detach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.chanusertracker.CUT的用法示例。


在下文中一共展示了CUT.detach方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import detach [as 别名]
    def run(self):
        # Import elements of Core we need
        # These will be refreshed each time the Loader reloads
        from Core.loader import Loader
        from Core.exceptions_ import Quit, Reboot, Reload, Call999
        from Core.connection import Connection
        from Core.chanusertracker import CUT
        from Core.robocop import RoboCop
        from Core.router import Router
	from Core.actions import Action
        
        # Collect any garbage remnants that might have been left behind
        #  from an old loader or backup that wasn't properly dereferenced
        gc.collect()
        
        try:

            # Attach the IRC connection and configure
            self.irc = Connection.attach(*self.irc)
            # Attach the RoboCop/clients sockets and configure
            self.robocop = RoboCop.attach(*self.robocop)
            # Attach the CUT state
            self.cut = CUT.attach(*self.cut)
            
            # Operation loop
            Router.run()
        
        except Call999 as exc:
            # RoboCop server failed, restart it
            self.robocop = RoboCop.disconnect(str(exc))
            return
        
        except Reboot as exc:
            # Reset the connection first
            self.irc = Connection.disconnect(str(exc) or "Rebooting")
            print "%s Reloading..." % (time.asctime(),)
            # Reimport all the modules
            Loader.reload()
            return
        
        except Reload:
            # Detach the current CUT state
            self.cut = CUT.detach()
            print "%s Reloading..." % (time.asctime(),)
            # Reimport all the modules
            Loader.reload()
            return
        
        except (Quit, KeyboardInterrupt, SystemExit) as exc:
            self.irc = Connection.disconnect(str(exc) or "Bye!")
            self.robocop = RoboCop.disconnect(str(exc) or "Bye!")
            sys.exit("Bye!")
开发者ID:liam-wiltshire,项目名称:merlin,代码行数:54,代码来源:__init__.py


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