本文整理汇总了Python中IPython.config.Application.instance方法的典型用法代码示例。如果您正苦于以下问题:Python Application.instance方法的具体用法?Python Application.instance怎么用?Python Application.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.config.Application
的用法示例。
在下文中一共展示了Application.instance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wrappedfunc
# 需要导入模块: from IPython.config import Application [as 别名]
# 或者: from IPython.config.Application import instance [as 别名]
def wrappedfunc(nb, resources):
from IPython.config import Application
if Application.initialized():
Application.instance().log.debug(
"Applying preprocessor: %s", function.__name__
)
for worksheet in nb.worksheets:
for index, cell in enumerate(worksheet.cells):
worksheet.cells[index], resources = function(cell, resources, index)
return nb, resources
示例2: _logger
# 需要导入模块: from IPython.config import Application [as 别名]
# 或者: from IPython.config.Application import instance [as 别名]
def _logger():
"""get the logger for the current Application
the root logger will be used if no Application is running
"""
if Application.initialized():
logger = Application.instance().log
else:
logger = logging.getLogger()
if not logger.handlers:
logging.basicConfig()
return logger
示例3: get_logger
# 需要导入模块: from IPython.config import Application [as 别名]
# 或者: from IPython.config.Application import instance [as 别名]
def get_logger():
"""Grab the global logger instance.
If a global IPython Application is instantiated, grab its logger.
Otherwise, grab the root logger.
"""
global _logger
if _logger is None:
from IPython.config import Application
if Application.initialized():
_logger = Application.instance().log
else:
logging.basicConfig()
_logger = logging.getLogger()
return _logger
示例4: set_engine_logger
# 需要导入模块: from IPython.config import Application [as 别名]
# 或者: from IPython.config.Application import instance [as 别名]
def set_engine_logger():
'''Updates EMA logging on the engines with an EngineLoggerAdapter
This adapter injects EMA as a topic into all messages
'''
logger = Application.instance().log
logger.setLevel(ema_logging.DEBUG)
for handler in logger.handlers:
if isinstance(handler, IPython.kernel.zmq.log.EnginePUBHandler): # @UndefinedVariable
handler.setLevel(ema_logging.DEBUG)
adapter = EngingeLoggerAdapter(logger, SUBTOPIC)
ema_logging._logger = adapter
ema_logging.debug('updated logger')
示例5: log
# 需要导入模块: from IPython.config import Application [as 别名]
# 或者: from IPython.config.Application import instance [as 别名]
def log(self):
"""use the IPython log by default, falling back on tornado's logger"""
if Application.initialized():
return Application.instance().log
else:
return app_log
示例6:
# 需要导入模块: from IPython.config import Application [as 别名]
# 或者: from IPython.config.Application import instance [as 别名]
# IPython.parallel - can I write my own log into the engine logs?
from IPython.config import Application
log = Application.instance().log