Home | Trees | Indices | Help |
|
---|
|
object --+ | ligolw.Element --+ | ligolw.EmptyElement --+ | ligolw.Table --+ | object --+ | | | list --+ | Table
High-level Table element that knows about its columns and rows.
|
|||
RowType Helpful parent class for row objects. |
|||
TableName |
|
|||
new empty list |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
constraints = None hash(x) |
|||
how_to_index = None hash(x) |
|||
interncolumns = None hash(x) |
|||
loadcolumns = None hash(x) |
|||
next_id = None hash(x) |
|||
validcolumns = None hash(x) |
|||
Inherited from Inherited from |
|
|||
Name The "Name" attribute. |
|||
Inherited from Inherited from |
|
Return True if element is a Table element whose Name attribute matches the .tableName attribute of this class ; return False otherwise. See also .CheckProperties(). |
Return True if tagname and attrs are the XML tag name and element attributes, respectively, of a Table element whose Name attribute matches the .tableName attribute of this class; return False otherwise. The Table parent class does not provide a .tableName attribute, but sub-classes, especially those in lsctables.py, do provide a value for that attribute. See also .CheckElement() Example: >>> import lsctables >>> lsctables.ProcessTable.CheckProperties(u"Table", {u"Name": u"process:table"}) True |
Initialize
|
Called during parsing to indicate that the last Column child element has been added. Subclasses can override this to perform any special action that should occur following the addition of the last Column element. |
Called during parsing to indicate that the last row has been added. Subclasses can override this to perform any special action that should occur following the addition of the last row. |
Used for validation during parsing, and additional book-keeping. For internal use only. |
Used for validation during parsing, and additional book-keeping. For internal use only.
|
Append a Column element named "name" to the table. Returns the new child. Raises ValueError if the table already has a column by that name, and KeyError if the validcolumns attribute of this table does not contain an entry for a column by that name. Note that the name string is assumed to be "pre-stripped", that is it is the significant portion of the elements Name attribute. The Column element's Name attribute will be constructed by pre-pending the stripped Table element's name and a colon. Example: >>> import lsctables >>> process_table = lsctables.New(lsctables.ProcessTable, []) >>> col = process_table.appendColumn("program") >>> col.getAttribute("Name") u'process:program' >>> col.Name u'program' |
Create and append a new row to this table, then return it All positional and keyword arguments are passed to the RowType constructor for this table. |
Used as the second half of the key reassignment algorithm. Loops over each row in the table, replacing references to old row keys with the new values from the mapping. |
Construct and return a new Table document subtree whose structure is the same as this table, that is it has the same columns etc.. The rows are not copied. Note that a fair amount of metadata is shared between the original and new tables. In particular, a copy of the Table object itself is created (but with no rows), and copies of the child nodes are created. All other object references are shared between the two instances, such as the RowType attribute on the Table object. |
Method invoked by document parser when it encounters the end-of-element event.
|
Retrieve and return the Column child element named name. The comparison is done using the stripped names. Raises KeyError if this table has no column by that name. Example: >>> import lsctables >>> tbl = lsctables.New(lsctables.SnglInspiralTable) >>> col = tbl.getColumnByName("mass1") |
Returns the current value of the next_id class attribute, and increments the next_id class attribute by 1. Raises ValueError if the table does not have an ID generator associated with it. |
Equivalent to the module-level function get_table(), but uses the .tableName attribute of this class to provide the name of the table to search for. The Table parent class does not provide a .tableName attribute, but sub-classes, especially those in lsctables.py, do provide a value for that attribute, and in those cases this class method provides a cleaner way to retrieve them. Example: >>> import ligolw >>> import lsctables >>> xmldoc = ligolw.Document() >>> xmldoc.appendChild(ligolw.LIGO_LW()).appendChild(lsctables.New(lsctables.SnglInspiralTable)) [] >>> sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc) |
Remove a child from this element. The child element is returned, and it's parentNode element is reset.
|
If the current value of the next_id class attribute is not None then set it to 0, otherwise it is left unmodified. Example: >>> import lsctables >>> for cls in lsctables.TableByName.values(): cls.reset_next_id() |
Sets the value of the next_id class attribute. This is a convenience function to help prevent accidentally assigning a value to an instance attribute instead of the class attribute. |
Determines the highest-numbered ID in this table, and sets the table's .next_id attribute to the next highest ID in sequence. If the .next_id attribute is already set to a value greater than the highest value found, then it is left unmodified. The return value is the ID identified by this method. If the table's .next_id attribute is None, then this function is a no-op. Note that tables of the same name typically share a common .next_id attribute (it is a class attribute, not an attribute of each instance) so that IDs can be generated that are unique across all tables in the document. Running sync_next_id() on all the tables in a document that are of the same type will have the effect of setting the ID to the next ID higher than any ID in any of those tables. Example: >>> import lsctables >>> tbl = lsctables.New(lsctables.ProcessTable) >>> print(tbl.sync_next_id()) process:process_id:0 |
Break internal references within the document tree rooted on this element to promote garbage collection.
|
Used as the first half of the row key reassignment algorithm. Accepts a dictionary mapping old key --> new key. Iterates over the rows in this table, using the table's next_id attribute to assign a new ID to each row, recording the changes in the mapping. Returns the mapping. Raises ValueError if the table's next_id attribute is None. |
|
NameThe "Name" attribute.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Dec 12 00:34:20 2017 | http://epydoc.sourceforge.net |