sourcecode 2.5.1__py3-none-any.whl → 2.5.2__py3-none-any.whl

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.
sourcecode/__init__.py CHANGED
@@ -4,4 +4,4 @@ ASK Engine is the product. ``ask`` is the canonical CLI command; ``sourcecode``
4
4
  the legacy compatibility alias and the Python/PyPI package name. See
5
5
  docs/PRODUCT_IDENTITY.md (normative)."""
6
6
 
7
- __version__ = "2.5.1"
7
+ __version__ = "2.5.2"
@@ -1489,6 +1489,16 @@ def _method_body(raw_lines: list[str], start_idx: int) -> str:
1489
1489
  return "\n".join(out)
1490
1490
 
1491
1491
 
1492
+ # Intra-class call-site matcher: a bare `name(` (not preceded by a word char or '.')
1493
+ # OR an explicit `this.name(`. Group 1 = bare callee, group 2 = this-qualified callee.
1494
+ # Encodes the SAME two match forms the old per-sibling regex used, so the derived edge
1495
+ # set is byte-identical — but as ONE alternation scanned once per body instead of once
1496
+ # per sibling name (see _intra_class_call_edges perf note).
1497
+ _INTRA_CALL_RE = re.compile(
1498
+ r'(?<![\w.])([A-Za-z_]\w*)\s*\(' r'|\bthis\s*\.\s*([A-Za-z_]\w*)\s*\('
1499
+ )
1500
+
1501
+
1492
1502
  def _intra_class_call_edges(symbols: list[SymbolRecord], source: str) -> list[RelationEdge]:
1493
1503
  """Method-level `calls` edges for intra-class invocations.
1494
1504
 
@@ -1528,13 +1538,20 @@ def _intra_class_call_edges(symbols: list[SymbolRecord], source: str) -> list[Re
1528
1538
  if not body:
1529
1539
  continue
1530
1540
  body = _STRING_LITERAL_RE.sub('', _strip_java_comments(body))
1531
- for name, fqns in sib.items():
1541
+ # PERF: one pass over the body collects every bare / this-qualified callee name,
1542
+ # then intersect with the sibling index. The old code ran a fresh regex search
1543
+ # per sibling name — O(siblings × body_len) per method, i.e. quadratic in method
1544
+ # count, which made large method-dense classes (generated parsers, 4k-line test
1545
+ # classes) pathological (alfresco cold scan ~220s). This is O(body_len). The
1546
+ # edge set is identical: _INTRA_CALL_RE matches the same two call forms.
1547
+ called: set[str] = set()
1548
+ for m in _INTRA_CALL_RE.finditer(body):
1549
+ called.add(m.group(1) or m.group(2))
1550
+ for name in sorted(called): # sorted → deterministic edge order
1532
1551
  if name in _CALL_KEYWORDS:
1533
1552
  continue
1534
- # bare `name(` (not preceded by word char or '.') OR explicit `this.name(`
1535
- pat = (r'(?<![\w.])' + re.escape(name) + r'\s*\('
1536
- + r'|\bthis\s*\.\s*' + re.escape(name) + r'\s*\(')
1537
- if not re.search(pat, body):
1553
+ fqns = sib.get(name)
1554
+ if not fqns:
1538
1555
  continue
1539
1556
  for tgt in fqns:
1540
1557
  if tgt == caller.symbol:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 2.5.1
3
+ Version: 2.5.2
4
4
  Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
5
5
  License-File: LICENSE
6
6
  Keywords: agents,ai,codebase,context,developer-tools,llm
@@ -1,4 +1,4 @@
1
- sourcecode/__init__.py,sha256=KLuqjzw229DS3vhMmuCKlXFinpcH1QG9fhcn7C3J2xg,308
1
+ sourcecode/__init__.py,sha256=nbtWf3A6IYQQ1rNky7L2moDkYZ2Uy7Nj9Mb5R7f2-KQ,308
2
2
  sourcecode/adaptive_scanner.py,sha256=XffluXKzJUXrMtjEiAOnSNPZnztdIcts17T9ouHeID0,10521
3
3
  sourcecode/archetype.py,sha256=d7yoN6Tj4OBj-VgSMPEKg4WF9H8FypnZ5A6AkUh5oIE,34484
4
4
  sourcecode/architecture_analyzer.py,sha256=6_wC4TYuBYxaqckZS0I1vBSMRPeH2vzlDB48gXwOOd4,46627
@@ -55,7 +55,7 @@ sourcecode/redactor.py,sha256=SB4hwIvg8h-hvcqKcDWaZvA-aSyn-at-BIRwa0tUv5E,3227
55
55
  sourcecode/relevance_scorer.py,sha256=0AgEt4KrV73nioMqBgjhGjtY7L2C7L7cSyKtj3IKcrw,9408
56
56
  sourcecode/rename_refactor.py,sha256=h6dNFlB9aZ_3q6heeHBkgXQeXaT03nvPSsYH6P8qxFg,12965
57
57
  sourcecode/repo_classifier.py,sha256=FG1vaWKdWXsWdl-S8hjVMiTqcwgaRXkDyvK4rPcOGtQ,22681
58
- sourcecode/repository_ir.py,sha256=Cyt7avInKNvayaOSgeSjJgWARcGnVXA-4EAmKSve_Jc,290150
58
+ sourcecode/repository_ir.py,sha256=bG81ARrPBaPZoGqGT9bXviGCHZ27D7zGli8KShn9-cI,291158
59
59
  sourcecode/ris.py,sha256=aG2D4159gtpg968yD3PylYbIXhGFOwIlFBI0DSr84yY,20412
60
60
  sourcecode/runtime_classifier.py,sha256=uTAD6BDCiBLUZEDRfqk718kM4RTT_vAbfkcOI2_Xx58,18432
61
61
  sourcecode/scanner.py,sha256=WdOQ78mMzjR1NjmKTlbxdgwinnCTfAhxCVLBEFQiFHU,8899
@@ -136,8 +136,8 @@ sourcecode/telemetry/consent.py,sha256=LIAO9ohJZF8OuZwM4u1VWtALlYfTCCKq4wV3Vwc7i
136
136
  sourcecode/telemetry/events.py,sha256=LtzYfaX9Ilckj5PTvAcTpDa9mLqDsYPDUiDkRa58piY,2580
137
137
  sourcecode/telemetry/filters.py,sha256=NHa5T-6DaZduQPFuC34jOqHWQgSizM-Ygq8aZ4j19ng,5834
138
138
  sourcecode/telemetry/transport.py,sha256=4gGHsq0WeY9VywEZXA3vUxykfiYnw9uuqfjAAec7F8o,1681
139
- sourcecode-2.5.1.dist-info/METADATA,sha256=eQZ2Bo5Okcz-pi14-mRu9KvrxZzIwkq7WExZEz0pjPE,10851
140
- sourcecode-2.5.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
141
- sourcecode-2.5.1.dist-info/entry_points.txt,sha256=-JEAdChrK5We51kZcb7OaDcyil-dHBjBPL-NhuO-QY8,89
142
- sourcecode-2.5.1.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
143
- sourcecode-2.5.1.dist-info/RECORD,,
139
+ sourcecode-2.5.2.dist-info/METADATA,sha256=cOmLhyx7sqYDB9m4eU6MkDuV4hfXzK68a2cUC_-N490,10851
140
+ sourcecode-2.5.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
141
+ sourcecode-2.5.2.dist-info/entry_points.txt,sha256=-JEAdChrK5We51kZcb7OaDcyil-dHBjBPL-NhuO-QY8,89
142
+ sourcecode-2.5.2.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
143
+ sourcecode-2.5.2.dist-info/RECORD,,