pyds.GroupStatements¶
- class pyds.GroupStatements(*statements)¶
Bases: pyds.Statements
Container for statements of a PDS group statement.
Methods
- GroupStatements.insert(index, statement)¶
Insert the statement statement at index index.
- Parameters
index (int)
The index at which to insert the statement.
index can be any integer (positive or negative). If negative, it’s taken to mean the index from the end. For example, s.insert(-10, stmt) is the same as s.insert(len(s)-10, stmt).
If index is out of range and positive, then statement is appended to the end. If it’s out of range and negative, then statement is prepended to the begining.
statement (Attribute)
The statement to insert. It must be an instance of Attribute.
Also, statement‘s identifier must not be the same as any other statement previously inserted.
- Raises
-
If statement is not an instance of Attribute.
-
If statements‘s identifier is not unique.
-
- GroupStatements.append(statement)¶
Append the statement statement.
Note
Calling s.append(stmt) is the same as calling s.insert(len(s), stmt). See insert() for further documentation.
- GroupStatements.get(index)¶
Return the statement at index index.
- Parameters
index (int)
The index from where to return the statement.
index can be any integer (positive or negative). If negative, it’s taken to mean the index from the end. For example, s.get(-10) is the same as s.get(len(s)-10).
- Raises
-
If index is out of range.
-
- GroupStatements.pop(index)¶
Remove and return the statement at index index.
- Parameters
index (int)
The index from where to remove and return the statement.
index can be any integer (positive or negative). If negative, it’s taken to mean the index from the end. For example, s.pop(-10) is the same as s.pop(len(s)-10).
- Raises
-
If index is out of range.
-
Special Methods
- GroupStatements.__setitem__(key, value)¶
Create and insert a new statement using key and value.
- Parameters
- Raises
-
If value is not an instance of Value.
-
If key is not a valid identifier.
-
- GroupStatements.__getitem__(key)¶
Return the value of the statement whose identifier is key.
- GroupStatements.__delitem__(key)¶
Remove the statement whose identifier is key.
- GroupStatements.__contains__(key)¶
Test if a statement exists whose identifier is key. Return True if it exists, and False otherwise.
- Parameters
key (str)
The identifier of the statement. key is case-insensitive.
- GroupStatements.__reversed__()¶
Return an iterator that iterates over the statements in reverse order.
Called by reversed().