Upload struct_data_operators.py with huggingface_hub
Browse files249 unmodified lines25025125225325325425525625825725825926026226126226326471 unmodified lines33633733834033934034134223 unmodified lines36636736837036937037137253 unmodified lines426427428430429430431432435436433434435436437249 unmodified lines max_length: int = 15 table: str = None text_output: Optional[str] = None use_query: bool = False
def process( self, instance: Dict[str, Any], stream_name: Optional[str] = None ) -> Dict[str, Any]: table = dict_get(instance, self.table, use_dpath=self.use_query) table = dict_get(instance, self.table)
answers = [] if self.text_output is not None: answers = dict_get(instance, self.text_output, use_dpath=self.use_query) answers = dict_get(instance, self.text_output)
self.truncate_table(table_content=table, answers=answers)
71 unmodified lines ) -> Dict[str, Any]: linearized_str = "" for field in self.fields: value = dict_get(instance, field, use_dpath=False) value = dict_get(instance, field) if self.max_cell_length is not None: truncated_value = truncate_cell(value, self.max_cell_length) if truncated_value is not None:23 unmodified lines ) -> Dict[str, Any]: linearized_str = "" for field in self.fields: value = dict_get(instance, field, use_dpath=False) value = dict_get(instance, field) if self.max_cell_length is not None: truncated_value = truncate_cell(value, self.max_cell_length) if truncated_value is not None:53 unmodified lines
fields: List[str] to_field: str use_query: bool = False
def process( self, instance: Dict[str, Any], stream_name: Optional[str] = None ) -> Dict[str, Any]: keylist = dict_get(instance, self.fields[0], use_dpath=self.use_query) valuelist = dict_get(instance, self.fields[1], use_dpath=self.use_query) keylist = dict_get(instance, self.fields[0]) valuelist = dict_get(instance, self.fields[1])
output_dict = {} for key, value in zip(keylist, valuelist):struct_data_operators.py+6-8