good version for 算法注册
This commit is contained in:
@@ -63,22 +63,41 @@ class ProjectAnalyzer:
|
||||
Returns:
|
||||
项目类型,如 "python", "java", "nodejs" 等
|
||||
"""
|
||||
# 检查Python项目
|
||||
# 检查Python项目 - 先检查根目录
|
||||
if os.path.exists(os.path.join(repo_path, "requirements.txt")) or \
|
||||
os.path.exists(os.path.join(repo_path, "pyproject.toml")) or \
|
||||
any(file.endswith(".py") for file in os.listdir(repo_path)):
|
||||
return "python"
|
||||
|
||||
# 检查Java项目
|
||||
# 检查Python项目 - 递归检查子目录
|
||||
for root, dirs, files in os.walk(repo_path):
|
||||
if "requirements.txt" in files or "pyproject.toml" in files:
|
||||
return "python"
|
||||
if any(file.endswith(".py") for file in files):
|
||||
return "python"
|
||||
|
||||
# 检查Java项目 - 先检查根目录
|
||||
if os.path.exists(os.path.join(repo_path, "pom.xml")) or \
|
||||
os.path.exists(os.path.join(repo_path, "build.gradle")) or \
|
||||
os.path.exists(os.path.join(repo_path, "src")):
|
||||
return "java"
|
||||
|
||||
# 检查Node.js项目
|
||||
# 检查Java项目 - 递归检查子目录
|
||||
for root, dirs, files in os.walk(repo_path):
|
||||
if "pom.xml" in files or "build.gradle" in files:
|
||||
return "java"
|
||||
if "src" in dirs:
|
||||
return "java"
|
||||
|
||||
# 检查Node.js项目 - 先检查根目录
|
||||
if os.path.exists(os.path.join(repo_path, "package.json")):
|
||||
return "nodejs"
|
||||
|
||||
# 检查Node.js项目 - 递归检查子目录
|
||||
for root, dirs, files in os.walk(repo_path):
|
||||
if "package.json" in files:
|
||||
return "nodejs"
|
||||
|
||||
# 检查其他项目类型
|
||||
if os.path.exists(os.path.join(repo_path, "CMakeLists.txt")):
|
||||
return "c++"
|
||||
|
||||
Reference in New Issue
Block a user