Spaces:
Running
Running
Download src/backend/base/langflow/services/database/models/base.py from opendigital/agent-flow: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/spaces/opendigital/agent-flow/resolve/main/src/backend/base/langflow/services/database/models/base.py
- Command line
-
hf download hf://spaces/opendigital/agent-flow/src/backend/base/langflow/services/database/models/base.py
-
curl -L -o base.py https://huggingface.co/spaces/opendigital/agent-flow/resolve/main/src/backend/base/langflow/services/database/models/base.py
760 Bytes
| import orjson | |
| def orjson_dumps(v, *, default=None, sort_keys=False, indent_2=True): | |
| option = orjson.OPT_SORT_KEYS if sort_keys else None | |
| if indent_2: | |
| # orjson.dumps returns bytes, to match standard json.dumps we need to decode | |
| # option | |
| # To modify how data is serialized, specify option. Each option is an integer constant in orjson. | |
| # To specify multiple options, mask them together, e.g., option=orjson.OPT_STRICT_INTEGER | orjson.OPT_NAIVE_UTC | |
| if option is None: | |
| option = orjson.OPT_INDENT_2 | |
| else: | |
| option |= orjson.OPT_INDENT_2 | |
| if default is None: | |
| return orjson.dumps(v, option=option).decode() | |
| return orjson.dumps(v, default=default, option=option).decode() | |