style: run ruff format and fix lint issues
This commit is contained in:
parent
c898895f22
commit
8f26a01b3a
3 changed files with 40 additions and 16 deletions
|
|
@ -43,17 +43,31 @@ async def run_code_graph_pipeline(repo_path, include_docs=False, excluded_paths=
|
|||
# Default exclusion patterns
|
||||
if excluded_paths is None:
|
||||
excluded_paths = [
|
||||
".venv/", "venv/", "__pycache__/", ".pytest_cache/",
|
||||
"build/", "dist/", "node_modules/", ".npm/", ".git/",
|
||||
".svn/", ".idea/", ".vscode/", "tmp/", "temp/",
|
||||
"*.pyc", "*.pyo", "*.log", "*.tmp"
|
||||
".venv/",
|
||||
"venv/",
|
||||
"__pycache__/",
|
||||
".pytest_cache/",
|
||||
"build/",
|
||||
"dist/",
|
||||
"node_modules/",
|
||||
".npm/",
|
||||
".git/",
|
||||
".svn/",
|
||||
".idea/",
|
||||
".vscode/",
|
||||
"tmp/",
|
||||
"temp/",
|
||||
"*.pyc",
|
||||
"*.pyo",
|
||||
"*.log",
|
||||
"*.tmp",
|
||||
]
|
||||
|
||||
tasks = [
|
||||
Task(
|
||||
get_repo_file_dependencies,
|
||||
detailed_extraction=detailed_extraction,
|
||||
excluded_paths=excluded_paths
|
||||
excluded_paths=excluded_paths,
|
||||
),
|
||||
Task(add_data_points, task_config={"batch_size": 30}),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -30,9 +30,24 @@ async def get_source_code_files(repo_path: str, excluded_paths: Optional[List[st
|
|||
|
||||
# Default exclusions
|
||||
default_excluded_patterns = [
|
||||
".venv/", "venv/", "__pycache__/", ".pytest_cache/", "build/", "dist/",
|
||||
"node_modules/", ".npm/", ".git/", ".svn/", ".idea/", ".vscode/", "tmp/", "temp/",
|
||||
"*.pyc", "*.pyo", "*.log", "*.tmp"
|
||||
".venv/",
|
||||
"venv/",
|
||||
"__pycache__/",
|
||||
".pytest_cache/",
|
||||
"build/",
|
||||
"dist/",
|
||||
"node_modules/",
|
||||
".npm/",
|
||||
".git/",
|
||||
".svn/",
|
||||
".idea/",
|
||||
".vscode/",
|
||||
"tmp/",
|
||||
"temp/",
|
||||
"*.pyc",
|
||||
"*.pyo",
|
||||
"*.log",
|
||||
"*.tmp",
|
||||
]
|
||||
|
||||
excluded_patterns = default_excluded_patterns + (excluded_paths or [])
|
||||
|
|
@ -51,11 +66,7 @@ async def get_source_code_files(repo_path: str, excluded_paths: Optional[List[st
|
|||
if should_exclude:
|
||||
continue
|
||||
|
||||
if (
|
||||
file.endswith(".py")
|
||||
and not file.startswith("test_")
|
||||
and not file.endswith("_test")
|
||||
):
|
||||
if file.endswith(".py") and not file.startswith("test_") and not file.endswith("_test"):
|
||||
py_files_paths.append(full_path)
|
||||
|
||||
source_code_files = set()
|
||||
|
|
@ -84,9 +95,7 @@ def run_coroutine(coroutine_func, *args, **kwargs):
|
|||
|
||||
|
||||
async def get_repo_file_dependencies(
|
||||
repo_path: str,
|
||||
detailed_extraction: bool = False,
|
||||
excluded_paths: Optional[List[str]] = None
|
||||
repo_path: str, detailed_extraction: bool = False, excluded_paths: Optional[List[str]] = None
|
||||
) -> AsyncGenerator[DataPoint, None]:
|
||||
"""
|
||||
Generate a dependency graph for Python files in the given repository path.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import shutil
|
|||
import tempfile
|
||||
from cognee.tasks.repo_processor.get_repo_file_dependencies import get_source_code_files
|
||||
|
||||
|
||||
def test_get_source_code_files_excludes_common_dirs_and_files():
|
||||
# Create a temporary test directory
|
||||
test_repo = tempfile.mkdtemp()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue