pyds.GroupStatements

class pyds.GroupStatements(*statements)

Bases: pyds.Statements

Container for statements of a PDS group statement.

Parameters
Raises

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
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
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

Special Methods

GroupStatements.__setitem__(key, value)

Create and insert a new statement using key and value.

Parameters
  • key (str)

    The identifier of the new statement.

    key should be a valid identifier such that a new Attribute can be instantiated as, Attribute(key, value)

  • value (Value)

    The value of the statement. It must be an instance of Value.

Raises
GroupStatements.__getitem__(key)

Return the value of the statement whose identifier is key.

Parameters
  • key (str)

    The identifier of the statement. key is case-insensitive.

Raises
  • KeyError

    If a statement with an identifier equal to key does not exist.

GroupStatements.__delitem__(key)

Remove the statement whose identifier is key.

Parameters
  • key (str)

    The identifier of the statement. key is case-insensitive.

Raises
  • KeyError

    If a statement with an identifier equal to key does not exist.

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.__iter__()

Return an iterator that iterates over the statements.

Called by iter().

GroupStatements.__reversed__()

Return an iterator that iterates over the statements in reverse order.

Called by reversed().

GroupStatements.__len__()

Return the number of statements.

Called by len().

GroupStatements.__str__()

Return a PDS serialized string (str) representing the object.

Called by str().

GroupStatements.__bytes__()

Return the object’s PDS serialization str as an ascii bytes string.

See also

__str__()

Called by bytes().