code2llm 0.5.29__tar.gz → 0.5.30__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.29 → code2llm-0.5.30}/PKG-INFO +1 -1
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/__init__.py +19 -14
- code2llm-0.5.30/code2llm/analysis/__init__.py +33 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/call_graph.py +5 -4
- code2llm-0.5.30/code2llm/core/__init__.py +44 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/core/file_analyzer.py +2 -2
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/core/refactoring.py +12 -9
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/nlp/__init__.py +1 -1
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm.egg-info/PKG-INFO +1 -1
- {code2llm-0.5.29 → code2llm-0.5.30}/pyproject.toml +1 -1
- code2llm-0.5.29/code2llm/analysis/__init__.py +0 -23
- code2llm-0.5.29/code2llm/core/__init__.py +0 -36
- {code2llm-0.5.29 → code2llm-0.5.30}/LICENSE +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/README.md +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/__main__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/cfg.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/coupling.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/data_analysis.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/dfg.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/pipeline_detector.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/side_effects.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/smells.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/analysis/type_inference.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/cli.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/cli_exports.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/analyzer.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/config.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/core/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/core/file_cache.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/core/file_filter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/large_repo.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/models.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming/cache.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming/incremental.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming/prioritizer.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming/scanner.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming/strategies.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/streaming_analyzer.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/core/toon_size_manager.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/base.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/context_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/evolution_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/flow_constants.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/flow_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/flow_renderer.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/json_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/llm_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/map_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/mermaid_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/readme_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/toon/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/toon/helpers.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/toon/metrics.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/toon/module_detail.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/toon/renderer.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/toon.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/exporters/yaml_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/generators/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/generators/llm_flow.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/generators/llm_task.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/generators/mermaid.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/nlp/config.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/nlp/entity_resolution.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/nlp/intent_matching.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/nlp/normalization.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/nlp/pipeline.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/patterns/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/patterns/detector.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/refactor/__init__.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm/refactor/prompt_engine.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm.egg-info/SOURCES.txt +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm.egg-info/dependency_links.txt +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm.egg-info/entry_points.txt +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm.egg-info/requires.txt +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/code2llm.egg-info/top_level.txt +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/setup.cfg +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/setup.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_advanced_analysis.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_analyzer.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_deep_analysis.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_edge_cases.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_flow_exporter.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_format_quality.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_nlp_pipeline.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_pipeline_detector.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_prompt_engine.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_prompt_txt.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/tests/test_refactoring_engine.py +0 -0
- {code2llm-0.5.29 → code2llm-0.5.30}/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.30
|
|
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
|
|
@@ -8,25 +8,13 @@ Includes NLP Processing Pipeline for query normalization, intent matching,
|
|
|
8
8
|
and entity resolution with multilingual support.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
__version__ = "0.5.
|
|
11
|
+
__version__ = "0.5.30"
|
|
12
12
|
__author__ = "STTS Project"
|
|
13
13
|
|
|
14
|
-
# Core analysis components
|
|
15
|
-
from .core.analyzer import ProjectAnalyzer
|
|
14
|
+
# Core analysis components (lightweight, always needed)
|
|
16
15
|
from .core.config import Config, FAST_CONFIG
|
|
17
16
|
from .core.models import AnalysisResult, FunctionInfo, ClassInfo, Pattern
|
|
18
17
|
|
|
19
|
-
# NLP Processing Pipeline
|
|
20
|
-
from .nlp import (
|
|
21
|
-
NLPPipeline,
|
|
22
|
-
QueryNormalizer,
|
|
23
|
-
IntentMatcher,
|
|
24
|
-
EntityResolver,
|
|
25
|
-
NLPConfig,
|
|
26
|
-
FAST_NLP_CONFIG,
|
|
27
|
-
PRECISE_NLP_CONFIG,
|
|
28
|
-
)
|
|
29
|
-
|
|
30
18
|
__all__ = [
|
|
31
19
|
# Core
|
|
32
20
|
"ProjectAnalyzer",
|
|
@@ -45,3 +33,20 @@ __all__ = [
|
|
|
45
33
|
"FAST_NLP_CONFIG",
|
|
46
34
|
"PRECISE_NLP_CONFIG",
|
|
47
35
|
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def __getattr__(name):
|
|
39
|
+
"""Lazy import heavy modules on first access."""
|
|
40
|
+
if name == "ProjectAnalyzer":
|
|
41
|
+
from .core.analyzer import ProjectAnalyzer
|
|
42
|
+
return ProjectAnalyzer
|
|
43
|
+
|
|
44
|
+
_nlp_names = {
|
|
45
|
+
"NLPPipeline", "QueryNormalizer", "IntentMatcher",
|
|
46
|
+
"EntityResolver", "NLPConfig", "FAST_NLP_CONFIG", "PRECISE_NLP_CONFIG",
|
|
47
|
+
}
|
|
48
|
+
if name in _nlp_names:
|
|
49
|
+
from . import nlp
|
|
50
|
+
return getattr(nlp, name)
|
|
51
|
+
|
|
52
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Analysis package for code2llm."""
|
|
2
|
+
|
|
3
|
+
__all__ = [
|
|
4
|
+
'CFGExtractor',
|
|
5
|
+
'DFGExtractor',
|
|
6
|
+
'CallGraphExtractor',
|
|
7
|
+
'CouplingAnalyzer',
|
|
8
|
+
'SmellDetector',
|
|
9
|
+
'DataAnalyzer',
|
|
10
|
+
'TypeInferenceEngine',
|
|
11
|
+
'SideEffectDetector',
|
|
12
|
+
'PipelineDetector',
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def __getattr__(name):
|
|
17
|
+
"""Lazy import analysis modules on first access."""
|
|
18
|
+
_imports = {
|
|
19
|
+
'CFGExtractor': '.cfg',
|
|
20
|
+
'DFGExtractor': '.dfg',
|
|
21
|
+
'CallGraphExtractor': '.call_graph',
|
|
22
|
+
'CouplingAnalyzer': '.coupling',
|
|
23
|
+
'SmellDetector': '.smells',
|
|
24
|
+
'DataAnalyzer': '.data_analysis',
|
|
25
|
+
'TypeInferenceEngine': '.type_inference',
|
|
26
|
+
'SideEffectDetector': '.side_effects',
|
|
27
|
+
'PipelineDetector': '.pipeline_detector',
|
|
28
|
+
}
|
|
29
|
+
if name in _imports:
|
|
30
|
+
import importlib
|
|
31
|
+
module = importlib.import_module(_imports[name], __package__)
|
|
32
|
+
return getattr(module, name)
|
|
33
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import ast
|
|
4
4
|
from typing import Optional, Set, List, Dict
|
|
5
|
-
import astroid
|
|
6
5
|
|
|
7
6
|
from ..core.config import Config
|
|
8
7
|
from ..core.models import AnalysisResult, FlowEdge
|
|
@@ -32,9 +31,10 @@ class CallGraphExtractor(ast.NodeVisitor):
|
|
|
32
31
|
self.class_stack = []
|
|
33
32
|
self.imports = {}
|
|
34
33
|
|
|
35
|
-
# Try to get astroid tree for better resolution
|
|
34
|
+
# Try to get astroid tree for better resolution (lazy import - heavy module)
|
|
36
35
|
try:
|
|
37
|
-
|
|
36
|
+
import astroid as _astroid
|
|
37
|
+
self.astroid_tree = _astroid.MANAGER.ast_from_file(file_path)
|
|
38
38
|
except Exception:
|
|
39
39
|
self.astroid_tree = None
|
|
40
40
|
|
|
@@ -188,7 +188,8 @@ class CallGraphExtractor(ast.NodeVisitor):
|
|
|
188
188
|
try:
|
|
189
189
|
# Find the corresponding astroid node by line/col
|
|
190
190
|
# This is a bit slow but robust
|
|
191
|
-
|
|
191
|
+
import astroid as _astroid
|
|
192
|
+
for astroid_node in self.astroid_tree.nodes_of_class(_astroid.Call):
|
|
192
193
|
if astroid_node.lineno == node.lineno and astroid_node.col_offset == node.col_offset:
|
|
193
194
|
# Infer the targets
|
|
194
195
|
inferred = astroid_node.func.infer()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Core analysis components for code2llm."""
|
|
2
|
+
|
|
3
|
+
from .config import Config, FAST_CONFIG, PerformanceConfig, FilterConfig
|
|
4
|
+
from .models import (
|
|
5
|
+
AnalysisResult, FlowNode, FlowEdge,
|
|
6
|
+
FunctionInfo, ClassInfo, ModuleInfo, Pattern
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
'ProjectAnalyzer',
|
|
11
|
+
'StreamingAnalyzer',
|
|
12
|
+
'IncrementalAnalyzer',
|
|
13
|
+
'ScanStrategy',
|
|
14
|
+
'SmartPrioritizer',
|
|
15
|
+
'STRATEGY_QUICK',
|
|
16
|
+
'STRATEGY_STANDARD',
|
|
17
|
+
'STRATEGY_DEEP',
|
|
18
|
+
'FileCache',
|
|
19
|
+
'FastFileFilter',
|
|
20
|
+
'Config',
|
|
21
|
+
'FAST_CONFIG',
|
|
22
|
+
'AnalysisResult',
|
|
23
|
+
'FunctionInfo',
|
|
24
|
+
'ClassInfo',
|
|
25
|
+
'ModuleInfo',
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def __getattr__(name):
|
|
30
|
+
"""Lazy import heavy modules on first access."""
|
|
31
|
+
_analyzer_names = {'ProjectAnalyzer', 'FileCache', 'FastFileFilter'}
|
|
32
|
+
if name in _analyzer_names:
|
|
33
|
+
from . import analyzer as _mod
|
|
34
|
+
return getattr(_mod, name)
|
|
35
|
+
|
|
36
|
+
_streaming_names = {
|
|
37
|
+
'StreamingAnalyzer', 'IncrementalAnalyzer', 'ScanStrategy',
|
|
38
|
+
'SmartPrioritizer', 'STRATEGY_QUICK', 'STRATEGY_STANDARD', 'STRATEGY_DEEP',
|
|
39
|
+
}
|
|
40
|
+
if name in _streaming_names:
|
|
41
|
+
from . import streaming_analyzer as _mod
|
|
42
|
+
return getattr(_mod, name)
|
|
43
|
+
|
|
44
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -22,6 +22,7 @@ class FileAnalyzer:
|
|
|
22
22
|
def __init__(self, config: Config, cache=None):
|
|
23
23
|
self.config = config
|
|
24
24
|
self.cache = cache
|
|
25
|
+
self._file_filter = FastFileFilter(config.filters)
|
|
25
26
|
self.stats = {
|
|
26
27
|
'files_processed': 0,
|
|
27
28
|
'functions_found': 0,
|
|
@@ -180,8 +181,7 @@ class FileAnalyzer:
|
|
|
180
181
|
for d in node.decorator_list
|
|
181
182
|
)
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
if filter_obj.should_skip_function(line_count, is_private, is_property):
|
|
184
|
+
if self._file_filter.should_skip_function(line_count, is_private, is_property):
|
|
185
185
|
return
|
|
186
186
|
|
|
187
187
|
# Create function info
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"""Refactoring analysis for code2llm."""
|
|
2
2
|
|
|
3
|
-
import networkx as nx
|
|
4
|
-
import vulture
|
|
5
3
|
from pathlib import Path
|
|
6
4
|
from typing import Optional
|
|
7
5
|
|
|
8
6
|
from ..config import Config
|
|
9
7
|
from ..models import AnalysisResult
|
|
10
|
-
from ...analysis.call_graph import CallGraphExtractor
|
|
11
|
-
from ...analysis.coupling import CouplingAnalyzer
|
|
12
|
-
from ...analysis.smells import SmellDetector
|
|
13
8
|
from .file_filter import FastFileFilter
|
|
14
9
|
|
|
15
10
|
|
|
@@ -26,6 +21,7 @@ class RefactoringAnalyzer:
|
|
|
26
21
|
print("Performing refactoring analysis...")
|
|
27
22
|
|
|
28
23
|
# 1. Calculate metrics (fan-in/fan-out)
|
|
24
|
+
from ...analysis.call_graph import CallGraphExtractor
|
|
29
25
|
cg_ext = CallGraphExtractor(self.config)
|
|
30
26
|
cg_ext.result = result
|
|
31
27
|
cg_ext._calculate_metrics()
|
|
@@ -54,8 +50,9 @@ class RefactoringAnalyzer:
|
|
|
54
50
|
if self.config.verbose:
|
|
55
51
|
print(f" Detected {len(result.smells)} code smells")
|
|
56
52
|
|
|
57
|
-
def _build_call_graph(self, result: AnalysisResult)
|
|
53
|
+
def _build_call_graph(self, result: AnalysisResult):
|
|
58
54
|
"""Build networkx call graph."""
|
|
55
|
+
import networkx as nx
|
|
59
56
|
G = nx.DiGraph()
|
|
60
57
|
for func_name, func_info in result.functions.items():
|
|
61
58
|
G.add_node(func_name)
|
|
@@ -63,7 +60,7 @@ class RefactoringAnalyzer:
|
|
|
63
60
|
G.add_edge(func_name, callee)
|
|
64
61
|
return G
|
|
65
62
|
|
|
66
|
-
def _calculate_centrality(self, call_graph
|
|
63
|
+
def _calculate_centrality(self, call_graph, result: AnalysisResult) -> None:
|
|
67
64
|
"""Calculate betweenness centrality for bottleneck detection."""
|
|
68
65
|
if len(call_graph) > 0:
|
|
69
66
|
try:
|
|
@@ -74,8 +71,10 @@ class RefactoringAnalyzer:
|
|
|
74
71
|
print(f" Large graph ({node_count} nodes), using sampled centrality...")
|
|
75
72
|
# Sample 20% of nodes, max 500
|
|
76
73
|
k = min(int(node_count * 0.2), 500)
|
|
74
|
+
import networkx as nx
|
|
77
75
|
centrality = nx.betweenness_centrality(call_graph, k=k)
|
|
78
76
|
else:
|
|
77
|
+
import networkx as nx
|
|
79
78
|
centrality = nx.betweenness_centrality(call_graph)
|
|
80
79
|
for func_name, score in centrality.items():
|
|
81
80
|
if func_name in result.functions:
|
|
@@ -84,7 +83,7 @@ class RefactoringAnalyzer:
|
|
|
84
83
|
if self.config.verbose:
|
|
85
84
|
print(f"Error calculating centrality: {e}")
|
|
86
85
|
|
|
87
|
-
def _detect_cycles(self, call_graph
|
|
86
|
+
def _detect_cycles(self, call_graph, result: AnalysisResult) -> None:
|
|
88
87
|
"""Detect circular dependencies."""
|
|
89
88
|
try:
|
|
90
89
|
# Limit cycle detection for large graphs
|
|
@@ -92,6 +91,7 @@ class RefactoringAnalyzer:
|
|
|
92
91
|
if self.config.verbose:
|
|
93
92
|
print(f" Skipping cycle detection for large graph ({len(call_graph)} nodes)")
|
|
94
93
|
return
|
|
94
|
+
import networkx as nx
|
|
95
95
|
cycles = list(nx.simple_cycles(call_graph))
|
|
96
96
|
if cycles:
|
|
97
97
|
result.metrics["project"] = result.metrics.get("project", {})
|
|
@@ -100,7 +100,7 @@ class RefactoringAnalyzer:
|
|
|
100
100
|
if self.config.verbose:
|
|
101
101
|
print(f"Error detecting cycles: {e}")
|
|
102
102
|
|
|
103
|
-
def _detect_communities(self, call_graph
|
|
103
|
+
def _detect_communities(self, call_graph, result: AnalysisResult) -> None:
|
|
104
104
|
"""Detect communities (module groups)."""
|
|
105
105
|
try:
|
|
106
106
|
# Limit community detection for large graphs
|
|
@@ -122,11 +122,13 @@ class RefactoringAnalyzer:
|
|
|
122
122
|
|
|
123
123
|
def _analyze_coupling(self, result: AnalysisResult) -> None:
|
|
124
124
|
"""Analyze coupling between modules."""
|
|
125
|
+
from ...analysis.coupling import CouplingAnalyzer
|
|
125
126
|
coupling_analyzer = CouplingAnalyzer(result)
|
|
126
127
|
coupling_analyzer.analyze()
|
|
127
128
|
|
|
128
129
|
def _detect_smells(self, result: AnalysisResult) -> None:
|
|
129
130
|
"""Detect code smells."""
|
|
131
|
+
from ...analysis.smells import SmellDetector
|
|
130
132
|
smell_detector = SmellDetector(result)
|
|
131
133
|
smell_detector.detect()
|
|
132
134
|
|
|
@@ -136,6 +138,7 @@ class RefactoringAnalyzer:
|
|
|
136
138
|
print("Detecting dead code with vulture...")
|
|
137
139
|
|
|
138
140
|
try:
|
|
141
|
+
import vulture
|
|
139
142
|
v = vulture.Vulture(verbose=False)
|
|
140
143
|
|
|
141
144
|
# vulture.scan takes the code content as a string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2llm
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.30
|
|
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.30"
|
|
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"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"""Analysis package for code2llm."""
|
|
2
|
-
|
|
3
|
-
from .cfg import CFGExtractor
|
|
4
|
-
from .dfg import DFGExtractor
|
|
5
|
-
from .call_graph import CallGraphExtractor
|
|
6
|
-
from .coupling import CouplingAnalyzer
|
|
7
|
-
from .smells import SmellDetector
|
|
8
|
-
from .data_analysis import DataAnalyzer
|
|
9
|
-
from .type_inference import TypeInferenceEngine
|
|
10
|
-
from .side_effects import SideEffectDetector
|
|
11
|
-
from .pipeline_detector import PipelineDetector
|
|
12
|
-
|
|
13
|
-
__all__ = [
|
|
14
|
-
'CFGExtractor',
|
|
15
|
-
'DFGExtractor',
|
|
16
|
-
'CallGraphExtractor',
|
|
17
|
-
'CouplingAnalyzer',
|
|
18
|
-
'SmellDetector',
|
|
19
|
-
'DataAnalyzer',
|
|
20
|
-
'TypeInferenceEngine',
|
|
21
|
-
'SideEffectDetector',
|
|
22
|
-
'PipelineDetector',
|
|
23
|
-
]
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"""Core analysis components for code2llm."""
|
|
2
|
-
|
|
3
|
-
from .analyzer import ProjectAnalyzer, FileCache, FastFileFilter
|
|
4
|
-
from .streaming_analyzer import (
|
|
5
|
-
StreamingAnalyzer,
|
|
6
|
-
IncrementalAnalyzer,
|
|
7
|
-
ScanStrategy,
|
|
8
|
-
SmartPrioritizer,
|
|
9
|
-
STRATEGY_QUICK,
|
|
10
|
-
STRATEGY_STANDARD,
|
|
11
|
-
STRATEGY_DEEP
|
|
12
|
-
)
|
|
13
|
-
from .config import Config, FAST_CONFIG, PerformanceConfig, FilterConfig
|
|
14
|
-
from .models import (
|
|
15
|
-
AnalysisResult, FlowNode, FlowEdge,
|
|
16
|
-
FunctionInfo, ClassInfo, ModuleInfo, Pattern
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
__all__ = [
|
|
20
|
-
'ProjectAnalyzer',
|
|
21
|
-
'StreamingAnalyzer',
|
|
22
|
-
'IncrementalAnalyzer',
|
|
23
|
-
'ScanStrategy',
|
|
24
|
-
'SmartPrioritizer',
|
|
25
|
-
'STRATEGY_QUICK',
|
|
26
|
-
'STRATEGY_STANDARD',
|
|
27
|
-
'STRATEGY_DEEP',
|
|
28
|
-
'FileCache',
|
|
29
|
-
'FastFileFilter',
|
|
30
|
-
'Config',
|
|
31
|
-
'FAST_CONFIG',
|
|
32
|
-
'AnalysisResult',
|
|
33
|
-
'FunctionInfo',
|
|
34
|
-
'ClassInfo',
|
|
35
|
-
'ModuleInfo',
|
|
36
|
-
]
|
|
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
|