Append a ``Col`` of each PyTables data type to the `classdict`. A column of a certain TYPE gets called ``c_TYPE``. The number of added columns is returned.
(classdict, shape=())
| 94 | # Table description |
| 95 | # ----------------- |
| 96 | def append_columns(classdict, shape=()): |
| 97 | """Append a ``Col`` of each PyTables data type to the `classdict`. |
| 98 | |
| 99 | A column of a certain TYPE gets called ``c_TYPE``. The number of |
| 100 | added columns is returned. |
| 101 | |
| 102 | """ |
| 103 | heavy = common.heavy |
| 104 | for itype, type_ in enumerate(sorted(type_info)): |
| 105 | if not heavy and type_ in heavy_types: |
| 106 | continue # skip heavy type in non-heavy mode |
| 107 | colpos = itype + 1 |
| 108 | colname = "c_%s" % type_ |
| 109 | if type_ == "enum": |
| 110 | base = tb.Atom.from_sctype(sctype_from_type[type_]) |
| 111 | col = tb.EnumCol(enum, enum(0), base, shape=shape, pos=colpos) |
| 112 | else: |
| 113 | sctype = sctype_from_type[type_] |
| 114 | dtype = np.dtype((sctype, shape)) |
| 115 | col = tb.Col.from_dtype(dtype, pos=colpos) |
| 116 | classdict[colname] = col |
| 117 | ncols = colpos |
| 118 | return ncols |
| 119 | |
| 120 | |
| 121 | def nested_description(classname, pos, shape=()): |
no test coverage detected