gebra 0.0.1__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.
Files changed (112) hide show
  1. gebra/__init__.py +114 -0
  2. gebra/annotations/__init__.py +154 -0
  3. gebra/annotations/contract.py +1036 -0
  4. gebra/annotations/errors.py +93 -0
  5. gebra/annotations/inference.py +1426 -0
  6. gebra/annotations/resolve.py +676 -0
  7. gebra/annotations/sidecar.py +776 -0
  8. gebra/annotations/slots.py +105 -0
  9. gebra/audit/__init__.py +79 -0
  10. gebra/audit/export.py +332 -0
  11. gebra/audit/freshness.py +128 -0
  12. gebra/audit/models.py +258 -0
  13. gebra/cli/__init__.py +47 -0
  14. gebra/cli/__main__.py +8 -0
  15. gebra/cli/app.py +681 -0
  16. gebra/cli/common.py +148 -0
  17. gebra/cli/diff.py +556 -0
  18. gebra/cli/display.py +307 -0
  19. gebra/cli/history.py +353 -0
  20. gebra/cli/invocation.py +192 -0
  21. gebra/cli/render.py +126 -0
  22. gebra/cli/resolve.py +378 -0
  23. gebra/cli/snapshot.py +343 -0
  24. gebra/cli/verify.py +357 -0
  25. gebra/diff/__init__.py +118 -0
  26. gebra/diff/contracts.py +375 -0
  27. gebra/diff/graph.py +190 -0
  28. gebra/diff/models.py +338 -0
  29. gebra/diff/state.py +260 -0
  30. gebra/diff/topology.py +367 -0
  31. gebra/diff/workflow.py +220 -0
  32. gebra/display/__init__.py +26 -0
  33. gebra/display/mermaid.py +240 -0
  34. gebra/display/overlay.py +349 -0
  35. gebra/extraction/__init__.py +231 -0
  36. gebra/extraction/base.py +83 -0
  37. gebra/extraction/builder.py +1229 -0
  38. gebra/extraction/compat.py +392 -0
  39. gebra/extraction/compiled.py +1330 -0
  40. gebra/extraction/contracts.py +616 -0
  41. gebra/extraction/digests.py +813 -0
  42. gebra/extraction/dispatch.py +320 -0
  43. gebra/extraction/envelope.py +297 -0
  44. gebra/extraction/errors.py +127 -0
  45. gebra/extraction/inference.py +82 -0
  46. gebra/extraction/lcel.py +1192 -0
  47. gebra/extraction/routing.py +309 -0
  48. gebra/extraction/sidecar.py +104 -0
  49. gebra/extraction/state.py +693 -0
  50. gebra/extraction/stock.py +121 -0
  51. gebra/extraction/warnings.py +368 -0
  52. gebra/ir/__init__.py +181 -0
  53. gebra/ir/base.py +59 -0
  54. gebra/ir/canonical.py +791 -0
  55. gebra/ir/identity.py +590 -0
  56. gebra/ir/models.py +515 -0
  57. gebra/ir/serialization.py +617 -0
  58. gebra/lineage/__init__.py +72 -0
  59. gebra/lineage/document.py +138 -0
  60. gebra/lineage/engine.py +265 -0
  61. gebra/lineage/models.py +244 -0
  62. gebra/naming.py +84 -0
  63. gebra/py.typed +0 -0
  64. gebra/pytest_plugin.py +2279 -0
  65. gebra/report/__init__.py +164 -0
  66. gebra/report/anchors.py +300 -0
  67. gebra/report/evidence.py +373 -0
  68. gebra/report/findings.py +149 -0
  69. gebra/report/human.py +465 -0
  70. gebra/report/native.py +38 -0
  71. gebra/report/rules.py +293 -0
  72. gebra/report/sarif.py +257 -0
  73. gebra/report/suggestions.py +82 -0
  74. gebra/snapshot/__init__.py +72 -0
  75. gebra/snapshot/engine.py +524 -0
  76. gebra/snapshot/models.py +164 -0
  77. gebra/store/__init__.py +121 -0
  78. gebra/store/atomic.py +124 -0
  79. gebra/store/base.py +63 -0
  80. gebra/store/models.py +361 -0
  81. gebra/store/serialization.py +198 -0
  82. gebra/store/store.py +507 -0
  83. gebra/testing/__init__.py +122 -0
  84. gebra/testing/fixtures.py +808 -0
  85. gebra/testing/harness.py +894 -0
  86. gebra/testing/mutations.py +2172 -0
  87. gebra/testing/strategies.py +1027 -0
  88. gebra/verify/__init__.py +422 -0
  89. gebra/verify/base.py +358 -0
  90. gebra/verify/conditions.py +741 -0
  91. gebra/verify/graph.py +898 -0
  92. gebra/verify/guards.py +657 -0
  93. gebra/verify/locations.py +245 -0
  94. gebra/verify/properties/__init__.py +37 -0
  95. gebra/verify/properties/dataflow_completeness.py +673 -0
  96. gebra/verify/properties/determinism_replay.py +334 -0
  97. gebra/verify/properties/effect_safety.py +489 -0
  98. gebra/verify/properties/graph_well_formed.py +351 -0
  99. gebra/verify/properties/termination_witness.py +1023 -0
  100. gebra/verify/registry.py +477 -0
  101. gebra/verify/report.py +242 -0
  102. gebra/verify/run.py +863 -0
  103. gebra/verify/witnesses.py +430 -0
  104. gebra/versioning/__init__.py +85 -0
  105. gebra/versioning/classify.py +289 -0
  106. gebra/versioning/models.py +301 -0
  107. gebra-0.0.1.dist-info/METADATA +453 -0
  108. gebra-0.0.1.dist-info/RECORD +112 -0
  109. gebra-0.0.1.dist-info/WHEEL +4 -0
  110. gebra-0.0.1.dist-info/entry_points.txt +5 -0
  111. gebra-0.0.1.dist-info/licenses/LICENSE +201 -0
  112. gebra-0.0.1.dist-info/licenses/NOTICE +2 -0
gebra/naming.py ADDED
@@ -0,0 +1,84 @@
1
+ """How gebra names a *type* when it has to name one — INTROSPECTION-SPEC §7.4 (DEC-15).
2
+
3
+ One function, in a module with no dependencies, because two lanes need it and neither may
4
+ import the other. :mod:`gebra.extraction` names the type of an object it refuses (§2 "naming
5
+ the object type") and the type of a declared value it cannot read; :mod:`gebra.annotations`
6
+ names the type of a decorator argument it refuses. Putting the spelling here keeps it a
7
+ single definition: it is digest-adjacent (§7.4 (c)/(d) fixes it for class identities in
8
+ digest input), and two copies of a digest-adjacent spelling drift.
9
+
10
+ Both re-export it under their own names, so ``gebra.extraction.type_identity`` and
11
+ ``gebra.extraction.base.type_identity`` continue to resolve.
12
+
13
+ Nothing here imports langgraph, opens a socket, or executes anything (WA-07).
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ __all__ = ["type_identity"]
19
+
20
+
21
+ def type_identity(value: object) -> str:
22
+ """``value``'s type as ``"<top-level package>:<qualname>"`` — e.g. ``"builtins:dict"``.
23
+
24
+ The identity spelling INTROSPECTION-SPEC §7.4 (c)/(d) fixes for class identities in
25
+ digest input (DEC-15), reused wherever this package names a *type* rather than a value:
26
+ the object an :class:`~gebra.extraction.errors.ExtractionError` refuses, the ``source``
27
+ reference of :class:`~gebra.extraction.envelope.ExtractedFrom`, and the value a
28
+ :class:`~gebra.annotations.errors.GebraContractError` refuses.
29
+
30
+ That last use is why naming a type rather than showing a value matters beyond tidiness:
31
+ a message built with ``{value!r}`` runs the value's own ``__repr__``, so a decorator
32
+ argument could replace gebra's error with an exception of its own. Nothing here is read
33
+ off the object at all — only its type, and only through the **unbound descriptors the
34
+ interpreter itself uses** (WA-07).
35
+
36
+ **Both halves go through ``type.__dict__``, and neither has a rendering as a fallback.**
37
+ ``cls.__qualname__`` and ``cls.__module__`` route through the *metaclass*, which may
38
+ define ``__getattribute__`` and answer or observe the read — and this value is
39
+ digest-bearing (§7.4 (d) rule 12 puts it inside ``config_digest``), so a metaclass could
40
+ reach both a foreign-code route and a nondeterminism one. The unbound descriptors are the
41
+ form :mod:`gebra.extraction.state` already uses, for the same reason. A fallback of
42
+ ``repr(cls)`` would be worse than useless twice over: evaluated as a ``getattr`` default
43
+ it runs on **every** call, eagerly, whether or not the name is missing; and what it runs
44
+ is the metaclass's ``__repr__``. The name a class does not carry is named ``"<unnamed>"``
45
+ and the package a class does not name is the empty string — a class that answers neither
46
+ is not something a rendering would have told the truth about either.
47
+ """
48
+ cls = type(value)
49
+ return f"{_package(cls)}:{_qualname(cls)}"
50
+
51
+
52
+ def _qualname(cls: type) -> str:
53
+ """``cls``'s qualified name, read through the interpreter's own descriptor."""
54
+ name = _unbound(cls, "__qualname__")
55
+ if not isinstance(name, str): # pragma: no cover - see :func:`_unbound`
56
+ return "<unnamed>"
57
+ return name
58
+
59
+
60
+ def _package(cls: type) -> str:
61
+ """The top-level package of ``cls``'s module, read the same way.
62
+
63
+ ``__module__`` is the half a class *can* answer with a non-string: it is an ordinary class
64
+ dict entry, so ``cls.__module__ = 7`` is legal Python. A class that does that is named by
65
+ its qualname alone rather than by a rendering of whatever it put there.
66
+ """
67
+ module = _unbound(cls, "__module__")
68
+ if not isinstance(module, str):
69
+ return ""
70
+ return module.partition(".")[0]
71
+
72
+
73
+ def _unbound(cls: type, name: str) -> object:
74
+ """One ``type`` slot of ``cls``, or ``None`` when the descriptor declines to answer.
75
+
76
+ The broad ``except`` covers a class whose metaclass is not a ``type`` subclass at all,
77
+ which the descriptor refuses — the same defensive shape and the same reasoning as
78
+ :func:`gebra.extraction.state._qualname`: the alternative to a caught failure over a
79
+ *name* is an aborted extraction, which no reading of INTROSPECTION §2 licenses.
80
+ """
81
+ try:
82
+ return type.__dict__[name].__get__(cls)
83
+ except Exception: # noqa: BLE001 # pragma: no cover - defensive; see above
84
+ return None
gebra/py.typed ADDED
File without changes