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.
- gebra/__init__.py +114 -0
- gebra/annotations/__init__.py +154 -0
- gebra/annotations/contract.py +1036 -0
- gebra/annotations/errors.py +93 -0
- gebra/annotations/inference.py +1426 -0
- gebra/annotations/resolve.py +676 -0
- gebra/annotations/sidecar.py +776 -0
- gebra/annotations/slots.py +105 -0
- gebra/audit/__init__.py +79 -0
- gebra/audit/export.py +332 -0
- gebra/audit/freshness.py +128 -0
- gebra/audit/models.py +258 -0
- gebra/cli/__init__.py +47 -0
- gebra/cli/__main__.py +8 -0
- gebra/cli/app.py +681 -0
- gebra/cli/common.py +148 -0
- gebra/cli/diff.py +556 -0
- gebra/cli/display.py +307 -0
- gebra/cli/history.py +353 -0
- gebra/cli/invocation.py +192 -0
- gebra/cli/render.py +126 -0
- gebra/cli/resolve.py +378 -0
- gebra/cli/snapshot.py +343 -0
- gebra/cli/verify.py +357 -0
- gebra/diff/__init__.py +118 -0
- gebra/diff/contracts.py +375 -0
- gebra/diff/graph.py +190 -0
- gebra/diff/models.py +338 -0
- gebra/diff/state.py +260 -0
- gebra/diff/topology.py +367 -0
- gebra/diff/workflow.py +220 -0
- gebra/display/__init__.py +26 -0
- gebra/display/mermaid.py +240 -0
- gebra/display/overlay.py +349 -0
- gebra/extraction/__init__.py +231 -0
- gebra/extraction/base.py +83 -0
- gebra/extraction/builder.py +1229 -0
- gebra/extraction/compat.py +392 -0
- gebra/extraction/compiled.py +1330 -0
- gebra/extraction/contracts.py +616 -0
- gebra/extraction/digests.py +813 -0
- gebra/extraction/dispatch.py +320 -0
- gebra/extraction/envelope.py +297 -0
- gebra/extraction/errors.py +127 -0
- gebra/extraction/inference.py +82 -0
- gebra/extraction/lcel.py +1192 -0
- gebra/extraction/routing.py +309 -0
- gebra/extraction/sidecar.py +104 -0
- gebra/extraction/state.py +693 -0
- gebra/extraction/stock.py +121 -0
- gebra/extraction/warnings.py +368 -0
- gebra/ir/__init__.py +181 -0
- gebra/ir/base.py +59 -0
- gebra/ir/canonical.py +791 -0
- gebra/ir/identity.py +590 -0
- gebra/ir/models.py +515 -0
- gebra/ir/serialization.py +617 -0
- gebra/lineage/__init__.py +72 -0
- gebra/lineage/document.py +138 -0
- gebra/lineage/engine.py +265 -0
- gebra/lineage/models.py +244 -0
- gebra/naming.py +84 -0
- gebra/py.typed +0 -0
- gebra/pytest_plugin.py +2279 -0
- gebra/report/__init__.py +164 -0
- gebra/report/anchors.py +300 -0
- gebra/report/evidence.py +373 -0
- gebra/report/findings.py +149 -0
- gebra/report/human.py +465 -0
- gebra/report/native.py +38 -0
- gebra/report/rules.py +293 -0
- gebra/report/sarif.py +257 -0
- gebra/report/suggestions.py +82 -0
- gebra/snapshot/__init__.py +72 -0
- gebra/snapshot/engine.py +524 -0
- gebra/snapshot/models.py +164 -0
- gebra/store/__init__.py +121 -0
- gebra/store/atomic.py +124 -0
- gebra/store/base.py +63 -0
- gebra/store/models.py +361 -0
- gebra/store/serialization.py +198 -0
- gebra/store/store.py +507 -0
- gebra/testing/__init__.py +122 -0
- gebra/testing/fixtures.py +808 -0
- gebra/testing/harness.py +894 -0
- gebra/testing/mutations.py +2172 -0
- gebra/testing/strategies.py +1027 -0
- gebra/verify/__init__.py +422 -0
- gebra/verify/base.py +358 -0
- gebra/verify/conditions.py +741 -0
- gebra/verify/graph.py +898 -0
- gebra/verify/guards.py +657 -0
- gebra/verify/locations.py +245 -0
- gebra/verify/properties/__init__.py +37 -0
- gebra/verify/properties/dataflow_completeness.py +673 -0
- gebra/verify/properties/determinism_replay.py +334 -0
- gebra/verify/properties/effect_safety.py +489 -0
- gebra/verify/properties/graph_well_formed.py +351 -0
- gebra/verify/properties/termination_witness.py +1023 -0
- gebra/verify/registry.py +477 -0
- gebra/verify/report.py +242 -0
- gebra/verify/run.py +863 -0
- gebra/verify/witnesses.py +430 -0
- gebra/versioning/__init__.py +85 -0
- gebra/versioning/classify.py +289 -0
- gebra/versioning/models.py +301 -0
- gebra-0.0.1.dist-info/METADATA +453 -0
- gebra-0.0.1.dist-info/RECORD +112 -0
- gebra-0.0.1.dist-info/WHEEL +4 -0
- gebra-0.0.1.dist-info/entry_points.txt +5 -0
- gebra-0.0.1.dist-info/licenses/LICENSE +201 -0
- 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
|