neuronum 0.1.0__tar.gz → 0.2.0__tar.gz
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.
- {neuronum-0.1.0 → neuronum-0.2.0}/PKG-INFO +2 -2
- {neuronum-0.1.0 → neuronum-0.2.0}/neuronum.egg-info/PKG-INFO +2 -2
- {neuronum-0.1.0 → neuronum-0.2.0}/neuronum.egg-info/SOURCES.txt +0 -2
- neuronum-0.2.0/neuronum.egg-info/top_level.txt +1 -0
- {neuronum-0.1.0 → neuronum-0.2.0}/setup.py +2 -2
- neuronum-0.1.0/neuronum/__init__.py +0 -5
- neuronum-0.1.0/neuronum/module.py +0 -104
- neuronum-0.1.0/neuronum.egg-info/top_level.txt +0 -1
- {neuronum-0.1.0 → neuronum-0.2.0}/README.md +0 -0
- {neuronum-0.1.0 → neuronum-0.2.0}/neuronum.egg-info/dependency_links.txt +0 -0
- {neuronum-0.1.0 → neuronum-0.2.0}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A high-level coding library
|
|
3
|
+
Version: 0.2.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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A high-level coding library
|
|
3
|
+
Version: 0.2.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 @@
|
|
|
1
|
+
|
|
@@ -2,10 +2,10 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='neuronum',
|
|
5
|
-
version='0.
|
|
5
|
+
version='0.2.0',
|
|
6
6
|
author='Neuronum Cybernetics',
|
|
7
7
|
author_email='welcome@neuronum.net',
|
|
8
|
-
description='A high-level coding library
|
|
8
|
+
description='A high-level coding library to interact with the Neuronum network.',
|
|
9
9
|
packages=find_packages(),
|
|
10
10
|
install_requires=[
|
|
11
11
|
#'socket>=
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
neuronum
|
|
File without changes
|
|
File without changes
|
|
File without changes
|