comparison utils/seriestables/series.py @ 221:02d9c1279dd8

Encore quelques typechecks à SeriesTables.
author fsavard
date Thu, 11 Mar 2010 11:08:42 -0500
parents e172ef73cdc5
children 0515a8901c6a
comparison
equal deleted inserted replaced
220:e172ef73cdc5 221:02d9c1279dd8
37 See Series().__init__ to see how those are used. 37 See Series().__init__ to see how those are used.
38 """ 38 """
39 int_constructor = "tables.Int64Col" 39 int_constructor = "tables.Int64Col"
40 if int_width == 32: 40 if int_width == 32:
41 int_constructor = "tables.Int32Col" 41 int_constructor = "tables.Int32Col"
42 elif not int_width in (32, 64):
43 raise "int_width must be left unspecified, or should equal 32 or 64"
42 44
43 toexec = "" 45 toexec = ""
44 46
45 for n in int_names: 47 for n in int_names:
46 toexec += "\t" + n + " = " + int_constructor + "(pos=" + str(pos) + ")\n" 48 toexec += "\t" + n + " = " + int_constructor + "(pos=" + str(pos) + ")\n"
87 toexec += toexec_ 89 toexec += toexec_
88 90
89 float_constructor = "tables.Float32Col" 91 float_constructor = "tables.Float32Col"
90 if float_width == 64: 92 if float_width == 64:
91 float_constructor = "tables.Float64Col" 93 float_constructor = "tables.Float64Col"
94 elif not float_width in (32, 64):
95 raise "float_width must be left unspecified, or should equal 32 or 64"
92 96
93 for n in float_names: 97 for n in float_names:
94 toexec += "\t" + n + " = " + float_constructor + "(pos=" + str(pos) + ")\n" 98 toexec += "\t" + n + " = " + float_constructor + "(pos=" + str(pos) + ")\n"
95 pos += 1 99 pos += 1
96 100
364 reduced = self.reduce_function(self._buffer) 368 reduced = self.reduce_function(self._buffer)
365 self.base_series.append(index, reduced) 369 self.base_series.append(index, reduced)
366 self._buffer = [] 370 self._buffer = []
367 371
368 # The >= case should never happen, except if lists 372 # The >= case should never happen, except if lists
369 # were appended, which should be a red flag. 373 # were appended by accessing _buffer externally (when it's
374 # intended to be private), which should be a red flag.
370 assert len(self._buffer) < self.reduce_every 375 assert len(self._buffer) < self.reduce_every
371 376
372 # Outside of class to fix an issue with exec in Python 2.6. 377 # Outside of class to fix an issue with exec in Python 2.6.
373 # My sorries to the god of pretty code. 378 # My sorries to the god of pretty code.
374 def _BasicStatisticsSeries_construct_table_toexec(index_names, store_timestamp, store_cpuclock): 379 def _BasicStatisticsSeries_construct_table_toexec(index_names, store_timestamp, store_cpuclock):