def getSettings(self): """ returns a mapping contains the indexes preferences """ from copy import copy d = {} for k in defaults.keys(): d[k] = copy(getattr(self, k)) return d
def __init__(self, **kw): # perform argument check first illegal_args = [k for k in kw.keys() if not k in defaults.keys()] if illegal_args: raise ValueError('Unknown parameters: %s' % ', '.join(illegal_args)) # setup preferences using default args (preferences are stored as # attributes of the index instance for k,v in defaults.items(): v = kw.get(k, v) setattr(self, k, v) self.clear()
def __init__(self, **kw): # perform argument check first illegal_args = [k for k in kw.keys() if not k in defaults.keys()] if illegal_args: raise ValueError('Unknown parameters: %s' % ', '.join(illegal_args)) # setup preferences using default args (preferences are stored as # attributes of the index instance for k, v in defaults.items(): v = kw.get(k, v) setattr(self, k, v) self.clear()
def __repr__(self): return '%s[%s]' % (self.__class__.__name__, ', '.join([ '%s=%s' % (k, repr(getattr(self, k, None))) for k in defaults.keys() ]))
def __repr__(self): return '%s[%s]' % (self.__class__.__name__, ', '.join(['%s=%s' % (k, repr(getattr(self, k, None))) for k in defaults.keys()]))