MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / DictProperty

Class DictProperty

thirdparty/bottle/bottle.py:190–213  ·  view source on GitHub ↗

Property that maps to a key in a local dict-like attribute.

Source from the content-addressed store, hash-verified

188
189
190class DictProperty(object):
191 """ Property that maps to a key in a local dict-like attribute. """
192
193 def __init__(self, attr, key=None, read_only=False):
194 self.attr, self.key, self.read_only = attr, key, read_only
195
196 def __call__(self, func):
197 functools.update_wrapper(self, func, updated=[])
198 self.getter, self.key = func, self.key or func.__name__
199 return self
200
201 def __get__(self, obj, cls):
202 if obj is None: return self
203 key, storage = self.key, getattr(obj, self.attr)
204 if key not in storage: storage[key] = self.getter(obj)
205 return storage[key]
206
207 def __set__(self, obj, value):
208 if self.read_only: raise AttributeError("Read-Only property.")
209 getattr(obj, self.attr)[self.key] = value
210
211 def __delete__(self, obj):
212 if self.read_only: raise AttributeError("Read-Only property.")
213 del getattr(obj, self.attr)[self.key]
214
215
216class cached_property(object):

Callers 1

BottleClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…