- Project: /home/tom/github/semcod/code2llm
- Primary Language: python
- Languages: python: 353, shell: 7, php: 2, java: 2, typescript: 1
- Analysis Mode: static
- Total Functions: 2150
- Total Classes: 245
- Modules: 369
- Entry Points: 0
- Functions: 28
- Classes: 3
- File:
data_analysis.py
- Functions: 28
- Classes: 3
- File:
data_analysis.py
- Functions: 26
- Classes: 1
- File:
renderer.py
- Functions: 26
- Classes: 1
- File:
renderer.py
- Functions: 25
- Classes: 1
- File:
yaml_exporter.py
- Functions: 25
- Classes: 1
- File:
yaml_exporter.py
- Functions: 21
- File:
validate_toon.py
- Functions: 21
- File:
validate_toon.py
- Functions: 20
- Classes: 1
- File:
analyzer.py
- Functions: 20
- Classes: 2
- File:
large_repo.py
- Functions: 20
- Classes: 3
- File:
pipeline.py
- Functions: 20
- Classes: 1
- File:
analyzer.py
- Functions: 20
- Classes: 2
- File:
large_repo.py
- Functions: 20
- Classes: 3
- File:
pipeline.py
- Functions: 19
- Classes: 1
- File:
persistent_cache.py
- Functions: 19
- Classes: 1
- File:
persistent_cache.py
- Functions: 18
- Classes: 1
- File:
file_analyzer.py
- Functions: 18
- Classes: 6
- File:
entity_preparers.py
- Functions: 18
- File:
prompt.py
- Functions: 18
- Classes: 1
- File:
file_analyzer.py
Main execution flows into the system:
Key execution flows identified:
Renders all sections for TOON export.
- Methods: 26
- Key Methods: code2llm.exporters.toon.renderer.ToonRenderer.render_header, code2llm.exporters.toon.renderer.ToonRenderer._detect_language_label, code2llm.exporters.toon.renderer.ToonRenderer.render_health, code2llm.exporters.toon.renderer.ToonRenderer.render_refactor, code2llm.exporters.toon.renderer.ToonRenderer.render_coupling, code2llm.exporters.toon.renderer.ToonRenderer._select_top_packages, code2llm.exporters.toon.renderer.ToonRenderer._render_coupling_header, code2llm.exporters.toon.renderer.ToonRenderer._render_coupling_rows, code2llm.exporters.toon.renderer.ToonRenderer._build_coupling_row, code2llm.exporters.toon.renderer.ToonRenderer._coupling_row_tag
Renders all sections for TOON export.
- Methods: 26
- Key Methods: exporters.toon.renderer.ToonRenderer.render_header, exporters.toon.renderer.ToonRenderer._detect_language_label, exporters.toon.renderer.ToonRenderer.render_health, exporters.toon.renderer.ToonRenderer.render_refactor, exporters.toon.renderer.ToonRenderer.render_coupling, exporters.toon.renderer.ToonRenderer._select_top_packages, exporters.toon.renderer.ToonRenderer._render_coupling_header, exporters.toon.renderer.ToonRenderer._render_coupling_rows, exporters.toon.renderer.ToonRenderer._build_coupling_row, exporters.toon.renderer.ToonRenderer._coupling_row_tag
Export to YAML format.
- Methods: 25
- Key Methods: code2llm.exporters.yaml_exporter.YAMLExporter.init, code2llm.exporters.yaml_exporter.YAMLExporter._get_name_index, code2llm.exporters.yaml_exporter.YAMLExporter.export, code2llm.exporters.yaml_exporter.YAMLExporter.export_grouped, code2llm.exporters.yaml_exporter.YAMLExporter.export_data_flow, code2llm.exporters.yaml_exporter.YAMLExporter.export_data_structures, code2llm.exporters.yaml_exporter.YAMLExporter.export_separated, code2llm.exporters.yaml_exporter.YAMLExporter.export_split, code2llm.exporters.yaml_exporter.YAMLExporter.export_calls, code2llm.exporters.yaml_exporter.YAMLExporter._collect_edges
- Inherits: BaseExporter
Export to YAML format.
- Methods: 25
- Key Methods: exporters.yaml_exporter.YAMLExporter.init, exporters.yaml_exporter.YAMLExporter._get_name_index, exporters.yaml_exporter.YAMLExporter.export, exporters.yaml_exporter.YAMLExporter.export_grouped, exporters.yaml_exporter.YAMLExporter.export_data_flow, exporters.yaml_exporter.YAMLExporter.export_data_structures, exporters.yaml_exporter.YAMLExporter.export_separated, exporters.yaml_exporter.YAMLExporter.export_split, exporters.yaml_exporter.YAMLExporter.export_calls, exporters.yaml_exporter.YAMLExporter._collect_edges
- Inherits: BaseExporter
Main analyzer with parallel processing.
- Methods: 20
- Key Methods: code2llm.core.analyzer.ProjectAnalyzer.init, code2llm.core.analyzer.ProjectAnalyzer.analyze_project, code2llm.core.analyzer.ProjectAnalyzer._resolve_project_path, code2llm.core.analyzer.ProjectAnalyzer._load_from_persistent_cache, code2llm.core.analyzer.ProjectAnalyzer._run_analysis, code2llm.core.analyzer.ProjectAnalyzer._store_to_persistent_cache, code2llm.core.analyzer.ProjectAnalyzer._build_stats, code2llm.core.analyzer.ProjectAnalyzer._print_summary, code2llm.core.analyzer.ProjectAnalyzer._post_process, code2llm.core.analyzer.ProjectAnalyzer._collect_files
Main analyzer with parallel processing.
- Methods: 20
- Key Methods: core.analyzer.ProjectAnalyzer.init, core.analyzer.ProjectAnalyzer.analyze_project, core.analyzer.ProjectAnalyzer._resolve_project_path, core.analyzer.ProjectAnalyzer._load_from_persistent_cache, core.analyzer.ProjectAnalyzer._run_analysis, core.analyzer.ProjectAnalyzer._store_to_persistent_cache, core.analyzer.ProjectAnalyzer._build_stats, core.analyzer.ProjectAnalyzer._print_summary, core.analyzer.ProjectAnalyzer._post_process, core.analyzer.ProjectAnalyzer._collect_files
Splits large repositories using hierarchical approach.
Strategy:
- First pass: level 1 folders
- Methods: 18
- Key Methods: code2llm.core.large_repo.HierarchicalRepoSplitter.init, code2llm.core.large_repo.HierarchicalRepoSplitter.get_analysis_plan, code2llm.core.large_repo.HierarchicalRepoSplitter._split_hierarchically, code2llm.core.large_repo.HierarchicalRepoSplitter._merge_small_l1_dirs, code2llm.core.large_repo.HierarchicalRepoSplitter._split_level2_consolidated, code2llm.core.large_repo.HierarchicalRepoSplitter._categorize_subdirs, code2llm.core.large_repo.HierarchicalRepoSplitter._process_large_dirs, code2llm.core.large_repo.HierarchicalRepoSplitter._process_level1_files, code2llm.core.large_repo.HierarchicalRepoSplitter._merge_small_dirs, code2llm.core.large_repo.HierarchicalRepoSplitter._chunk_by_files
Splits large repositories using hierarchical approach.
Strategy:
- First pass: level 1 folders
- Methods: 18
- Key Methods: core.large_repo.HierarchicalRepoSplitter.init, core.large_repo.HierarchicalRepoSplitter.get_analysis_plan, core.large_repo.HierarchicalRepoSplitter._split_hierarchically, core.large_repo.HierarchicalRepoSplitter._merge_small_l1_dirs, core.large_repo.HierarchicalRepoSplitter._split_level2_consolidated, core.large_repo.HierarchicalRepoSplitter._categorize_subdirs, core.large_repo.HierarchicalRepoSplitter._process_large_dirs, core.large_repo.HierarchicalRepoSplitter._process_level1_files, core.large_repo.HierarchicalRepoSplitter._merge_small_dirs, core.large_repo.HierarchicalRepoSplitter._chunk_by_files
Extract and infer type information from Python source files.
Operates on source files referenced by
- Methods: 17
- Key Methods: code2llm.analysis.type_inference.TypeInferenceEngine.init, code2llm.analysis.type_inference.TypeInferenceEngine.enrich_function, code2llm.analysis.type_inference.TypeInferenceEngine.get_arg_types, code2llm.analysis.type_inference.TypeInferenceEngine.get_return_type, code2llm.analysis.type_inference.TypeInferenceEngine.get_typed_signature, code2llm.analysis.type_inference.TypeInferenceEngine.extract_all_types, code2llm.analysis.type_inference.TypeInferenceEngine._extract_from_node, code2llm.analysis.type_inference.TypeInferenceEngine._extract_args, code2llm.analysis.type_inference.TypeInferenceEngine._annotation_to_str, code2llm.analysis.type_inference.TypeInferenceEngine._ann_constant
Analyzes a single file.
- Methods: 17
- Key Methods: code2llm.core.file_analyzer.FileAnalyzer.init, code2llm.core.file_analyzer.FileAnalyzer._route_to_language_analyzer, code2llm.core.file_analyzer.FileAnalyzer.analyze_file, code2llm.core.file_analyzer.FileAnalyzer._analyze_python, code2llm.core.file_analyzer.FileAnalyzer._analyze_ast, code2llm.core.file_analyzer.FileAnalyzer._calculate_complexity, code2llm.core.file_analyzer.FileAnalyzer._perform_deep_analysis, code2llm.core.file_analyzer.FileAnalyzer._process_class, code2llm.core.file_analyzer.FileAnalyzer._process_function, code2llm.core.file_analyzer.FileAnalyzer._build_cfg
Extract and infer type information from Python source files.
Operates on source files referenced by
- Methods: 17
- Key Methods: analysis.type_inference.TypeInferenceEngine.init, analysis.type_inference.TypeInferenceEngine.enrich_function, analysis.type_inference.TypeInferenceEngine.get_arg_types, analysis.type_inference.TypeInferenceEngine.get_return_type, analysis.type_inference.TypeInferenceEngine.get_typed_signature, analysis.type_inference.TypeInferenceEngine.extract_all_types, analysis.type_inference.TypeInferenceEngine._extract_from_node, analysis.type_inference.TypeInferenceEngine._extract_args, analysis.type_inference.TypeInferenceEngine._annotation_to_str, analysis.type_inference.TypeInferenceEngine._ann_constant
Analyzes a single file.
- Methods: 17
- Key Methods: core.file_analyzer.FileAnalyzer.init, core.file_analyzer.FileAnalyzer._route_to_language_analyzer, core.file_analyzer.FileAnalyzer.analyze_file, core.file_analyzer.FileAnalyzer._analyze_python, core.file_analyzer.FileAnalyzer._analyze_ast, core.file_analyzer.FileAnalyzer._calculate_complexity, core.file_analyzer.FileAnalyzer._perform_deep_analysis, core.file_analyzer.FileAnalyzer._process_class, core.file_analyzer.FileAnalyzer._process_function, core.file_analyzer.FileAnalyzer._build_cfg
Analyze data flows, structures, and optimization opportunities.
- Methods: 16
- Key Methods: code2llm.analysis.data_analysis.DataAnalyzer.analyze_data_flow, code2llm.analysis.data_analysis.DataAnalyzer.analyze_data_structures, code2llm.analysis.data_analysis.DataAnalyzer._find_data_pipelines, code2llm.analysis.data_analysis.DataAnalyzer._find_state_patterns, code2llm.analysis.data_analysis.DataAnalyzer._find_data_dependencies, code2llm.analysis.data_analysis.DataAnalyzer._find_event_flows, code2llm.analysis.data_analysis.DataAnalyzer._detect_types_from_name, code2llm.analysis.data_analysis.DataAnalyzer._create_type_entry, code2llm.analysis.data_analysis.DataAnalyzer._update_type_stats, code2llm.analysis.data_analysis.DataAnalyzer._analyze_data_types
Extract Control Flow Graph from AST.
- Methods: 16
- Key Methods: code2llm.analysis.cfg.CFGExtractor.init, code2llm.analysis.cfg.CFGExtractor.extract, code2llm.analysis.cfg.CFGExtractor.new_node, code2llm.analysis.cfg.CFGExtractor.connect, code2llm.analysis.cfg.CFGExtractor.visit_FunctionDef, code2llm.analysis.cfg.CFGExtractor.visit_AsyncFunctionDef, code2llm.analysis.cfg.CFGExtractor.visit_If, code2llm.analysis.cfg.CFGExtractor.visit_For, code2llm.analysis.cfg.CFGExtractor.visit_While, code2llm.analysis.cfg.CFGExtractor.visit_Try
- Inherits: ast.NodeVisitor
Computes core structural and complexity metrics.
- Methods: 16
- Key Methods: code2llm.exporters.toon.metrics_core.CoreMetricsComputer.init, code2llm.exporters.toon.metrics_core.CoreMetricsComputer.compute_file_metrics, code2llm.exporters.toon.metrics_core.CoreMetricsComputer._new_file_record, code2llm.exporters.toon.metrics_core.CoreMetricsComputer._compute_fan_in, code2llm.exporters.toon.metrics_core.CoreMetricsComputer._process_function_calls, code2llm.exporters.toon.metrics_core.CoreMetricsComputer._process_called_by, code2llm.exporters.toon.metrics_core.CoreMetricsComputer._process_callee_calls, code2llm.exporters.toon.metrics_core.CoreMetricsComputer._handle_suffix_match, code2llm.exporters.toon.metrics_core.CoreMetricsComputer.compute_package_metrics, code2llm.exporters.toon.metrics_core.CoreMetricsComputer.compute_function_metrics
Main NLP processing pipeline (4a-4e).
- Methods: 16
- Key Methods: code2llm.nlp.pipeline.NLPPipeline.init, code2llm.nlp.pipeline.NLPPipeline.process, code2llm.nlp.pipeline.NLPPipeline._step_normalize, code2llm.nlp.pipeline.NLPPipeline._step_match_intent, code2llm.nlp.pipeline.NLPPipeline._step_resolve_entities, code2llm.nlp.pipeline.NLPPipeline._infer_entity_types, code2llm.nlp.pipeline.NLPPipeline._calculate_overall_confidence, code2llm.nlp.pipeline.NLPPipeline._calculate_entity_confidence, code2llm.nlp.pipeline.NLPPipeline._apply_fallback, code2llm.nlp.pipeline.NLPPipeline._format_action
Analyze data flows, structures, and optimization opportunities.
- Methods: 16
- Key Methods: analysis.data_analysis.DataAnalyzer.analyze_data_flow, analysis.data_analysis.DataAnalyzer.analyze_data_structures, analysis.data_analysis.DataAnalyzer._find_data_pipelines, analysis.data_analysis.DataAnalyzer._find_state_patterns, analysis.data_analysis.DataAnalyzer._find_data_dependencies, analysis.data_analysis.DataAnalyzer._find_event_flows, analysis.data_analysis.DataAnalyzer._detect_types_from_name, analysis.data_analysis.DataAnalyzer._create_type_entry, analysis.data_analysis.DataAnalyzer._update_type_stats, analysis.data_analysis.DataAnalyzer._analyze_data_types
Extract Control Flow Graph from AST.
- Methods: 16
- Key Methods: analysis.cfg.CFGExtractor.init, analysis.cfg.CFGExtractor.extract, analysis.cfg.CFGExtractor.new_node, analysis.cfg.CFGExtractor.connect, analysis.cfg.CFGExtractor.visit_FunctionDef, analysis.cfg.CFGExtractor.visit_AsyncFunctionDef, analysis.cfg.CFGExtractor.visit_If, analysis.cfg.CFGExtractor.visit_For, analysis.cfg.CFGExtractor.visit_While, analysis.cfg.CFGExtractor.visit_Try
- Inherits: ast.NodeVisitor
Computes core structural and complexity metrics.
- Methods: 16
- Key Methods: exporters.toon.metrics_core.CoreMetricsComputer.init, exporters.toon.metrics_core.CoreMetricsComputer.compute_file_metrics, exporters.toon.metrics_core.CoreMetricsComputer._new_file_record, exporters.toon.metrics_core.CoreMetricsComputer._compute_fan_in, exporters.toon.metrics_core.CoreMetricsComputer._process_function_calls, exporters.toon.metrics_core.CoreMetricsComputer._process_called_by, exporters.toon.metrics_core.CoreMetricsComputer._process_callee_calls, exporters.toon.metrics_core.CoreMetricsComputer._handle_suffix_match, exporters.toon.metrics_core.CoreMetricsComputer.compute_package_metrics, exporters.toon.metrics_core.CoreMetricsComputer.compute_function_metrics
Main NLP processing pipeline (4a-4e).
- Methods: 16
- Key Methods: nlp.pipeline.NLPPipeline.init, nlp.pipeline.NLPPipeline.process, nlp.pipeline.NLPPipeline._step_normalize, nlp.pipeline.NLPPipeline._step_match_intent, nlp.pipeline.NLPPipeline._step_resolve_entities, nlp.pipeline.NLPPipeline._infer_entity_types, nlp.pipeline.NLPPipeline._calculate_overall_confidence, nlp.pipeline.NLPPipeline._calculate_entity_confidence, nlp.pipeline.NLPPipeline._apply_fallback, nlp.pipeline.NLPPipeline._format_action
Key functions that process and transform data:
- Output to: test_langs.valid.sample.foreach
- Output to: test_langs.valid.sample.func, test_langs.valid.sample.Printf
Validate session and return user ID.
- Output to: self.sessions.get
Process API request.
- Output to: self._check_rate_limit, self._get_stats, self._get_user_info, self._health_check
Format API response.
- Output to: json.dumps
Validate input data.
- Output to: isinstance, isinstance
Format output data.
- Output to: isinstance, json.dumps, isinstance, json.dumps, str
Transform data fields.
- Output to: item.copy, transformations.items, transformed.append, None.upper, None.lower
Extract metrics from evolution.toon content.
- Output to: toon_content.splitlines, re.search, line.strip, line.startswith, int
Process a user request with complex logic.
- Output to: request.action.startswith, examples.streaming-analyzer.sample_project.utils.validate_input, print, self.auth.authenticate, print
- Output to: print, time.sleep, print, ch.basic_ack
Parse version string into tuple of (major, minor, patch)
- Output to: version_str.split, tuple, int
Format version tuple as string
Extract metrics from evolution.toon content.
- Output to: toon_content.splitlines, re.search, line.strip, line.startswith, m.group
Parse format quality JSON report.
- Output to: report_path.exists, json.loads, data.get, report_path.read_text
Parse performance JSON report.
- Output to: report_path.exists, json.loads, report_path.read_text
Generate badges from format quality scores.
- Output to: enumerate, badges.append, sorted, badges.append, format_scores.items
Create CLI argument parser.
- Output to: argparse.ArgumentParser, parser.add_argument, parser.add_argument, parser.add_argument, parser.add_argument
Validate toon format structure.
- Output to: print, print, bool, bool, bool
- Output to: print
Identify common data processing patterns (filter, map, reduce, etc.).
- Output to: result.functions.items, patterns.items, sorted, func.name.lower, indicators.items
Identify common data processing patterns.
- Output to: None._identify_process_patterns, DataAnalyzer
Convert an AST node to its source string via ast.unparse (Python 3.9+).
Used as a shared replacemen
- Output to: hasattr, ast.unparse, str, str
Remove cached AST and source for filepath (e.g. after file write).
- Output to: self._trees.pop, self._sources.pop
Functions exposed as public API (no underscore prefix):
pipeline.run_pipeline- 68 callscode2llm.cli_parser.create_parser- 45 callscli_parser.create_parser- 45 callscode2llm.generators.llm_task.normalize_llm_task- 43 callsgenerators.llm_task.normalize_llm_task- 43 callscode2llm.generators.llm_flow.generator.render_llm_flow_md- 42 callsgenerators.llm_flow.generator.render_llm_flow_md- 42 callsbenchmarks.benchmark_performance.main- 41 callsvalidate_toon.analyze_class_differences- 39 callsbenchmarks.benchmark_evolution.run_benchmark- 34 callscode2llm.cli_commands.handle_cache_command- 33 callscli_commands.handle_cache_command- 33 callscode2llm.core.lang.rust.analyze_rust- 31 callscore.lang.rust.analyze_rust- 31 callsbenchmarks.benchmark_optimizations.benchmark_cold_vs_warm- 30 callsbenchmarks.benchmark_performance.create_test_project- 29 callscode2llm.nlp.pipeline.NLPPipeline.process- 29 callsnlp.pipeline.NLPPipeline.process- 29 callscode2llm.exporters.mermaid.compact.export_compact- 27 callsexporters.mermaid.compact.export_compact- 27 callsvalidate_toon.compare_modules- 26 callscode2llm.core.streaming_analyzer.StreamingAnalyzer.analyze_streaming- 26 callscode2llm.exporters.mermaid.calls.export_calls- 26 callscore.streaming_analyzer.StreamingAnalyzer.analyze_streaming- 26 callsexporters.mermaid.calls.export_calls- 26 callsbenchmarks.benchmark_evolution.parse_evolution_metrics- 25 callscode2llm.exporters.toon.metrics_core.CoreMetricsComputer.compute_file_metrics- 25 callscode2llm.exporters.toon.ToonExporter.export- 25 callsexporters.toon.ToonExporter.export- 25 callsexporters.toon.metrics_core.CoreMetricsComputer.compute_file_metrics- 25 callsvalidate_toon.compare_functions- 24 callscode2llm.exporters.context_exporter.ContextExporter.export- 24 callscode2llm.exporters.evolution.yaml_export.export_to_yaml- 24 callsexporters.context_exporter.ContextExporter.export- 24 callsexporters.evolution.yaml_export.export_to_yaml- 24 callsscripts.benchmark_badges.main- 23 callsbenchmarks.format_evaluator.evaluate_format- 22 callscode2llm.core.analyzer.ProjectAnalyzer.analyze_project- 22 callsbenchmarks.benchmark_format_quality.run_benchmark- 22 callscode2llm.exporters.evolution_exporter.EvolutionExporter.export- 22 calls
How components interact:
graph TD
- Entry Points: Start analysis from the entry points listed above
- Core Logic: Focus on classes with many methods
- Data Flow: Follow data transformation functions
- Process Flows: Use the flow diagrams for execution paths
- API Surface: Public API functions reveal the interface
Maintain the identified architectural patterns and public API surface when suggesting changes.