tnfr 4.5.0__py3-none-any.whl → 4.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.

Potentially problematic release.


This version of tnfr might be problematic. Click here for more details.

Files changed (78) hide show
  1. tnfr/__init__.py +91 -89
  2. tnfr/alias.py +546 -0
  3. tnfr/cache.py +578 -0
  4. tnfr/callback_utils.py +388 -0
  5. tnfr/cli/__init__.py +75 -0
  6. tnfr/cli/arguments.py +177 -0
  7. tnfr/cli/execution.py +288 -0
  8. tnfr/cli/utils.py +36 -0
  9. tnfr/collections_utils.py +300 -0
  10. tnfr/config.py +19 -28
  11. tnfr/constants/__init__.py +174 -0
  12. tnfr/constants/core.py +159 -0
  13. tnfr/constants/init.py +31 -0
  14. tnfr/constants/metric.py +110 -0
  15. tnfr/constants_glyphs.py +98 -0
  16. tnfr/dynamics/__init__.py +658 -0
  17. tnfr/dynamics/dnfr.py +733 -0
  18. tnfr/dynamics/integrators.py +267 -0
  19. tnfr/dynamics/sampling.py +31 -0
  20. tnfr/execution.py +201 -0
  21. tnfr/flatten.py +283 -0
  22. tnfr/gamma.py +302 -88
  23. tnfr/glyph_history.py +290 -0
  24. tnfr/grammar.py +285 -96
  25. tnfr/graph_utils.py +84 -0
  26. tnfr/helpers/__init__.py +71 -0
  27. tnfr/helpers/numeric.py +87 -0
  28. tnfr/immutable.py +178 -0
  29. tnfr/import_utils.py +228 -0
  30. tnfr/initialization.py +197 -0
  31. tnfr/io.py +246 -0
  32. tnfr/json_utils.py +162 -0
  33. tnfr/locking.py +37 -0
  34. tnfr/logging_utils.py +116 -0
  35. tnfr/metrics/__init__.py +41 -0
  36. tnfr/metrics/coherence.py +829 -0
  37. tnfr/metrics/common.py +151 -0
  38. tnfr/metrics/core.py +101 -0
  39. tnfr/metrics/diagnosis.py +234 -0
  40. tnfr/metrics/export.py +137 -0
  41. tnfr/metrics/glyph_timing.py +189 -0
  42. tnfr/metrics/reporting.py +148 -0
  43. tnfr/metrics/sense_index.py +120 -0
  44. tnfr/metrics/trig.py +181 -0
  45. tnfr/metrics/trig_cache.py +109 -0
  46. tnfr/node.py +214 -159
  47. tnfr/observers.py +126 -128
  48. tnfr/ontosim.py +134 -134
  49. tnfr/operators/__init__.py +420 -0
  50. tnfr/operators/jitter.py +203 -0
  51. tnfr/operators/remesh.py +485 -0
  52. tnfr/presets.py +46 -14
  53. tnfr/rng.py +254 -0
  54. tnfr/selector.py +210 -0
  55. tnfr/sense.py +284 -131
  56. tnfr/structural.py +207 -79
  57. tnfr/tokens.py +60 -0
  58. tnfr/trace.py +329 -94
  59. tnfr/types.py +43 -17
  60. tnfr/validators.py +70 -24
  61. tnfr/value_utils.py +59 -0
  62. tnfr-4.5.2.dist-info/METADATA +379 -0
  63. tnfr-4.5.2.dist-info/RECORD +67 -0
  64. tnfr/cli.py +0 -322
  65. tnfr/constants.py +0 -277
  66. tnfr/dynamics.py +0 -814
  67. tnfr/helpers.py +0 -264
  68. tnfr/main.py +0 -47
  69. tnfr/metrics.py +0 -597
  70. tnfr/operators.py +0 -525
  71. tnfr/program.py +0 -176
  72. tnfr/scenarios.py +0 -34
  73. tnfr-4.5.0.dist-info/METADATA +0 -109
  74. tnfr-4.5.0.dist-info/RECORD +0 -28
  75. {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/WHEEL +0 -0
  76. {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/entry_points.txt +0 -0
  77. {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/licenses/LICENSE.md +0 -0
  78. {tnfr-4.5.0.dist-info → tnfr-4.5.2.dist-info}/top_level.txt +0 -0
tnfr/__init__.py CHANGED
@@ -1,89 +1,91 @@
1
-
2
- from __future__ import annotations
3
- """
4
- TNFR Teoría de la Naturaleza Fractal Resonante
5
- API pública del paquete.
6
-
7
- Ecuación nodal:
8
- ∂EPI/∂t = νf · ΔNFR(t)
9
- """
10
-
11
- __version__ = "4.5.0"
12
-
13
- # Re-exports de la API pública
14
- from .dynamics import step, run, set_delta_nfr_hook, validate_canon
15
- from .ontosim import preparar_red
16
- from .observers import attach_standard_observer, coherencia_global, orden_kuramoto
17
- from .gamma import GAMMA_REGISTRY, eval_gamma, kuramoto_R_psi
18
- from .grammar import enforce_canonical_grammar, on_applied_glifo
19
- from .sense import (
20
- GLYPHS_CANONICAL, glyph_angle, glyph_unit,
21
- sigma_vector_node, sigma_vector_global,
22
- push_sigma_snapshot, sigma_series, sigma_rose,
23
- register_sigma_callback,
24
- )
25
- from .metrics import (
26
- register_metrics_callbacks,
27
- Tg_global, Tg_by_node,
28
- latency_series, glifogram_series,
29
- glyph_top, glyph_dwell_stats, export_history,
30
- )
31
- from .operators import aplicar_remesh_red_topologico
32
- from .trace import register_trace
33
- from .program import play, seq, block, target, wait, THOL, TARGET, WAIT, ejemplo_canonico_basico
34
- from .cli import main as cli_main
35
- from .scenarios import build_graph
36
- from .presets import get_preset
37
- from .types import NodeState
38
- from .structural import (
39
- create_nfr,
40
- Operador,
41
- Emision,
42
- Recepcion,
43
- Coherencia,
44
- Disonancia,
45
- Acoplamiento,
46
- Resonancia,
47
- Silencio,
48
- Expansion,
49
- Contraccion,
50
- Autoorganizacion,
51
- Mutacion,
52
- Transicion,
53
- Recursividad,
54
- OPERADORES,
55
- validate_sequence,
56
- run_sequence,
57
- )
58
-
59
-
60
- __all__ = [
61
- "preparar_red",
62
- "step", "run", "set_delta_nfr_hook", "validate_canon",
63
-
64
- "attach_standard_observer", "coherencia_global", "orden_kuramoto",
65
- "GAMMA_REGISTRY", "eval_gamma", "kuramoto_R_psi",
66
- "enforce_canonical_grammar", "on_applied_glifo",
67
- "GLYPHS_CANONICAL", "glyph_angle", "glyph_unit",
68
- "sigma_vector_node", "sigma_vector_global",
69
- "push_sigma_snapshot", "sigma_series", "sigma_rose",
70
- "register_sigma_callback",
71
- "register_metrics_callbacks",
72
- "register_trace",
73
- "Tg_global", "Tg_by_node",
74
- "latency_series", "glifogram_series",
75
- "glyph_top", "glyph_dwell_stats",
76
- "export_history",
77
- "aplicar_remesh_red_topologico",
78
- "play", "seq", "block", "target", "wait", "THOL", "TARGET", "WAIT",
79
- "cli_main", "build_graph", "get_preset", "NodeState",
80
- "ejemplo_canonico_basico",
81
- "create_nfr",
82
- "Operador", "Emision", "Recepcion", "Coherencia", "Disonancia",
83
- "Acoplamiento", "Resonancia", "Silencio", "Expansion", "Contraccion",
84
- "Autoorganizacion", "Mutacion", "Transicion", "Recursividad",
85
- "OPERADORES", "validate_sequence", "run_sequence",
86
- "__version__",
87
- ]
88
-
89
-
1
+ """Minimal public API for :mod:`tnfr`.
2
+
3
+ This package only re-exports a handful of high level helpers. Most
4
+ functionality lives in submodules that should be imported directly, for
5
+ example :mod:`tnfr.metrics`, :mod:`tnfr.observers` or the DSL utilities
6
+ in :mod:`tnfr.tokens`, :mod:`tnfr.flatten` and :mod:`tnfr.execution`.
7
+ Recommended entry points are:
8
+
9
+ - ``step`` and ``run`` in :mod:`tnfr.dynamics`
10
+ - ``preparar_red`` in :mod:`tnfr.ontosim`
11
+ - ``create_nfr`` and ``run_sequence`` in :mod:`tnfr.structural`
12
+ - ``cached_import`` and ``prune_failed_imports`` for optional dependencies
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from .import_utils import cached_import, prune_failed_imports
18
+ from .ontosim import preparar_red
19
+
20
+
21
+ def _missing_dependency(name: str, exc: ImportError):
22
+ def _stub(*args, **kwargs):
23
+ raise ImportError(
24
+ f"{name} is unavailable because required dependencies could not be imported. "
25
+ f"Original error ({exc.__class__.__name__}): {exc}. "
26
+ "Install the missing packages (e.g. 'networkx' or grammar modules)."
27
+ ) from exc
28
+
29
+ return _stub
30
+
31
+
32
+ try: # pragma: no cover - exercised in import tests
33
+ from .dynamics import step, run
34
+ except ImportError as exc: # pragma: no cover - no missing deps in CI
35
+ step = _missing_dependency("step", exc)
36
+ run = _missing_dependency("run", exc)
37
+
38
+
39
+ _HAS_RUN_SEQUENCE = False
40
+ try: # pragma: no cover - exercised in import tests
41
+ from .structural import create_nfr, run_sequence
42
+ except ImportError as exc: # pragma: no cover - no missing deps in CI
43
+ create_nfr = _missing_dependency("create_nfr", exc)
44
+ run_sequence = _missing_dependency("run_sequence", exc)
45
+ else:
46
+ _HAS_RUN_SEQUENCE = True
47
+
48
+
49
+ _metadata = cached_import("importlib.metadata")
50
+ if _metadata is None: # pragma: no cover
51
+ _metadata = cached_import("importlib_metadata")
52
+
53
+ if _metadata is not None: # pragma: no cover
54
+ version = _metadata.version # type: ignore[attr-defined]
55
+ PackageNotFoundError = _metadata.PackageNotFoundError # type: ignore[attr-defined]
56
+ else: # pragma: no cover
57
+
58
+ class PackageNotFoundError(Exception):
59
+ pass
60
+
61
+ def version(_: str) -> str:
62
+ raise PackageNotFoundError
63
+
64
+
65
+ try:
66
+ __version__ = version("tnfr")
67
+ except PackageNotFoundError: # pragma: no cover
68
+ tomllib = cached_import("tomllib")
69
+ if tomllib is not None:
70
+ from pathlib import Path
71
+
72
+ try:
73
+ with (Path(__file__).resolve().parents[2] / "pyproject.toml").open(
74
+ "rb",
75
+ ) as f:
76
+ __version__ = tomllib.load(f)["project"]["version"]
77
+ except (OSError, KeyError, ValueError): # pragma: no cover
78
+ __version__ = "0+unknown"
79
+ else: # pragma: no cover
80
+ __version__ = "0+unknown"
81
+
82
+ __all__ = [
83
+ "__version__",
84
+ "step",
85
+ "run",
86
+ "preparar_red",
87
+ "create_nfr",
88
+ ]
89
+
90
+ if _HAS_RUN_SEQUENCE:
91
+ __all__.append("run_sequence")