MCPcopy Create free account
hub / github.com/cherrypy/cherrypy / _ThreadLocalProxy

Class _ThreadLocalProxy

cherrypy/__init__.py:221–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219
220
221class _ThreadLocalProxy(object):
222
223 __slots__ = ['__attrname__', '__dict__']
224
225 def __init__(self, attrname):
226 self.__attrname__ = attrname
227
228 def __getattr__(self, name):
229 child = getattr(serving, self.__attrname__)
230 return getattr(child, name)
231
232 def __setattr__(self, name, value):
233 if name in ('__attrname__', ):
234 object.__setattr__(self, name, value)
235 else:
236 child = getattr(serving, self.__attrname__)
237 setattr(child, name, value)
238
239 def __delattr__(self, name):
240 child = getattr(serving, self.__attrname__)
241 delattr(child, name)
242
243 @property
244 def __dict__(self):
245 child = getattr(serving, self.__attrname__)
246 d = child.__class__.__dict__.copy()
247 d.update(child.__dict__)
248 return d
249
250 def __getitem__(self, key):
251 child = getattr(serving, self.__attrname__)
252 return child[key]
253
254 def __setitem__(self, key, value):
255 child = getattr(serving, self.__attrname__)
256 child[key] = value
257
258 def __delitem__(self, key):
259 child = getattr(serving, self.__attrname__)
260 del child[key]
261
262 def __contains__(self, key):
263 child = getattr(serving, self.__attrname__)
264 return key in child
265
266 def __len__(self):
267 child = getattr(serving, self.__attrname__)
268 return len(child)
269
270 def __nonzero__(self):
271 child = getattr(serving, self.__attrname__)
272 return bool(child)
273 # Python 3
274 __bool__ = __nonzero__
275
276
277# Create request and response object (the same objects will be used

Callers 1

__init__.pyFile · 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…