(ctx, getter=getattr)
| 4 | # Retrieve the values of all context attributes as a |
| 5 | # dictionary in an implementation-agnostic manner. |
| 6 | def 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 | |
| 18 | default_context = get_context_as_dict(Context()) |
no outgoing calls
no test coverage detected
searching dependent graphs…