Download lingologos_python/reasons.py from tailot/codex-python: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/datasets/tailot/codex-python/resolve/main/lingologos_python/reasons.py
- Command line
-
hf download hf://datasets/tailot/codex-python/lingologos_python/reasons.py
-
curl -L -o reasons.py https://huggingface.co/datasets/tailot/codex-python/resolve/main/lingologos_python/reasons.py
2.47 kB
| """One registry of every reason code this bundle can answer with. | |
| A verdict is only useful when its reason can be looked up. Every REFUSED and | |
| every UNKNOWN result names one of these codes: the pattern cases anchor their | |
| negative rows on them, the card lists all of them, and the self_lint gate | |
| checks that the registry and the card agree so the two can never drift apart. | |
| """ | |
| from __future__ import annotations | |
| from typing import Tuple | |
| from lingologos_python import rules | |
| # Refusals the session raises itself, before or around the six-node run. | |
| PATH_POLICY = "PATH_POLICY" | |
| PATCH_NOT_APPLIED = "PATCH_NOT_APPLIED" | |
| NODE_TIMEOUT = "NODE_TIMEOUT" | |
| LINKED_PATH_IN_WORKSPACE = "LINKED_PATH_IN_WORKSPACE" | |
| HARDLINKED_PATH_IN_WORKSPACE = "HARDLINKED_PATH_IN_WORKSPACE" | |
| SESSION_LOCKED = "SESSION_LOCKED" | |
| SESSION_REASONS: Tuple[str, ...] = ( | |
| PATH_POLICY, | |
| PATCH_NOT_APPLIED, | |
| NODE_TIMEOUT, | |
| LINKED_PATH_IN_WORKSPACE, | |
| HARDLINKED_PATH_IN_WORKSPACE, | |
| SESSION_LOCKED, | |
| ) | |
| # Verdicts the codex kernel brings back when the gates fail or decline to answer. | |
| # The six-node run answers with the kernel's own vocabulary; the registry holds | |
| # every word of it that can arrive on a REFUSED or UNKNOWN line, so the promise | |
| # that every refusal names a registered code survives the pipeline too. | |
| GATE_REJECTED = "GATE_REJECTED" | |
| GATE_ABSTAIN = "GATE_ABSTAIN" | |
| GATE_MISSING = "GATE_MISSING" | |
| CHECKER_REJECTED = "CHECKER_REJECTED" | |
| CHECKER_ABSTAIN = "CHECKER_ABSTAIN" | |
| NOT_APPLIED = "NOT_APPLIED" | |
| PROTECTED_PATH = "PROTECTED_PATH" | |
| NO_INDEPENDENT_CONFIRMATION = "NO_INDEPENDENT_CONFIRMATION" | |
| KERNEL_REASONS: Tuple[str, ...] = ( | |
| GATE_REJECTED, | |
| GATE_ABSTAIN, | |
| GATE_MISSING, | |
| CHECKER_REJECTED, | |
| CHECKER_ABSTAIN, | |
| NOT_APPLIED, | |
| PROTECTED_PATH, | |
| NO_INDEPENDENT_CONFIRMATION, | |
| ) | |
| # The refusal the catalog layer adds above the rules: a scan found the card fits | |
| # more than one target and the caller named none. | |
| AMBIGUOUS_TARGET = "AMBIGUOUS_TARGET" | |
| PATTERN_REASONS: Tuple[str, ...] = (AMBIGUOUS_TARGET,) | |
| # Preflight and shape refusals of the pattern rules, collected from the rules | |
| # module so the registry cannot fall behind the rules that raise them. | |
| RULE_REASONS: Tuple[str, ...] = tuple( | |
| value | |
| for name, value in vars(rules).items() | |
| if name.isupper() and isinstance(value, str) and value == name | |
| ) | |
| REASON_CODES = ( | |
| frozenset(SESSION_REASONS) | |
| | frozenset(KERNEL_REASONS) | |
| | frozenset(PATTERN_REASONS) | |
| | frozenset(RULE_REASONS) | |
| ) | |