MCPcopy Create free account
hub / github.com/PyTables/PyTables / append_columns

Function append_columns

tables/tests/test_queries.py:96–118  ·  view source on GitHub ↗

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=())

Source from the content-addressed store, hash-verified

94# Table description
95# -----------------
96def 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
121def nested_description(classname, pos, shape=()):

Callers 2

nested_descriptionFunction · 0.85
table_descriptionFunction · 0.85

Calls 3

from_sctypeMethod · 0.45
dtypeMethod · 0.45
from_dtypeMethod · 0.45

Tested by

no test coverage detected