Ejemplo n.º 1
0
    def __str__(self):
        """The table as a restructured text object"""

        tab = ReSTTable()
        tab[0] = [""] + self.__columnLabels
        tab.addLine(head=True)
        for i, l in enumerate(self.__data):
            tab[i + 1] = [self.__rowLabels[i]] + l

        return str(tab)
Ejemplo n.º 2
0
 def __str__(self):
     """The table as a restructured text object"""
     
     tab=ReSTTable()
     tab[0]=[""]+self.__columnLabels
     tab.addLine(head=True)
     for i,l in enumerate(self.__data):
         tab[i+1]=[self.__rowLabels[i]]+l
     
     return str(tab)
Ejemplo n.º 3
0
    def reportRunnerData(self,run):
        if self.opts.reportRunnerData:
            try:
                data=run.data["analyzed"]
            except KeyError:
                self.error("No analyzed data")

            print "\n Analyzed data:"
            print
            
            helper=RestructuredTextHelper(RestructuredTextHelper.LevelSubSubSection)

            for n,d in data.iteritems():
                table=helper.table()
                heads=["Descrition","value"]
                table[0]=heads
                table.addLine(head=True)
                lNr=1

                for k,v in d.iteritems():
                    table[(lNr,0)]=k
                    table[(lNr,1)]=v
                    lNr+=1
                
                print helper.heading(n),table

        if self.opts.reportRunnerData:
            table=ReSTTable()
            heads=["Descrition","value"]
            table[0]=heads
            table.addLine(head=True)
            lNr=1
            done=["analyzed"]
            
            def addLine(key,description):
                if key in run.data:
                    table[(lNr,0)]=description
                    table[(lNr,1)]=run.data[key]
                    done.append(key)
                    return lNr+1
                return lNr
            
            lNr=addLine("time","Last simulation time")
            lNr=addLine("stepNr","Number of timesteps")
            lNr=addLine("lines","Lines written to stdout")
            lNr=addLine("warnings","Number of warnings")

            table.addLine()
            
            for k,v in run.data.iteritems():
                if k not in done:
                    table[(lNr,0)]=k
                    table[(lNr,1)]=v
                    lNr+=1
                
            print "\n  Runner data:"
            print
            print table
  
        if self.opts.dumpRunnerData:
            print "\n  Runner data:",run.data
Ejemplo n.º 4
0
    def reportRunnerData(self,run):
        if self.opts.reportRunnerData:
            try:
                data=run.data["analyzed"]
            except KeyError:
                self.error("No analyzed data")

            print_("\n Analyzed data:")
            print_()

            helper=RestructuredTextHelper(RestructuredTextHelper.LevelSubSubSection)

            for n,d in iteritems(data):
                table=helper.table()
                heads=["Descrition","value"]
                table[0]=heads
                table.addLine(head=True)
                lNr=1

                for k,v in iteritems(d):
                    table[(lNr,0)]=k
                    table[(lNr,1)]=v
                    lNr+=1

                print_(helper.heading(n),table)

        if self.opts.reportRunnerData:
            table=ReSTTable()
            heads=["Descrition","value"]
            table[0]=heads
            table.addLine(head=True)
            lNr=1
            done=["analyzed"]

            def addLine(key,description):
                if key in run.data:
                    table[(lNr,0)]=description
                    table[(lNr,1)]=run.data[key]
                    done.append(key)
                    return lNr+1
                return lNr

            lNr=addLine("time","Last simulation time")
            lNr=addLine("stepNr","Number of timesteps")
            lNr=addLine("lines","Lines written to stdout")
            lNr=addLine("warnings","Number of warnings")

            table.addLine()

            for k,v in iteritems(run.data):
                if k not in done:
                    table[(lNr,0)]=k
                    table[(lNr,1)]=v
                    lNr+=1

            print_("\n  Runner data:")
            print_()
            print_(table)

        if self.opts.dumpRunnerData:
            print_("\n  Runner data:",run.data)