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


Python BaseIPythonApplication.initialize方法代码示例

本文整理汇总了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)
开发者ID:ateranishi,项目名称:pyon,代码行数:30,代码来源:pycc.py

示例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
开发者ID:pyarnold,项目名称:ipython,代码行数:15,代码来源:sign.py

示例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()
开发者ID:AkiraKaneshiro,项目名称:ipython,代码行数:5,代码来源:test_connect.py


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