def get_history(self, exp, rep, tags):
        """ returns the whole history for one experiment and one repetition.
            tags can be a string or a list of strings. if tags is a string,
            the history is returned as list of values, if tags is a list of 
            strings or 'all', history is returned as a dictionary of lists
            of values.
        """
        params = self.get_params(exp)
           
        if params == None:
            raise SystemExit(exp%'experiment %s not found.')         
        
        # make list of tags, even if it is only one
        if tags != 'all' and not hasattr(tags, '__iter__'):
            tags = [tags] 
        
        results = {}
        logfile = os.path.join(exp, '%i.log'%rep)
        try:
            f = open(logfile)
        except IOError:
            if len(tags) == 1:
                return []
            else:
                return {}

        for line in f:
            pairs = line.split()
            for pair in pairs:
                tag,val = pair.split(':')
                if tags == 'all' or tag in tags:
                    if not tag in results:
                        try:
                            results[tag] = [eval(val)]
                        except (NameError, SyntaxError):
                            results[tag] = [val]
                    else:
                        try:
                            results[tag].append(eval(val))
                        except (NameError, SyntaxError):
                            results[tag].append(val)
                            
        f.close()
        if len(results) == 0:
            if len(tags) == 1:
                return []
            else:
                return {}
            # raise ValueError('tag(s) not found: %s'%str(tags))
        if len(tags) == 1:
            return results[results.keys()[0]]
        else:
            return results
dataset/ETHPy150Open rueckstiess/expsuite/expsuite.py/PyExperimentSuite.get_history/swapped operands of `%`