# Path: guild/actor.py
# class Actor(ActorMixin, _Thread):
#     daemon = True
# 
#     def __init__(self):
#         self.killflag = False
#         super(Actor, self).__init__()
# 
#     def run(self):
#         self.process_start()
#         self.process()
#         try:
#             gen = self.main
#         except AttributeError:
#             try:
#                 gen = self.gen_process
#             except AttributeError:
#                 gen = None
# 
#         if gen:
#             # NB next line looks at the code object, and checks a flag
#             if inspect.isgeneratorfunction(gen):
#                 g = gen()
#             else:
#                 function_name = gen.__self__.__class__.__name__ +"."+gen.__name__
#                 source_ref = "(%s, line: %d)" % (gen.__func__.__code__.co_filename, gen.__func__.__code__.co_firstlineno)
#                 warning = "Function %s %s must be a generator" % (function_name, source_ref)
#                 raise ValueError(warning)
#         else:
#             g = None
# 
#         while not self.killflag:
# 
#             while (self.F_inbound or self.inbound or self.core):
#                 self._actor_do_queued()
# 
#             if not self._actor_do_queued():
#                 if g is None:
#                     time.sleep(0.01)
#             if g:
#                 try:
#                     next(g)
#                 except StopIteration:
#                     # Print("Generator Exited")
#                     self.stop()
#                     g = None
#         self.onStop()
#         if g:
#             try:
#                 g.throw(StopIteration)
#             except StopIteration:
#                 pass
# 
#     def stop(self):
#         self.killflag = True
# 
# def actor_method(method):
#     return ("ACTORMETHOD", method)
# 
# def process_method(method):
#     return ("PROCESSMETHOD", method)
# 
# def late_bind(method):
#     return ("LATEBIND", method)


from guild.actor import Actor, actor_method, process_method, late_bind
    import time
#!/usr/bin/python

from __future__ import print_function



class Dog(Actor):

    @actor_method    # Input - triggered by data coming in
    def woof(self):
        print("Woof", self)

    @process_method  # Process - triggered each time it's run
    def process(self):
        #print(" ", end="")
        pass

    @late_bind       # Output
    def produce(self):
        pass


class Shitzu(Dog):
    def __init__(self):
        self.count = 0
        super(Dog, self).__init__()


# Path: guild/actor.py
# class Actor(ActorMixin, _Thread):
#     daemon = True
# 
#     def __init__(self):
#         self.killflag = False
#         super(Actor, self).__init__()
# 
#     def run(self):
#         self.process_start()
#         self.process()
#         try:
#             gen = self.main
#         except AttributeError:
#             try:
#                 gen = self.gen_process
#             except AttributeError:
#                 gen = None
# 
#         if gen:
#             # NB next line looks at the code object, and checks a flag
#             if inspect.isgeneratorfunction(gen):
#                 g = gen()
#             else:
#                 function_name = gen.__self__.__class__.__name__ +"."+gen.__name__
#                 source_ref = "(%s, line: %d)" % (gen.__func__.__code__.co_filename, gen.__func__.__code__.co_firstlineno)
#                 warning = "Function %s %s must be a generator" % (function_name, source_ref)
#                 raise ValueError(warning)
#         else:
#             g = None
# 
#         while not self.killflag:
# 
#             while (self.F_inbound or self.inbound or self.core):
#                 self._actor_do_queued()
# 
#             if not self._actor_do_queued():
#                 if g is None:
#                     time.sleep(0.01)
#             if g:
#                 try:
#                     next(g)
#                 except StopIteration:
#                     # Print("Generator Exited")
#                     self.stop()
#                     g = None
#         self.onStop()
#         if g:
#             try:
#                 g.throw(StopIteration)
#             except StopIteration:
#                 pass
# 
#     def stop(self):
#         self.killflag = True
# 
# def actor_method(method):
#     return ("ACTORMETHOD", method)
# 
# def process_method(method):
#     return ("PROCESSMETHOD", method)
# 
# def late_bind(method):
#     return ("LATEBIND", method)


# Path: examples/dogs_go_woof_actors.py
from guild.actor import Actor, actor_method, process_method, late_bind
    import time

#!/usr/bin/python

from __future__ import print_function



class Dog(Actor):

    @actor_method    # Input - triggered by data coming in
    def woof(self):
        print("Woof", self)

    @process_method  # Process - triggered each time it's run
    def process(self):
        #print(" ", end="")
        pass

    @late_bind       # Output
    def produce(self):
        pass


class Shitzu(Dog):
    def __init__(self):
        self.count = 0
        super(Dog, self).__init__()


    @process_method