# Path: ebu_tt_live/utils.py
# class AutoRegisteringABCMeta(abc.ABCMeta):
#     """
#     This metaclass gets us automatic class registration and cooperates with AbstractStaticMember.
#     If none of the 2 features are needed it just provides the basic abc.ABCMeta functionality.
#     For the auto registration an abstract class needs to implement the auto_register_impl classmethod.
#     """
# 
#     def __new__(mcls, name, bases, namespace):
#         cls = super(AutoRegisteringABCMeta, mcls).__new__(mcls, name, bases, namespace)
#         abstract_members = set(name
#                         for name, value in namespace.items()
#                         if isinstance(value, AbstractStaticMember))
# 
#         abstracts = getattr(cls, "__abstractmethods__", set())
# 
#         if not abstracts:
#             # This means the class is not abstract so we should not have any abstract static members
#             validated_members = set()
#             for base in bases:
#                 if isinstance(base, mcls):
#                     for base_member in getattr(base, '_abc_static_members', set()):
#                         if base_member in validated_members:
#                             continue
#                         value = getattr(cls, base_member, NotImplemented)
#                         if isinstance(value, AbstractStaticMember) or value is NotImplemented:
#                             abstract_members.add(base_member)
#                         else:
#                             getattr(base, base_member).validate(value, base_member, name)
#                             validated_members.add(base_member)
# 
#                     base.auto_register_impl(cls)
# 
#             if abstract_members:
#                 raise TypeError('{} must implement abstract static members: [{}]'.format(
#                     name,
#                     ', '.join(abstract_members)
#                 ))
#         if namespace.get('auto_register_impl') is None:
#             cls.auto_register_impl = classmethod(lambda x, y: None)
#         cls._abc_static_members = frozenset(abstract_members)
#         cls._abc_interface = '__metaclass__' in namespace.keys()
#         return cls
# 
#     def __call__(cls, *args, **kwargs):
#         if cls._abc_interface is True:
#             raise TypeError('Can\'t instantiate {} is an abstract base class.'.format(cls))
#         instance = super(AutoRegisteringABCMeta, cls).__call__(*args, **kwargs)
#         return instance
# 
# class AbstractStaticMember(object):
#     """
#     This allows me to require the subclasses to define some attributes using a customizeable
#     validator. The idea is that all static members should be initialized to a value by the time
#     abstract functions have all been implemented.
#     """
# 
#     _validation_func = None
# 
#     def __init__(self, validation_func=None):
#         if validation_func is None:
#             self._validation_func = _assert_asm_is_defined
#         else:
#             self._validation_func = validation_func
# 
#     def validate(self, value, member_name, class_name):
#         self._validation_func(value, member_name, class_name)
# 
# def validate_types_only(value, member_name, class_name):
#     if not isinstance(value, tuple):
#         value = (value,)
#     for item in value:
#         if not isinstance(item, (type, types.ClassType)) and item is not ANY:
#             raise TypeError(
#                 'Abstract static member: \'{}.{}\' is not a type or class'.format(
#                     class_name,
#                     member_name
#                 )
#             )


from abc import abstractmethod, abstractproperty
from ebu_tt_live.utils import AutoRegisteringABCMeta, AbstractStaticMember, validate_types_only

    @abstractmethod
    def process_document(self, document, **kwargs):
        """
        The central hook that is meant to implement the main functionality of the node.
        A node must implement this method.

        :param kwargs: Extra parameters
        :param document: Can be XML, Document object...etc. depending on the carriage implementation

        """
        raise NotImplementedError()


class IProducerNode(INode):

    _provides = AbstractStaticMember(validate_types_only)

    @abstractmethod
    def resume_producing(self):
        """
        This allows the node to be triggered by events, such as a timer.
        """

    @classmethod
    def provides(cls):
        """
        Data type provided
        :return:
        """

# Path: ebu_tt_live/utils.py
# class AutoRegisteringABCMeta(abc.ABCMeta):
#     """
#     This metaclass gets us automatic class registration and cooperates with AbstractStaticMember.
#     If none of the 2 features are needed it just provides the basic abc.ABCMeta functionality.
#     For the auto registration an abstract class needs to implement the auto_register_impl classmethod.
#     """
# 
#     def __new__(mcls, name, bases, namespace):
#         cls = super(AutoRegisteringABCMeta, mcls).__new__(mcls, name, bases, namespace)
#         abstract_members = set(name
#                         for name, value in namespace.items()
#                         if isinstance(value, AbstractStaticMember))
# 
#         abstracts = getattr(cls, "__abstractmethods__", set())
# 
#         if not abstracts:
#             # This means the class is not abstract so we should not have any abstract static members
#             validated_members = set()
#             for base in bases:
#                 if isinstance(base, mcls):
#                     for base_member in getattr(base, '_abc_static_members', set()):
#                         if base_member in validated_members:
#                             continue
#                         value = getattr(cls, base_member, NotImplemented)
#                         if isinstance(value, AbstractStaticMember) or value is NotImplemented:
#                             abstract_members.add(base_member)
#                         else:
#                             getattr(base, base_member).validate(value, base_member, name)
#                             validated_members.add(base_member)
# 
#                     base.auto_register_impl(cls)
# 
#             if abstract_members:
#                 raise TypeError('{} must implement abstract static members: [{}]'.format(
#                     name,
#                     ', '.join(abstract_members)
#                 ))
#         if namespace.get('auto_register_impl') is None:
#             cls.auto_register_impl = classmethod(lambda x, y: None)
#         cls._abc_static_members = frozenset(abstract_members)
#         cls._abc_interface = '__metaclass__' in namespace.keys()
#         return cls
# 
#     def __call__(cls, *args, **kwargs):
#         if cls._abc_interface is True:
#             raise TypeError('Can\'t instantiate {} is an abstract base class.'.format(cls))
#         instance = super(AutoRegisteringABCMeta, cls).__call__(*args, **kwargs)
#         return instance
# 
# class AbstractStaticMember(object):
#     """
#     This allows me to require the subclasses to define some attributes using a customizeable
#     validator. The idea is that all static members should be initialized to a value by the time
#     abstract functions have all been implemented.
#     """
# 
#     _validation_func = None
# 
#     def __init__(self, validation_func=None):
#         if validation_func is None:
#             self._validation_func = _assert_asm_is_defined
#         else:
#             self._validation_func = validation_func
# 
#     def validate(self, value, member_name, class_name):
#         self._validation_func(value, member_name, class_name)
# 
# def validate_types_only(value, member_name, class_name):
#     if not isinstance(value, tuple):
#         value = (value,)
#     for item in value:
#         if not isinstance(item, (type, types.ClassType)) and item is not ANY:
#             raise TypeError(
#                 'Abstract static member: \'{}.{}\' is not a type or class'.format(
#                     class_name,
#                     member_name
#                 )
#             )


# Path: ebu_tt_live/node/interface.py
from abc import abstractmethod, abstractproperty
from ebu_tt_live.utils import AutoRegisteringABCMeta, AbstractStaticMember, validate_types_only


    @abstractmethod
    def process_document(self, document, **kwargs):
        """
        The central hook that is meant to implement the main functionality of the node.
        A node must implement this method.

        :param kwargs: Extra parameters
        :param document: Can be XML, Document object...etc. depending on the carriage implementation

        """
        raise NotImplementedError()


class IProducerNode(INode):

    _provides = AbstractStaticMember(validate_types_only)

    @abstractmethod
    def resume_producing(self):
        """
        This allows the node to be triggered by events, such as a timer.
        """

    @classmethod
    def provides(cls):
        """
        Data type provided
        :return:
        """

        if isinstance(cls._provides, AbstractStaticMember):