naeural-client 2.3.0__py3-none-any.whl → 2.3.1__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_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.3.0"
1
+ __VER__ = "2.3.1"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
naeural_client/bc/ec.py CHANGED
@@ -480,13 +480,17 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
480
480
  message_hash = self.eth_hash_message(types, values, as_hex=False)
481
481
  signable_message = encode_defunct(primitive=message_hash)
482
482
  signed_message = Account.sign_message(signable_message, private_key=self.eth_account.key)
483
+ if hasattr(signed_message, "message_hash"): # backward compatibility
484
+ signed_message_hash = signed_message.message_hash
485
+ else:
486
+ signed_message_hash = signed_message.messageHash
483
487
  return {
484
488
  "message_hash": message_hash.hex(),
485
489
  "r": hex(signed_message.r),
486
490
  "s": hex(signed_message.s),
487
491
  "v": signed_message.v,
488
492
  "signature": signed_message.signature.hex(),
489
- "signed_message": signed_message.message_hash.hex(),
493
+ "signed_message": signed_message_hash.hex(),
490
494
  "sender" : self.eth_address,
491
495
  }
492
496
 
naeural_client/cli/cli.py CHANGED
@@ -1,8 +1,10 @@
1
1
  import argparse
2
2
 
3
- from naeural_client.utils.config import maybe_init_config
3
+ from naeural_client.utils.config import maybe_init_config, log_with_color
4
4
  from naeural_client.cli.cli_commands import CLI_COMMANDS
5
5
 
6
+ from naeural_client import version
7
+
6
8
  def build_parser():
7
9
  """
8
10
  Dynamically builds the argument parser based on CLI_COMMANDS.
@@ -12,7 +14,10 @@ def build_parser():
12
14
  argparse.ArgumentParser
13
15
  Configured argument parser.
14
16
  """
15
- parser = argparse.ArgumentParser(description="nepctl - CLI for Naeural Edge Protocol SDK package")
17
+ descr = f"nepctl v{version} - CLI for Naeural Edge Protocol SDK package"
18
+
19
+
20
+ parser = argparse.ArgumentParser(description=descr)
16
21
  subparsers = parser.add_subparsers(dest="command", help="Available commands")
17
22
 
18
23
  # Iterate over top-level commands
@@ -1,4 +1,4 @@
1
-
1
+ from naeural_client.utils.config import log_with_color
2
2
 
3
3
 
4
4
  def get_nodes():
@@ -10,7 +10,7 @@ def get_nodes():
10
10
  3. Wait for the second net mon message via Session and show progress.
11
11
  4. Get the active nodes union via Session and display the nodes marking those peered vs non-peered.
12
12
  """
13
- print("Getting nodes information")
13
+ log_with_color("Getting nodes information", color="b")
14
14
  return
15
15
 
16
16
 
@@ -18,5 +18,5 @@ def get_supervisors():
18
18
  """
19
19
  This function is used to get the information about the supervisors.
20
20
  """
21
- print("Getting supervisors information")
21
+ log_with_color("Getting supervisors information", color='b')
22
22
  return
@@ -14,6 +14,33 @@ EE_SECURED=true
14
14
  TARGET_NODE=
15
15
  """
16
16
 
17
+ def log_with_color(s, color='n'):
18
+ """
19
+ Prints the string `s` to the console in the specified color.
20
+
21
+ Parameters
22
+ ----------
23
+ s : str
24
+ The string to be logged.
25
+ color : str, optional
26
+ The color code:
27
+ 'r' for red, 'g' for green, 'y' for yellow,
28
+ 'b' for blue, 'w' for light white, 'n' for dark white (default).
29
+ """
30
+ color_codes = {
31
+ 'r': '\033[31m', # Red
32
+ 'g': '\033[32m', # Green
33
+ 'y': '\033[33m', # Yellow
34
+ 'b': '\033[34m', # Blue
35
+ 'w': '\033[97m', # Light white
36
+ 'n': '\033[37m', # Dark white (default)
37
+ }
38
+
39
+ reset_code = '\033[0m' # Reset color
40
+ color_code = color_codes.get(color, color_codes['n'])
41
+ print(f"{color_code}{s}{reset_code}", flush=True)
42
+
43
+
17
44
  def get_user_folder():
18
45
  """
19
46
  Returns the user folder.
@@ -43,12 +70,12 @@ def reset_config():
43
70
  if current_env_file.exists():
44
71
  # Copy .env content to ~/.naeural/config
45
72
  shutil.copy(current_env_file, config_file)
46
- print(f"Configuration has been reset using {current_env_file} into {config_file}")
73
+ log_with_color(f"Configuration has been reset using {current_env_file} into {config_file}", color='y')
47
74
  else:
48
75
  # Create an empty config file
49
76
  with config_file.open("wt") as file:
50
77
  file.write(ENV_TEMPLATE)
51
- print(f"Configuration has been reset to default in {config_file}:\n{ENV_TEMPLATE}")
78
+ log_with_color(f"Configuration has been reset to default in {config_file}:\n{ENV_TEMPLATE}", color='y')
52
79
 
53
80
 
54
81
  def show_config():
@@ -58,11 +85,12 @@ def show_config():
58
85
  config_file = get_user_config_file()
59
86
 
60
87
  if config_file.exists():
61
- print(f"Current configuration ({config_file}):")
88
+ log_with_color(f"Current configuration ({config_file}):")
62
89
  with config_file.open("r") as file:
63
- print(file.read())
90
+ log_with_color(file.read())
64
91
  else:
65
- print(f"No configuration found at {config_file}. Please run `reset_config` first.")
92
+ log_with_color(f"No configuration found at {config_file}. Please run `reset_config` first.", color="r")
93
+ return
66
94
 
67
95
 
68
96
  def load_user_defined_config(verbose=False):
@@ -84,10 +112,10 @@ def load_user_defined_config(verbose=False):
84
112
  result = True
85
113
  os.environ[key.strip()] = value
86
114
  if verbose:
87
- print(f"Configuration from {config_file} has been loaded into the environment.")
115
+ log_with_color(f"Configuration from {config_file} has been loaded into the environment.", color='b')
88
116
  else:
89
117
  if verbose:
90
- print(f"No configuration file found at {config_file}. Please run `reset_config` first.")
118
+ log_with_color(f"No configuration file found at {config_file}. Please run `reset_config` first.", color="r")
91
119
  return result
92
120
 
93
121
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: naeural_client
3
- Version: 2.3.0
3
+ Version: 2.3.1
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
@@ -1,5 +1,5 @@
1
1
  naeural_client/__init__.py,sha256=UKEDGS0wFYyxwmhEAKJGecO2vYbIfRYUP4SQgnK10IE,578
2
- naeural_client/_ver.py,sha256=zb8Hzmn-gdMpHg77kLusI381BxnNJ0u_wIk_OIVA5jQ,330
2
+ naeural_client/_ver.py,sha256=31pw4Zp2s9RPTWeYsyGqbi2Dc3lW0dqZ4WsTZckfaww,330
3
3
  naeural_client/base_decentra_object.py,sha256=wXjl65gWxxkhV6Tq48wFfNGITvdYdkKPT-wLurGB5vc,4287
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
@@ -15,13 +15,13 @@ naeural_client/base/payload/payload.py,sha256=v50D7mBBD2WwWzvpbRGMSr-X6vv5ie21IY
15
15
  naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
16
16
  naeural_client/bc/base.py,sha256=GI9CbI2RVgIBXpOoRjrhXt45tONlBDMrybX_BcL3_Os,29513
17
17
  naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- naeural_client/bc/ec.py,sha256=eUkdHUDZ-OgmbwjbYx1wmTOJVWLmjvP4Svduocj69Uk,13841
18
+ naeural_client/bc/ec.py,sha256=raIGI7BpSH8xU_Bg7RpKv9KEW3F6PuAdL5miZfvw7iI,14027
19
19
  naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
21
21
  naeural_client/cli/README.md,sha256=WPdI_EjzAbUW1aPyj1sSR8rLydcJKZtoiaEtklQrjHo,74
22
- naeural_client/cli/cli.py,sha256=KlPb6ExUMrrFxBl2j7XRnOQhtH-1s-jFtsca5zcz5qI,1342
22
+ naeural_client/cli/cli.py,sha256=eKzO8hu_436e3svGPNSpn6q4EiEcaTIKPhgn5QOJJVw,1426
23
23
  naeural_client/cli/cli_commands.py,sha256=NluWqnsyuabu0EKNM6MDUBtnfloH7oqCOrkfJs8Ajjk,353
24
- naeural_client/cli/nodes.py,sha256=tOgWGzsCqGhznne1-FRbiYdmIALSXljYz2C8Eub25Ks,619
24
+ naeural_client/cli/nodes.py,sha256=y3yKKLzyZe-zu4H-cgqDqmZ8jt1s4RA6QdqeUD7z4i0,713
25
25
  naeural_client/code_cheker/__init__.py,sha256=pwkdeZGVL16ZA4Qf2mRahEhoOvKhL7FyuQbMFLr1E5M,33
26
26
  naeural_client/code_cheker/base.py,sha256=lT5DRIFO5rqzsMNCmdMRfkAeevmezozehyfgmhnKpuI,19074
27
27
  naeural_client/code_cheker/checker.py,sha256=QWupeM7ToancVIq1tRUxRNUrI8B5l5eoY0kDU4-O5aE,7365
@@ -78,10 +78,10 @@ naeural_client/logging/tzlocal/win32.py,sha256=zBoj0vFVrGhnCm_f7xmYzGym4-fV-4Ij2
78
78
  naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXyXUxkSKCAFmWT9Hw,34203
79
79
  naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
80
80
  naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
81
- naeural_client/utils/config.py,sha256=eqVhrSte94nC1eJOkRzuUAdIgJUOLoqcV3CZEFS2O6g,2767
81
+ naeural_client/utils/config.py,sha256=0IngDOJjtopdi06VdtKPRv6qCBOTEt_Ww4l4MIBKhZw,3624
82
82
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
83
- naeural_client-2.3.0.dist-info/METADATA,sha256=7X1taqH_efSawHEHyKlLCRjwh5CLamWnnmW5hDc6Ays,14449
84
- naeural_client-2.3.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
85
- naeural_client-2.3.0.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
86
- naeural_client-2.3.0.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
87
- naeural_client-2.3.0.dist-info/RECORD,,
83
+ naeural_client-2.3.1.dist-info/METADATA,sha256=qrRjlmz_8n-D5mCQuYYArpPEzcmQ8CY4b0RkUT_VuIM,14449
84
+ naeural_client-2.3.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
85
+ naeural_client-2.3.1.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
86
+ naeural_client-2.3.1.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
87
+ naeural_client-2.3.1.dist-info/RECORD,,