Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

feat: parse class view

莘权 马9d080e22d6c2
diff --cc .gitignore
index 350df1514,6dd3608f1..c10191dcc
--- a/.gitignore
+++ b/.gitignore
@@@ -171,6 -172,6 +172,8 @@@ tests/metagpt/utils/file_repo_gi
*.png
htmlcov
htmlcov.*
+*.dot
*.pkl
+ *-structure.csv
+ *-structure.json
+
diff --cc metagpt/repo_parser.py
index 465f40d63,5e4d67940..9863a29ae
--- a/metagpt/repo_parser.py
+++ b/metagpt/repo_parser.py
@@@ -12,16 -12,14 +12,14 @@@ import jso
import re
import subprocess
from pathlib import Path
- from pprint import pformat
-from typing import Dict, List, Optional, Tuple
+from typing import Dict, List, Optional
-import aiofiles
import pandas as pd
from pydantic import BaseModel, Field
- from metagpt.config import CONFIG
+from metagpt.const import AGGREGATION, COMPOSITION, GENERALIZATION
from metagpt.logs import logger
-from metagpt.utils.common import any_to_str
+from metagpt.utils.common import any_to_str, aread
from metagpt.utils.exceptions import handle_exception
@@@ -117,11 -107,10 +115,12 @@@ class RepoParser(BaseModel)
self.generate_json_structure(output_path)
elif mode == "csv":
self.generate_dataframe_structure(output_path)
+ return output_path
@staticmethod
- def node_to_str(node) -> (int, int, str, str | Tuple):
+ def node_to_str(node) -> CodeBlockInfo | None:
+ if isinstance(node, ast.Try):
+ return None
if any_to_str(node) == any_to_str(ast.Expr):
return CodeBlockInfo(
lineno=node.lineno,
diff --cc tests/conftest.py
index 4caecc8ee,1f4a73030..419ac7d0c
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@@ -7,10 -7,11 +7,12 @@@
"""
import asyncio
+ import json
import logging
+ import os
import re
+import uuid
- from unittest.mock import Mock
+ from typing import Optional
import pytest