本文整理汇总了Python中IPython.core.application.BaseIPythonApplication.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python BaseIPythonApplication.initialize方法的具体用法?Python BaseIPythonApplication.initialize怎么用?Python BaseIPythonApplication.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.core.application.BaseIPythonApplication
的用法示例。
在下文中一共展示了BaseIPythonApplication.initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _assert_ipython_dir
# 需要导入模块: from IPython.core.application import BaseIPythonApplication [as 别名]
# 或者: from IPython.core.application.BaseIPythonApplication import initialize [as 别名]
def _assert_ipython_dir():
# Fix OOIION-1124:
# When multiple containers are started in parallel, all start an embedded IPython shell/manhole.
# There might be a race condition between the IPython creating the default $HOME/.python dir
# leading to an error. Prevent this by...
homedir = os.path.expanduser('~')
homedir = os.path.realpath(homedir)
home_ipdir = os.path.join(homedir, ".ipython")
ipdir = os.path.normpath(os.path.expanduser(home_ipdir))
if not os.path.exists(ipdir):
log.warn("%s not found. Preventing potential race condition", ipdir)
for tries in range(3):
try:
import gevent
import random
gevent.sleep(random.random() * 0.1)
from IPython.core.application import BaseIPythonApplication
ba = BaseIPythonApplication()
ba.initialize()
if os.path.exists(ipdir):
log.debug("Success initializing IPython")
break
except Exception as ex:
log.debug("Failed IPython initialize attempt (try #%s): %s", tries, str(ex))
# At this point there should be
if not os.path.exists(ipdir):
log.error("%s not found after several tries", ipdir)
示例2: _profile_dir_default
# 需要导入模块: from IPython.core.application import BaseIPythonApplication [as 别名]
# 或者: from IPython.core.application.BaseIPythonApplication import initialize [as 别名]
def _profile_dir_default(self):
from IPython.core.application import BaseIPythonApplication
app = None
try:
if BaseIPythonApplication.initialized():
app = BaseIPythonApplication.instance()
except MultipleInstanceError:
pass
if app is None:
# create an app, without the global instance
app = BaseIPythonApplication()
app.initialize(argv=[])
return app.profile_dir
示例3: initialize
# 需要导入模块: from IPython.core.application import BaseIPythonApplication [as 别名]
# 或者: from IPython.core.application.BaseIPythonApplication import initialize [as 别名]
def initialize(self, argv=[]):
BaseIPythonApplication.initialize(self, argv=argv)
self.init_connection_file()