tnfr 6.0.0__py3-none-any.whl → 7.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.
Potentially problematic release.
This version of tnfr might be problematic. Click here for more details.
- tnfr/__init__.py +50 -5
- tnfr/__init__.pyi +0 -7
- tnfr/_compat.py +0 -1
- tnfr/_generated_version.py +34 -0
- tnfr/_version.py +44 -2
- tnfr/alias.py +14 -13
- tnfr/alias.pyi +5 -37
- tnfr/cache.py +9 -729
- tnfr/cache.pyi +8 -224
- tnfr/callback_utils.py +16 -31
- tnfr/callback_utils.pyi +3 -29
- tnfr/cli/__init__.py +17 -11
- tnfr/cli/__init__.pyi +0 -21
- tnfr/cli/arguments.py +175 -14
- tnfr/cli/arguments.pyi +5 -11
- tnfr/cli/execution.py +434 -48
- tnfr/cli/execution.pyi +14 -24
- tnfr/cli/utils.py +20 -3
- tnfr/cli/utils.pyi +5 -5
- tnfr/config/__init__.py +2 -1
- tnfr/config/__init__.pyi +2 -0
- tnfr/config/feature_flags.py +83 -0
- tnfr/config/init.py +1 -1
- tnfr/config/operator_names.py +1 -14
- tnfr/config/presets.py +6 -26
- tnfr/constants/__init__.py +10 -13
- tnfr/constants/__init__.pyi +10 -22
- tnfr/constants/aliases.py +31 -0
- tnfr/constants/core.py +4 -3
- tnfr/constants/init.py +1 -1
- tnfr/constants/metric.py +3 -3
- tnfr/dynamics/__init__.py +64 -10
- tnfr/dynamics/__init__.pyi +3 -4
- tnfr/dynamics/adaptation.py +79 -13
- tnfr/dynamics/aliases.py +10 -9
- tnfr/dynamics/coordination.py +77 -35
- tnfr/dynamics/dnfr.py +575 -274
- tnfr/dynamics/dnfr.pyi +1 -10
- tnfr/dynamics/integrators.py +47 -33
- tnfr/dynamics/integrators.pyi +0 -1
- tnfr/dynamics/runtime.py +489 -129
- tnfr/dynamics/sampling.py +2 -0
- tnfr/dynamics/selectors.py +101 -62
- tnfr/execution.py +15 -8
- tnfr/execution.pyi +5 -25
- tnfr/flatten.py +7 -3
- tnfr/flatten.pyi +1 -8
- tnfr/gamma.py +22 -26
- tnfr/gamma.pyi +0 -6
- tnfr/glyph_history.py +37 -26
- tnfr/glyph_history.pyi +1 -19
- tnfr/glyph_runtime.py +16 -0
- tnfr/glyph_runtime.pyi +9 -0
- tnfr/immutable.py +20 -15
- tnfr/immutable.pyi +4 -7
- tnfr/initialization.py +5 -7
- tnfr/initialization.pyi +1 -9
- tnfr/io.py +6 -305
- tnfr/io.pyi +13 -8
- tnfr/mathematics/__init__.py +81 -0
- tnfr/mathematics/backend.py +426 -0
- tnfr/mathematics/dynamics.py +398 -0
- tnfr/mathematics/epi.py +254 -0
- tnfr/mathematics/generators.py +222 -0
- tnfr/mathematics/metrics.py +119 -0
- tnfr/mathematics/operators.py +233 -0
- tnfr/mathematics/operators_factory.py +71 -0
- tnfr/mathematics/projection.py +78 -0
- tnfr/mathematics/runtime.py +173 -0
- tnfr/mathematics/spaces.py +247 -0
- tnfr/mathematics/transforms.py +292 -0
- tnfr/metrics/__init__.py +10 -10
- tnfr/metrics/coherence.py +123 -94
- tnfr/metrics/common.py +22 -13
- tnfr/metrics/common.pyi +42 -11
- tnfr/metrics/core.py +72 -14
- tnfr/metrics/diagnosis.py +48 -57
- tnfr/metrics/diagnosis.pyi +3 -7
- tnfr/metrics/export.py +3 -5
- tnfr/metrics/glyph_timing.py +41 -31
- tnfr/metrics/reporting.py +13 -6
- tnfr/metrics/sense_index.py +884 -114
- tnfr/metrics/trig.py +167 -11
- tnfr/metrics/trig.pyi +1 -0
- tnfr/metrics/trig_cache.py +112 -15
- tnfr/node.py +400 -17
- tnfr/node.pyi +55 -38
- tnfr/observers.py +111 -8
- tnfr/observers.pyi +0 -15
- tnfr/ontosim.py +9 -6
- tnfr/ontosim.pyi +0 -5
- tnfr/operators/__init__.py +529 -42
- tnfr/operators/__init__.pyi +14 -0
- tnfr/operators/definitions.py +350 -18
- tnfr/operators/definitions.pyi +0 -14
- tnfr/operators/grammar.py +760 -0
- tnfr/operators/jitter.py +28 -22
- tnfr/operators/registry.py +7 -12
- tnfr/operators/registry.pyi +0 -2
- tnfr/operators/remesh.py +38 -61
- tnfr/rng.py +17 -300
- tnfr/schemas/__init__.py +8 -0
- tnfr/schemas/grammar.json +94 -0
- tnfr/selector.py +3 -4
- tnfr/selector.pyi +1 -1
- tnfr/sense.py +22 -24
- tnfr/sense.pyi +0 -7
- tnfr/structural.py +504 -21
- tnfr/structural.pyi +41 -18
- tnfr/telemetry/__init__.py +23 -1
- tnfr/telemetry/cache_metrics.py +226 -0
- tnfr/telemetry/nu_f.py +423 -0
- tnfr/telemetry/nu_f.pyi +123 -0
- tnfr/tokens.py +1 -4
- tnfr/tokens.pyi +1 -6
- tnfr/trace.py +20 -53
- tnfr/trace.pyi +9 -37
- tnfr/types.py +244 -15
- tnfr/types.pyi +200 -14
- tnfr/units.py +69 -0
- tnfr/units.pyi +16 -0
- tnfr/utils/__init__.py +107 -48
- tnfr/utils/__init__.pyi +80 -11
- tnfr/utils/cache.py +1705 -65
- tnfr/utils/cache.pyi +370 -58
- tnfr/utils/chunks.py +104 -0
- tnfr/utils/chunks.pyi +21 -0
- tnfr/utils/data.py +95 -5
- tnfr/utils/data.pyi +8 -17
- tnfr/utils/graph.py +2 -4
- tnfr/utils/init.py +31 -7
- tnfr/utils/init.pyi +4 -11
- tnfr/utils/io.py +313 -14
- tnfr/{helpers → utils}/numeric.py +50 -24
- tnfr/utils/numeric.pyi +21 -0
- tnfr/validation/__init__.py +92 -4
- tnfr/validation/__init__.pyi +77 -17
- tnfr/validation/compatibility.py +79 -43
- tnfr/validation/compatibility.pyi +4 -6
- tnfr/validation/grammar.py +55 -133
- tnfr/validation/grammar.pyi +37 -8
- tnfr/validation/graph.py +138 -0
- tnfr/validation/graph.pyi +17 -0
- tnfr/validation/rules.py +161 -74
- tnfr/validation/rules.pyi +55 -18
- tnfr/validation/runtime.py +263 -0
- tnfr/validation/runtime.pyi +31 -0
- tnfr/validation/soft_filters.py +170 -0
- tnfr/validation/soft_filters.pyi +37 -0
- tnfr/validation/spectral.py +159 -0
- tnfr/validation/spectral.pyi +46 -0
- tnfr/validation/syntax.py +28 -139
- tnfr/validation/syntax.pyi +7 -4
- tnfr/validation/window.py +39 -0
- tnfr/validation/window.pyi +1 -0
- tnfr/viz/__init__.py +9 -0
- tnfr/viz/matplotlib.py +246 -0
- {tnfr-6.0.0.dist-info → tnfr-7.0.0.dist-info}/METADATA +63 -19
- tnfr-7.0.0.dist-info/RECORD +185 -0
- {tnfr-6.0.0.dist-info → tnfr-7.0.0.dist-info}/licenses/LICENSE.md +1 -1
- tnfr/constants_glyphs.py +0 -16
- tnfr/constants_glyphs.pyi +0 -12
- tnfr/grammar.py +0 -25
- tnfr/grammar.pyi +0 -13
- tnfr/helpers/__init__.py +0 -151
- tnfr/helpers/__init__.pyi +0 -66
- tnfr/helpers/numeric.pyi +0 -12
- tnfr/presets.py +0 -15
- tnfr/presets.pyi +0 -7
- tnfr/utils/io.pyi +0 -10
- tnfr/utils/validators.py +0 -130
- tnfr/utils/validators.pyi +0 -19
- tnfr-6.0.0.dist-info/RECORD +0 -157
- {tnfr-6.0.0.dist-info → tnfr-7.0.0.dist-info}/WHEEL +0 -0
- {tnfr-6.0.0.dist-info → tnfr-7.0.0.dist-info}/entry_points.txt +0 -0
- {tnfr-6.0.0.dist-info → tnfr-7.0.0.dist-info}/top_level.txt +0 -0
tnfr/units.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Structural unit conversion helpers.
|
|
2
|
+
|
|
3
|
+
The TNFR engine tracks structural dynamics using the ``Hz_str`` unit. A
|
|
4
|
+
single configurable scale factor ``k`` bridges this canonical structural
|
|
5
|
+
frequency with the conventional ``Hz`` base unit. The factor is resolved
|
|
6
|
+
according to the following invariants:
|
|
7
|
+
|
|
8
|
+
* ``k`` is always read from the graph configuration via :func:`get_param` so
|
|
9
|
+
per-graph overrides take precedence over the package defaults.
|
|
10
|
+
* The fallback value comes from :data:`tnfr.constants.DEFAULTS`, ensuring the
|
|
11
|
+
canonical 1 Hz_str↔Hz relationship is preserved when callers do not provide
|
|
12
|
+
explicit overrides.
|
|
13
|
+
* ``k`` must remain strictly positive. Invalid overrides raise
|
|
14
|
+
:class:`ValueError` to prevent incoherent conversions.
|
|
15
|
+
|
|
16
|
+
All helpers defined here operate purely on ``GraphLike`` instances and only
|
|
17
|
+
depend on :mod:`tnfr.constants` for configuration access, keeping the
|
|
18
|
+
conversion logic transparent and side-effect free.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from typing import Final
|
|
24
|
+
|
|
25
|
+
from .constants import get_param
|
|
26
|
+
from .types import GraphLike
|
|
27
|
+
|
|
28
|
+
__all__ = ("get_hz_bridge", "hz_str_to_hz", "hz_to_hz_str")
|
|
29
|
+
|
|
30
|
+
HZ_STR_BRIDGE_KEY: Final[str] = "HZ_STR_BRIDGE"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _coerce_bridge_factor(raw: object) -> float:
|
|
34
|
+
"""Return ``raw`` coerced to a strictly positive floating point factor."""
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
factor = float(raw)
|
|
38
|
+
except (TypeError, ValueError) as exc: # pragma: no cover - defensive guard
|
|
39
|
+
raise TypeError(
|
|
40
|
+
"HZ_STR_BRIDGE must be a real number convertible to float"
|
|
41
|
+
) from exc
|
|
42
|
+
|
|
43
|
+
if factor <= 0.0:
|
|
44
|
+
raise ValueError("HZ_STR_BRIDGE must be strictly positive")
|
|
45
|
+
|
|
46
|
+
return factor
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_hz_bridge(G: GraphLike) -> float:
|
|
50
|
+
"""Return the ``Hz_str``→``Hz`` bridge factor for ``G``.
|
|
51
|
+
|
|
52
|
+
The helper always consults ``G.graph`` via :func:`get_param` so per-graph
|
|
53
|
+
overrides remain authoritative.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
return _coerce_bridge_factor(get_param(G, HZ_STR_BRIDGE_KEY))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def hz_str_to_hz(value: float, G: GraphLike) -> float:
|
|
60
|
+
"""Convert ``value`` expressed in ``Hz_str`` into ``Hz`` using ``G``."""
|
|
61
|
+
|
|
62
|
+
return float(value) * get_hz_bridge(G)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def hz_to_hz_str(value: float, G: GraphLike) -> float:
|
|
66
|
+
"""Convert ``value`` expressed in ``Hz`` into ``Hz_str`` using ``G``."""
|
|
67
|
+
|
|
68
|
+
return float(value) / get_hz_bridge(G)
|
|
69
|
+
|
tnfr/units.pyi
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
from .types import GraphLike
|
|
6
|
+
|
|
7
|
+
__all__ = ("get_hz_bridge", "hz_str_to_hz", "hz_to_hz_str")
|
|
8
|
+
|
|
9
|
+
HZ_STR_BRIDGE_KEY: Final[str]
|
|
10
|
+
|
|
11
|
+
def get_hz_bridge(G: GraphLike) -> float: ...
|
|
12
|
+
|
|
13
|
+
def hz_str_to_hz(value: float, G: GraphLike) -> float: ...
|
|
14
|
+
|
|
15
|
+
def hz_to_hz_str(value: float, G: GraphLike) -> float: ...
|
|
16
|
+
|
tnfr/utils/__init__.py
CHANGED
|
@@ -5,11 +5,69 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import Any, Final
|
|
6
6
|
|
|
7
7
|
from . import init as _init
|
|
8
|
-
from ..
|
|
8
|
+
from ..locking import get_lock
|
|
9
|
+
|
|
10
|
+
WarnOnce = _init.WarnOnce
|
|
11
|
+
cached_import = _init.cached_import
|
|
12
|
+
warm_cached_import = _init.warm_cached_import
|
|
13
|
+
LazyImportProxy = _init.LazyImportProxy
|
|
14
|
+
get_logger = _init.get_logger
|
|
15
|
+
get_nodenx = _init.get_nodenx
|
|
16
|
+
get_numpy = _init.get_numpy
|
|
17
|
+
prune_failed_imports = _init.prune_failed_imports
|
|
18
|
+
warn_once = _init.warn_once
|
|
19
|
+
_configure_root = _init._configure_root
|
|
20
|
+
_reset_logging_state = _init._reset_logging_state
|
|
21
|
+
_reset_import_state = _init._reset_import_state
|
|
22
|
+
_warn_failure = _init._warn_failure
|
|
23
|
+
_FAILED_IMPORT_LIMIT = _init._FAILED_IMPORT_LIMIT
|
|
24
|
+
_DEFAULT_CACHE_SIZE = _init._DEFAULT_CACHE_SIZE
|
|
25
|
+
EMIT_MAP = _init.EMIT_MAP
|
|
26
|
+
|
|
27
|
+
from .cache import (
|
|
28
|
+
CacheCapacityConfig,
|
|
29
|
+
CacheLayer,
|
|
30
|
+
CacheManager,
|
|
31
|
+
CacheStatistics,
|
|
32
|
+
InstrumentedLRUCache,
|
|
33
|
+
ManagedLRUCache,
|
|
34
|
+
MappingCacheLayer,
|
|
35
|
+
RedisCacheLayer,
|
|
36
|
+
ShelveCacheLayer,
|
|
37
|
+
prune_lock_mapping,
|
|
38
|
+
DNFR_PREP_STATE_KEY,
|
|
39
|
+
DnfrPrepState,
|
|
40
|
+
DnfrCache,
|
|
41
|
+
NODE_SET_CHECKSUM_KEY,
|
|
42
|
+
ScopedCounterCache,
|
|
43
|
+
EdgeCacheManager,
|
|
44
|
+
cached_node_list,
|
|
45
|
+
cached_nodes_and_A,
|
|
46
|
+
clear_node_repr_cache,
|
|
47
|
+
configure_graph_cache_limits,
|
|
48
|
+
configure_global_cache_layers,
|
|
49
|
+
edge_version_cache,
|
|
50
|
+
edge_version_update,
|
|
51
|
+
ensure_node_index_map,
|
|
52
|
+
ensure_node_offset_map,
|
|
53
|
+
new_dnfr_cache,
|
|
54
|
+
_SeedHashCache,
|
|
55
|
+
_GRAPH_CACHE_MANAGER_KEY,
|
|
56
|
+
_graph_cache_manager,
|
|
57
|
+
build_cache_manager,
|
|
58
|
+
get_graph_version,
|
|
59
|
+
increment_edge_version,
|
|
60
|
+
increment_graph_version,
|
|
61
|
+
node_set_checksum,
|
|
62
|
+
reset_global_cache_manager,
|
|
63
|
+
stable_json,
|
|
64
|
+
_GRAPH_CACHE_LAYERS_KEY,
|
|
65
|
+
)
|
|
9
66
|
from .data import (
|
|
10
67
|
MAX_MATERIALIZE_DEFAULT,
|
|
11
68
|
STRING_TYPES,
|
|
12
69
|
convert_value,
|
|
70
|
+
normalize_optional_int,
|
|
13
71
|
ensure_collection,
|
|
14
72
|
flatten_structure,
|
|
15
73
|
is_non_string_sequence,
|
|
@@ -19,34 +77,30 @@ from .data import (
|
|
|
19
77
|
normalize_materialize_limit,
|
|
20
78
|
normalize_weights,
|
|
21
79
|
)
|
|
80
|
+
from .chunks import auto_chunk_size, resolve_chunk_size
|
|
22
81
|
from .graph import (
|
|
23
82
|
get_graph,
|
|
24
83
|
get_graph_mapping,
|
|
25
84
|
mark_dnfr_prep_dirty,
|
|
26
85
|
supports_add_edge,
|
|
27
86
|
)
|
|
28
|
-
from .
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,
|
|
87
|
+
from .numeric import (
|
|
88
|
+
angle_diff,
|
|
89
|
+
angle_diff_array,
|
|
90
|
+
clamp,
|
|
91
|
+
clamp01,
|
|
92
|
+
kahan_sum_nd,
|
|
93
|
+
similarity_abs,
|
|
94
|
+
within_range,
|
|
44
95
|
)
|
|
45
96
|
from .io import (
|
|
46
97
|
DEFAULT_PARAMS,
|
|
47
98
|
JsonDumpsParams,
|
|
99
|
+
StructuredFileError,
|
|
48
100
|
clear_orjson_param_warnings,
|
|
49
101
|
json_dumps,
|
|
102
|
+
read_structured_file,
|
|
103
|
+
safe_write,
|
|
50
104
|
)
|
|
51
105
|
|
|
52
106
|
__all__ = (
|
|
@@ -56,11 +110,13 @@ __all__ = (
|
|
|
56
110
|
"warm_cached_import",
|
|
57
111
|
"LazyImportProxy",
|
|
58
112
|
"get_logger",
|
|
113
|
+
"get_lock",
|
|
59
114
|
"get_nodenx",
|
|
60
115
|
"get_numpy",
|
|
61
116
|
"prune_failed_imports",
|
|
62
117
|
"warn_once",
|
|
63
118
|
"convert_value",
|
|
119
|
+
"normalize_optional_int",
|
|
64
120
|
"normalize_weights",
|
|
65
121
|
"normalize_counter",
|
|
66
122
|
"normalize_materialize_limit",
|
|
@@ -71,22 +127,49 @@ __all__ = (
|
|
|
71
127
|
"MAX_MATERIALIZE_DEFAULT",
|
|
72
128
|
"negative_weights_warn_once",
|
|
73
129
|
"mix_groups",
|
|
130
|
+
"angle_diff",
|
|
131
|
+
"angle_diff_array",
|
|
132
|
+
"clamp",
|
|
133
|
+
"clamp01",
|
|
134
|
+
"auto_chunk_size",
|
|
135
|
+
"resolve_chunk_size",
|
|
136
|
+
"CacheCapacityConfig",
|
|
137
|
+
"CacheLayer",
|
|
74
138
|
"CacheManager",
|
|
139
|
+
"CacheStatistics",
|
|
140
|
+
"InstrumentedLRUCache",
|
|
141
|
+
"ManagedLRUCache",
|
|
142
|
+
"MappingCacheLayer",
|
|
143
|
+
"RedisCacheLayer",
|
|
144
|
+
"ShelveCacheLayer",
|
|
145
|
+
"prune_lock_mapping",
|
|
75
146
|
"EdgeCacheManager",
|
|
147
|
+
"DNFR_PREP_STATE_KEY",
|
|
148
|
+
"DnfrPrepState",
|
|
149
|
+
"DnfrCache",
|
|
76
150
|
"NODE_SET_CHECKSUM_KEY",
|
|
151
|
+
"ScopedCounterCache",
|
|
77
152
|
"cached_node_list",
|
|
78
153
|
"cached_nodes_and_A",
|
|
79
154
|
"clear_node_repr_cache",
|
|
80
155
|
"edge_version_cache",
|
|
81
156
|
"edge_version_update",
|
|
157
|
+
"configure_global_cache_layers",
|
|
82
158
|
"ensure_node_index_map",
|
|
83
159
|
"ensure_node_offset_map",
|
|
160
|
+
"new_dnfr_cache",
|
|
84
161
|
"get_graph_version",
|
|
85
162
|
"increment_edge_version",
|
|
86
163
|
"increment_graph_version",
|
|
87
164
|
"configure_graph_cache_limits",
|
|
165
|
+
"build_cache_manager",
|
|
166
|
+
"_graph_cache_manager",
|
|
167
|
+
"_GRAPH_CACHE_MANAGER_KEY",
|
|
88
168
|
"node_set_checksum",
|
|
89
169
|
"stable_json",
|
|
170
|
+
"reset_global_cache_manager",
|
|
171
|
+
"_SeedHashCache",
|
|
172
|
+
"_GRAPH_CACHE_LAYERS_KEY",
|
|
90
173
|
"get_graph",
|
|
91
174
|
"get_graph_mapping",
|
|
92
175
|
"mark_dnfr_prep_dirty",
|
|
@@ -95,8 +178,12 @@ __all__ = (
|
|
|
95
178
|
"DEFAULT_PARAMS",
|
|
96
179
|
"json_dumps",
|
|
97
180
|
"clear_orjson_param_warnings",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
181
|
+
"read_structured_file",
|
|
182
|
+
"safe_write",
|
|
183
|
+
"StructuredFileError",
|
|
184
|
+
"kahan_sum_nd",
|
|
185
|
+
"similarity_abs",
|
|
186
|
+
"within_range",
|
|
100
187
|
"_configure_root",
|
|
101
188
|
"_LOGGING_CONFIGURED",
|
|
102
189
|
"_reset_logging_state",
|
|
@@ -108,23 +195,6 @@ __all__ = (
|
|
|
108
195
|
"EMIT_MAP",
|
|
109
196
|
)
|
|
110
197
|
|
|
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
198
|
#: Mapping of dynamically proxied names to the runtime types they expose.
|
|
129
199
|
#:
|
|
130
200
|
#: ``IMPORT_LOG`` and ``_IMPORT_STATE`` refer to the
|
|
@@ -137,22 +207,11 @@ _DYNAMIC_EXPORT_TYPES: Final[dict[str, type[object]]] = {
|
|
|
137
207
|
"_LOGGING_CONFIGURED": bool,
|
|
138
208
|
}
|
|
139
209
|
_DYNAMIC_EXPORTS: Final[frozenset[str]] = frozenset(_DYNAMIC_EXPORT_TYPES)
|
|
140
|
-
_VALIDATOR_EXPORTS = {"validate_window", "run_validators"}
|
|
141
|
-
|
|
142
|
-
|
|
143
210
|
def __getattr__(name: str) -> Any: # pragma: no cover - trivial delegation
|
|
144
211
|
if name in _DYNAMIC_EXPORTS:
|
|
145
212
|
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
213
|
raise AttributeError(name)
|
|
155
214
|
|
|
156
215
|
|
|
157
216
|
def __dir__() -> list[str]: # pragma: no cover - trivial delegation
|
|
158
|
-
return sorted(set(globals()) | _DYNAMIC_EXPORTS
|
|
217
|
+
return sorted(set(globals()) | set(_DYNAMIC_EXPORTS))
|
tnfr/utils/__init__.pyi
CHANGED
|
@@ -2,28 +2,52 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import Any, Final
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from threading import Lock
|
|
6
|
+
|
|
6
7
|
from .cache import (
|
|
7
|
-
|
|
8
|
+
CacheCapacityConfig,
|
|
9
|
+
CacheLayer,
|
|
10
|
+
CacheManager,
|
|
11
|
+
CacheStatistics,
|
|
12
|
+
InstrumentedLRUCache,
|
|
13
|
+
ManagedLRUCache,
|
|
14
|
+
MappingCacheLayer,
|
|
15
|
+
RedisCacheLayer,
|
|
16
|
+
ShelveCacheLayer,
|
|
17
|
+
prune_lock_mapping,
|
|
18
|
+
DNFR_PREP_STATE_KEY,
|
|
19
|
+
DnfrPrepState,
|
|
20
|
+
DnfrCache,
|
|
8
21
|
NODE_SET_CHECKSUM_KEY,
|
|
22
|
+
ScopedCounterCache,
|
|
23
|
+
EdgeCacheManager,
|
|
9
24
|
cached_node_list,
|
|
10
25
|
cached_nodes_and_A,
|
|
11
26
|
clear_node_repr_cache,
|
|
12
27
|
configure_graph_cache_limits,
|
|
28
|
+
configure_global_cache_layers,
|
|
13
29
|
edge_version_cache,
|
|
14
30
|
edge_version_update,
|
|
15
31
|
ensure_node_index_map,
|
|
16
32
|
ensure_node_offset_map,
|
|
33
|
+
new_dnfr_cache,
|
|
34
|
+
_SeedHashCache,
|
|
35
|
+
_GRAPH_CACHE_MANAGER_KEY,
|
|
36
|
+
_graph_cache_manager,
|
|
37
|
+
build_cache_manager,
|
|
17
38
|
get_graph_version,
|
|
18
39
|
increment_edge_version,
|
|
19
40
|
increment_graph_version,
|
|
20
41
|
node_set_checksum,
|
|
42
|
+
reset_global_cache_manager,
|
|
21
43
|
stable_json,
|
|
44
|
+
_GRAPH_CACHE_LAYERS_KEY,
|
|
22
45
|
)
|
|
23
46
|
from .data import (
|
|
24
47
|
MAX_MATERIALIZE_DEFAULT,
|
|
25
48
|
STRING_TYPES,
|
|
26
49
|
convert_value,
|
|
50
|
+
normalize_optional_int,
|
|
27
51
|
ensure_collection,
|
|
28
52
|
flatten_structure,
|
|
29
53
|
is_non_string_sequence,
|
|
@@ -33,21 +57,31 @@ from .data import (
|
|
|
33
57
|
normalize_materialize_limit,
|
|
34
58
|
normalize_weights,
|
|
35
59
|
)
|
|
60
|
+
from .chunks import auto_chunk_size, resolve_chunk_size
|
|
36
61
|
from .graph import (
|
|
37
62
|
get_graph,
|
|
38
63
|
get_graph_mapping,
|
|
39
64
|
mark_dnfr_prep_dirty,
|
|
40
65
|
supports_add_edge,
|
|
41
66
|
)
|
|
67
|
+
from .numeric import (
|
|
68
|
+
angle_diff,
|
|
69
|
+
angle_diff_array,
|
|
70
|
+
clamp,
|
|
71
|
+
clamp01,
|
|
72
|
+
kahan_sum_nd,
|
|
73
|
+
similarity_abs,
|
|
74
|
+
within_range,
|
|
75
|
+
)
|
|
42
76
|
from .init import (
|
|
43
|
-
EMIT_MAP,
|
|
44
|
-
IMPORT_LOG,
|
|
45
|
-
LazyImportProxy,
|
|
46
|
-
WarnOnce,
|
|
47
77
|
_DEFAULT_CACHE_SIZE,
|
|
48
78
|
_FAILED_IMPORT_LIMIT,
|
|
49
79
|
_IMPORT_STATE,
|
|
50
80
|
_LOGGING_CONFIGURED,
|
|
81
|
+
EMIT_MAP,
|
|
82
|
+
IMPORT_LOG,
|
|
83
|
+
LazyImportProxy,
|
|
84
|
+
WarnOnce,
|
|
51
85
|
_configure_root,
|
|
52
86
|
_reset_import_state,
|
|
53
87
|
_reset_logging_state,
|
|
@@ -63,11 +97,12 @@ from .init import (
|
|
|
63
97
|
from .io import (
|
|
64
98
|
DEFAULT_PARAMS,
|
|
65
99
|
JsonDumpsParams,
|
|
100
|
+
StructuredFileError,
|
|
66
101
|
clear_orjson_param_warnings,
|
|
67
102
|
json_dumps,
|
|
103
|
+
read_structured_file,
|
|
104
|
+
safe_write,
|
|
68
105
|
)
|
|
69
|
-
from .validators import run_validators, validate_window
|
|
70
|
-
|
|
71
106
|
__all__ = (
|
|
72
107
|
"IMPORT_LOG",
|
|
73
108
|
"WarnOnce",
|
|
@@ -75,11 +110,13 @@ __all__ = (
|
|
|
75
110
|
"warm_cached_import",
|
|
76
111
|
"LazyImportProxy",
|
|
77
112
|
"get_logger",
|
|
113
|
+
"get_lock",
|
|
78
114
|
"get_nodenx",
|
|
79
115
|
"get_numpy",
|
|
80
116
|
"prune_failed_imports",
|
|
81
117
|
"warn_once",
|
|
82
118
|
"convert_value",
|
|
119
|
+
"normalize_optional_int",
|
|
83
120
|
"normalize_weights",
|
|
84
121
|
"normalize_counter",
|
|
85
122
|
"normalize_materialize_limit",
|
|
@@ -90,22 +127,49 @@ __all__ = (
|
|
|
90
127
|
"MAX_MATERIALIZE_DEFAULT",
|
|
91
128
|
"negative_weights_warn_once",
|
|
92
129
|
"mix_groups",
|
|
130
|
+
"angle_diff",
|
|
131
|
+
"angle_diff_array",
|
|
132
|
+
"clamp",
|
|
133
|
+
"clamp01",
|
|
134
|
+
"auto_chunk_size",
|
|
135
|
+
"resolve_chunk_size",
|
|
136
|
+
"CacheCapacityConfig",
|
|
137
|
+
"CacheLayer",
|
|
93
138
|
"CacheManager",
|
|
139
|
+
"CacheStatistics",
|
|
140
|
+
"InstrumentedLRUCache",
|
|
141
|
+
"ManagedLRUCache",
|
|
142
|
+
"MappingCacheLayer",
|
|
143
|
+
"RedisCacheLayer",
|
|
144
|
+
"ShelveCacheLayer",
|
|
145
|
+
"prune_lock_mapping",
|
|
94
146
|
"EdgeCacheManager",
|
|
147
|
+
"DNFR_PREP_STATE_KEY",
|
|
148
|
+
"DnfrPrepState",
|
|
149
|
+
"DnfrCache",
|
|
95
150
|
"NODE_SET_CHECKSUM_KEY",
|
|
151
|
+
"ScopedCounterCache",
|
|
96
152
|
"cached_node_list",
|
|
97
153
|
"cached_nodes_and_A",
|
|
98
154
|
"clear_node_repr_cache",
|
|
99
155
|
"edge_version_cache",
|
|
100
156
|
"edge_version_update",
|
|
157
|
+
"configure_global_cache_layers",
|
|
101
158
|
"ensure_node_index_map",
|
|
102
159
|
"ensure_node_offset_map",
|
|
160
|
+
"new_dnfr_cache",
|
|
103
161
|
"get_graph_version",
|
|
104
162
|
"increment_edge_version",
|
|
105
163
|
"increment_graph_version",
|
|
106
164
|
"configure_graph_cache_limits",
|
|
165
|
+
"build_cache_manager",
|
|
166
|
+
"_graph_cache_manager",
|
|
167
|
+
"_GRAPH_CACHE_MANAGER_KEY",
|
|
107
168
|
"node_set_checksum",
|
|
108
169
|
"stable_json",
|
|
170
|
+
"reset_global_cache_manager",
|
|
171
|
+
"_SeedHashCache",
|
|
172
|
+
"_GRAPH_CACHE_LAYERS_KEY",
|
|
109
173
|
"get_graph",
|
|
110
174
|
"get_graph_mapping",
|
|
111
175
|
"mark_dnfr_prep_dirty",
|
|
@@ -114,8 +178,12 @@ __all__ = (
|
|
|
114
178
|
"DEFAULT_PARAMS",
|
|
115
179
|
"json_dumps",
|
|
116
180
|
"clear_orjson_param_warnings",
|
|
117
|
-
"
|
|
118
|
-
"
|
|
181
|
+
"read_structured_file",
|
|
182
|
+
"safe_write",
|
|
183
|
+
"StructuredFileError",
|
|
184
|
+
"kahan_sum_nd",
|
|
185
|
+
"similarity_abs",
|
|
186
|
+
"within_range",
|
|
119
187
|
"_configure_root",
|
|
120
188
|
"_LOGGING_CONFIGURED",
|
|
121
189
|
"_reset_logging_state",
|
|
@@ -127,7 +195,8 @@ __all__ = (
|
|
|
127
195
|
"EMIT_MAP",
|
|
128
196
|
)
|
|
129
197
|
|
|
130
|
-
|
|
198
|
+
def get_lock(name: str, /) -> Lock: ...
|
|
131
199
|
|
|
200
|
+
_DYNAMIC_EXPORTS: Final[frozenset[str]]
|
|
132
201
|
|
|
133
202
|
def __getattr__(name: str) -> Any: ...
|