def write_row(self, array): if is_empty_array(array): print(constants.MESSAGE_EMPTY_ARRAY) else: new_array = swap_empty_string_for_none(array) try: self._write_row(new_array) except PyexcelSQLSkipRowException: print(constants.MESSAGE_IGNORE_ROW) print(new_array)
def write_row(self, array): if is_empty_array(array): print(constants.MESSAGE_EMPTY_ARRAY) else: new_array = swap_empty_string_for_none(array) try: self._write_row(new_array) except PyexcelSQLSkipRowException: print(constants.MESSAGE_IGNORE_ROW) print(new_array)
def write_row(self, array): if is_empty_array(array): print(constants.MESSAGE_EMPTY_ARRAY) else: new_array = swap_empty_string_for_none(array) model_to_be_created = new_array if self.__initializer is not None: model_to_be_created = self.__initializer(new_array) if model_to_be_created: self.__objs.append( self.__model( **dict(zip(self.__column_names, model_to_be_created))))
def write_row(self, array): if is_empty_array(array): print(constants.MESSAGE_EMPTY_ARRAY) else: new_array = swap_empty_string_for_none(array) model_to_be_created = new_array if self.__initializer is not None: model_to_be_created = self.__initializer(new_array) if model_to_be_created: self.__objs.append(self.__model(**dict( zip(self.__column_names, model_to_be_created) )))
def write_row(self, array): if is_empty_array(array): print(constants.MESSAGE_EMPTY_ARRAY) else: new_array = swap_empty_string_for_none(array) if self.mapdict: another_new_array = [] for index, element in enumerate(new_array): if index in self.mapdict: another_new_array.append(element) new_array = another_new_array model_to_be_created = new_array if self.initializer is not None: model_to_be_created = self.initializer(new_array) if model_to_be_created: row = dict(zip(self.column_names, model_to_be_created)) self.objs.append(self.model(**row))
def test_is_empty_array(): a = ["", "", "", ""] assert is_empty_array(a) is True b = [1, "", "", ""] assert is_empty_array(b) is False
def test_is_empty_array(): a = ["", "", "", ""] assert is_empty_array(a) is True b = [1, "", "", ""] assert is_empty_array(b) is False