修正examine_file方法中的路径类型检查,并优化后续路径处理逻辑
This commit is contained in:
@ -191,6 +191,8 @@ class PublicFunc:
|
||||
|
||||
@staticmethod
|
||||
def examine_file(path_str, filename, suffix):
|
||||
if not isinstance(path_str, str):
|
||||
path_str = str(path_str)
|
||||
temp_path = [p for p in Path(path_str).glob(f"{filename}*") if p.stem.startswith(filename) and p.suffix == suffix]
|
||||
|
||||
if len(temp_path) == 0:
|
||||
@ -214,13 +216,13 @@ class PublicFunc:
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
Constants.FAILURE_REASON["Data_Frequency_Not_In_Filename"])
|
||||
if Path(path).suffix != suffix:
|
||||
if path.suffix != suffix:
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
Constants.FAILURE_REASON["Suffix_Not_Correct"])
|
||||
data = {
|
||||
"path": str(path),
|
||||
"path": path,
|
||||
"freq": int(freq)
|
||||
}
|
||||
return Result().success(data=data)
|
||||
|
||||
Reference in New Issue
Block a user