neuronum 0.1.0__py3-none-any.whl → 0.3.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 neuronum might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neuronum
3
- Version: 0.1.0
4
- Summary: A high-level coding library based on sockets to interact with the Neuronum network.
3
+ Version: 0.3.0
4
+ Summary: A high-level coding library to interact with the Neuronum network.
5
5
  Author: Neuronum Cybernetics
6
6
  Author-email: welcome@neuronum.net
7
7
  Requires-Python: >=3.6
@@ -0,0 +1,4 @@
1
+ neuronum-0.3.0.dist-info/METADATA,sha256=v_t8zE8ATX37nKQ5-F3MgIHE11g8R_fECHJjiKDp_c4,224
2
+ neuronum-0.3.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
3
+ neuronum-0.3.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ neuronum-0.3.0.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+
neuronum/__init__.py DELETED
@@ -1,5 +0,0 @@
1
- # neuronum/__init__.py
2
-
3
- from .module import synapse, nt, circuit
4
-
5
- __all__ = ['synapse', 'nt', 'circuit'] # This defines the public API of your library
neuronum/module.py DELETED
@@ -1,104 +0,0 @@
1
- import socket
2
- import json
3
- import hashlib
4
- from datetime import datetime
5
-
6
- def synapse(ip, port):
7
- server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8
- server_socket.bind((ip, port))
9
- server_socket.listen(1)
10
- print(f"synapse connected to {ip}:{port}")
11
-
12
- while True:
13
- conn, addr = server_socket.accept()
14
- print(f"Connected by {addr}")
15
-
16
- try:
17
- # Receive data from the client
18
- data = conn.recv(1024).decode('utf-8')
19
- if not data:
20
- break
21
-
22
- # Deserialize JSON data
23
- json_data = json.loads(data)
24
-
25
- # Prepare a response
26
- response = {"status": "success", "received": json_data}
27
- response_data = json.dumps(response)
28
-
29
- # Send response back to client
30
- conn.sendall(response_data.encode('utf-8'))
31
- except json.JSONDecodeError:
32
- print("Failed to decode JSON")
33
- finally:
34
- # Close the connection
35
- conn.close()
36
-
37
-
38
- def nt(ip, port, transmitter):
39
- timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
40
- transmitter_id = hashlib.sha1(f"{transmitter}{timestamp}".encode()).hexdigest()
41
- transmit = {
42
- "id": transmitter_id,
43
- "transmitter": transmitter
44
- }
45
-
46
- try:
47
- # Create a socket and connect to the node
48
- client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
49
- client_socket.connect((ip, port))
50
- print(f"Connected to {ip}:{port}")
51
-
52
- # Send JSON data
53
- json_slice = json.dumps(transmit) # Convert transmit dictionary to JSON
54
- client_socket.sendall(json_slice.encode('utf-8'))
55
- print(f"Sent data to {ip}:{port}")
56
-
57
- # Receive response
58
- response = client_socket.recv(1024).decode('utf-8')
59
- print(f"Received response from {ip}:{port}: {response}")
60
-
61
- except Exception as e:
62
- print(f"Failed to connect to {ip}:{port}: {e}")
63
-
64
- finally:
65
- client_socket.close()
66
-
67
-
68
- def circuit(cells, transmitter):
69
- for cell in cells:
70
- address = cell["address"]
71
- ip, port = address.split(":")
72
- port = int(port)
73
-
74
- timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
75
- transmitter_id = hashlib.sha1(f"{transmitter}{timestamp}".encode()).hexdigest()
76
- transmit = {
77
- "id": transmitter_id,
78
- "transmitter": transmitter
79
- }
80
-
81
- try:
82
- # Create a socket and connect to the node
83
- client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
84
- client_socket.connect((ip, port))
85
- print(f"Connected to {ip}:{port}")
86
-
87
- # Send JSON data
88
- json_slice = json.dumps(transmit) # Convert transmit dictionary to JSON
89
- client_socket.sendall(json_slice.encode('utf-8'))
90
- print(f"Sent data to {ip}:{port}")
91
-
92
- # Receive response
93
- response = client_socket.recv(1024).decode('utf-8')
94
- print(f"Received response from {ip}:{port}: {response}")
95
-
96
- except Exception as e:
97
- print(f"Failed to connect to {ip}:{port}: {e}")
98
-
99
- finally:
100
- client_socket.close()
101
-
102
-
103
-
104
-
@@ -1,6 +0,0 @@
1
- neuronum/__init__.py,sha256=TFA21Px4l5JI2i4W-xydzYoseuJYzVMm4dcy_ScX_x0,157
2
- neuronum/module.py,sha256=NWXWmE6tBthmrow03-XCwsGQ0EzLaY15KqQwbFlRmFA,3294
3
- neuronum-0.1.0.dist-info/METADATA,sha256=cGynNHgK87xIFIVkNxMc3adUKaP3HWdOHqkT4t7gxx4,241
4
- neuronum-0.1.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
5
- neuronum-0.1.0.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
6
- neuronum-0.1.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- neuronum