Package schrodinger :: Package utils :: Module sea :: Class List
[hide private]
[frames] | no frames]

Class List

object --+    
         |    
       Sea --+
             |
object --+   |
         |   |
      list --+
             |
            List

This class represents the "list" parameters in a config file. This class' behavior is very similar to that of the buildin list class.

Instance Methods [hide private]
new empty list
__init__(self, val=[], parent=None)
Constructs a List object from the given 'val'.
 
__getslice__(self, i, j)
Returns a new list composed of elements deep-copied from this list from i-th through the j-th element (but not including the j-th element).
 
__add__(self, rhs)
Returns a new list composed of elements deep-copied from this list and the 'rhs' list.
 
__iadd__(self, rhs)
Updates this list with the given 'rhs'.
 
__setitem__(self, index, val)
Resets the 'index'-th element with the given value 'val'.
 
__str__(self, ind='', tag=set([]), pre='', is_list_elem=False, outdent='')
Converts this list to a string in the ark syntax and returns the string.
 
__eq__(self, rhs)
Returns True if the value of this object equals that of 'rhs'.
 
__deepcopy__(self, memo={})
 
__set_val(self, val)
Sets the value, which must be a list or tuple.
 
__get_raw_val(self)
Returns the raw value.
 
__get_bval(self)
Returns a new `Sea' object, which has all macros expanded and references dereferenced.
 
__get_dval(self)
Returns a new `Sea' object with dereferenced values.
 
__get_val(self)
Returns the value with macro's expended and references dereferenced if the raw value is a string.
 
append(self, val)
Appends the given value 'val' to this list.
 
quick_append(self, val)
Appends the given value 'val' to this list.
 
extend(self, val_list)
Extends this list with the given list or tuple 'val_list'.
 
insert(self, index, val)
Inserts the given value 'val' to the 'index'-th position in the list.
item
pop(self, index=-1)
Removes the 'index'-th element from the list and returns the removed element.
 
apply(self, op)
Recursively applies the operation as given by 'op' to all 'Sea' subobjects of this 'Sea' object.
 
update(self, ark=None, tag=set([]))
Updates this list with 'ark'.
 
_set_value_helper(self, key_index_list, value, tag)
This functions uses the given 'key_index_list' to locate the Sea object and changes its value to the given 'value'.
 
_dump_impl(self, tag)

Inherited from Sea: __getstate__, __ne__, __setstate__, add_tag, clear_all_tag, dump, has_tag, parent, pmode, remove_tag, reset_tag, set_parent, set_pmode, tag

Inherited from Sea (private): _add_tag_impl, _remove_tag_impl, _reset_tag_impl

Inherited from list: __contains__, __delitem__, __delslice__, __ge__, __getattribute__, __getitem__, __gt__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __new__, __repr__, __reversed__, __rmul__, __setslice__, __sizeof__, count, index, remove, reverse, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Static Methods [hide private]

Inherited from Sea (private): _gen_sea, _normalize_tag

Class Variables [hide private]

Inherited from list: __hash__

Properties [hide private]
  raw_val
Readwrite.
  bval
Readonly.
  dval
Readonly.
  val
Readwrite.

Inherited from Sea: sval

Inherited from object: __class__

Method Details [hide private]

__init__(self, val=[], parent=None)
(Constructor)

 

Constructs a List object from the given 'val'.

Parameters:
  • val - Must be either a list or tuple. The elements must be of either buildin types or Sea.
  • parent - Specifies the parent of this List object.
Returns: new empty list
Overrides: object.__init__

__getslice__(self, i, j)
(Slicling operator)

 

Returns a new list composed of elements deep-copied from this list from i-th through the j-th element (but not including the j-th element). The parent of the new list remains the same as this list.

Overrides: list.__getslice__

__add__(self, rhs)
(Addition operator)

 

Returns a new list composed of elements deep-copied from this list and the 'rhs' list. The parent of the new list remains the same as this list.

Parameters:
  • rhs - The 'rhs' can be a buildin list or tuple object. In this case, a Sea object will be made out of 'rhs' and then concatenated to the copy of this list.
Overrides: list.__add__

__iadd__(self, rhs)

 

Updates this list with the given 'rhs'.

Parameters:
  • rhs - The 'rhs' can be a buildin list or tuple object. In this case, a Sea object will be made out of 'rhs' and then concatenated to this list.
Overrides: list.__iadd__

__setitem__(self, index, val)
(Index assignment operator)

 

Resets the 'index'-th element with the given value 'val'.

Parameters:
  • val - Can be either a 'Sea' object or a buildin type object. In the latter case, a 'Sea' object will be made out of 'val' and then be used to set the 'index'-th element.
Overrides: list.__setitem__

__str__(self, ind='', tag=set([]), pre='', is_list_elem=False, outdent='')
(Informal representation operator)

 

Converts this list to a string in the ark syntax and returns the string.

Parameters:
  • ind - Indentation of the converted string.
  • tag - Converts only the elements with the given tag.
Overrides: object.__str__

__eq__(self, rhs)
(Equality operator)

 

Returns True if the value of this object equals that of 'rhs'.

Overrides: list.__eq__

__deepcopy__(self, memo={})

 
Overrides: Sea.__deepcopy__

append(self, val)

 

Appends the given value 'val' to this list.

Overrides: list.append

extend(self, val_list)

 

Extends this list with the given list or tuple 'val_list'.

Overrides: list.extend

insert(self, index, val)

 

Inserts the given value 'val' to the 'index'-th position in the list.

Overrides: list.insert

pop(self, index=-1)

 

Removes the 'index'-th element from the list and returns the removed element. The parent of the returned element will be set to None.

Returns: item
Overrides: list.pop

apply(self, op)

 

Recursively applies the operation as given by 'op' to all 'Sea' subobjects of this 'Sea' object.

Overrides: Sea.apply

update(self, ark=None, tag=set([]))

 

Updates this list with 'ark'.

Parameters:
  • ark - If 'ark' is None, no effects. If the first element has a string value "!append!", the remaining elements in 'ark' will be appended to this list. If the first element has a string value "!removed!", the remaining elements in 'ark' will be removed from this list. Otherwise, this list will be completely reset to 'ark'.
  • tag - Resets the tag of this list to the given 'tag'.

_dump_impl(self, tag)

 
Overrides: Sea._dump_impl

Property Details [hide private]

raw_val

Readwrite. When read, this returns the current value.

Get Method:
__get_raw_val(self) - Returns the raw value.
Set Method:
__set_val(self, val) - Sets the value, which must be a list or tuple.

bval

Readonly. Returns a new `List' object, which has all macros expanded and references dereferenced.

Get Method:
__get_bval(self) - Returns a new `Sea' object, which has all macros expanded and references dereferenced.

dval

Readonly. Returns a new `List' object dereferenced values.

Get Method:
__get_bval(self) - Returns a new `Sea' object, which has all macros expanded and references dereferenced.

val

Readwrite. When read, this returns the current value.

Get Method:
__get_val(self) - Returns the value with macro's expended and references dereferenced if the raw value is a string.
Set Method:
__set_val(self, val) - Sets the value, which must be a list or tuple.