35 lines
744 B
Python
35 lines
744 B
Python
from .key import buildKey
|
|
|
|
def buildObject(keys, outputs, resolved):
|
|
object = {}
|
|
|
|
for key in keys:
|
|
object.update(
|
|
buildKey(key, outputs, resolved),
|
|
)
|
|
|
|
return object
|
|
|
|
|
|
def buildObject2(value, outputs, resolved):
|
|
|
|
if isinstance(value, dict):
|
|
|
|
if value.keys() == {"resolved"}:
|
|
return resolved[value["resolved"]]
|
|
|
|
if value.keys() == {"output"}:
|
|
return outputs[value["output"]]
|
|
|
|
return {
|
|
key: buildObject2(item, outputs, resolved)
|
|
for key, item in value.items()
|
|
}
|
|
|
|
if isinstance(value, list):
|
|
return [
|
|
buildObject2(item, outputs, resolved)
|
|
for item in value
|
|
]
|
|
|
|
return value |