tnfr 4.5.1__py3-none-any.whl → 6.0.0__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.
- tnfr/__init__.py +270 -90
- tnfr/__init__.pyi +40 -0
- tnfr/_compat.py +11 -0
- tnfr/_version.py +7 -0
- tnfr/_version.pyi +7 -0
- tnfr/alias.py +631 -0
- tnfr/alias.pyi +140 -0
- tnfr/cache.py +732 -0
- tnfr/cache.pyi +232 -0
- tnfr/callback_utils.py +381 -0
- tnfr/callback_utils.pyi +105 -0
- tnfr/cli/__init__.py +89 -0
- tnfr/cli/__init__.pyi +47 -0
- tnfr/cli/arguments.py +199 -0
- tnfr/cli/arguments.pyi +33 -0
- tnfr/cli/execution.py +322 -0
- tnfr/cli/execution.pyi +80 -0
- tnfr/cli/utils.py +34 -0
- tnfr/cli/utils.pyi +8 -0
- tnfr/config/__init__.py +12 -0
- tnfr/config/__init__.pyi +8 -0
- tnfr/config/constants.py +104 -0
- tnfr/config/constants.pyi +12 -0
- tnfr/config/init.py +36 -0
- tnfr/config/init.pyi +8 -0
- tnfr/config/operator_names.py +106 -0
- tnfr/config/operator_names.pyi +28 -0
- tnfr/config/presets.py +104 -0
- tnfr/config/presets.pyi +7 -0
- tnfr/constants/__init__.py +228 -0
- tnfr/constants/__init__.pyi +104 -0
- tnfr/constants/core.py +158 -0
- tnfr/constants/core.pyi +17 -0
- tnfr/constants/init.py +31 -0
- tnfr/constants/init.pyi +12 -0
- tnfr/constants/metric.py +102 -0
- tnfr/constants/metric.pyi +19 -0
- tnfr/constants_glyphs.py +16 -0
- tnfr/constants_glyphs.pyi +12 -0
- tnfr/dynamics/__init__.py +136 -0
- tnfr/dynamics/__init__.pyi +83 -0
- tnfr/dynamics/adaptation.py +201 -0
- tnfr/dynamics/aliases.py +22 -0
- tnfr/dynamics/coordination.py +343 -0
- tnfr/dynamics/dnfr.py +2315 -0
- tnfr/dynamics/dnfr.pyi +33 -0
- tnfr/dynamics/integrators.py +561 -0
- tnfr/dynamics/integrators.pyi +35 -0
- tnfr/dynamics/runtime.py +521 -0
- tnfr/dynamics/sampling.py +34 -0
- tnfr/dynamics/sampling.pyi +7 -0
- tnfr/dynamics/selectors.py +680 -0
- tnfr/execution.py +216 -0
- tnfr/execution.pyi +65 -0
- tnfr/flatten.py +283 -0
- tnfr/flatten.pyi +28 -0
- tnfr/gamma.py +320 -89
- tnfr/gamma.pyi +40 -0
- tnfr/glyph_history.py +337 -0
- tnfr/glyph_history.pyi +53 -0
- tnfr/grammar.py +23 -153
- tnfr/grammar.pyi +13 -0
- tnfr/helpers/__init__.py +151 -0
- tnfr/helpers/__init__.pyi +66 -0
- tnfr/helpers/numeric.py +88 -0
- tnfr/helpers/numeric.pyi +12 -0
- tnfr/immutable.py +214 -0
- tnfr/immutable.pyi +37 -0
- tnfr/initialization.py +199 -0
- tnfr/initialization.pyi +73 -0
- tnfr/io.py +311 -0
- tnfr/io.pyi +11 -0
- tnfr/locking.py +37 -0
- tnfr/locking.pyi +7 -0
- tnfr/metrics/__init__.py +41 -0
- tnfr/metrics/__init__.pyi +20 -0
- tnfr/metrics/coherence.py +1469 -0
- tnfr/metrics/common.py +149 -0
- tnfr/metrics/common.pyi +15 -0
- tnfr/metrics/core.py +259 -0
- tnfr/metrics/core.pyi +13 -0
- tnfr/metrics/diagnosis.py +840 -0
- tnfr/metrics/diagnosis.pyi +89 -0
- tnfr/metrics/export.py +151 -0
- tnfr/metrics/glyph_timing.py +369 -0
- tnfr/metrics/reporting.py +152 -0
- tnfr/metrics/reporting.pyi +12 -0
- tnfr/metrics/sense_index.py +294 -0
- tnfr/metrics/sense_index.pyi +9 -0
- tnfr/metrics/trig.py +216 -0
- tnfr/metrics/trig.pyi +12 -0
- tnfr/metrics/trig_cache.py +105 -0
- tnfr/metrics/trig_cache.pyi +10 -0
- tnfr/node.py +255 -177
- tnfr/node.pyi +161 -0
- tnfr/observers.py +154 -150
- tnfr/observers.pyi +46 -0
- tnfr/ontosim.py +135 -134
- tnfr/ontosim.pyi +33 -0
- tnfr/operators/__init__.py +452 -0
- tnfr/operators/__init__.pyi +31 -0
- tnfr/operators/definitions.py +181 -0
- tnfr/operators/definitions.pyi +92 -0
- tnfr/operators/jitter.py +266 -0
- tnfr/operators/jitter.pyi +11 -0
- tnfr/operators/registry.py +80 -0
- tnfr/operators/registry.pyi +15 -0
- tnfr/operators/remesh.py +569 -0
- tnfr/presets.py +10 -23
- tnfr/presets.pyi +7 -0
- tnfr/py.typed +0 -0
- tnfr/rng.py +440 -0
- tnfr/rng.pyi +14 -0
- tnfr/selector.py +217 -0
- tnfr/selector.pyi +19 -0
- tnfr/sense.py +307 -142
- tnfr/sense.pyi +30 -0
- tnfr/structural.py +69 -164
- tnfr/structural.pyi +46 -0
- tnfr/telemetry/__init__.py +13 -0
- tnfr/telemetry/verbosity.py +37 -0
- tnfr/tokens.py +61 -0
- tnfr/tokens.pyi +41 -0
- tnfr/trace.py +520 -95
- tnfr/trace.pyi +68 -0
- tnfr/types.py +382 -17
- tnfr/types.pyi +145 -0
- tnfr/utils/__init__.py +158 -0
- tnfr/utils/__init__.pyi +133 -0
- tnfr/utils/cache.py +755 -0
- tnfr/utils/cache.pyi +156 -0
- tnfr/utils/data.py +267 -0
- tnfr/utils/data.pyi +73 -0
- tnfr/utils/graph.py +87 -0
- tnfr/utils/graph.pyi +10 -0
- tnfr/utils/init.py +746 -0
- tnfr/utils/init.pyi +85 -0
- tnfr/utils/io.py +157 -0
- tnfr/utils/io.pyi +10 -0
- tnfr/utils/validators.py +130 -0
- tnfr/utils/validators.pyi +19 -0
- tnfr/validation/__init__.py +25 -0
- tnfr/validation/__init__.pyi +17 -0
- tnfr/validation/compatibility.py +59 -0
- tnfr/validation/compatibility.pyi +8 -0
- tnfr/validation/grammar.py +149 -0
- tnfr/validation/grammar.pyi +11 -0
- tnfr/validation/rules.py +194 -0
- tnfr/validation/rules.pyi +18 -0
- tnfr/validation/syntax.py +151 -0
- tnfr/validation/syntax.pyi +7 -0
- tnfr-6.0.0.dist-info/METADATA +135 -0
- tnfr-6.0.0.dist-info/RECORD +157 -0
- tnfr/cli.py +0 -322
- tnfr/config.py +0 -41
- tnfr/constants.py +0 -277
- tnfr/dynamics.py +0 -814
- tnfr/helpers.py +0 -264
- tnfr/main.py +0 -47
- tnfr/metrics.py +0 -597
- tnfr/operators.py +0 -525
- tnfr/program.py +0 -176
- tnfr/scenarios.py +0 -34
- tnfr/validators.py +0 -38
- tnfr-4.5.1.dist-info/METADATA +0 -221
- tnfr-4.5.1.dist-info/RECORD +0 -28
- {tnfr-4.5.1.dist-info → tnfr-6.0.0.dist-info}/WHEEL +0 -0
- {tnfr-4.5.1.dist-info → tnfr-6.0.0.dist-info}/entry_points.txt +0 -0
- {tnfr-4.5.1.dist-info → tnfr-6.0.0.dist-info}/licenses/LICENSE.md +0 -0
- {tnfr-4.5.1.dist-info → tnfr-6.0.0.dist-info}/top_level.txt +0 -0
tnfr/utils/__init__.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""Shared utility helpers exposed under :mod:`tnfr.utils`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Final
|
|
6
|
+
|
|
7
|
+
from . import init as _init
|
|
8
|
+
from ..cache import CacheManager
|
|
9
|
+
from .data import (
|
|
10
|
+
MAX_MATERIALIZE_DEFAULT,
|
|
11
|
+
STRING_TYPES,
|
|
12
|
+
convert_value,
|
|
13
|
+
ensure_collection,
|
|
14
|
+
flatten_structure,
|
|
15
|
+
is_non_string_sequence,
|
|
16
|
+
mix_groups,
|
|
17
|
+
negative_weights_warn_once,
|
|
18
|
+
normalize_counter,
|
|
19
|
+
normalize_materialize_limit,
|
|
20
|
+
normalize_weights,
|
|
21
|
+
)
|
|
22
|
+
from .graph import (
|
|
23
|
+
get_graph,
|
|
24
|
+
get_graph_mapping,
|
|
25
|
+
mark_dnfr_prep_dirty,
|
|
26
|
+
supports_add_edge,
|
|
27
|
+
)
|
|
28
|
+
from .cache import (
|
|
29
|
+
EdgeCacheManager,
|
|
30
|
+
NODE_SET_CHECKSUM_KEY,
|
|
31
|
+
cached_node_list,
|
|
32
|
+
cached_nodes_and_A,
|
|
33
|
+
clear_node_repr_cache,
|
|
34
|
+
edge_version_cache,
|
|
35
|
+
edge_version_update,
|
|
36
|
+
ensure_node_index_map,
|
|
37
|
+
ensure_node_offset_map,
|
|
38
|
+
get_graph_version,
|
|
39
|
+
increment_edge_version,
|
|
40
|
+
increment_graph_version,
|
|
41
|
+
configure_graph_cache_limits,
|
|
42
|
+
node_set_checksum,
|
|
43
|
+
stable_json,
|
|
44
|
+
)
|
|
45
|
+
from .io import (
|
|
46
|
+
DEFAULT_PARAMS,
|
|
47
|
+
JsonDumpsParams,
|
|
48
|
+
clear_orjson_param_warnings,
|
|
49
|
+
json_dumps,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
__all__ = (
|
|
53
|
+
"IMPORT_LOG",
|
|
54
|
+
"WarnOnce",
|
|
55
|
+
"cached_import",
|
|
56
|
+
"warm_cached_import",
|
|
57
|
+
"LazyImportProxy",
|
|
58
|
+
"get_logger",
|
|
59
|
+
"get_nodenx",
|
|
60
|
+
"get_numpy",
|
|
61
|
+
"prune_failed_imports",
|
|
62
|
+
"warn_once",
|
|
63
|
+
"convert_value",
|
|
64
|
+
"normalize_weights",
|
|
65
|
+
"normalize_counter",
|
|
66
|
+
"normalize_materialize_limit",
|
|
67
|
+
"ensure_collection",
|
|
68
|
+
"flatten_structure",
|
|
69
|
+
"is_non_string_sequence",
|
|
70
|
+
"STRING_TYPES",
|
|
71
|
+
"MAX_MATERIALIZE_DEFAULT",
|
|
72
|
+
"negative_weights_warn_once",
|
|
73
|
+
"mix_groups",
|
|
74
|
+
"CacheManager",
|
|
75
|
+
"EdgeCacheManager",
|
|
76
|
+
"NODE_SET_CHECKSUM_KEY",
|
|
77
|
+
"cached_node_list",
|
|
78
|
+
"cached_nodes_and_A",
|
|
79
|
+
"clear_node_repr_cache",
|
|
80
|
+
"edge_version_cache",
|
|
81
|
+
"edge_version_update",
|
|
82
|
+
"ensure_node_index_map",
|
|
83
|
+
"ensure_node_offset_map",
|
|
84
|
+
"get_graph_version",
|
|
85
|
+
"increment_edge_version",
|
|
86
|
+
"increment_graph_version",
|
|
87
|
+
"configure_graph_cache_limits",
|
|
88
|
+
"node_set_checksum",
|
|
89
|
+
"stable_json",
|
|
90
|
+
"get_graph",
|
|
91
|
+
"get_graph_mapping",
|
|
92
|
+
"mark_dnfr_prep_dirty",
|
|
93
|
+
"supports_add_edge",
|
|
94
|
+
"JsonDumpsParams",
|
|
95
|
+
"DEFAULT_PARAMS",
|
|
96
|
+
"json_dumps",
|
|
97
|
+
"clear_orjson_param_warnings",
|
|
98
|
+
"validate_window",
|
|
99
|
+
"run_validators",
|
|
100
|
+
"_configure_root",
|
|
101
|
+
"_LOGGING_CONFIGURED",
|
|
102
|
+
"_reset_logging_state",
|
|
103
|
+
"_reset_import_state",
|
|
104
|
+
"_IMPORT_STATE",
|
|
105
|
+
"_warn_failure",
|
|
106
|
+
"_FAILED_IMPORT_LIMIT",
|
|
107
|
+
"_DEFAULT_CACHE_SIZE",
|
|
108
|
+
"EMIT_MAP",
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
WarnOnce = _init.WarnOnce
|
|
112
|
+
cached_import = _init.cached_import
|
|
113
|
+
warm_cached_import = _init.warm_cached_import
|
|
114
|
+
LazyImportProxy = _init.LazyImportProxy
|
|
115
|
+
get_logger = _init.get_logger
|
|
116
|
+
get_nodenx = _init.get_nodenx
|
|
117
|
+
get_numpy = _init.get_numpy
|
|
118
|
+
prune_failed_imports = _init.prune_failed_imports
|
|
119
|
+
warn_once = _init.warn_once
|
|
120
|
+
_configure_root = _init._configure_root
|
|
121
|
+
_reset_logging_state = _init._reset_logging_state
|
|
122
|
+
_reset_import_state = _init._reset_import_state
|
|
123
|
+
_warn_failure = _init._warn_failure
|
|
124
|
+
_FAILED_IMPORT_LIMIT = _init._FAILED_IMPORT_LIMIT
|
|
125
|
+
_DEFAULT_CACHE_SIZE = _init._DEFAULT_CACHE_SIZE
|
|
126
|
+
EMIT_MAP = _init.EMIT_MAP
|
|
127
|
+
|
|
128
|
+
#: Mapping of dynamically proxied names to the runtime types they expose.
|
|
129
|
+
#:
|
|
130
|
+
#: ``IMPORT_LOG`` and ``_IMPORT_STATE`` refer to the
|
|
131
|
+
#: :class:`~tnfr.utils.init.ImportRegistry` instance that tracks cached import
|
|
132
|
+
#: metadata, while ``_LOGGING_CONFIGURED`` is the module-level flag guarding the
|
|
133
|
+
#: lazy logging bootstrap performed in :mod:`tnfr.utils.init`.
|
|
134
|
+
_DYNAMIC_EXPORT_TYPES: Final[dict[str, type[object]]] = {
|
|
135
|
+
"IMPORT_LOG": _init.ImportRegistry,
|
|
136
|
+
"_IMPORT_STATE": _init.ImportRegistry,
|
|
137
|
+
"_LOGGING_CONFIGURED": bool,
|
|
138
|
+
}
|
|
139
|
+
_DYNAMIC_EXPORTS: Final[frozenset[str]] = frozenset(_DYNAMIC_EXPORT_TYPES)
|
|
140
|
+
_VALIDATOR_EXPORTS = {"validate_window", "run_validators"}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def __getattr__(name: str) -> Any: # pragma: no cover - trivial delegation
|
|
144
|
+
if name in _DYNAMIC_EXPORTS:
|
|
145
|
+
return getattr(_init, name)
|
|
146
|
+
if name in _VALIDATOR_EXPORTS:
|
|
147
|
+
if name == "validate_window":
|
|
148
|
+
from .validators import validate_window as _validate_window
|
|
149
|
+
|
|
150
|
+
return _validate_window
|
|
151
|
+
from .validators import run_validators as _run_validators
|
|
152
|
+
|
|
153
|
+
return _run_validators
|
|
154
|
+
raise AttributeError(name)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def __dir__() -> list[str]: # pragma: no cover - trivial delegation
|
|
158
|
+
return sorted(set(globals()) | _DYNAMIC_EXPORTS | _VALIDATOR_EXPORTS)
|
tnfr/utils/__init__.pyi
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Final
|
|
4
|
+
|
|
5
|
+
from ..cache import CacheManager
|
|
6
|
+
from .cache import (
|
|
7
|
+
EdgeCacheManager,
|
|
8
|
+
NODE_SET_CHECKSUM_KEY,
|
|
9
|
+
cached_node_list,
|
|
10
|
+
cached_nodes_and_A,
|
|
11
|
+
clear_node_repr_cache,
|
|
12
|
+
configure_graph_cache_limits,
|
|
13
|
+
edge_version_cache,
|
|
14
|
+
edge_version_update,
|
|
15
|
+
ensure_node_index_map,
|
|
16
|
+
ensure_node_offset_map,
|
|
17
|
+
get_graph_version,
|
|
18
|
+
increment_edge_version,
|
|
19
|
+
increment_graph_version,
|
|
20
|
+
node_set_checksum,
|
|
21
|
+
stable_json,
|
|
22
|
+
)
|
|
23
|
+
from .data import (
|
|
24
|
+
MAX_MATERIALIZE_DEFAULT,
|
|
25
|
+
STRING_TYPES,
|
|
26
|
+
convert_value,
|
|
27
|
+
ensure_collection,
|
|
28
|
+
flatten_structure,
|
|
29
|
+
is_non_string_sequence,
|
|
30
|
+
mix_groups,
|
|
31
|
+
negative_weights_warn_once,
|
|
32
|
+
normalize_counter,
|
|
33
|
+
normalize_materialize_limit,
|
|
34
|
+
normalize_weights,
|
|
35
|
+
)
|
|
36
|
+
from .graph import (
|
|
37
|
+
get_graph,
|
|
38
|
+
get_graph_mapping,
|
|
39
|
+
mark_dnfr_prep_dirty,
|
|
40
|
+
supports_add_edge,
|
|
41
|
+
)
|
|
42
|
+
from .init import (
|
|
43
|
+
EMIT_MAP,
|
|
44
|
+
IMPORT_LOG,
|
|
45
|
+
LazyImportProxy,
|
|
46
|
+
WarnOnce,
|
|
47
|
+
_DEFAULT_CACHE_SIZE,
|
|
48
|
+
_FAILED_IMPORT_LIMIT,
|
|
49
|
+
_IMPORT_STATE,
|
|
50
|
+
_LOGGING_CONFIGURED,
|
|
51
|
+
_configure_root,
|
|
52
|
+
_reset_import_state,
|
|
53
|
+
_reset_logging_state,
|
|
54
|
+
_warn_failure,
|
|
55
|
+
cached_import,
|
|
56
|
+
get_logger,
|
|
57
|
+
get_nodenx,
|
|
58
|
+
get_numpy,
|
|
59
|
+
prune_failed_imports,
|
|
60
|
+
warm_cached_import,
|
|
61
|
+
warn_once,
|
|
62
|
+
)
|
|
63
|
+
from .io import (
|
|
64
|
+
DEFAULT_PARAMS,
|
|
65
|
+
JsonDumpsParams,
|
|
66
|
+
clear_orjson_param_warnings,
|
|
67
|
+
json_dumps,
|
|
68
|
+
)
|
|
69
|
+
from .validators import run_validators, validate_window
|
|
70
|
+
|
|
71
|
+
__all__ = (
|
|
72
|
+
"IMPORT_LOG",
|
|
73
|
+
"WarnOnce",
|
|
74
|
+
"cached_import",
|
|
75
|
+
"warm_cached_import",
|
|
76
|
+
"LazyImportProxy",
|
|
77
|
+
"get_logger",
|
|
78
|
+
"get_nodenx",
|
|
79
|
+
"get_numpy",
|
|
80
|
+
"prune_failed_imports",
|
|
81
|
+
"warn_once",
|
|
82
|
+
"convert_value",
|
|
83
|
+
"normalize_weights",
|
|
84
|
+
"normalize_counter",
|
|
85
|
+
"normalize_materialize_limit",
|
|
86
|
+
"ensure_collection",
|
|
87
|
+
"flatten_structure",
|
|
88
|
+
"is_non_string_sequence",
|
|
89
|
+
"STRING_TYPES",
|
|
90
|
+
"MAX_MATERIALIZE_DEFAULT",
|
|
91
|
+
"negative_weights_warn_once",
|
|
92
|
+
"mix_groups",
|
|
93
|
+
"CacheManager",
|
|
94
|
+
"EdgeCacheManager",
|
|
95
|
+
"NODE_SET_CHECKSUM_KEY",
|
|
96
|
+
"cached_node_list",
|
|
97
|
+
"cached_nodes_and_A",
|
|
98
|
+
"clear_node_repr_cache",
|
|
99
|
+
"edge_version_cache",
|
|
100
|
+
"edge_version_update",
|
|
101
|
+
"ensure_node_index_map",
|
|
102
|
+
"ensure_node_offset_map",
|
|
103
|
+
"get_graph_version",
|
|
104
|
+
"increment_edge_version",
|
|
105
|
+
"increment_graph_version",
|
|
106
|
+
"configure_graph_cache_limits",
|
|
107
|
+
"node_set_checksum",
|
|
108
|
+
"stable_json",
|
|
109
|
+
"get_graph",
|
|
110
|
+
"get_graph_mapping",
|
|
111
|
+
"mark_dnfr_prep_dirty",
|
|
112
|
+
"supports_add_edge",
|
|
113
|
+
"JsonDumpsParams",
|
|
114
|
+
"DEFAULT_PARAMS",
|
|
115
|
+
"json_dumps",
|
|
116
|
+
"clear_orjson_param_warnings",
|
|
117
|
+
"validate_window",
|
|
118
|
+
"run_validators",
|
|
119
|
+
"_configure_root",
|
|
120
|
+
"_LOGGING_CONFIGURED",
|
|
121
|
+
"_reset_logging_state",
|
|
122
|
+
"_reset_import_state",
|
|
123
|
+
"_IMPORT_STATE",
|
|
124
|
+
"_warn_failure",
|
|
125
|
+
"_FAILED_IMPORT_LIMIT",
|
|
126
|
+
"_DEFAULT_CACHE_SIZE",
|
|
127
|
+
"EMIT_MAP",
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
_DYNAMIC_EXPORTS: Final[frozenset[str]]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def __getattr__(name: str) -> Any: ...
|