Ignore:
Timestamp:
Feb 8, 2010 5:13:22 PM (10 years ago)
Author:
wehart
Message:

Setting up 'import' tests for the other simple examples.
These seem to work, but the internal code is too ugly. I'm
going to clean that up next to help explain what is going on...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/data/TableData.py

    r2285 r2289  
    6161
    6262    def _set_data(self, headers, rows):
     63        #print "_SET_DATA"
    6364        if self.options.symbol_map is None:
    6465            mapped_headers = map(str,list(headers))
    6566        else:
    6667            mapped_headers = [self.options.symbol_map[tuple(header)] if tuple(header) in self.options.symbol_map else header for header in map(str,list(headers))]
    67         #print "X",mapped_headers,self.options.symbol_map,self.options.index
     68        #print "X",mapped_headers,self.options.symbol_map,self.options.index,self.options.format
    6869
    6970        if not self.options.set is None:
     
    7273              for row in rows:
    7374                self._info = self._info + list(row)
    74            elif self.options.format is "set_array":
     75           elif self.options.format == "set_array":
    7576              self._info = ["set",self.options.set, ":"]
    7677              self._info = self._info + list(mapped_headers[1:])
     
    8283
    8384        elif self.options.index is not None and self.options.param is None:
     85           #print "Z1"
    8486           self._info = ["param",":",self.options.index,":"]
    85            self._info = self._info + mapped_headers[1:]
     87           self._info = self._info + mapped_headers[self.options.nindex:]
    8688           self._info.append(":=")
    8789           for row in rows:
     
    8991
    9092        elif self.options.index is not None and self.options.param is not None:
     93           #print "Z2"
    9194           self._info = ["param",":",self.options.index,":"]
    9295           if type(self.options.param) is str:
     
    101104
    102105        elif self.options.param is not None and self.options.format is not None:
    103            if self.options.format is "transposed_array":
     106           #print "Z3"
     107           if self.options.format == "transposed_array":
    104108              self._info = ["param",self.options.param,"(tr)",":"] + mapped_headers[1:]
    105            elif self.options.format is "array":
     109           elif self.options.format == "array":
    106110              self._info = ["param",self.options.param,":"] + mapped_headers[1:]
    107111           else:
     
    112116
    113117        else:
     118           #print "Z4"
    114119           if len(mapped_headers) == 1:
    115120              self._info = ["set",mapped_headers[0],":="]
Note: See TracChangeset for help on using the changeset viewer.