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


Python config.Application方法代码示例

本文整理汇总了Python中traitlets.config.Application方法的典型用法代码示例。如果您正苦于以下问题:Python config.Application方法的具体用法?Python config.Application怎么用?Python config.Application使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在traitlets.config的用法示例。


在下文中一共展示了config.Application方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_tornado_application

# 需要导入模块: from traitlets import config [as 别名]
# 或者: from traitlets.config import Application [as 别名]
def init_tornado_application(self):
        self.tornado_application = web.Application(self.handlers, **self.tornado_settings) 
开发者ID:jupyterhub,项目名称:hubshare,代码行数:4,代码来源:app.py

示例2: __init__

# 需要导入模块: from traitlets import config [as 别名]
# 或者: from traitlets.config import Application [as 别名]
def __init__(self, **kwargs):
        # make sure there are some default aliases in all Tools:
        if self.aliases:
            self.aliases["log-level"] = "Application.log_level"
            self.aliases["config"] = "Tool.config_file"

        super().__init__(**kwargs)
        self.log_level = logging.INFO
        self.is_setup = False
        self._registered_components = []
        self.version = version
        self.raise_config_file_errors = True  # override traitlets.Application default 
开发者ID:cta-observatory,项目名称:ctapipe,代码行数:14,代码来源:tool.py

示例3: subcommands

# 需要导入模块: from traitlets import config [as 别名]
# 或者: from traitlets.config import Application [as 别名]
def subcommands(self):
        # Slightly awkward way to pass the actual kernel class to the install
        # subcommand.

        class KernelInstallerApp(Application):
            kernel_class = self.kernel_class

            def initialize(self, argv=None):
                self.argv = argv

            def start(self):
                kernel_spec = self.kernel_class().kernel_json
                with TemporaryDirectory() as td:
                    dirname = os.path.join(td, kernel_spec['name'])
                    os.mkdir(dirname)
                    with open(os.path.join(dirname, 'kernel.json'), 'w') as f:
                        json.dump(kernel_spec, f, sort_keys=True)
                    filenames = ['logo-64x64.png', 'logo-32x32.png']
                    name = self.kernel_class.__module__
                    for filename in filenames:
                        try:
                            data = pkgutil.get_data(name.split('.')[0],
                                                    'images/' + filename)
                        except (OSError, IOError):
                            data = pkgutil.get_data('metakernel',
                                'images/' + filename)
                        with open(os.path.join(dirname, filename), 'wb') as f:
                            f.write(data)
                    try:
                        subprocess.check_call(
                            [sys.executable, '-m', 'jupyter',
                            'kernelspec', 'install'] + self.argv + [dirname])
                    except CalledProcessError as exc:
                        sys.exit(exc.returncode)

        return {'install': (KernelInstallerApp, 'Install this kernel')} 
开发者ID:Calysto,项目名称:metakernel,代码行数:38,代码来源:_metakernel.py


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