本文整理匯總了Python中configuration.Config.load_file方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.load_file方法的具體用法?Python Config.load_file怎麽用?Python Config.load_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類configuration.Config
的用法示例。
在下文中一共展示了Config.load_file方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: shutdown_bot
# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import load_file [as 別名]
self.channel_manager.join_channel(*self.bot_config["Connection Info"]["channels"])
"""
if (time.time() - last_ping) > 30:
IRCNetworking.send_msg("PING", [host])
last_ping = time.time()
"""
if self.networking.thread_has_crashed:
self.shutdown_bot()
def shutdown_bot(self):
self.networking.send_msg("QUIT", ["Test"])#message="Shutting down")
self._shutdown = True
if __name__ == "__main__":
bot_config = Config("config.yaml", schema=default_bot_config)
bot_config.load_file()
bot = IRCBot(bot_config)
bot.start()
log = logging.getLogger("bot.shutdown")
log.info("Now shutting down.")
# Wait until all outgoing messages have been sent.
# This allows the quit message to be received by the server before the connection is cut.
log.info("Status of send queue: Empty:%s/Full:%s",
bot.networking.send_thread._buffer.empty(),
bot.networking.send_thread._buffer.full())
log.info("Status of read queue: Empty:%s/Full:%s",