def _classkeys(self): # protected keywords return frozenset( chain( keys(vars(self)), keys(vars(self.__class__)), self._reserved, ))
def test_keys(self): self.store['max'] = 3 self.store['min'] = 6 self.store['pow'] = 7 self.store.sync() slist = list(keys(self.store)) self.assertEqual('min' in slist, True)
def __getattr__(self, key, _getter=object.__getattribute__): try: return self[key] except KeyError: if key == 'iteritems': return items(self) elif key == 'iterkeys': return keys(self) elif key == 'itervalues': return values(self) return _getter(self, key)
def __getattr__(self, key, _getter=object.__getattribute__): try: if key == 'iteritems': return items(self) elif key == 'iterkeys': return keys(self) elif key == 'itervalues': return values(self) return _getter(self, key) except AttributeError: return self[key]
def _prepopulate(self, *args, **kw): iterable = super(fixedstuf, self)._prepopulate(*args, **kw) self.allowed = frozenset(keys(iterable)) return iterable
def _classkeys(self): # protected keywords return frozenset(chain( keys(vars(self)), keys(vars(self.__class__)), self._reserved, ))