Commit c379610a authored by Wei Shoulin's avatar Wei Shoulin
Browse files

fix(plan): add return type hint and handle non-list data input

parent 6fc650b5
Pipeline #11382 failed with stages
in 0 seconds
...@@ -85,7 +85,7 @@ def find_by_opid(opid: str) -> Result: ...@@ -85,7 +85,7 @@ def find_by_opid(opid: str) -> Result:
""" """
return request.get(f"/api/plan/{opid}") return request.get(f"/api/plan/{opid}")
def load_file(local_file: Union[IO, str, list]): def load_file(local_file: Union[IO, str, list]) -> list:
""" """
将本地json文件、json数据流或json数据列表写入DFS中。 将本地json文件、json数据流或json数据列表写入DFS中。
...@@ -108,7 +108,8 @@ def load_file(local_file: Union[IO, str, list]): ...@@ -108,7 +108,8 @@ def load_file(local_file: Union[IO, str, list]):
raise ValueError("Unsupported type for local_file") raise ValueError("Unsupported type for local_file")
if not isinstance(data, list): if not isinstance(data, list):
raise ValueError("Data must be a list of JSON objects") raise ValueError("Data must be a list of JSON objects")
return data
def write_file(local_file: Union[IO, str, list]) -> Result: def write_file(local_file: Union[IO, str, list]) -> Result:
""" """
将本地json文件、json数据流或json数据列表写入DFS中。 将本地json文件、json数据流或json数据列表写入DFS中。
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment