MCPcopy Create free account
hub / github.com/1Panel-dev/MaxKB / get_instance_resource

Function get_instance_resource

apps/application/flow/tools.py:916–929  ·  view source on GitHub ↗
(instance, source_type, source_id, instance_field_call_dict)

Source from the content-addressed store, hash-verified

914
915
916def get_instance_resource(instance, source_type, source_id, instance_field_call_dict):
917 response = []
918 from system_manage.models.resource_mapping import ResourceMapping
919
920 for target_type, call_list in instance_field_call_dict.items():
921 target_id_list = reduce(lambda x, y: [*x, *y], [call(instance) for call in call_list], [])
922 if target_id_list:
923 for target_id in target_id_list:
924 response.append(
925 ResourceMapping(
926 source_type=source_type, target_type=target_type, source_id=source_id, target_id=target_id
927 )
928 )
929 return response
930
931
932def save_workflow_mapping(workflow, source_type, source_id, other_resource_mapping=None):

Calls 2

ResourceMappingClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected