Did I find the right examples for you? yes no

All Samples(14)  |  Call(14)  |  Derive(0)  |  Import(0)
Get :class:`ActorRef` for all running actors of the given class, or of
any subclass of the given class.

:param actor_class: actor class, or any superclass of the actor
:type actor_class: class

:returns: list of :class:`pykka.ActorRef`

src/m/o/Mopidy-0.18.3/mopidy/utils/process.py   Mopidy(Download)
def stop_actors_by_class(klass):
    actors = ActorRegistry.get_by_class(klass)
    logger.debug('Stopping %d instance(s) of %s', len(actors), klass.__name__)
    for actor in actors:
        actor.stop()

src/m/o/mopidy-HEAD/mopidy/utils/process.py   mopidy(Download)
def stop_actors_by_class(klass):
    actors = ActorRegistry.get_by_class(klass)
    logger.debug('Stopping %d instance(s) of %s', len(actors), klass.__name__)
    for actor in actors:
        actor.stop()

src/p/y/Pykka-1.2.0/tests/registry_test.py   Pykka(Download)
    def test_actors_may_be_looked_up_by_class(self):
        result = ActorRegistry.get_by_class(self.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)
 
    def test_actors_may_be_looked_up_by_superclass(self):
        result = ActorRegistry.get_by_class(AnActor)
    def test_broadcast_sends_message_to_all_actors_of_given_class(self):
        ActorRegistry.broadcast({'command': 'foo'}, target_class=self.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):
    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)

src/p/y/pykka-HEAD/tests/registry_test.py   pykka(Download)
    def test_actors_may_be_looked_up_by_class(self):
        result = ActorRegistry.get_by_class(self.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)
 
    def test_actors_may_be_looked_up_by_superclass(self):
        result = ActorRegistry.get_by_class(AnActor)
    def test_broadcast_sends_message_to_all_actors_of_given_class(self):
        ActorRegistry.broadcast({'command': 'foo'}, target_class=self.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):
    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)