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.
Files changed (86) hide show
  1. {code2llm-0.5.13 → code2llm-0.5.15}/PKG-INFO +1 -1
  2. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/__init__.py +1 -1
  3. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/analyzer.py +29 -7
  4. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/refactoring.py +20 -1
  5. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/__init__.py +1 -1
  6. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/PKG-INFO +1 -1
  7. {code2llm-0.5.13 → code2llm-0.5.15}/pyproject.toml +2 -2
  8. {code2llm-0.5.13 → code2llm-0.5.15}/LICENSE +0 -0
  9. {code2llm-0.5.13 → code2llm-0.5.15}/README.md +0 -0
  10. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/__main__.py +0 -0
  11. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/__init__.py +0 -0
  12. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/call_graph.py +0 -0
  13. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/cfg.py +0 -0
  14. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/coupling.py +0 -0
  15. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/data_analysis.py +0 -0
  16. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/dfg.py +0 -0
  17. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/pipeline_detector.py +0 -0
  18. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/side_effects.py +0 -0
  19. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/smells.py +0 -0
  20. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/analysis/type_inference.py +0 -0
  21. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/cli.py +0 -0
  22. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/__init__.py +0 -0
  23. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/config.py +0 -0
  24. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/__init__.py +0 -0
  25. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/file_analyzer.py +0 -0
  26. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/file_cache.py +0 -0
  27. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/core/file_filter.py +0 -0
  28. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/models.py +0 -0
  29. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/__init__.py +0 -0
  30. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/cache.py +0 -0
  31. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/incremental.py +0 -0
  32. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/prioritizer.py +0 -0
  33. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/scanner.py +0 -0
  34. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming/strategies.py +0 -0
  35. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/core/streaming_analyzer.py +0 -0
  36. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/__init__.py +0 -0
  37. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/base.py +0 -0
  38. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/context_exporter.py +0 -0
  39. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/evolution_exporter.py +0 -0
  40. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/flow_constants.py +0 -0
  41. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/flow_exporter.py +0 -0
  42. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/flow_renderer.py +0 -0
  43. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/json_exporter.py +0 -0
  44. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/llm_exporter.py +0 -0
  45. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/map_exporter.py +0 -0
  46. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/mermaid_exporter.py +0 -0
  47. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/readme_exporter.py +0 -0
  48. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/__init__.py +0 -0
  49. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/helpers.py +0 -0
  50. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/metrics.py +0 -0
  51. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/module_detail.py +0 -0
  52. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon/renderer.py +0 -0
  53. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/toon.py +0 -0
  54. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/exporters/yaml_exporter.py +0 -0
  55. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/__init__.py +0 -0
  56. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/llm_flow.py +0 -0
  57. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/llm_task.py +0 -0
  58. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/generators/mermaid.py +0 -0
  59. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/config.py +0 -0
  60. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/entity_resolution.py +0 -0
  61. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/intent_matching.py +0 -0
  62. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/normalization.py +0 -0
  63. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/nlp/pipeline.py +0 -0
  64. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/patterns/__init__.py +0 -0
  65. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/patterns/detector.py +0 -0
  66. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/refactor/__init__.py +0 -0
  67. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm/refactor/prompt_engine.py +0 -0
  68. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/SOURCES.txt +0 -0
  69. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/dependency_links.txt +0 -0
  70. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/entry_points.txt +0 -0
  71. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/requires.txt +0 -0
  72. {code2llm-0.5.13 → code2llm-0.5.15}/code2llm.egg-info/top_level.txt +0 -0
  73. {code2llm-0.5.13 → code2llm-0.5.15}/setup.cfg +0 -0
  74. {code2llm-0.5.13 → code2llm-0.5.15}/setup.py +0 -0
  75. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_advanced_analysis.py +0 -0
  76. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_analyzer.py +0 -0
  77. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_deep_analysis.py +0 -0
  78. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_edge_cases.py +0 -0
  79. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_flow_exporter.py +0 -0
  80. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_format_quality.py +0 -0
  81. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_nlp_pipeline.py +0 -0
  82. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_pipeline_detector.py +0 -0
  83. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_prompt_engine.py +0 -0
  84. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_prompt_txt.py +0 -0
  85. {code2llm-0.5.13 → code2llm-0.5.15}/tests/test_refactoring_engine.py +0 -0
  86. {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.13
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
@@ -8,7 +8,7 @@ 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.13"
11
+ __version__ = "0.5.15"
12
12
  __author__ = "STTS Project"
13
13
 
14
14
  # Core analysis components
@@ -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 to resolve to a known function
191
- for known_name in result.functions:
192
- if known_name.endswith(f".{called}") or known_name == called:
193
- func.calls[func.calls.index(called)] = known_name
194
- result.functions[known_name].called_by.append(func_name)
195
- break
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
- centrality = nx.betweenness_centrality(call_graph)
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'):
@@ -4,7 +4,7 @@ Provides query normalization, intent matching, and entity resolution
4
4
  with multilingual support and fuzzy matching.
5
5
  """
6
6
 
7
- __version__ = "0.5.13"
7
+ __version__ = "0.5.15"
8
8
 
9
9
  from .pipeline import NLPPipeline
10
10
  from .normalization import QueryNormalizer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code2llm
3
- Version: 0.5.13
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.13"
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.8"
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