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

Method get_enum

tables/table.py:2140–2157  ·  view source on GitHub ↗

Get the enumerated type associated with the named column. If the column named colname (a string) exists and is of an enumerated type, the corresponding Enum instance (see :ref:`EnumClassDescr`) is returned. If it is not of an enumerated type, a TypeError is raised. If

(self, colname: str)

Source from the content-addressed store, hash-verified

2138 return internal_to_flavor(result, self.flavor)
2139
2140 def get_enum(self, colname: str) -> Enum:
2141 """Get the enumerated type associated with the named column.
2142
2143 If the column named colname (a string) exists and is of an enumerated
2144 type, the corresponding Enum instance (see :ref:`EnumClassDescr`) is
2145 returned. If it is not of an enumerated type, a TypeError is raised. If
2146 the column does not exist, a KeyError is raised.
2147
2148 """
2149 self._check_column(colname)
2150
2151 try:
2152 return self._colenums[colname]
2153 except KeyError:
2154 raise TypeError(
2155 "column ``%s`` of table ``%s`` is not of an enumerated type"
2156 % (colname, self._v_pathname)
2157 )
2158
2159 def col(self, name: str) -> np.ndarray:
2160 """Get a column from the table.

Callers 12

test00a_reopenMethod · 0.45
test00b_reopenMDMethod · 0.45
test00a_reopenMethod · 0.45
test00b_reopenMDMethod · 0.45
test00a_reopenMethod · 0.45
test00b_reopenMDMethod · 0.45
testMethod · 0.45
play-with-enums.pyFile · 0.45

Calls

no outgoing calls

Tested by 11

test00a_reopenMethod · 0.36
test00b_reopenMDMethod · 0.36
test00a_reopenMethod · 0.36
test00b_reopenMDMethod · 0.36
test00a_reopenMethod · 0.36
test00b_reopenMDMethod · 0.36
testMethod · 0.36