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


Python ActorRegistry.get_by_class方法代码示例

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


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

示例1: test_broadcast_sends_message_to_all_actors_of_given_class_name

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def test_broadcast_sends_message_to_all_actors_of_given_class_name(self):
     ActorRegistry.broadcast({'command': 'foo'}, target_class='AnActor')
     for actor_ref in ActorRegistry.get_by_class(self.AnActor):
         received_messages = actor_ref.proxy().received_messages.get()
         self.assert_({'command': 'foo'} in received_messages)
     for actor_ref in ActorRegistry.get_by_class(self.BeeActor):
         received_messages = actor_ref.proxy().received_messages.get()
         self.assert_({'command': 'foo'} not in received_messages)
开发者ID:benjixx,项目名称:pykka,代码行数:10,代码来源:registry_test.py

示例2: setup

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
    def setup(self):
        gstreamer_refs = ActorRegistry.get_by_class(GStreamer)
        assert len(gstreamer_refs) == 1, \
            'Expected exactly one running gstreamer.'
        self.gstreamer = gstreamer_refs[0].proxy()

        backend_refs = ActorRegistry.get_by_class(Backend)
        assert len(backend_refs) == 1, 'Expected exactly one running backend.'
        self.backend = backend_refs[0].proxy()
开发者ID:WoLpH,项目名称:mopidy,代码行数:11,代码来源:session_manager.py

示例3: setup

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
    def setup(self):
        audio_refs = ActorRegistry.get_by_class(audio.Audio)
        assert len(audio_refs) == 1, \
            'Expected exactly one running Audio instance.'
        self.audio = audio_refs[0].proxy()

        backend_refs = ActorRegistry.get_by_class(Backend)
        assert len(backend_refs) == 1, 'Expected exactly one running backend.'
        self.backend = backend_refs[0].proxy()
开发者ID:Dvad,项目名称:mopidy,代码行数:11,代码来源:session_manager.py

示例4: backend

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def backend(self):
     if self._backend is None:
         backend_refs = ActorRegistry.get_by_class(Backend)
         assert len(backend_refs) == 1, \
             'Expected exactly one running backend.'
         self._backend = backend_refs[0].proxy()
     return self._backend
开发者ID:MechanisM,项目名称:mopidy,代码行数:9,代码来源:objects.py

示例5: on_start

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
    def on_start(self):
        gstreamer_refs = ActorRegistry.get_by_class(GStreamer)
        assert len(gstreamer_refs) == 1, 'Expected exactly one running gstreamer.'
        self.gstreamer = gstreamer_refs[0].proxy()

        logger.info(u'Mopidy uses SPOTIFY(R) CORE')
        self.spotify = self._connect()
开发者ID:Amli,项目名称:mopidy,代码行数:9,代码来源:__init__.py

示例6: _notify_backend_of_eos

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def _notify_backend_of_eos(self):
     backend_refs = ActorRegistry.get_by_class(Backend)
     assert len(backend_refs) <= 1, 'Expected at most one running backend.'
     if backend_refs:
         logger.debug(u'Notifying backend of end-of-stream.')
         backend_refs[0].proxy().playback.on_end_of_track()
     else:
         logger.debug(u'No backend to notify of end-of-stream found.')
开发者ID:xim,项目名称:mopidy,代码行数:10,代码来源:__init__.py

示例7: on_start

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
    def on_start(self):
        audio_refs = ActorRegistry.get_by_class(audio.Audio)
        assert len(audio_refs) == 1, \
            'Expected exactly one running Audio instance.'
        self.audio = audio_refs[0].proxy()

        logger.info(u'Mopidy uses SPOTIFY(R) CORE')
        self.spotify = self._connect()
开发者ID:Dvad,项目名称:mopidy,代码行数:10,代码来源:__init__.py

示例8: backend

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def backend(self):
     """
     The backend. An instance of :class:`mopidy.backends.base.Backend`.
     """
     if self._backend is None:
         backend_refs = ActorRegistry.get_by_class(Backend)
         assert len(backend_refs) == 1, 'Expected exactly one running backend.'
         self._backend = backend_refs[0].proxy()
     return self._backend
开发者ID:MechanisM,项目名称:mopidy,代码行数:11,代码来源:dispatcher.py

示例9: mixer

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def mixer(self):
     """
     The mixer. An instance of :class:`mopidy.mixers.base.BaseMixer`.
     """
     if self._mixer is None:
         mixer_refs = ActorRegistry.get_by_class(BaseMixer)
         assert len(mixer_refs) == 1, 'Expected exactly one running mixer.'
         self._mixer = mixer_refs[0].proxy()
     return self._mixer
开发者ID:arambelo,项目名称:mopidy,代码行数:11,代码来源:dispatcher.py

示例10: _trigger_started_playing_event

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
    def _trigger_started_playing_event(self):
        """
        Notifies frontends that a track has started playing.

        For internal use only. Should be called by the backend directly after a
        track has started playing.
        """
        if self.current_track is None:
            return
        frontend_refs = ActorRegistry.get_by_class(BaseFrontend)
        for frontend_ref in frontend_refs:
            frontend_ref.send_one_way({
                'command': 'started_playing',
                'track': self.current_track,
            })
开发者ID:Amli,项目名称:mopidy,代码行数:17,代码来源:playback.py

示例11: _trigger_stopped_playing_event

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
    def _trigger_stopped_playing_event(self):
        """
        Notifies frontends that a track has stopped playing.

        For internal use only. Should be called by the backend before a track
        is stopped playing, e.g. at the next, previous, and stop actions and at
        end-of-track.
        """
        if self.current_track is None:
            return
        frontend_refs = ActorRegistry.get_by_class(BaseFrontend)
        for frontend_ref in frontend_refs:
            frontend_ref.send_one_way({
                'command': 'stopped_playing',
                'track': self.current_track,
                'stop_position': self.time_position,
            })
开发者ID:Amli,项目名称:mopidy,代码行数:19,代码来源:playback.py

示例12: test_actors_may_be_looked_up_by_superclass

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def test_actors_may_be_looked_up_by_superclass(self):
     result = ActorRegistry.get_by_class(AnActor)
     for a_actor in self.a_actors:
         self.assert_(a_actor in result)
     for b_actor in self.b_actors:
         self.assert_(b_actor not in result)
开发者ID:benjixx,项目名称:pykka,代码行数:8,代码来源:registry_test.py

示例13: on_start

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def on_start(self):
     gstreamer_refs = ActorRegistry.get_by_class(GStreamer)
     assert len(gstreamer_refs) == 1, \
         'Expected exactly one running GStreamer.'
     self.gstreamer = gstreamer_refs[0].proxy()
开发者ID:MechanisM,项目名称:mopidy,代码行数:7,代码来源:__init__.py

示例14: mixer

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def mixer(self):
     if self._mixer is None:
         mixer_refs = ActorRegistry.get_by_class(BaseMixer)
         assert len(mixer_refs) == 1, 'Expected exactly one running mixer.'
         self._mixer = mixer_refs[0].proxy()
     return self._mixer
开发者ID:MechanisM,项目名称:mopidy,代码行数:8,代码来源:objects.py

示例15: on_start

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_by_class [as 别名]
 def on_start(self):
     output_refs = ActorRegistry.get_by_class(GStreamer)
     assert len(output_refs) == 1, 'Expected exactly one running output.'
     self.output = output_refs[0].proxy()
开发者ID:arambelo,项目名称:mopidy,代码行数:6,代码来源:gstreamer_software.py


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