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

Class Cols

tables/table.py:3244–3510  ·  view source on GitHub ↗

Container for columns in a table or nested column. This class is used as an *accessor* to the columns in a table or nested column. It supports the *natural naming* convention, so that you can access the different columns as attributes which lead to Column instances (for non-nested

Source from the content-addressed store, hash-verified

3242
3243
3244class Cols:
3245 """Container for columns in a table or nested column.
3246
3247 This class is used as an *accessor* to the columns in a table or nested
3248 column. It supports the *natural naming* convention, so that you can
3249 access the different columns as attributes which lead to Column instances
3250 (for non-nested columns) or other Cols instances (for nested columns).
3251
3252 For instance, if table.cols is a Cols instance with a column named col1
3253 under it, the later can be accessed as table.cols.col1. If col1 is nested
3254 and contains a col2 column, this can be accessed as table.cols.col1.col2
3255 and so on. Because of natural naming, the names of members start with
3256 special prefixes, like in the Group class (see :ref:`GroupClassDescr`).
3257
3258 Like the Column class (see :ref:`ColumnClassDescr`), Cols supports item
3259 access to read and write ranges of values in the table or nested column.
3260
3261
3262 .. rubric:: Cols attributes
3263
3264 .. attribute:: _v_colnames
3265
3266 A list of the names of the columns hanging directly
3267 from the associated table or nested column. The order of
3268 the names matches the order of their respective columns in
3269 the containing table.
3270
3271 .. attribute:: _v_colpathnames
3272
3273 A list of the pathnames of all the columns under the
3274 associated table or nested column (in preorder). If it does
3275 not contain nested columns, this is exactly the same as the
3276 :attr:`Cols._v_colnames` attribute.
3277
3278 .. attribute:: _v_desc
3279
3280 The associated Description instance (see
3281 :ref:`DescriptionClassDescr`).
3282
3283 """
3284
3285 @property
3286 def _v_table(self) -> Table:
3287 """Return the parent Table instance (see :ref:`TableClassDescr`)."""
3288 return self._v__tableFile._get_node(self._v__tablePath)
3289
3290 def __init__(self, table: Table, desc: Description) -> None:
3291 dict_ = self.__dict__
3292 dict_["_v__tableFile"] = table._v_file
3293 dict_["_v__tablePath"] = table._v_pathname
3294 dict_["_v_desc"] = desc
3295 dict_["_v_colnames"] = desc._v_names
3296 dict_["_v_colpathnames"] = table.description._v_pathnames
3297 # Put the column in the local dictionary
3298 for name in desc._v_names:
3299 if name in desc._v_types:
3300 dict_[name] = Column(table, name, desc)
3301 else:

Callers 2

_g_post_init_hookMethod · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected