From 270aa001d449fd6b85bc01e4c79f9d561b2941cd Mon Sep 17 00:00:00 2001 From: Xiaohang Date: Tue, 25 Mar 2025 11:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=97=E8=A1=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_generator.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config_generator.py b/config_generator.py index 5e9cebb..24b24e7 100644 --- a/config_generator.py +++ b/config_generator.py @@ -165,15 +165,15 @@ class ConfigGenerator: def gen_config_json(self): sheet = self.sheet_helper.get_sheet_table(self.google_sheet_file_name, self.sheet_table_name) sheet_all_row_datas = sheet.get_all_values(major_dimension='ROWS') - config_json = {'datas': []} + config_json = {} error_lines = [] - data_row_index = -1 + list_field = '' for i, row_values in enumerate(sheet_all_row_datas): - if data_row_index == -1: - if 'data' not in str(row_values[0]).lower(): - continue - else: - data_row_index = i + if i <= 4: + continue + if row_values[0] != '': + list_field = row_values[0] + config_json[list_field] = [] if self.is_row_env_valid(row_values) is False: continue @@ -184,7 +184,7 @@ class ConfigGenerator: elif len(item_data) == 0: continue else: - config_json['datas'].append(item_data) + config_json[list_field].append(item_data) if len(error_lines) > 0: config.notification.append_msg(str(error_lines))