naeural-core 7.7.246__py3-none-any.whl → 7.7.247__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.
- naeural_core/local_libraries/config_handler_mixin.py +81 -9
- naeural_core/main/ver.py +1 -1
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.247.dist-info}/METADATA +1 -1
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.247.dist-info}/RECORD +6 -6
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.247.dist-info}/WHEEL +0 -0
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.247.dist-info}/licenses/LICENSE +0 -0
|
@@ -208,8 +208,58 @@ class _ConfigHandlerMixin(object):
|
|
|
208
208
|
|
|
209
209
|
|
|
210
210
|
def create_config_handlers(self, verbose=0):
|
|
211
|
-
if hasattr(self, 'config_data') and isinstance(self.config_data, dict) and len(self.config_data) > 0:
|
|
212
|
-
|
|
211
|
+
if not (hasattr(self, 'config_data') and isinstance(self.config_data, dict) and len(self.config_data) > 0):
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
cache_enabled = False
|
|
215
|
+
if hasattr(self, 'log') and hasattr(self.log, 'config_data'):
|
|
216
|
+
cache_enabled = self.log.config_data.get('BM_CACHE_CONFIG_HANDLERS', False)
|
|
217
|
+
|
|
218
|
+
res = []
|
|
219
|
+
cls = type(self)
|
|
220
|
+
|
|
221
|
+
if cache_enabled:
|
|
222
|
+
# 1) Ensure BasePluginExecutor base keys are created once (no import)
|
|
223
|
+
base_cls = next((c for c in cls.mro() if c.__name__ == "BasePluginExecutor"), None)
|
|
224
|
+
if base_cls is not None:
|
|
225
|
+
base_created = getattr(base_cls, '_cfg_keys_created', None)
|
|
226
|
+
if base_created is None:
|
|
227
|
+
base_created = set()
|
|
228
|
+
setattr(base_cls, '_cfg_keys_created', base_created)
|
|
229
|
+
|
|
230
|
+
base_cfg = getattr(base_cls, 'CONFIG', {}) or {}
|
|
231
|
+
base_keys = set(base_cfg.keys())
|
|
232
|
+
missing_base = base_keys - base_created
|
|
233
|
+
|
|
234
|
+
for k in missing_base:
|
|
235
|
+
func_name = self._get_prop(k)
|
|
236
|
+
if not hasattr(base_cls, func_name):
|
|
237
|
+
fnc = partial(getter, key=k) # create the func
|
|
238
|
+
fnc_prop = property(fget=fnc, doc="Get '{}' from config_data".format(k)) # create prop from func
|
|
239
|
+
setattr(base_cls, func_name, fnc_prop) # set the prop of the class
|
|
240
|
+
base_created.add(k)
|
|
241
|
+
|
|
242
|
+
# 2) Per-subclass cache for extra keys
|
|
243
|
+
created_keys = getattr(cls, '_cfg_keys_created', None)
|
|
244
|
+
if created_keys is None:
|
|
245
|
+
created_keys = set()
|
|
246
|
+
setattr(cls, '_cfg_keys_created', created_keys)
|
|
247
|
+
|
|
248
|
+
current_keys = set(self.config_data.keys())
|
|
249
|
+
missing_keys = current_keys - created_keys
|
|
250
|
+
|
|
251
|
+
for k in missing_keys:
|
|
252
|
+
func_name = self._get_prop(k)
|
|
253
|
+
if not hasattr(cls, func_name):
|
|
254
|
+
# below is a bit tricky: using a lambda generates a non-deterministic abnormal behavior
|
|
255
|
+
# the ideea is to create a global func instance that wil be then loaded on the class (not instance)
|
|
256
|
+
# as a descriptor object - ie a `property`. "many Bothans died to bring the plans of the Death Star..."
|
|
257
|
+
fnc = partial(getter, key=k) # create the func
|
|
258
|
+
fnc_prop = property(fget=fnc, doc="Get '{}' from config_data".format(k)) # create prop from func
|
|
259
|
+
setattr(cls, func_name, fnc_prop) # set the prop of the class
|
|
260
|
+
res.append(func_name)
|
|
261
|
+
created_keys.add(k)
|
|
262
|
+
else:
|
|
213
263
|
for k in self.config_data:
|
|
214
264
|
func_name = self._get_prop(k)
|
|
215
265
|
if not hasattr(self, func_name):
|
|
@@ -217,13 +267,13 @@ class _ConfigHandlerMixin(object):
|
|
|
217
267
|
# the ideea is to create a global func instance that wil be then loaded on the class (not instance)
|
|
218
268
|
# as a descriptor object - ie a `property`. "many Bothans died to bring the plans of the Death Star..."
|
|
219
269
|
fnc = partial(getter, key=k) # create the func
|
|
220
|
-
cls = type(self) # get the class
|
|
221
270
|
fnc_prop = property(fget=fnc, doc="Get '{}' from config_data".format(k)) # create prop from func
|
|
222
271
|
setattr(cls, func_name, fnc_prop) # set the prop of the class
|
|
223
272
|
res.append(func_name)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
self.
|
|
273
|
+
|
|
274
|
+
if len(res) > 0 and verbose > 1:
|
|
275
|
+
self.P("Created '{}' config_data handlers: {}".format(self.__class__.__name__, res), color='b')
|
|
276
|
+
self.__cfg_ready = True
|
|
227
277
|
return
|
|
228
278
|
|
|
229
279
|
|
|
@@ -480,12 +530,34 @@ class _ConfigHandlerMixin(object):
|
|
|
480
530
|
for msg in fail_msgs:
|
|
481
531
|
self.add_error(msg)
|
|
482
532
|
|
|
483
|
-
|
|
484
|
-
|
|
533
|
+
cache_enabled = False
|
|
534
|
+
if hasattr(self, 'log') and hasattr(self.log, 'config_data'):
|
|
535
|
+
cache_enabled = self.log.config_data.get('BM_CACHE_VALIDATORS', False)
|
|
536
|
+
|
|
537
|
+
if cache_enabled:
|
|
538
|
+
cls = self.__class__
|
|
539
|
+
validators = getattr(cls, "_cfg_validators", None)
|
|
540
|
+
if validators is None:
|
|
541
|
+
validators = []
|
|
542
|
+
for method_name, func in self.log.get_class_methods(cls, include_parent=True):
|
|
543
|
+
if method_name.startswith('validate_'):
|
|
544
|
+
validators.append(func)
|
|
545
|
+
setattr(cls, "_cfg_validators", validators)
|
|
546
|
+
|
|
547
|
+
for func in validators:
|
|
485
548
|
try:
|
|
486
549
|
func(self)
|
|
487
550
|
except:
|
|
488
|
-
self.add_error("Programming error in validation method '{}'.\n{}".format(
|
|
551
|
+
self.add_error("Programming error in validation method '{}'.\n{}".format(
|
|
552
|
+
func.__name__, traceback.format_exc()))
|
|
553
|
+
else:
|
|
554
|
+
for method_name, func in self.log.get_class_methods(self.__class__, include_parent=True):
|
|
555
|
+
if method_name.startswith('validate_'):
|
|
556
|
+
try:
|
|
557
|
+
func(self)
|
|
558
|
+
except:
|
|
559
|
+
self.add_error("Programming error in validation method '{}'.\n{}".format(
|
|
560
|
+
method_name, traceback.format_exc()))
|
|
489
561
|
|
|
490
562
|
lst_errors = self.get_errors()
|
|
491
563
|
lst_warnings = self.get_warnings()
|
naeural_core/main/ver.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: naeural_core
|
|
3
|
-
Version: 7.7.
|
|
3
|
+
Version: 7.7.247
|
|
4
4
|
Summary: Ratio1 Core is the backbone of the Ratio1 Edge Protocol.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Ratio1/naeural_core
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/Ratio1/naeural_core/issues
|
|
@@ -207,7 +207,7 @@ naeural_core/local_libraries/__init__.py,sha256=j1oqXOivpe5pu-yUfJdNuuSbTv-jw2uk
|
|
|
207
207
|
naeural_core/local_libraries/azure_logger.py,sha256=VC-8UnleVzG5NHcAw7fvM1XmYwUv4-x5SlfD_Xrx-cg,2910
|
|
208
208
|
naeural_core/local_libraries/clustering.py,sha256=J0GNywMNrQcYVI4Ty0aaS86cR-ztXygZTp2N9j-T4Hk,3051
|
|
209
209
|
naeural_core/local_libraries/config.txt,sha256=sOe3IGuBPCNZOMm4cxf5D7ukDYLV5qsM-q0acGqPJCA,70
|
|
210
|
-
naeural_core/local_libraries/config_handler_mixin.py,sha256=
|
|
210
|
+
naeural_core/local_libraries/config_handler_mixin.py,sha256=8O2s19XUxLy3AeH7RyZ3OYfGELkIaTzrgbE1r9zNcAc,22015
|
|
211
211
|
naeural_core/local_libraries/custom_layers.py,sha256=5ajYAPCjmwpHNwwf9KjZwXkMM_D-nDoebFB_4DpPuQQ,1297
|
|
212
212
|
naeural_core/local_libraries/decorators.py,sha256=dSGH3TZAMizEuemc2I_tRUETFnCaFv57Vp94GuzsKGA,224
|
|
213
213
|
naeural_core/local_libraries/model_helper.inf,sha256=Xws-UlelG5wEltHfcH7CzZBCrjjL_4aJdxl34MltZW0,22
|
|
@@ -345,7 +345,7 @@ naeural_core/main/geoloc.py,sha256=TEqyuNzpVqZSBCo0OOrpHYncIsHSClvRt28hgvxJ35o,2
|
|
|
345
345
|
naeural_core/main/main_loop_data_handler.py,sha256=hABB65OUBhtur3rd2mYsEhdAc54jVILzybrvxml5h0s,13815
|
|
346
346
|
naeural_core/main/net_mon.py,sha256=qlyo1fqTeQy_M9VfJOxon_PBbQat0QO9Zbu_93FMbLc,88144
|
|
347
347
|
naeural_core/main/orchestrator.py,sha256=EodPSzrJd-Yg_RnBIA6-aIsMBa94I5uV1ATZUR5j3Kg,70750
|
|
348
|
-
naeural_core/main/ver.py,sha256=
|
|
348
|
+
naeural_core/main/ver.py,sha256=t6g0uq9KL9bhWOSTzTPkBD0xuok8r6bV28wL6JeDE2s,335
|
|
349
349
|
naeural_core/main/orchestrator_mixins/__init__.py,sha256=MNleg48vdlqsyAR8Vamjl4ahG2jwCH5kLbQN5CfU57E,149
|
|
350
350
|
naeural_core/main/orchestrator_mixins/managers_init.py,sha256=sQVqpr99a5WP9HCloYCyaWDW5J3IypEImlf703bqTF4,6692
|
|
351
351
|
naeural_core/main/orchestrator_mixins/utils.py,sha256=jMa0uStVNLQmp0VhNMRvfBDjo387ORLlUVLthRNBKqc,1866
|
|
@@ -555,7 +555,7 @@ naeural_core/utils/tracing/onnx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
|
555
555
|
naeural_core/utils/tracing/onnx/base_trt_scripter.py,sha256=1FelEBo7JGsc8hbJ3sevzxnM-J61nvBHz6L1VLpZrVc,2043
|
|
556
556
|
naeural_core/utils/tracing/onnx/utils.py,sha256=IKmqUWakrMWn34uJvbRjNLacdszD8jkkQBFPUhgJtOQ,5618
|
|
557
557
|
naeural_core/utils/web_app/favicon.ico,sha256=zU6-Jxx4ol1A9FJvcQELYV9DiqwqyvjPS89xQybZE74,15406
|
|
558
|
-
naeural_core-7.7.
|
|
559
|
-
naeural_core-7.7.
|
|
560
|
-
naeural_core-7.7.
|
|
561
|
-
naeural_core-7.7.
|
|
558
|
+
naeural_core-7.7.247.dist-info/METADATA,sha256=u7suMyGpLlY2oQx-RhGJK0UatoOPlHczFvU69dmrXlo,6522
|
|
559
|
+
naeural_core-7.7.247.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
560
|
+
naeural_core-7.7.247.dist-info/licenses/LICENSE,sha256=SPHPWjOdAUUUUI020nI5VNCtFjmTOlJpi1cZxyB3gKo,11339
|
|
561
|
+
naeural_core-7.7.247.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|