(event)
return sequence
A convenience function that should for :class:`EventDescription` that,
    given an event, produces a generic behavior-creator that provides this
    sequence behavior, which is named "sequence".

    :param event: an instance of :class:`EventDescription`
    :return: a callable behavior-creator as described above
A convenience function that should for :class:`EventDescription` that,
    given an event, produces a generic behavior-creator that provides this
    sequence behavior, which is named "sequence".
A convenience function that should for : class : EventDescription that given an event produces a generic behavior - creator that provides this sequence behavior which is named sequence .
def _sequence_behavior(event):
    """
    A convenience function that should for :class:`EventDescription` that,
    given an event, produces a generic behavior-creator that provides this
    sequence behavior, which is named "sequence".

    :param event: an instance of :class:`EventDescription`
    :return: a callable behavior-creator as described above
    """
    @event.declare_behavior_creator("sequence")
    def sequence(parameters):
        behavior_specification = parameters["behaviors"]
        behavior_objects = cycle([
            (
                event.create_behavior(behavior["name"],
                                      behavior["parameters"])
                if behavior["name"] != "default"
                else event.default_behavior
            )
            for behavior in behavior_specification
        ])

        def rotating_behavior(*args, **kwargs):
            current = next(behavior_objects)
            return current(*args, **kwargs)
        return rotating_behavior

    sequence.__doc__ = sequence_docstring
    return sequence
def _sequence_behavior ( event ) : @ event . declare_behavior_creator ( "sequence" ) def sequence ( parameters ) : behavior_specification = parameters [ "behaviors" ] behavior_objects = cycle ( [ ( event . create_behavior ( behavior [ "name" ] , behavior [ "parameters" ] ) if behavior [ "name" ] != "default" else event . default_behavior ) for behavior in behavior_specification ] ) def rotating_behavior ( * args , * * kwargs ) : current = next ( behavior_objects ) return current ( * args , * * kwargs ) return rotating_behavior sequence . __doc__ = sequence_docstring return sequence