@@ -169,6 +169,13 @@ async def run(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
169169 # TODO Address the need to copy operation implementation inputs dict
170170 # In case the input is used elsewhere in the network
171171 exported = copy .deepcopy (inputs ["spec" ])
172+ name_map = {}
173+ for i , input_value in enumerate (exported ):
174+ if isinstance (input_value , dict ):
175+ name , value = list (input_value .items ())[0 ]
176+ name_map [value ] = name
177+ exported [i ] = value
178+
172179 # Look up the definiton for each
173180 for convert in range (0 , len (exported )):
174181 exported [convert ] = await self .octx .ictx .definition (
@@ -184,6 +191,12 @@ async def run(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
184191 async for item in od .inputs (definition ):
185192 want .setdefault (definition .name , [])
186193 want [definition .name ].append (item .value )
194+
195+ # Rename outputs if present in name_map
196+ for key , value in want .copy ().items ():
197+ if name_map .get (key , None ):
198+ want [name_map [key ]] = value
199+ want .pop (key )
187200 return want
188201
189202
@@ -224,11 +237,12 @@ class GetSingle(GetMulti):
224237 >>> from dffml import *
225238 >>>
226239 >>> URL = Definition(name="URL", primitive="string")
240+ >>> ORG = Definition(name="ORG", primitive="string")
227241 >>>
228242 >>> dataflow = DataFlow.auto(GetSingle)
229243 >>> dataflow.seed.append(
230244 ... Input(
231- ... value=[URL.name],
245+ ... value=[{"Repo Link": URL.name}, ORG .name],
232246 ... definition=GetSingle.op.inputs["spec"]
233247 ... )
234248 ... )
@@ -238,12 +252,16 @@ class GetSingle(GetMulti):
238252 ... Input(
239253 ... value="https://github.com/intel/dffml",
240254 ... definition=URL
255+ ... ),
256+ ... Input(
257+ ... value="Intel",
258+ ... definition=ORG
241259 ... )
242260 ... ]):
243261 ... print(results)
244262 ...
245263 >>> asyncio.run(main())
246- {'URL ': 'https://github.com/intel/dffml'}
264+ {'ORG': 'Intel', 'Repo Link ': 'https://github.com/intel/dffml'}
247265 """
248266
249267 async def run (self , inputs : Dict [str , Any ]) -> Dict [str , Any ]:
0 commit comments