MCPcopy
hub / github.com/celery/celery / get_context_as_dict

Function get_context_as_dict

t/unit/tasks/test_context.py:6–15  ·  view source on GitHub ↗
(ctx, getter=getattr)

Source from the content-addressed store, hash-verified

4# Retrieve the values of all context attributes as a
5# dictionary in an implementation-agnostic manner.
6def get_context_as_dict(ctx, getter=getattr):
7 defaults = {}
8 for attr_name in dir(ctx):
9 if attr_name.startswith('_'):
10 continue # Ignore pseudo-private attributes
11 attr = getter(ctx, attr_name)
12 if callable(attr):
13 continue # Ignore methods and other non-trivial types
14 defaults[attr_name] = attr
15 return defaults
16
17
18default_context = get_context_as_dict(Context())

Callers 6

test_context.pyFile · 0.85
test_default_contextMethod · 0.85
test_updated_contextMethod · 0.85
test_modified_contextMethod · 0.85
test_cleared_contextMethod · 0.85
test_context_getMethod · 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…