style: Run black formatter on 16 files
Applied black formatting to files modified in linting fixes: Source files (8): - config_extractor.py - doc_scraper.py - how_to_guide_builder.py - llms_txt_downloader.py - llms_txt_parser.py - pattern_recognizer.py - test_example_extractor.py - unified_codebase_analyzer.py Test files (8): - test_architecture_scenarios.py - test_async_scraping.py - test_github_scraper.py - test_guide_enhancer.py - test_install_agent.py - test_issue_219_e2e.py - test_llms_txt_downloader.py - test_skip_llms_txt.py All formatting issues resolved. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,9 @@ class WorkflowStep:
|
||||
setup_required: str | None = None
|
||||
explanation: str | None = None # Why this step matters
|
||||
common_pitfall: str | None = None # Warning for this step
|
||||
common_variations: list[str] = field(default_factory=list) # AI: Alternative approaches
|
||||
common_variations: list[str] = field(
|
||||
default_factory=list
|
||||
) # AI: Alternative approaches
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -221,7 +223,9 @@ class WorkflowAnalyzer:
|
||||
# Check if next statement is assertion (verification)
|
||||
idx = statements.index(stmt)
|
||||
verification = None
|
||||
if idx + 1 < len(statements) and isinstance(statements[idx + 1], ast.Assert):
|
||||
if idx + 1 < len(statements) and isinstance(
|
||||
statements[idx + 1], ast.Assert
|
||||
):
|
||||
verification = ast.get_source_segment(code, statements[idx + 1])
|
||||
|
||||
steps.append(
|
||||
@@ -240,7 +244,9 @@ class WorkflowAnalyzer:
|
||||
|
||||
return steps
|
||||
|
||||
def _extract_steps_heuristic(self, code: str, _workflow: dict) -> list[WorkflowStep]:
|
||||
def _extract_steps_heuristic(
|
||||
self, code: str, _workflow: dict
|
||||
) -> list[WorkflowStep]:
|
||||
"""Extract steps using heuristics (for non-Python or invalid syntax)"""
|
||||
steps = []
|
||||
lines = code.split("\n")
|
||||
@@ -259,7 +265,11 @@ class WorkflowAnalyzer:
|
||||
description = self._infer_description_from_code(step_code)
|
||||
|
||||
steps.append(
|
||||
WorkflowStep(step_number=step_num, code=step_code, description=description)
|
||||
WorkflowStep(
|
||||
step_number=step_num,
|
||||
code=step_code,
|
||||
description=description,
|
||||
)
|
||||
)
|
||||
step_num += 1
|
||||
current_step = []
|
||||
@@ -272,7 +282,9 @@ class WorkflowAnalyzer:
|
||||
step_code = "\n".join(current_step)
|
||||
description = self._infer_description_from_code(step_code)
|
||||
steps.append(
|
||||
WorkflowStep(step_number=step_num, code=step_code, description=description)
|
||||
WorkflowStep(
|
||||
step_number=step_num, code=step_code, description=description
|
||||
)
|
||||
)
|
||||
|
||||
return steps
|
||||
@@ -336,7 +348,11 @@ class WorkflowAnalyzer:
|
||||
|
||||
def _detect_prerequisites(self, workflow: dict) -> dict:
|
||||
"""Detect prerequisites from workflow"""
|
||||
metadata = {"prerequisites": [], "required_imports": [], "required_fixtures": []}
|
||||
metadata = {
|
||||
"prerequisites": [],
|
||||
"required_imports": [],
|
||||
"required_fixtures": [],
|
||||
}
|
||||
|
||||
# Get dependencies from workflow
|
||||
dependencies = workflow.get("dependencies", [])
|
||||
@@ -438,7 +454,9 @@ class WorkflowGrouper:
|
||||
groups = self._group_by_file_path(workflows)
|
||||
return groups
|
||||
|
||||
def _group_by_ai_tutorial_group(self, workflows: list[dict]) -> dict[str, list[dict]]:
|
||||
def _group_by_ai_tutorial_group(
|
||||
self, workflows: list[dict]
|
||||
) -> dict[str, list[dict]]:
|
||||
"""Group by AI-generated tutorial_group (from C3.6 enhancement)"""
|
||||
groups = defaultdict(list)
|
||||
ungrouped = []
|
||||
@@ -866,7 +884,10 @@ class HowToGuideBuilder:
|
||||
if not workflows:
|
||||
logger.warning("No workflow examples found!")
|
||||
return GuideCollection(
|
||||
total_guides=0, guides_by_complexity={}, guides_by_use_case={}, guides=[]
|
||||
total_guides=0,
|
||||
guides_by_complexity={},
|
||||
guides_by_use_case={},
|
||||
guides=[],
|
||||
)
|
||||
|
||||
# Group workflows
|
||||
@@ -893,7 +914,9 @@ class HowToGuideBuilder:
|
||||
"""Filter to workflow category only"""
|
||||
return [ex for ex in examples if ex.get("category") == "workflow"]
|
||||
|
||||
def _create_guide(self, title: str, workflows: list[dict], enhancer=None) -> HowToGuide:
|
||||
def _create_guide(
|
||||
self, title: str, workflows: list[dict], enhancer=None
|
||||
) -> HowToGuide:
|
||||
"""
|
||||
Generate single guide from workflow(s).
|
||||
|
||||
@@ -928,7 +951,8 @@ class HowToGuideBuilder:
|
||||
# Extract source files
|
||||
source_files = [w.get("file_path", "") for w in workflows]
|
||||
source_files = [
|
||||
f"{Path(f).name}:{w.get('line_start', 0)}" for f, w in zip(source_files, workflows, strict=False)
|
||||
f"{Path(f).name}:{w.get('line_start', 0)}"
|
||||
for f, w in zip(source_files, workflows, strict=False)
|
||||
]
|
||||
|
||||
# Create guide
|
||||
@@ -950,14 +974,18 @@ class HowToGuideBuilder:
|
||||
|
||||
# Add AI enhancements if enhancer is available
|
||||
if enhancer:
|
||||
self._enhance_guide_with_ai(guide, primary_workflow.get("ai_analysis", {}), enhancer)
|
||||
self._enhance_guide_with_ai(
|
||||
guide, primary_workflow.get("ai_analysis", {}), enhancer
|
||||
)
|
||||
elif self.enhance_with_ai and primary_workflow.get("ai_analysis"):
|
||||
# Fallback to old enhancement method (basic)
|
||||
self._enhance_guide_with_ai_basic(guide, primary_workflow["ai_analysis"])
|
||||
|
||||
return guide
|
||||
|
||||
def _generate_overview(self, primary_workflow: dict, _all_workflows: list[dict]) -> str:
|
||||
def _generate_overview(
|
||||
self, primary_workflow: dict, _all_workflows: list[dict]
|
||||
) -> str:
|
||||
"""Generate guide overview"""
|
||||
# Try to get explanation from AI analysis
|
||||
if primary_workflow.get("ai_analysis"):
|
||||
@@ -991,7 +1019,10 @@ class HowToGuideBuilder:
|
||||
# Prepare guide data for enhancer
|
||||
guide_data = {
|
||||
"title": guide.title,
|
||||
"steps": [{"description": step.description, "code": step.code} for step in guide.steps],
|
||||
"steps": [
|
||||
{"description": step.description, "code": step.code}
|
||||
for step in guide.steps
|
||||
],
|
||||
"language": "python", # TODO: Detect from code
|
||||
"prerequisites": guide.prerequisites,
|
||||
"description": guide.overview,
|
||||
@@ -1024,7 +1055,9 @@ class HowToGuideBuilder:
|
||||
if "use_cases" in enhanced_data:
|
||||
guide.use_cases = enhanced_data["use_cases"]
|
||||
|
||||
logger.info(f"✨ Enhanced guide '{guide.title}' with comprehensive AI improvements")
|
||||
logger.info(
|
||||
f"✨ Enhanced guide '{guide.title}' with comprehensive AI improvements"
|
||||
)
|
||||
|
||||
def _enhance_guide_with_ai_basic(self, guide: HowToGuide, ai_analysis: dict):
|
||||
"""
|
||||
@@ -1089,7 +1122,9 @@ class HowToGuideBuilder:
|
||||
|
||||
for guide in guides:
|
||||
# Generate filename from title
|
||||
filename = guide.title.lower().replace(" ", "-").replace(":", "") + ".md"
|
||||
filename = (
|
||||
guide.title.lower().replace(" ", "-").replace(":", "") + ".md"
|
||||
)
|
||||
file_path = use_case_dir / filename
|
||||
|
||||
# Generate and save markdown
|
||||
@@ -1100,7 +1135,9 @@ class HowToGuideBuilder:
|
||||
index_markdown = self.generator.generate_index(collection.guides)
|
||||
(output_dir / "index.md").write_text(index_markdown, encoding="utf-8")
|
||||
|
||||
logger.info(f"✅ Saved {collection.total_guides} guides + index to {output_dir}")
|
||||
logger.info(
|
||||
f"✅ Saved {collection.total_guides} guides + index to {output_dir}"
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -1142,11 +1179,15 @@ Grouping Strategies:
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"input", nargs="?", help="Input: directory with test files OR test_examples.json file"
|
||||
"input",
|
||||
nargs="?",
|
||||
help="Input: directory with test files OR test_examples.json file",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--input", dest="input_file", help="Input JSON file with test examples (from C3.2)"
|
||||
"--input",
|
||||
dest="input_file",
|
||||
help="Input JSON file with test examples (from C3.2)",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -1165,7 +1206,9 @@ Grouping Strategies:
|
||||
parser.add_argument("--no-ai", action="store_true", help="Disable AI enhancement")
|
||||
|
||||
parser.add_argument(
|
||||
"--json-output", action="store_true", help="Output JSON summary instead of markdown files"
|
||||
"--json-output",
|
||||
action="store_true",
|
||||
help="Output JSON summary instead of markdown files",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
@@ -1201,7 +1244,9 @@ Grouping Strategies:
|
||||
# Extract from directory using test example extractor
|
||||
print("⚠️ Directory input requires test example extractor")
|
||||
print(" Please use test_examples.json output from C3.2")
|
||||
print(f" Or run: skill-seekers extract-test-examples {input_path} --json > examples.json")
|
||||
print(
|
||||
f" Or run: skill-seekers extract-test-examples {input_path} --json > examples.json"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user