def interface_decorator(decorator_name, interface, method_decorator, *args, **kwargs):
 for method_name in interface.names():
  if (not isinstance(interface[method_name], Method)):
   raise TypeError('{} does not support interfaces with non-methods attributes'.format(decorator_name))
 def class_decorator(cls):
  for name in interface.names():
   setattr(cls, name, method_decorator(name, *args, **kwargs))
  return cls
 return class_decorator

def interface_decorator ( decorator_name , interface , method_decorator , * args , ** kwargs ) : for method_name in interface . names ( ) : if ( not isinstance ( interface [ method_name ] , Method ) ) : raise TypeError ( '{} does not support interfaces with non-methods attributes' . format ( decorator_name ) ) def class_decorator ( cls ) : for name in interface . names ( ) : setattr ( cls , name , method_decorator ( name , * args , ** kwargs ) ) return cls return class_decorator
create a class decorator which applies a method decorator to each method of an interface .