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


Python Config.update方法代码示例

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


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

示例1: create_config

# 需要导入模块: from pulsar import Config [as 别名]
# 或者: from pulsar.Config import update [as 别名]
    def create_config(cls, params, prefix=None, name=None):
        """Create a new :class:`.Config` container.

        Invoked during initialisation, it overrides defaults
        with ``params`` and apply the ``prefix`` to non global
        settings.
        """
        if isinstance(cls.cfg, Config):
            cfg = cls.cfg.copy(name=name, prefix=prefix)
        else:
            cfg = cls.cfg.copy()
            if name:
                cfg[name] = name
            if prefix:
                cfg[prefix] = prefix
            cfg = Config(**cfg)
        cfg.update_settings()
        cfg.update(params, True)
        return cfg
开发者ID:juanignaciocatalano,项目名称:pulsar,代码行数:21,代码来源:__init__.py

示例2: __call__

# 需要导入模块: from pulsar import Config [as 别名]
# 或者: from pulsar.Config import update [as 别名]
    def __call__(self, actor=None):
        '''Register this application with the (optional) calling ``actor``.

        If an ``actor`` is available (either via the function argument or via
        the :func:`~pulsar.async.actor.get_actor` function) it must be
        :class:`.Arbiter`, otherwise this call is no-op.

        If no actor is available, it means this application starts
        pulsar engine by creating the :class:`.Arbiter` with its
        :ref:`global settings <setting-section-global-server-settings>`
        copied to the arbiter :class:`.Config` container.

        :return: the ``start`` one time event fired once this application
            has fired it.
        '''
        if actor is None:
            actor = get_actor()
        monitor = None
        if actor and actor.is_arbiter():
            monitor = actor.get_actor(self.name)
        if monitor is None and (not actor or actor.is_arbiter()):
            self.cfg.on_start()
            self.logger = self.cfg.configured_logger()
            if not actor:   # arbiter not available
                # This application is starts the arbiter
                cfg = Config()
                cfg.update(self.arbiter_params())
                actor = pulsar.arbiter(cfg=cfg)
                self.cfg.set('exc_id', actor.cfg.exc_id)
            if self.on_config(actor) is not False:
                start = Future(loop=actor._loop)
                actor.bind_event('start', partial(self._add_monitor, start))
                return start
            else:
                return
        raise ImproperlyConfigured('Already started or not in arbiter domain')
开发者ID:Ghost-script,项目名称:dyno-chat,代码行数:38,代码来源:__init__.py


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