def _preprocess_table_dp(self): if self._is_complete_table_dp_preprocess: return self._logger.logger.debug("_preprocess_table_dp") if typepy.is_empty_sequence(self.header_list) and self._use_default_header: self.header_list = [ convert_idx_to_alphabet(col_idx) for col_idx in range(len(self.__value_matrix_org[0])) ] try: self._table_value_dp_matrix = self._dp_extractor.to_dp_matrix( to_value_matrix(self.header_list, self.__value_matrix_org) ) except TypeError as e: self._logger.logger.debug(msgfy.to_error_message(e)) self._table_value_dp_matrix = [] self._column_dp_list = self._dp_extractor.to_column_dp_list( self._table_value_dp_matrix, self._column_dp_list ) self._is_complete_table_dp_preprocess = True
def _preprocess_table_dp(self) -> None: if self._is_complete_table_dp_preprocess: return self._logger.logger.debug("_preprocess_table_dp") try: self._table_value_dp_matrix = self._dp_extractor.to_dp_matrix( to_value_matrix(self.headers, self.value_matrix)) except TypeError as e: self._logger.logger.debug(msgfy.to_error_message(e)) self._table_value_dp_matrix = [] self._is_complete_table_dp_preprocess = True
def test_normal_OrderedDict_rows(self): expect = [ [1, None, None], [None, 2.1, "hoge"], [0, 0.1, "foo"], [None, None, None], [-1, -0.1, "bar"], ] assert ( to_value_matrix( ["A", "B", "C"], [ OrderedDict({"A": 1}), OrderedDict({"B": 2.1, "C": "hoge"}), OrderedDict({"A": 0, "B": 0.1, "C": "foo"}), OrderedDict({}), OrderedDict({"A": -1, "B": -0.1, "C": "bar", "D": "extra"}), ], ) == expect )