Package gavo :: Package rscdef :: Module common :: Class ColumnList
[frames] | no frames]

Class ColumnList

source code

object --+    
         |    
      list --+
             |
            ColumnList

A list of column.Columns (or derived classes) that takes care that no duplicates (in name) occur.

If you add a field with the same dest to a ColumnList, the previous instance will be overwritten. The idea is that you can override ColumnList in, e.g., interfaces later on.

Also, two ColumnLists are considered equal if they contain the same names.

After construction, you should set the withinId attribute to something that will help make sense of error messages.

Instance Methods
new empty list
__init__(self, *args)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__contains__(self, fieldName)
y in x
source code
 
__eq__(self, other)
x==y
source code
 
deepcopy(self, newParent)
returns a deep copy of self.
source code
 
getIdIndex(self) source code
 
append(self, item)
adds the Column item to the data field list.
source code
 
replace(self, oldCol, newCol) source code
 
remove(self, col)
remove first occurrence of value.
source code
 
extend(self, seq)
extend list by appending elements from the iterable
source code
 
getColumnByName(self, name)
returns the column with name.
source code
 
getColumnById(self, id)
returns the column with id.
source code
 
getColumnByUtype(self, utype)
returns the column having utype.
source code
 
getColumnsByUCD(self, ucd)
returns all columns having ucd.
source code
 
getColumnByUCD(self, ucd)
retuns the single, unique column having ucd.
source code
 
getColumnByUCDs(self, *ucds)
returns the single, unique column having one of ucds.
source code

Inherited from list: __add__, __delitem__, __delslice__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, count, index, insert, pop, reverse, sort

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

Class Variables

Inherited from list: __hash__

Properties

Inherited from object: __class__

Method Details

__init__(self, *args)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Returns: new empty list
Overrides: object.__init__
(inherited documentation)

__contains__(self, fieldName)
(In operator)

source code 

y in x

Overrides: list.__contains__
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

x==y

Overrides: list.__eq__
(inherited documentation)

deepcopy(self, newParent)

source code 

returns a deep copy of self.

This means that all child structures are being copied. In that process, they receive a new parent, which is why you need to pass one in.

append(self, item)

source code 

adds the Column item to the data field list.

It will overwrite a Column of the same name if such a thing is already in the list. Indices are updated.

Overrides: list.append

remove(self, col)

source code 

remove first occurrence of value. Raises ValueError if the value is not present.

Overrides: list.remove
(inherited documentation)

extend(self, seq)

source code 

extend list by appending elements from the iterable

Overrides: list.extend
(inherited documentation)

getColumnByName(self, name)

source code 

returns the column with name.

It will raise a NotFoundError if no such column exists.

getColumnById(self, id)

source code 

returns the column with id.

It will raise a NotFoundError if no such column exists.

getColumnByUtype(self, utype)

source code 

returns the column having utype.

This should be unique, but this method does not check for uniqueness.

getColumnByUCD(self, ucd)

source code 

retuns the single, unique column having ucd.

It raises a ValueError if there is no such column or more than one.

getColumnByUCDs(self, *ucds)

source code 

returns the single, unique column having one of ucds.

This method has a confusing interface. It sole function is to help when there are multiple possible UCDs that may be interesting (like pos.eq.ra;meta.main and POS_EQ_RA_MAIN). It should only be used for such cases.