schrodinger.infra.table module¶
A pythonic wrapper to an mmlibs mmtable object.
Note that column and row indices start at 1.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.infra.table.
TableRow
(table, row)[source]¶ Bases:
object
This class represents a table row–what you get by indexing a Table.
Note that a TableRow should not outlive its corresponding Table.
-
class
schrodinger.infra.table.
Table
(table_file='', table_handle=None, manage=True)[source]¶ Bases:
schrodinger.infra.mmobject.MmObject
Class to handle mmtables. This is largely a wrapper to the underlying C library which stores all the state information.
-
static
setDebug
(state)[source]¶ Enable or disable debug output. Use False or True. Sets this for the class, i.e. affects all instances, current and future.
-
static
initialize
(error_handler=None)[source]¶ Initialize necessary mmlibs (which will also implicitly initialize all the dependent mmlibs)
-
static
terminate
()[source]¶ Terminate various mmlibs (which also implicitly terminates all the libraries they are dependent upon)
-
__init__
(table_file='', table_handle=None, manage=True)[source]¶ Construct a Table class object either by reading a table file or using a handle to an existing mmtable.
If a table file is given via table_file, then we read the given mmtable file. If a table handle for an existing table is passed in (via the table_handle argument), then we use that. If neither are given, then we create a new table object owned by this table. Specifying both is an error.
Passing in a table file causes manage=True. When a managed instance goes out of scope or is deleted, garbage collection is performed. One side effect is that the table is deleted.
Passing in a table handle causes manage=False. When a non-managed instance goes out of scope or is deleted the table is left around.
-
columnGetDataType
(column)[source]¶ Returns the data type for the given column
Possibilities are: mm.M2IO_BOOLEAN_TYPE, mm.M2IO_INT_TYPE, mm.M2IO_REAL_TYPE, or mm.M2IO_STRING_TYPE
-
columnGetPersistent
(column)[source]¶ Returns whether or not the given column is persistent. Only persistent columns will be written to disk.
-
columnSetPersistent
(column, persistent)[source]¶ Sets whether or not the given row is persistent. Only persistent columns will be written to disk.
-
getFirstSelectedRow
()[source]¶ Returns the first selected row–throws an error if no rows are selected.
-
getOrAddColumn
(name, visible)[source]¶ Finds or adds the given column via data name.
visible indicates whether or not the column should be visible if it is added.
-
getVisibleColumnIndex
(column)[source]¶ Converts an index from the visible columns into the full set of columns
-
insertColumn
(column, name)[source]¶ Adds the given column before the specified column. Specify column 1 to insert at the far left of the table (first column) Specify mm.MMTABLE_END to add to the right of the table
-
insertRow
(row, file_index)[source]¶ Adds a row.
Set row to 1 to insert at the top of the table or mm.MMTABLE_END to add to the bottom of the table.
If the table has an M2IO_DATA_FILE_INDEX column, the cell’s value will be set to file_index (if file_index != 0), or to a unique value if file_index == 0.
-
makeNestedRowVisible
(row)[source]¶ Expands and makes visible all parents of the given row. Also makes the given row visible, but does not expand it.
-
rowSetExpanded
(row, expanded)[source]¶ Sets the expanded property for the given row. The row can also be set to mm.MMTABLE_ALL_ROWS.
-
rowSetVisible
(row, visible)[source]¶ Sets the visible property for the given row. The row can also be set to mm.MMTABLE_ALL_ROWS.
-
selectAddRows
(rows)[source]¶ This function selects the given rows without deselecting any other rows.
-
static