unaiverse 0.1.6__cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.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.

Files changed (50) hide show
  1. unaiverse/__init__.py +19 -0
  2. unaiverse/agent.py +2008 -0
  3. unaiverse/agent_basics.py +1846 -0
  4. unaiverse/clock.py +191 -0
  5. unaiverse/dataprops.py +1209 -0
  6. unaiverse/hsm.py +1880 -0
  7. unaiverse/modules/__init__.py +18 -0
  8. unaiverse/modules/cnu/__init__.py +17 -0
  9. unaiverse/modules/cnu/cnus.py +536 -0
  10. unaiverse/modules/cnu/layers.py +261 -0
  11. unaiverse/modules/cnu/psi.py +60 -0
  12. unaiverse/modules/hl/__init__.py +15 -0
  13. unaiverse/modules/hl/hl_utils.py +411 -0
  14. unaiverse/modules/networks.py +1509 -0
  15. unaiverse/modules/utils.py +680 -0
  16. unaiverse/networking/__init__.py +16 -0
  17. unaiverse/networking/node/__init__.py +18 -0
  18. unaiverse/networking/node/connpool.py +1261 -0
  19. unaiverse/networking/node/node.py +2223 -0
  20. unaiverse/networking/node/profile.py +446 -0
  21. unaiverse/networking/node/tokens.py +79 -0
  22. unaiverse/networking/p2p/__init__.py +198 -0
  23. unaiverse/networking/p2p/go.mod +127 -0
  24. unaiverse/networking/p2p/go.sum +548 -0
  25. unaiverse/networking/p2p/golibp2p.py +18 -0
  26. unaiverse/networking/p2p/golibp2p.pyi +135 -0
  27. unaiverse/networking/p2p/lib.go +2714 -0
  28. unaiverse/networking/p2p/lib.go.sha256 +1 -0
  29. unaiverse/networking/p2p/lib_types.py +312 -0
  30. unaiverse/networking/p2p/message_pb2.py +63 -0
  31. unaiverse/networking/p2p/messages.py +265 -0
  32. unaiverse/networking/p2p/mylogger.py +77 -0
  33. unaiverse/networking/p2p/p2p.py +929 -0
  34. unaiverse/networking/p2p/proto-go/message.pb.go +616 -0
  35. unaiverse/networking/p2p/unailib.cpython-311-aarch64-linux-gnu.so +0 -0
  36. unaiverse/streamlib/__init__.py +15 -0
  37. unaiverse/streamlib/streamlib.py +210 -0
  38. unaiverse/streams.py +770 -0
  39. unaiverse/utils/__init__.py +16 -0
  40. unaiverse/utils/ask_lone_wolf.json +27 -0
  41. unaiverse/utils/lone_wolf.json +19 -0
  42. unaiverse/utils/misc.py +305 -0
  43. unaiverse/utils/sandbox.py +293 -0
  44. unaiverse/utils/server.py +435 -0
  45. unaiverse/world.py +175 -0
  46. unaiverse-0.1.6.dist-info/METADATA +365 -0
  47. unaiverse-0.1.6.dist-info/RECORD +50 -0
  48. unaiverse-0.1.6.dist-info/WHEEL +7 -0
  49. unaiverse-0.1.6.dist-info/licenses/LICENSE +43 -0
  50. 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