Lines Matching full:key
54 def __setitem__(cls, key, value): argument
58 key += MUTABLE
59 setattr(cls, key, value)
61 def __getmutable__(cls, key, readonly=False): argument
62 nkey = key + MUTABLE
73 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
83 def __getreadonly__(cls, key, default=__getmarker__): argument
87 return cls.__getitem__(key, default, True)
89 def __getitem__(cls, key, default=__getmarker__, readonly=False): argument
92 value = getattr(cls, key)
94 value = cls.__getmutable__(key, readonly)
98 raise AttributeError("key %s does not exist." % key)
107 def __delitem__(cls, key): argument
108 cls.__setitem__(key, cls.__marker__)
110 def __revertitem__(cls, key): argument
111 if key not in cls.__dict__:
112 key += MUTABLE
113 delattr(cls, key)
115 def __contains__(cls, key): argument
116 return cls.has_key(key)
118 def has_key(cls, key): argument
119 value = cls.__getreadonly__(key, cls.__marker__)
125 for key in dir(cls):
126 if key.startswith("__"):
129 if key.endswith(MUTABLE):
130 key = key[:-len(MUTABLE)]
133 yield key
137 value = cls.__getreadonly__(key)
139 value = cls[key]
146 yield (key, value)