@@ -2111,10 +2111,6 @@ def set_info(self, info):
21112111 if idx is not None :
21122112 self .__dict__ .update (idx )
21132113
2114- def get_attr (self ):
2115- """ set the kind for this column """
2116- self .kind = getattr (self .attrs , self .kind_attr , None )
2117-
21182114 def set_attr (self ):
21192115 """ set the kind for this column """
21202116 setattr (self .attrs , self .kind_attr , self .kind )
@@ -2161,9 +2157,6 @@ def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str):
21612157 assert isinstance (values , np .ndarray ), type (values )
21622158 self .values = Int64Index (np .arange (len (values )))
21632159
2164- def get_attr (self ):
2165- pass
2166-
21672160 def set_attr (self ):
21682161 pass
21692162
@@ -2363,6 +2356,7 @@ def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str):
23632356 self .data = values
23642357
23652358 own_data = self .data
2359+ assert isinstance (own_data , np .ndarray ) # for mypy
23662360
23672361 # use the meta if needed
23682362 meta = _ensure_decoded (self .meta )
@@ -2430,15 +2424,6 @@ def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str):
24302424
24312425 self .data = own_data
24322426
2433- def get_attr (self ):
2434- """ get the data for this column """
2435- self .values = getattr (self .attrs , self .kind_attr , None )
2436- self .dtype = getattr (self .attrs , self .dtype_attr , None )
2437- self .meta = getattr (self .attrs , self .meta_attr , None )
2438- assert self .typ is not None
2439- assert self .dtype is not None
2440- self .kind = _dtype_to_kind (self .dtype )
2441-
24422427 def set_attr (self ):
24432428 """ set the data for this column """
24442429 setattr (self .attrs , self .kind_attr , self .values )
@@ -2477,8 +2462,7 @@ def get_atom_timedelta64(cls, shape):
24772462class GenericDataIndexableCol (DataIndexableCol ):
24782463 """ represent a generic pytables data column """
24792464
2480- def get_attr (self ):
2481- pass
2465+ pass
24822466
24832467
24842468class Fixed :
@@ -3424,6 +3408,7 @@ def indexables(self):
34243408 _indexables = []
34253409
34263410 desc = self .description
3411+ table_attrs = self .table .attrs
34273412
34283413 # Note: each of the `name` kwargs below are str, ensured
34293414 # by the definition in index_cols.
@@ -3432,16 +3417,20 @@ def indexables(self):
34323417 atom = getattr (desc , name )
34333418 md = self .read_metadata (name )
34343419 meta = "category" if md is not None else None
3420+
3421+ kind_attr = f"{ name } _kind"
3422+ kind = getattr (table_attrs , kind_attr , None )
3423+
34353424 index_col = IndexCol (
34363425 name = name ,
34373426 axis = axis ,
34383427 pos = i ,
3428+ kind = kind ,
34393429 typ = atom ,
34403430 table = self .table ,
34413431 meta = meta ,
34423432 metadata = md ,
34433433 )
3444- index_col .get_attr ()
34453434 _indexables .append (index_col )
34463435
34473436 # values columns
@@ -3456,18 +3445,29 @@ def f(i, c):
34563445
34573446 atom = getattr (desc , c )
34583447 adj_name = _maybe_adjust_name (c , self .version )
3448+
3449+ # TODO: why kind_attr here?
3450+ values = getattr (table_attrs , f"{ adj_name } _kind" , None )
3451+ dtype = getattr (table_attrs , f"{ adj_name } _dtype" , None )
3452+ kind = _dtype_to_kind (dtype )
3453+
34593454 md = self .read_metadata (c )
3460- meta = "category" if md is not None else None
3455+ # TODO: figure out why these two versions of `meta` dont always match.
3456+ # meta = "category" if md is not None else None
3457+ meta = getattr (table_attrs , f"{ adj_name } _meta" , None )
3458+
34613459 obj = klass (
34623460 name = adj_name ,
34633461 cname = c ,
3462+ values = values ,
3463+ kind = kind ,
34643464 pos = base_pos + i ,
34653465 typ = atom ,
34663466 table = self .table ,
34673467 meta = meta ,
34683468 metadata = md ,
3469+ dtype = dtype ,
34693470 )
3470- obj .get_attr ()
34713471 return obj
34723472
34733473 # Note: the definition of `values_cols` ensures that each
@@ -4491,7 +4491,6 @@ def indexables(self):
44914491 index_col = GenericIndexCol (
44924492 name = "index" , axis = 0 , table = self .table , meta = meta , metadata = md
44934493 )
4494- index_col .get_attr ()
44954494
44964495 _indexables = [index_col ]
44974496
@@ -4510,7 +4509,6 @@ def indexables(self):
45104509 meta = meta ,
45114510 metadata = md ,
45124511 )
4513- dc .get_attr ()
45144512 _indexables .append (dc )
45154513
45164514 return _indexables
0 commit comments