unaiverse 0.1.6__cp314-cp314-macosx_10_15_x86_64.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 unaiverse might be problematic. Click here for more details.
- unaiverse/__init__.py +19 -0
- unaiverse/agent.py +2008 -0
- unaiverse/agent_basics.py +1846 -0
- unaiverse/clock.py +191 -0
- unaiverse/dataprops.py +1209 -0
- unaiverse/hsm.py +1880 -0
- unaiverse/modules/__init__.py +18 -0
- unaiverse/modules/cnu/__init__.py +17 -0
- unaiverse/modules/cnu/cnus.py +536 -0
- unaiverse/modules/cnu/layers.py +261 -0
- unaiverse/modules/cnu/psi.py +60 -0
- unaiverse/modules/hl/__init__.py +15 -0
- unaiverse/modules/hl/hl_utils.py +411 -0
- unaiverse/modules/networks.py +1509 -0
- unaiverse/modules/utils.py +680 -0
- unaiverse/networking/__init__.py +16 -0
- unaiverse/networking/node/__init__.py +18 -0
- unaiverse/networking/node/connpool.py +1261 -0
- unaiverse/networking/node/node.py +2223 -0
- unaiverse/networking/node/profile.py +446 -0
- unaiverse/networking/node/tokens.py +79 -0
- unaiverse/networking/p2p/__init__.py +198 -0
- unaiverse/networking/p2p/go.mod +127 -0
- unaiverse/networking/p2p/go.sum +548 -0
- unaiverse/networking/p2p/golibp2p.py +18 -0
- unaiverse/networking/p2p/golibp2p.pyi +135 -0
- unaiverse/networking/p2p/lib.go +2714 -0
- unaiverse/networking/p2p/lib.go.sha256 +1 -0
- unaiverse/networking/p2p/lib_types.py +312 -0
- unaiverse/networking/p2p/message_pb2.py +63 -0
- unaiverse/networking/p2p/messages.py +265 -0
- unaiverse/networking/p2p/mylogger.py +77 -0
- unaiverse/networking/p2p/p2p.py +929 -0
- unaiverse/networking/p2p/proto-go/message.pb.go +616 -0
- unaiverse/networking/p2p/unailib.cpython-314-darwin.so +0 -0
- unaiverse/streamlib/__init__.py +15 -0
- unaiverse/streamlib/streamlib.py +210 -0
- unaiverse/streams.py +770 -0
- unaiverse/utils/__init__.py +16 -0
- unaiverse/utils/ask_lone_wolf.json +27 -0
- unaiverse/utils/lone_wolf.json +19 -0
- unaiverse/utils/misc.py +305 -0
- unaiverse/utils/sandbox.py +293 -0
- unaiverse/utils/server.py +435 -0
- unaiverse/world.py +175 -0
- unaiverse-0.1.6.dist-info/METADATA +365 -0
- unaiverse-0.1.6.dist-info/RECORD +50 -0
- unaiverse-0.1.6.dist-info/WHEEL +6 -0
- unaiverse-0.1.6.dist-info/licenses/LICENSE +43 -0
- unaiverse-0.1.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
█████ █████ ██████ █████ █████ █████ █████ ██████████ ███████████ █████████ ██████████
|
|
3
|
+
░░███ ░░███ ░░██████ ░░███ ░░███ ░░███ ░░███ ░░███░░░░░█░░███░░░░░███ ███░░░░░███░░███░░░░░█
|
|
4
|
+
░███ ░███ ░███░███ ░███ ██████ ░███ ░███ ░███ ░███ █ ░ ░███ ░███ ░███ ░░░ ░███ █ ░
|
|
5
|
+
░███ ░███ ░███░░███░███ ░░░░░███ ░███ ░███ ░███ ░██████ ░██████████ ░░█████████ ░██████
|
|
6
|
+
░███ ░███ ░███ ░░██████ ███████ ░███ ░░███ ███ ░███░░█ ░███░░░░░███ ░░░░░░░░███ ░███░░█
|
|
7
|
+
░███ ░███ ░███ ░░█████ ███░░███ ░███ ░░░█████░ ░███ ░ █ ░███ ░███ ███ ░███ ░███ ░ █
|
|
8
|
+
░░████████ █████ ░░█████░░████████ █████ ░░███ ██████████ █████ █████░░█████████ ██████████
|
|
9
|
+
░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░░░░░
|
|
10
|
+
A Collectionless AI Project (https://collectionless.ai)
|
|
11
|
+
Registration/Login: https://unaiverse.io
|
|
12
|
+
Code Repositories: https://github.com/collectionlessai/
|
|
13
|
+
Main Developers: Stefano Melacci (Project Leader), Christian Di Maio, Tommaso Guidi
|
|
14
|
+
"""
|
|
15
|
+
import os
|
|
16
|
+
import logging
|
|
17
|
+
from logging.handlers import TimedRotatingFileHandler
|
|
18
|
+
|
|
19
|
+
LOG_FOLDER = "unaiverse/networking/p2p/logs"
|
|
20
|
+
|
|
21
|
+
def setup_logger(module_name: str, when: str = 'midnight', backup_count: int = 7) -> logging.Logger:
|
|
22
|
+
"""
|
|
23
|
+
Sets up a logger for a specific module with a timed rotating file handler.
|
|
24
|
+
Args:
|
|
25
|
+
module_name (str): The name of the module for which the logger is being set up.
|
|
26
|
+
when (str, optional): Specifies the type of interval for log rotation.
|
|
27
|
+
Defaults to 'midnight'. Common values include 'S', 'M', 'H', 'D', 'midnight', etc.
|
|
28
|
+
backup_count (int, optional): The number of backup log files to keep. Defaults to 7.
|
|
29
|
+
Returns:
|
|
30
|
+
logging.Logger: A configured logger instance for the specified module.
|
|
31
|
+
Notes:
|
|
32
|
+
- Log files are stored in a predefined folder (`LOG_FOLDER`).
|
|
33
|
+
- Log rotation occurs based on the specified interval (`when`).
|
|
34
|
+
- The logger writes logs in UTF-8 encoding and uses UTC time by default.
|
|
35
|
+
- The log format includes timestamp, log level, filename, line number, and the log message.
|
|
36
|
+
- If the logger for the module already exists, it will not add duplicate handlers.
|
|
37
|
+
"""
|
|
38
|
+
do_log = False # Stefano
|
|
39
|
+
|
|
40
|
+
# Ensure log folder exists
|
|
41
|
+
if do_log:
|
|
42
|
+
os.makedirs(LOG_FOLDER, exist_ok=True)
|
|
43
|
+
|
|
44
|
+
# Log file base path (without date suffix)
|
|
45
|
+
log_base_filename = os.path.join(LOG_FOLDER, f"{module_name}.log")
|
|
46
|
+
|
|
47
|
+
# Create logger
|
|
48
|
+
logger = logging.getLogger(module_name)
|
|
49
|
+
logger.setLevel(logging.DEBUG)
|
|
50
|
+
|
|
51
|
+
if do_log and not logger.handlers:
|
|
52
|
+
|
|
53
|
+
# Create rotating file handler
|
|
54
|
+
handler = TimedRotatingFileHandler(
|
|
55
|
+
log_base_filename,
|
|
56
|
+
when=when,
|
|
57
|
+
interval=1,
|
|
58
|
+
backupCount=backup_count,
|
|
59
|
+
encoding='utf-8',
|
|
60
|
+
utc=True # Set to False if you want local time
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
formatter = logging.Formatter(
|
|
64
|
+
fmt="%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s",
|
|
65
|
+
datefmt="%Y-%m-%d %H:%M:%S"
|
|
66
|
+
)
|
|
67
|
+
handler.setFormatter(formatter)
|
|
68
|
+
logger.addHandler(handler)
|
|
69
|
+
|
|
70
|
+
# Avoid logging to root handlers
|
|
71
|
+
logger.propagate = False
|
|
72
|
+
|
|
73
|
+
if not do_log:
|
|
74
|
+
logger.handlers.clear()
|
|
75
|
+
logger.addHandler(logging.NullHandler())
|
|
76
|
+
|
|
77
|
+
return logger
|