def __new__(meta, class_name, bases, class_dict): if class_name != "Reader": #Parent class is exempt from checks assert 'file' in class_dict or key_in_bases('file',bases), \ "%s must define the name of the file it reads" % class_name assert 'reads' in class_dict or key_in_bases('reads',bases), \ "%s must define the 'boolean reads(self,build)' member" % class_name assert 'read' in class_dict or key_in_bases('read',bases), \ "%s must define the 'void read(self, filecontents, replay)' member" % class_name return type.__new__(meta, class_name, bases, class_dict)
def __new__(meta, class_name, bases, class_dict): if class_name != 'Config': #Parent class is exempt from checks assert 'ReplayClass' in class_dict or key_in_bases('ReplayClass',bases), \ "%s must specify 'ReplayClass' to be the class acting as a replay container" % class_name assert 'readers' in class_dict or key_in_bases('readers',bases), \ "%s must specify 'dict<string,list<Reader>> readers'" % class_name assert 'processors' in class_dict or key_in_bases('processors',bases), \ "%s must specify 'list<Processor> processors'" % class_name return type.__new__(meta, class_name, bases, class_dict)
def __new__(meta, class_name, bases, class_dict): if class_name != "Processor": #Parent class is exempt from checks assert 'required_readers' in class_dict or key_in_bases('required_readers',bases), \ "%s must define attribute 'required_readers' as an iterable" % class_name assert 'required_processors' in class_dict or key_in_bases('required_processors',bases), \ "%s must define attribute 'required_processors' as an iterable" % class_name assert 'process' in class_dict or key_in_bases('process',bases), \ "%s must define method 'Replay process(self, replay)'" % class_name return type.__new__(meta, class_name, bases, class_dict)
def __new__(meta, class_name, bases, class_dict): if class_name != "Config": # Parent class is exempt from checks assert "ReplayClass" in class_dict or key_in_bases("ReplayClass", bases), ( "%s must specify 'ReplayClass' to be the class acting as a replay container" % class_name ) assert "readers" in class_dict or key_in_bases("readers", bases), ( "%s must specify 'dict<string,list<Reader>> readers'" % class_name ) assert "processors" in class_dict or key_in_bases("processors", bases), ( "%s must specify 'list<Processor> processors'" % class_name ) return type.__new__(meta, class_name, bases, class_dict)