| 219 | |
| 220 | |
| 221 | class _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 |
no outgoing calls
no test coverage detected
searching dependent graphs…