Home | Trees | Index | Help |
|
---|
Package CedarBackup2 :: Module util :: Class RestrictedContentList |
|
object
--+ |list
--+ |UnorderedList
--+ | RestrictedContentList
Class representing a list containing only object with certain values.
This is an unordered list.
We override the append
, insert
and
extend
methods to ensure that any item added to the list is
among the valid values. We use a standard comparison, so pretty much
anything can be in the list of valid values.
valuesDescr
value will be used in exceptions, i.e.
"Item must be one of values in VALID_ACTIONS"
if
valuesDescr
is "VALID_ACTIONS"
.
Note: This class doesn't make any attempt to trap for nonsensical arguments. All of the values in the values list should be of the same type (i.e. strings). Then, all list operations also need to be of that type (i.e. you should always insert or append just strings). If you mix types -- for instance lists and strings -- you will likely see AttributeError exceptions or other problems.
Method Summary | |
---|---|
Initializes a list restricted to containing certain values. | |
Overrides the standard append method. | |
Overrides the standard insert method. | |
Overrides the standard insert method. | |
Inherited from UnorderedList | |
Definition of == operator for this class. | |
Definition of ≥ operator for this class. | |
Definition of > operator for this class. | |
Definition of ≤ operator for this class. | |
Definition of < operator for this class. | |
Definition of != operator for this class. | |
Inherited from list | |
x.__add__(y) <==> x+y | |
x.__contains__(y) <==> y in x | |
x.__delitem__(y) <==> del x[y] | |
Use of negative indices is not supported. | |
x.__getattribute__('name') <==> x.name | |
x.__getitem__(y) <==> x[y] | |
Use of negative indices is not supported. | |
x.__hash__() <==> hash(x) | |
x.__iadd__(y) <==> x+=y | |
x.__imul__(y) <==> x*=y | |
x.__iter__() <==> iter(x) | |
x.__len__() <==> len(x) | |
x.__mul__(n) <==> x*n | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
x.__repr__() <==> repr(x) | |
L.__reversed__() -- return a reverse iterator over the list | |
x.__rmul__(n) <==> n*x | |
x.__setitem__(i, y) <==> x[i]=y | |
Use of negative indices is not supported. | |
L.count(value) -> integer -- return number of occurrences of value | |
L.index(value, [start, [stop]]) -> integer -- return first index of value | |
L.pop([index]) -> item -- remove and return item at index (default last) | |
L.remove(value) -- remove first occurrence of value | |
L.reverse() -- reverse *IN PLACE* | |
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1 | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Method Details |
---|
__init__(self,
valuesList,
valuesDescr)
Initializes a list restricted to containing certain values.
|
append(self, item)Overrides the standardappend method.
|
extend(self, seq)Overrides the standardinsert method.
|
insert(self, index, item)Overrides the standardinsert method.
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Thu Mar 29 20:58:28 2007 | http://epydoc.sf.net |