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

Method _cache_description_data

tables/table.py:1152–1194  ·  view source on GitHub ↗

Cache some data which is already in the description. Some information is extracted from `self.description` to build some useful (but redundant) structures: * `self.colnames` * `self.colpathnames` * `self.coldescrs` * `self.coltypes` * `self.c

(self)

Source from the content-addressed store, hash-verified

1150 return self._v_objectid
1151
1152 def _cache_description_data(self) -> None:
1153 """Cache some data which is already in the description.
1154
1155 Some information is extracted from `self.description` to build
1156 some useful (but redundant) structures:
1157
1158 * `self.colnames`
1159 * `self.colpathnames`
1160 * `self.coldescrs`
1161 * `self.coltypes`
1162 * `self.coldtypes`
1163 * `self.coldflts`
1164 * `self._v_dtype`
1165 * `self._time64colnames`
1166 * `self._strcolnames`
1167 * `self._colenums`
1168
1169 """
1170 self.colnames = list(self.description._v_names)
1171 self.colpathnames = [
1172 col._v_pathname
1173 for col in self.description._f_walk()
1174 if not hasattr(col, "_v_names")
1175 ] # bottom-level
1176
1177 # Find ``time64`` column names.
1178 self._time64colnames = self._get_type_col_names("time64")
1179 # Find ``string`` column names.
1180 self._strcolnames = self._get_type_col_names("string")
1181 # Get a mapping of enumerated columns to their `Enum` instances.
1182 self._colenums = self._get_enum_map()
1183
1184 # Get info about columns
1185 for colobj in self.description._f_walk(type="Col"):
1186 colname = colobj._v_pathname
1187 # Get the column types, types and defaults
1188 self.coldescrs[colname] = colobj
1189 self.coltypes[colname] = colobj.type
1190 self.coldtypes[colname] = colobj.dtype
1191 self.coldflts[colname] = colobj.dflt
1192
1193 # Assign _v_dtype for this table
1194 self._v_dtype = self.description._v_dtype
1195
1196 def _get_column_instance(self, colpathname: str):
1197 """Get the instance of the column with the given `colpathname`.

Callers 2

_g_createMethod · 0.95
_g_openMethod · 0.95

Calls 3

_get_type_col_namesMethod · 0.95
_get_enum_mapMethod · 0.95
_f_walkMethod · 0.80

Tested by

no test coverage detected