mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-02 02:58:10 +02:00
Squashed 'ai-context/trustgraph-templates/' content from commit 42a5fd1b
git-subtree-dir: ai-context/trustgraph-templates git-subtree-split: 42a5fd1b678f32be378062e30451e2052ccb95dd
This commit is contained in:
commit
74cc8a4685
1216 changed files with 116347 additions and 0 deletions
23
trustgraph_configurator/generator.py
Executable file
23
trustgraph_configurator/generator.py
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
import _gojsonnet as j
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger("generator")
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
class Generator:
|
||||
|
||||
def __init__(self, fetch):
|
||||
self.fetch = fetch
|
||||
|
||||
def process(self, config):
|
||||
res = j.evaluate_snippet("config", config, import_callback=self.fetch)
|
||||
return json.loads(res)
|
||||
|
||||
def process_file(self, path):
|
||||
content = path.read_text()
|
||||
res = j.evaluate_snippet(str(path), content, import_callback=self.fetch)
|
||||
return json.loads(res)
|
||||
Loading…
Add table
Add a link
Reference in a new issue