naeural-client 2.5.20__py3-none-any.whl → 2.5.22__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.5.20"
1
+ __VER__ = "2.5.22"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -250,12 +250,18 @@ class GenericSession(BaseDecentrAIObject):
250
250
  # end bc_engine
251
251
  self.formatter_wrapper = IOFormatterWrapper(self.log, plugin_search_locations=self.__formatter_plugins_locations)
252
252
 
253
+ msg = f"Connection to {self._config[comm_ct.USER]}:*****@{self._config[comm_ct.HOST]}:{self._config[comm_ct.PORT]} {'<secured>' if self._config[comm_ct.SECURED] else '<UNSECURED>'}"
254
+ self.P(msg, color='y')
253
255
  self._connect()
254
256
 
255
- self.P("Created {} comms session '{}' from <{}> SDKv{}.".format(
256
- "decrypted" if not self.encrypt_comms else "encrypted",
257
- self.name, self.bc_engine.address, self.log.version
258
- ))
257
+ msg = f"Created comms session '{self.name}'"
258
+ msg += f"\n - SDK: {self.log.version}"
259
+ msg += f"\n - Address: {self.bc_engine.address}"
260
+ msg += f"\n - Server: {self._config[comm_ct.HOST]}:{self._config[comm_ct.PORT]}"
261
+ msg += f"\n - Secured: {self._config[comm_ct.SECURED]}"
262
+ msg += f"\n - User: {self._config[comm_ct.USER]}"
263
+ msg += f"\n - Encrypt: {'YES' if self.encrypt_comms else 'NO'}"
264
+ self.P(msg, color='g')
259
265
 
260
266
  if not self.encrypt_comms:
261
267
  self.P(
@@ -657,8 +663,7 @@ class GenericSession(BaseDecentrAIObject):
657
663
  if True:
658
664
  def __start_blockchain(self, bc_engine, blockchain_config, user_config=False):
659
665
  if bc_engine is not None:
660
- self.bc_engine = bc_engine
661
- self.bc_engine.set_eth_flat(self.__eth_enabled)
666
+ self.bc_engine = bc_engine
662
667
  return
663
668
 
664
669
  try:
@@ -668,10 +673,13 @@ class GenericSession(BaseDecentrAIObject):
668
673
  config=blockchain_config,
669
674
  verbosity=self._verbosity,
670
675
  user_config=user_config,
671
- eth_enabled=self.__eth_enabled,
676
+ eth_enabled=self.__eth_enabled,
672
677
  )
673
678
  except:
674
679
  raise ValueError("Failure in private blockchain setup:\n{}".format(traceback.format_exc()))
680
+
681
+ # extra setup flag for re-connections with same multiton instance
682
+ self.bc_engine.set_eth_flag(self.__eth_enabled)
675
683
  return
676
684
 
677
685
  def __start_main_loop_thread(self):
@@ -1023,6 +1031,7 @@ class GenericSession(BaseDecentrAIObject):
1023
1031
  if secured is not None and self._config.get(comm_ct.SECURED, None) is None:
1024
1032
  secured = str(secured).strip().upper() in ['TRUE', '1']
1025
1033
  self._config[comm_ct.SECURED] = secured
1034
+
1026
1035
  return
1027
1036
 
1028
1037
  def __get_node_address(self, node):
naeural_client/bc/base.py CHANGED
@@ -359,7 +359,7 @@ class BaseBlockEngine:
359
359
  s = "<BC:{}> ".format(self.__name) + s
360
360
  return self.log.P(
361
361
  s,
362
- color='g' if (color is None or color.lower() not in ['r', 'red', 'error']) else color,
362
+ color=color or 'd',
363
363
  boxed=boxed,
364
364
  **kwargs
365
365
  )
@@ -375,8 +375,7 @@ class BaseBlockEngine:
375
375
 
376
376
  def _init(self):
377
377
  self.P(
378
- f"Initializing BC-engine (ETH_ENABLED={self.__eth_enabled})...",
379
- boxed=True, box_char='*', verbosity=1
378
+ f"Initializing BC-engine (ETH_ENABLED={self.__eth_enabled})...", verbosity=1
380
379
  )
381
380
 
382
381
  if True:
@@ -414,9 +413,12 @@ class BaseBlockEngine:
414
413
  self.__eth_account = self._get_eth_account()
415
414
  ### end Ethereum
416
415
  if self.__eth_enabled:
417
- self.P("Address: {} / ETH: {}".format(self.address, self.eth_address), boxed=True, verbosity=1)
416
+ self.P(
417
+ "Address: {} / ETH: {}".format(self.address, self.eth_address), boxed=True, verbosity=1,
418
+ color='g'
419
+ )
418
420
  else:
419
- self.P("Address: {}".format(self.address), boxed=True, verbosity=1)
421
+ self.P("Address: {}".format(self.address), boxed=True, color='g', verbosity=1)
420
422
  self.P("Allowed list of senders: {}".format(self.allowed_list), verbosity=1)
421
423
  return
422
424
 
@@ -702,7 +704,7 @@ class BaseBlockEngine:
702
704
 
703
705
  """
704
706
  if from_file and os.path.isfile(source):
705
- self.P("Reading SK from '{}'".format(source), color='g', verbosity=1)
707
+ self.P("Reading SK from '{}'".format(source), verbosity=1)
706
708
  with open(source, 'rt') as fh:
707
709
  data = fh.read()
708
710
  else:
@@ -1230,8 +1232,11 @@ class BaseBlockEngine:
1230
1232
 
1231
1233
  ### Ethereum
1232
1234
 
1233
- def set_eth_flag(self, value):
1234
- self.__eth_enabled = value
1235
+ def set_eth_flag(self, value):
1236
+ if value != self.__eth_enabled:
1237
+ self.__eth_enabled = value
1238
+ self.log.P("Changed eth_enabled to {}".format(value), color='d')
1239
+ return
1235
1240
 
1236
1241
  @property
1237
1242
  def eth_address(self):
@@ -83,11 +83,12 @@ def get_user_config_file():
83
83
  """
84
84
  return get_user_folder() / "config"
85
85
 
86
- def reset_config(args, *larg, **kwargs):
86
+ def reset_config(*larg, **kwargs):
87
87
  """
88
88
  Resets the configuration by creating a ~/.naeural folder and populating
89
89
  ~/.naeural/config with values from a local .env file, if it exists.
90
90
  """
91
+ log_with_color("Resetting the configuration...", color='y')
91
92
  # Define the target config folder and file
92
93
  config_dir = get_user_folder()
93
94
  config_file = get_user_config_file()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.5.20
3
+ Version: 2.5.22
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -35,6 +35,13 @@ This packet depends on the following packets: `pika`, `paho-mqtt`, `numpy`, `pyo
35
35
  python -m pip install naeural_client
36
36
  ```
37
37
 
38
+ ### Development installation
39
+
40
+ ```shell
41
+ git clone https://github.com/NaeuralEdgeProtocol/naeural_client
42
+ pip install -e .
43
+ ```
44
+
38
45
  ## Documentation
39
46
 
40
47
  Minimal documentation will be presented here. The complete documentation is
@@ -1,10 +1,10 @@
1
1
  naeural_client/__init__.py,sha256=GP8WSrn87sjTPO-QRNL2PG8JK5Mixbiea_HrtbG8RAQ,592
2
- naeural_client/_ver.py,sha256=uTqaN7xpck9Wbtyp-J-7kahzd8SaJ5FHu8BtiFHFhOo,331
2
+ naeural_client/_ver.py,sha256=hAQqRW-VZgezlnLQtLAB_kXl-vLNgz3ubPhqfDOIrVg,331
3
3
  naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
4
4
  naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
6
6
  naeural_client/base/distributed_custom_code_presets.py,sha256=cvz5R88P6Z5V61Ce1vHVVh8bOkgXd6gve_vdESDNAsg,2544
7
- naeural_client/base/generic_session.py,sha256=Jymz_4ML2pkvKDWSRoalZuXB95NCyBYmhnJSc7tUpNU,88612
7
+ naeural_client/base/generic_session.py,sha256=rKOTBmreGwjoEG7CRAAKePNOdl0masfF66ORC-a0vjY,89170
8
8
  naeural_client/base/instance.py,sha256=kcZJmjLBtx8Bjj_ysIOx1JmLA-qSpG7E28j5rq6IYus,20444
9
9
  naeural_client/base/pipeline.py,sha256=b4uNHrEIOlAtw4PGUx20dxwBhDck5__SrVXaHcSi8ZA,58251
10
10
  naeural_client/base/plugin_template.py,sha256=qGaXByd_JZFpjvH9GXNbT7KaitRxIJB6-1IhbKrZjq4,138123
@@ -14,7 +14,7 @@ naeural_client/base/webapp_pipeline.py,sha256=QmPLVmhP0CPdi0YuvbZEH4APYz2Amtw3gy
14
14
  naeural_client/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
15
15
  naeural_client/base/payload/payload.py,sha256=x-au7l67Z_vfn_4R2C_pjZCaFuUVXHngJiGOfIAYVdE,2690
16
16
  naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
17
- naeural_client/bc/base.py,sha256=uky74Z4vLurZXK4vqoxDAA6P5Xs0EqVY-9eWX7BEWxM,32931
17
+ naeural_client/bc/base.py,sha256=G-NYWhQaFHlHrKF01M7hOgXOKRsOtjcjJYjoxamYLbQ,32990
18
18
  naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  naeural_client/bc/ec.py,sha256=mWjodWCRgC3omVXOA9jtNdtPVNn2kMKV3Dcjt9oFUCQ,22974
20
20
  naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -79,10 +79,10 @@ naeural_client/logging/tzlocal/win32.py,sha256=zBoj0vFVrGhnCm_f7xmYzGym4-fV-4Ij2
79
79
  naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXyXUxkSKCAFmWT9Hw,34203
80
80
  naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
81
81
  naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
82
- naeural_client/utils/config.py,sha256=aUVyi5rZjvnbUwM5mmj0E2IHvURdrlHSgleqZvJBNuU,5202
82
+ naeural_client/utils/config.py,sha256=mFqzz69UQAZN9oblxoTqWS52F2p8AnXmzDtdf2SoDz4,5258
83
83
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
84
- naeural_client-2.5.20.dist-info/METADATA,sha256=XbXnIq0bEvjD4GP2XALZLzMxib6tk2VOFLI_Zgboy8o,14494
85
- naeural_client-2.5.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
86
- naeural_client-2.5.20.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
87
- naeural_client-2.5.20.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
88
- naeural_client-2.5.20.dist-info/RECORD,,
84
+ naeural_client-2.5.22.dist-info/METADATA,sha256=PGQE3We4_RODRS6YsHEyMspcTRDBZZGLuJUsegEB8Ds,14619
85
+ naeural_client-2.5.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
86
+ naeural_client-2.5.22.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
87
+ naeural_client-2.5.22.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
88
+ naeural_client-2.5.22.dist-info/RECORD,,