10def format_data(data):
11 globals()['types'] = __import__('types')
12
13 exclude_keys = ['copyright', 'credits', 'False',
14 'True', 'None', 'Ellipsis', 'quit',
15 'QtCriticalMsg', 'krita_path',
16 'QtWarningMsg', 'QWIDGETSIZE_MAX',
17 'QtFatalMsg', 'PYQT_CONFIGURATION',
18 'on_load', 'PYQT_VERSION', 'on_pykrita_unloading',
19 'on_unload', 'QT_VERSION', 'QtInfoMsg',
20 'PYQT_VERSION_STR', 'qApp', 'QtSystemMsg',
21 'QtDebugMsg', 'on_pykrita_loaded', 'QT_VERSION_STR']
22 exclude_valuetypes = [types.BuiltinFunctionType,
23 types.BuiltinMethodType,
24 types.ModuleType,
25 types.FunctionType]
26
27 return [{k: {'value': str(v), 'type': str(type(v))}} for k, v in data.items() if not (k in exclude_keys or
28 type(v) in exclude_valuetypes or
29 re.search(r'^(__).*\1$', k) or
30 inspect.isclass(v) or
31 inspect.isfunction(v))]