Module metakitplus :: Class view
[show private | hide private]
[frames | no frames]

Class view


Convenience wrapper for metakit views
Method Summary
  __init__(self, v)
Constructor for wrapped view class
  __getattr__(self, attr)
Supports attribute access for our view subclass
  __getitem__(self, idx)
Support subscripting of our view subclass
  __getslice__(self, fromidx, toidx)
Supports slice retrieval for our view subclass
  __len__(self)
Number of rows in this group
  __setitem__(self, idx, val)
Support subscripting and cell assignment for our view subclass
  __setslice__(self, fromidx, toidx, newslice)
Supports slice assignment for our view subclass
  blocked(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  copy(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  counts(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  different(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  dump(self)
  filter(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  filterInPlace(self, func)
Removes from this view all rows which do not satisfy func.
  find(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  flatten(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  getColAsList(self, colname)
return the column 'colname' of each row, as a list
  getFiltered(self, func)
shorthand for view.remapwith(view.filter(func))
  getRowAsDict(self, idx)
Returns a dict with keys,values in row
  getRowAsList(self, idx)
return the column 'colname' of each row, as a list
  groupby(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  hash(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  hasRowsWhen(self, func)
Returns 1 if the table has any rows satisfying 'func', or 0 if not
  indices(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  intersect(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  join(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  minus(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  onlyWhen(self, func)
Synonym for 'getFiltered' Returns a view that contains only rows satisfying func
  ordered(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  pair(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  product(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  project(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  purgeDuplicates(self)
  remapwith(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  removeWhen(self, func)
Shorthand for view.filter...
  rename(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  search(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  select(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  setWhen(self, func, values, **kw)
viewSetWhen(view, func, values)
  sort(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  sortrev(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html
  union(self, v)
RTFM - http://www.equi4.com/metakit/python.html
  unique(self, *args, **kw)
RTFM - http://www.equi4.com/metakit/python.html

Method Details

__init__(self, v=None)
(Constructor)

Constructor for wrapped view class

RTFM Metakit for more info

__getattr__(self, attr)
(Qualification operator)

Supports attribute access for our view subclass

__getitem__(self, idx)
(Indexing operator)

Support subscripting of our view subclass

__getslice__(self, fromidx, toidx)
(Slicling operator)

Supports slice retrieval for our view subclass

__len__(self)
(Length operator)

Number of rows in this group

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

Support subscripting and cell assignment for our view subclass

__setslice__(self, fromidx, toidx, newslice)
(Slice assignment operator)

Supports slice assignment for our view subclass

blocked(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

copy(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

counts(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

different(self, v)

RTFM - http://www.equi4.com/metakit/python.html

filter(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

filterInPlace(self, func)

Removes from this view all rows which do not satisfy func.

Func should accept one argument - the row to test - and should return 1 if the row should be kept, or 0 if it should be discarded

This function is opposite to removeWhen

find(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

flatten(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

getColAsList(self, colname)

return the column 'colname' of each row, as a list

getFiltered(self, func)

shorthand for view.remapwith(view.filter(func))

Returns a view whose rows satisfy 'func'

getRowAsDict(self, idx)

Returns a dict with keys,values in row

getRowAsList(self, idx)

return the column 'colname' of each row, as a list

groupby(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

hash(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

hasRowsWhen(self, func)

Returns 1 if the table has any rows satisfying 'func', or 0 if not

indices(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

intersect(self, v)

RTFM - http://www.equi4.com/metakit/python.html

join(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

minus(self, v)

RTFM - http://www.equi4.com/metakit/python.html

onlyWhen(self, func)

Synonym for 'getFiltered' Returns a view that contains only rows satisfying func

ordered(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

pair(self, v)

RTFM - http://www.equi4.com/metakit/python.html

product(self, v)

RTFM - http://www.equi4.com/metakit/python.html

project(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

remapwith(self, v)

RTFM - http://www.equi4.com/metakit/python.html

removeWhen(self, func)

Shorthand for view.filter... view.remove

Args:
  • func - a lambda func accepting row which returns 1 if should delete that row
Returns:
  • the same view, with the desired rows deleted
Example:
  • get rid of all records for 'Mary Smith':
       myview.removeWhen(lambda r: r.firstname == 'Mary' and r.lastname != 'Smith')
    
  • corresponding SQL syntax would be:
       DELETE FROM myview WHERE firstname='Mary' AND lastname='Smith'
    

rename(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

search(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

select(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

setWhen(self, func, values=None, **kw)

viewSetWhen(view, func, values)

When func(row) returns true, set fields in view to those in dict 'values'

Example:
  • Change Mary Pike's surname to married name of 'Fisher':
      myview.setWhen(lambda r: r.first=='Mary' and r.last!='Pike',
                     {'last':'Fisher'})
    
  • This roughly corresponds to SQL syntax like:
       UPDATE myview SET last='Fisher' WHERE first='Mary' AND last='Pike'
    

sort(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

sortrev(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

union(self, v)

RTFM - http://www.equi4.com/metakit/python.html

unique(self, *args, **kw)

RTFM - http://www.equi4.com/metakit/python.html

Generated by Epydoc 1.1 on Fri Jul 25 19:27:28 2003 http://epydoc.sf.net