def _sanitize_inputs(self):
ret = {}<EOL>if self.inputs is None:<EOL><INDENT>return<EOL><DEDENT>if isinstance(self.inputs, dict):<EOL><INDENT>for key, grouping in self.inputs.items():<EOL><INDENT>if not Grouping.is_grouping_sane(grouping):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if isinstance(key, HeronComponentSpec):<EOL><INDENT>if key.name is None:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>global_streamid = GlobalStreamId(key.name, Stream.DEFAULT_STREAM_ID)<EOL>ret[global_streamid] = grouping<EOL><DEDENT>elif isinstance(key, GlobalStreamId):<EOL><INDENT>ret[key] = grouping<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % str(key))<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(self.inputs, (list, tuple)):<EOL><INDENT>for input_obj in self.inputs:<EOL><INDENT>if isinstance(input_obj, HeronComponentSpec):<EOL><INDENT>if input_obj.name is None:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>global_streamid = GlobalStreamId(input_obj.name, Stream.DEFAULT_STREAM_ID)<EOL>ret[global_streamid] = Grouping.SHUFFLE<EOL><DEDENT>elif isinstance(input_obj, GlobalStreamId):<EOL><INDENT>ret[input_obj] = Grouping.SHUFFLE<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % str(input_obj))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % str(self.inputs))<EOL><DEDENT>return ret<EOL>
Sanitizes input fields and returns a map <GlobalStreamId -> Grouping>