code2llm 0.5.13__tar.gz → 0.5.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {code2llm-0.5.13 → code2llm-0.5.15}/PKG-INFO +1 -1
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/__init__.py +1 -1
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/analyzer.py +29 -7
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/refactoring.py +20 -1
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/__init__.py +1 -1
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/PKG-INFO +1 -1
- {code2llm-0.5.13 → code2llm-0.5.15}/pyproject.toml +2 -2
- {code2llm-0.5.13 → code2llm-0.5.15}/LICENSE +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/README.md +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/__main__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/call_graph.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/cfg.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/coupling.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/data_analysis.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/dfg.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/pipeline_detector.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/side_effects.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/smells.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/type_inference.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/cli.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/config.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/file_analyzer.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/file_cache.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/file_filter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/models.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/cache.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/incremental.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/prioritizer.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/scanner.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/strategies.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming_analyzer.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/base.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/context_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/evolution_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/flow_constants.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/flow_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/flow_renderer.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/json_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/llm_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/map_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/mermaid_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/readme_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/helpers.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/metrics.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/module_detail.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/renderer.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/yaml_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/llm_flow.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/llm_task.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/mermaid.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/config.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/entity_resolution.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/intent_matching.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/normalization.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/pipeline.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/patterns/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/patterns/detector.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/refactor/__init__.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/refactor/prompt_engine.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/SOURCES.txt +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/dependency_links.txt +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/entry_points.txt +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/requires.txt +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/top_level.txt +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/setup.cfg +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/setup.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_advanced_analysis.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_analyzer.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_deep_analysis.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_edge_cases.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_flow_exporter.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_format_quality.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_nlp_pipeline.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_pipeline_detector.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_prompt_engine.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_prompt_txt.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_refactoring_engine.py +0 -0
- {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_toon_v2.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2llm
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.15
|
|
4
4
|
Summary: High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries
|
|
5
5
|
Home-page: https://github.com/wronai/stts
|
|
6
6
|
Author: STTS Project
|
|
@@ -184,15 +184,37 @@ class ProjectAnalyzer:
|
|
|
184
184
|
|
|
185
185
|
def _build_call_graph(self, result: AnalysisResult) -> None:
|
|
186
186
|
"""Build call graph and find entry points."""
|
|
187
|
+
# Build lookup maps for O(1) resolution
|
|
188
|
+
# Map simple name -> list of full names (for overloaded methods)
|
|
189
|
+
simple_to_full: Dict[str, List[str]] = {}
|
|
190
|
+
for known_name in result.functions:
|
|
191
|
+
simple_name = known_name.split('.')[-1]
|
|
192
|
+
if simple_name not in simple_to_full:
|
|
193
|
+
simple_to_full[simple_name] = []
|
|
194
|
+
simple_to_full[simple_name].append(known_name)
|
|
195
|
+
|
|
187
196
|
# Map calls between functions
|
|
188
197
|
for func_name, func in result.functions.items():
|
|
189
|
-
for called in func.calls:
|
|
190
|
-
# Try
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
for idx, called in enumerate(func.calls):
|
|
199
|
+
# Try exact match first, then suffix match
|
|
200
|
+
if called in result.functions:
|
|
201
|
+
resolved = called
|
|
202
|
+
elif called in simple_to_full:
|
|
203
|
+
# Use first match if multiple (common case: single match)
|
|
204
|
+
candidates = simple_to_full[called]
|
|
205
|
+
# Prefer exact module match if available
|
|
206
|
+
resolved = None
|
|
207
|
+
for cand in candidates:
|
|
208
|
+
if func_name.rsplit('.', 1)[0] == cand.rsplit('.', 1)[0]:
|
|
209
|
+
resolved = cand
|
|
210
|
+
break
|
|
211
|
+
if resolved is None:
|
|
212
|
+
resolved = candidates[0]
|
|
213
|
+
else:
|
|
214
|
+
continue # Unknown function
|
|
215
|
+
|
|
216
|
+
func.calls[idx] = resolved
|
|
217
|
+
result.functions[resolved].called_by.append(func_name)
|
|
196
218
|
|
|
197
219
|
# Find entry points (not called by anything)
|
|
198
220
|
for func_name, func in result.functions.items():
|
|
@@ -67,7 +67,16 @@ class RefactoringAnalyzer:
|
|
|
67
67
|
"""Calculate betweenness centrality for bottleneck detection."""
|
|
68
68
|
if len(call_graph) > 0:
|
|
69
69
|
try:
|
|
70
|
-
|
|
70
|
+
node_count = len(call_graph)
|
|
71
|
+
# For large graphs, use sampling to avoid exponential time complexity
|
|
72
|
+
if node_count > 500:
|
|
73
|
+
if self.config.verbose:
|
|
74
|
+
print(f" Large graph ({node_count} nodes), using sampled centrality...")
|
|
75
|
+
# Sample 20% of nodes, max 500
|
|
76
|
+
k = min(int(node_count * 0.2), 500)
|
|
77
|
+
centrality = nx.betweenness_centrality(call_graph, k=k)
|
|
78
|
+
else:
|
|
79
|
+
centrality = nx.betweenness_centrality(call_graph)
|
|
71
80
|
for func_name, score in centrality.items():
|
|
72
81
|
if func_name in result.functions:
|
|
73
82
|
result.functions[func_name].centrality = score
|
|
@@ -78,6 +87,11 @@ class RefactoringAnalyzer:
|
|
|
78
87
|
def _detect_cycles(self, call_graph: nx.DiGraph, result: AnalysisResult) -> None:
|
|
79
88
|
"""Detect circular dependencies."""
|
|
80
89
|
try:
|
|
90
|
+
# Limit cycle detection for large graphs
|
|
91
|
+
if len(call_graph) > 1000:
|
|
92
|
+
if self.config.verbose:
|
|
93
|
+
print(f" Skipping cycle detection for large graph ({len(call_graph)} nodes)")
|
|
94
|
+
return
|
|
81
95
|
cycles = list(nx.simple_cycles(call_graph))
|
|
82
96
|
if cycles:
|
|
83
97
|
result.metrics["project"] = result.metrics.get("project", {})
|
|
@@ -89,6 +103,11 @@ class RefactoringAnalyzer:
|
|
|
89
103
|
def _detect_communities(self, call_graph: nx.DiGraph, result: AnalysisResult) -> None:
|
|
90
104
|
"""Detect communities (module groups)."""
|
|
91
105
|
try:
|
|
106
|
+
# Limit community detection for large graphs
|
|
107
|
+
if len(call_graph) > 1000:
|
|
108
|
+
if self.config.verbose:
|
|
109
|
+
print(f" Skipping community detection for large graph ({len(call_graph)} nodes)")
|
|
110
|
+
return
|
|
92
111
|
from networkx.algorithms import community
|
|
93
112
|
# Using Louvain if available, otherwise greedy modularity
|
|
94
113
|
if hasattr(community, 'louvain_communities'):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2llm
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.15
|
|
4
4
|
Summary: High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries
|
|
5
5
|
Home-page: https://github.com/wronai/stts
|
|
6
6
|
Author: STTS Project
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "code2llm"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.15"
|
|
8
8
|
description = "High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -75,7 +75,7 @@ line-length = 100
|
|
|
75
75
|
target-version = ['py38']
|
|
76
76
|
|
|
77
77
|
[tool.mypy]
|
|
78
|
-
python_version = "0.5.
|
|
78
|
+
python_version = "0.5.14"
|
|
79
79
|
ignore_missing_imports = true
|
|
80
80
|
|
|
81
81
|
[tool.pytest.ini_options]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|