MCPcopy
hub / github.com/celery/celery / _get_current_object

Method _get_current_object

celery/local.py:96–110  ·  view source on GitHub ↗

Get current object. This is useful if you want the real object behind the proxy at a time for performance reasons or because you want to pass the object into a different context.

(self)

Source from the content-addressed store, hash-verified

94 return self._get_class()
95
96 def _get_current_object(self):
97 """Get current object.
98
99 This is useful if you want the real
100 object behind the proxy at a time for performance reasons or because
101 you want to pass the object into a different context.
102 """
103 loc = object.__getattribute__(self, '_Proxy__local')
104 if not hasattr(loc, '__release_local__'):
105 return loc(*self.__args, **self.__kwargs)
106 try: # pragma: no cover
107 # not sure what this is about
108 return getattr(loc, self.__name__)
109 except AttributeError: # pragma: no cover
110 raise RuntimeError(f'no object bound to {self.__name__}')
111
112 @property
113 def __dict__(self):

Callers 15

__name__Method · 0.95
__qualname__Method · 0.95
__module__Method · 0.95
__doc__Method · 0.95
_get_classMethod · 0.95
__dict__Method · 0.95
__repr__Method · 0.95
__bool__Method · 0.95
__dir__Method · 0.95
__getattr__Method · 0.95
__setitem__Method · 0.95

Calls 1

__getattribute__Method · 0.80

Tested by 6

test_AsyncResultMethod · 0.36
test_send_eventMethod · 0.36