Lines Matching refs:key
53 def __setitem__(cls, key, value): argument
57 key += MUTABLE
58 setattr(cls, key, value)
60 def __getmutable__(cls, key, readonly=False): argument
61 nkey = key + MUTABLE
72 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
82 def __getreadonly__(cls, key, default=__getmarker__): argument
86 return cls.__getitem__(key, default, True)
88 def __getitem__(cls, key, default=__getmarker__, readonly=False): argument
91 value = getattr(cls, key)
93 value = cls.__getmutable__(key, readonly)
97 raise AttributeError("key %s does not exist." % key)
106 def __delitem__(cls, key): argument
107 cls.__setitem__(key, cls.__marker__)
109 def __revertitem__(cls, key): argument
110 if key not in cls.__dict__:
111 key += MUTABLE
112 delattr(cls, key)
114 def __contains__(cls, key): argument
115 return cls.has_key(key)
117 def has_key(cls, key): argument
118 value = cls.__getreadonly__(key, cls.__marker__)
124 for key in dir(cls):
125 if key.startswith("__"):
128 if key.endswith(MUTABLE):
129 key = key[:-len(MUTABLE)]
132 yield key
136 value = cls.__getreadonly__(key)
138 value = cls[key]
145 yield (key, value)