27 lines
781 B
Python
27 lines
781 B
Python
import os
|
|
from typing import List
|
|
|
|
from models.RepoInfo import RepoInfo
|
|
|
|
|
|
class FileOperator(object):
|
|
def __init__(self, path: str) -> None:
|
|
self.path = path
|
|
|
|
def load_repos(self) -> List[RepoInfo]:
|
|
"""
|
|
Function: load project address list
|
|
return:
|
|
- list: a list including all the testing RepoInfo objects
|
|
"""
|
|
result = []
|
|
with open(self.path, "r") as file:
|
|
list = file.read().strip().splitlines()
|
|
for line in list:
|
|
ownername, reponame, git_url, id = line.split(" ")
|
|
repoInfo = RepoInfo(
|
|
id=id, ownername=ownername, reponame=reponame, git_url=git_url
|
|
)
|
|
result.append(repoInfo)
|
|
return result
|