refactor: cleanup

This commit is contained in:
Florian Hönicke
2023-05-09 18:08:09 +02:00
parent b86ba5df09
commit c29c212e12
8 changed files with 354 additions and 328 deletions

View File

@@ -0,0 +1,17 @@
import json
def context_to_string(context):
context_strings = []
for k, v in context.items():
if isinstance(v, dict):
v = json.dumps(v, indent=4)
v = v.replace('{', '{{').replace('}', '}}')
context_strings.append(f'''\
{k}:
```
{v}
```
'''
)
return '\n'.join(context_strings)