在导入数据时,将校验数据的扩展名是否合法
This commit is contained in:
@ -94,6 +94,8 @@ class Constants:
|
||||
"Path_Not_Exist": "(路径不存在)",
|
||||
"File_Not_Exist": "(数据文件不存在)",
|
||||
"File_More_Than_One": "(数据文件超过一个)",
|
||||
"Data_Frequency_Not_In_Filename": "(无法找到文件名中的数据频率信息)",
|
||||
"Suffix_Not_Correct": "(文件扩展名不正确)",
|
||||
"Frequency_Not_In_Filename": "(数据频率不在文件名中)",
|
||||
"Data_Not_Exist": "(数据不存在)",
|
||||
"Model_File_Not_Exist": "(模型文件不存在)",
|
||||
|
||||
@ -177,7 +177,7 @@ class PublicFunc:
|
||||
QApplication.processEvents()
|
||||
|
||||
@staticmethod
|
||||
def examine_file(path_str, filename):
|
||||
def examine_file(path_str, filename, suffix):
|
||||
temp_path = list(
|
||||
Path(path_str).glob(f"{filename}*"))
|
||||
if len(temp_path) == 0:
|
||||
@ -201,6 +201,11 @@ class PublicFunc:
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
Constants.FAILURE_REASON["Data_Frequency_Not_In_Filename"])
|
||||
if Path(path).suffix != suffix:
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
Constants.FAILURE_REASON["Suffix_Not_Correct"])
|
||||
data = {
|
||||
"path": str(path),
|
||||
"freq": int(freq)
|
||||
|
||||
Reference in New Issue
Block a user