fix: resolve CI/CD issues - Poetry setup, type annotations, MyPy errors
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import Optional, List
|
from typing import Optional
|
||||||
from codechunk.core.chunking import ParsedChunk
|
from codechunk.core.chunking import ParsedChunk
|
||||||
|
|
||||||
|
|
||||||
@@ -62,8 +62,6 @@ class CodeSummarizer:
|
|||||||
|
|
||||||
def _summarize_method(self, chunk: ParsedChunk) -> str:
|
def _summarize_method(self, chunk: ParsedChunk) -> str:
|
||||||
"""Summarize a method."""
|
"""Summarize a method."""
|
||||||
class_name = chunk.name.split(".")[0] if "." in chunk.name else "Unknown"
|
|
||||||
|
|
||||||
parts = []
|
parts = []
|
||||||
parts.append(f"Method: {chunk.name}")
|
parts.append(f"Method: {chunk.name}")
|
||||||
|
|
||||||
@@ -115,18 +113,18 @@ class CodeSummarizer:
|
|||||||
"""Summarize a generic chunk."""
|
"""Summarize a generic chunk."""
|
||||||
return f"{chunk.chunk_type.capitalize()}: {chunk.name} ({chunk.metadata.line_count} lines)"
|
return f"{chunk.chunk_type.capitalize()}: {chunk.name} ({chunk.metadata.line_count} lines)"
|
||||||
|
|
||||||
def batch_summarize(self, chunks: List[ParsedChunk]) -> List[str]:
|
def batch_summarize(self, chunks: list[ParsedChunk]) -> list[str]:
|
||||||
"""Generate summaries for multiple chunks."""
|
"""Generate summaries for multiple chunks."""
|
||||||
return [self.summarize(chunk) for chunk in chunks]
|
return [self.summarize(chunk) for chunk in chunks]
|
||||||
|
|
||||||
def generate_overview(self, chunks: List[ParsedChunk], project_name: str = "Project") -> str:
|
def generate_overview(self, chunks: list[ParsedChunk], project_name: str = "Project") -> str:
|
||||||
"""Generate an overview of the project structure."""
|
"""Generate an overview of the project structure."""
|
||||||
lines = []
|
lines = []
|
||||||
lines.append(f"# {project_name} Overview")
|
lines.append(f"# {project_name} Overview")
|
||||||
lines.append("")
|
lines.append("")
|
||||||
|
|
||||||
type_counts = {}
|
type_counts: dict[str, int] = {}
|
||||||
lang_counts = {}
|
lang_counts: dict[str, int] = {}
|
||||||
|
|
||||||
for chunk in chunks:
|
for chunk in chunks:
|
||||||
type_counts[chunk.chunk_type] = type_counts.get(chunk.chunk_type, 0) + 1
|
type_counts[chunk.chunk_type] = type_counts.get(chunk.chunk_type, 0) + 1
|
||||||
|
|||||||
Reference in New Issue
Block a user