def __init__(self, channel_type): ''' Initialize empty Channel Template with specific type ''' ChannelType.__init__(self, channel_type) ChannelStyle.__init__(self, channel_type) Template.__init__(self) self.__input_templates = [] # track added input templates self.__input_template_types = set() # track added input template types
def __str__(self): ''' Add counter of templates to print ''' return ("<{Class} with {templates} input template(s) at 0x{ID:x}>\n" " + {ChannelTypeStr}\n" " + {TemplateStr}").format( Class = self.__class__.__name__, templates = len(self.input_templates), ChannelTypeStr = ChannelType.__str__(self), TemplateStr = Template.__str__(self), ID = id(self))
def __contains__(self, value): return (ChannelType.__contains__(self, value) and ChannelStyle.__contains__(self, value))