graphite-code 1.9.1__py3-none-any.whl → 1.9.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.
graphite/__init__.py CHANGED
@@ -38,4 +38,4 @@ __all__ = ["__version__"]
38
38
  #: Coarse and hand-maintained by construction. It is a release label, not
39
39
  #: evidence that a given fix is present -- to answer that, survey for the marker
40
40
  #: the fix introduced, or compare `graphite --version` fingerprints.
41
- __version__ = "1.9.1"
41
+ __version__ = "1.9.2"
graphite/agent_hooks.py CHANGED
@@ -308,6 +308,46 @@ def _beside_a_required_space(start: int, end: int, spaces: list[tuple[int, int]]
308
308
  return any(run_end == start or run_start == end for run_start, run_end in spaces)
309
309
 
310
310
 
311
+ # The words a definition is written with, in the languages graphite reads.
312
+ # The word after one is the name being defined, so `def dependents` asks where
313
+ # `dependents` is defined -- the question the graph answers -- and is not a
314
+ # phrase. Round 331 first excused it as prose, which gave up the nudge for
315
+ # the commonest way a definition is searched for.
316
+ _DEFINITION_KEYWORDS = frozenset(
317
+ {
318
+ "def", "class", "function", "fn", "func", "struct", "enum", "trait",
319
+ "impl", "interface", "type", "const", "let", "var",
320
+ }
321
+ )
322
+ # The word that ends exactly where a space begins: the whole identifier, so
323
+ # `undef` and `defx` are not `def`.
324
+ _WORD_BEFORE_RE = re.compile(r"[A-Za-z0-9_]+$")
325
+
326
+
327
+ def _follows_a_definition_keyword(
328
+ pattern: str, start: int, spaces: list[tuple[int, int]], fold_case: bool
329
+ ) -> bool:
330
+ """Whether the token at `start` follows a definition keyword across a
331
+ required space.
332
+
333
+ Such a token is the name a definition defines, so the space beside it does
334
+ not make it a fragment of a phrase. `pattern` is read with its fused
335
+ escapes blanked, so `\\bdef name` reads its keyword as `def`. The keyword
336
+ is matched as written unless the search folds case: `Def name` cannot
337
+ match `def name` in code.
338
+ """
339
+ for run_start, run_end in spaces:
340
+ if run_end != start:
341
+ continue
342
+ found = _WORD_BEFORE_RE.search(pattern, 0, run_start)
343
+ if found is None:
344
+ continue
345
+ word = found.group()
346
+ if (word.lower() if fold_case else word) in _DEFINITION_KEYWORDS:
347
+ return True
348
+ return False
349
+
350
+
311
351
  def _receiver_of(pattern: str, start: int) -> str | None:
312
352
  """The identifier the word at `start` is qualified by, or None.
313
353
 
@@ -353,7 +393,9 @@ def _pattern_tokens(pattern: str, fold_case: bool) -> list[tuple[str, str | None
353
393
  for found in _IDENTIFIER_RE.finditer(pattern):
354
394
  if _is_literal_fragment(pattern, found.start(), found.end()):
355
395
  continue
356
- if _beside_a_required_space(found.start(), found.end(), spaces):
396
+ if _beside_a_required_space(
397
+ found.start(), found.end(), spaces
398
+ ) and not _follows_a_definition_keyword(pattern, found.start(), spaces, fold_case):
357
399
  continue
358
400
  token = found.group()
359
401
  key = token.lower() if fold_case else token
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: graphite-code
3
- Version: 1.9.1
3
+ Version: 1.9.2
4
4
  Summary: Local-first, zero-LLM knowledge graph extraction for codebases.
5
5
  Project-URL: Homepage, https://github.com/jared0565/graphite
6
6
  Project-URL: Repository, https://github.com/jared0565/graphite
@@ -49,7 +49,7 @@ Description-Content-Type: text/markdown
49
49
 
50
50
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
51
51
 
52
- **Status: 1.9.1, production/stable.** Published on PyPI as
52
+ **Status: 1.9.2, production/stable.** Published on PyPI as
53
53
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
54
54
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
55
55
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -1,9 +1,9 @@
1
- graphite/__init__.py,sha256=_eFv1YrMH5u50nLWZL2_Z7LN22zTt5OjF9Ci5M3_8b4,2181
1
+ graphite/__init__.py,sha256=mYsg9nlvtTa9QFSakoqrk8K90yp4yILLkY3kymLyjmg,2181
2
2
  graphite/__main__.py,sha256=Bp5bcXE6M0AnuNW1LjOXOEvGG5r0fXZoeRb_k5Yxphs,149
3
3
  graphite/_cleanup_worker.py,sha256=oIXOPa1jHVP8ePRSwn27nZEHOAc4DSBrjeH2Ds9wuq8,19619
4
4
  graphite/_win32_ctypes.py,sha256=YLH4kpKjL7zUUOs9E8C-Kjdy45PJBd6eRUeKwiKdSV4,1476
5
5
  graphite/activation.py,sha256=Jcgk8AFvqbMNQiPAa2MTzSO0BAYRC5FX6MsZUjbDe1I,5249
6
- graphite/agent_hooks.py,sha256=uZDxS2moMwnj8_xhXiIgP7sWkRpstz9dWJSkIZ3oJVc,75857
6
+ graphite/agent_hooks.py,sha256=m8L2hEWdqZxLiEXpIatY-TxEtiHI6WF3F0fUszNlo54,77565
7
7
  graphite/agent_settings.py,sha256=Ec95ilPhkPOM3vW67pdsjYivnCyc5uCqWfCBu-DLI3A,11085
8
8
  graphite/analyze.py,sha256=BwiZ4lkQ8Oo8WvnIGLI03YSNUpynYvV46tVbzHH5iWQ,9304
9
9
  graphite/answer_contract.py,sha256=KTnGmtT6gvi28-PhLZp9vaj7FDvGrqLW_BvhAa-VPR4,31237
@@ -113,8 +113,8 @@ graphite/routing/zai_edit.py,sha256=Kra2tI9GkntQAhV1vNHlFlp4sY-ksq2-bY4N9fEfLEc,
113
113
  graphite/routing/zai_executor.py,sha256=cHUl7DbWRUhYg9Lwm3OiP6H3dI70y_b8iAWCyfgOPi0,6636
114
114
  graphite/routing/zai_probe.py,sha256=HL2vM8s2J4-n8Bp3l7QLpWLEk-PhZrt_rLc2cY65hvU,4771
115
115
  graphite/ts_resolver.mjs,sha256=wiKDWkJIC9__3wL49ty4W8hRc5biisNNtFhH1aFA47A,10822
116
- graphite_code-1.9.1.dist-info/METADATA,sha256=nSC2uqjvGmoD0XZFe0yXT2vmim8mHzo41JeEf88ze7Q,48525
117
- graphite_code-1.9.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
118
- graphite_code-1.9.1.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
119
- graphite_code-1.9.1.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
120
- graphite_code-1.9.1.dist-info/RECORD,,
116
+ graphite_code-1.9.2.dist-info/METADATA,sha256=SmtqgP0Sv5hyDWdRGMMT2kqUPibFmcEnIN0fMxZhncw,48525
117
+ graphite_code-1.9.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
118
+ graphite_code-1.9.2.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
119
+ graphite_code-1.9.2.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
120
+ graphite_code-1.9.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any