本文整理汇总了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!")