creating-intelligence 0.1.0a7__py3-none-win_amd64.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.
- creating_intelligence/__init__.py +41 -0
- creating_intelligence/circuits.py +1945 -0
- creating_intelligence/libmemory.pyd +0 -0
- creating_intelligence/memory_c_ffi.py +170 -0
- creating_intelligence/memory_python.py +143 -0
- creating_intelligence-0.1.0a7.dist-info/METADATA +55 -0
- creating_intelligence-0.1.0a7.dist-info/RECORD +9 -0
- creating_intelligence-0.1.0a7.dist-info/WHEEL +5 -0
- creating_intelligence-0.1.0a7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import importlib
|
|
3
|
+
import logging
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
if sys.maxsize <= 2**32:
|
|
9
|
+
raise ImportError("creating-intelligence requires a 64-bit Python interpreter.")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
logger.addHandler(logging.NullHandler())
|
|
14
|
+
|
|
15
|
+
# MEMORY_BACKEND selects the backend explicitly ("c_ffi" or "python").
|
|
16
|
+
# If unset, the fast C backend is tried first, with the pure-Python one as fallback.
|
|
17
|
+
_requested = os.environ.get("MEMORY_BACKEND")
|
|
18
|
+
backend = (_requested or "c_ffi").lower()
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
_module = importlib.import_module(f".memory_{backend}", package=__name__)
|
|
22
|
+
except (ImportError, OSError, AttributeError) as e:
|
|
23
|
+
if _requested is None and backend == "c_ffi":
|
|
24
|
+
warnings.warn(
|
|
25
|
+
f"C memory backend unavailable, using the slower pure-Python backend. ({e})",
|
|
26
|
+
RuntimeWarning,
|
|
27
|
+
stacklevel=2,
|
|
28
|
+
)
|
|
29
|
+
backend = "python"
|
|
30
|
+
_module = importlib.import_module(".memory_python", package=__name__)
|
|
31
|
+
else:
|
|
32
|
+
raise ImportError(f"Backend '{backend}' failed to load: {e}") from e
|
|
33
|
+
|
|
34
|
+
Memory = _module.Memory
|
|
35
|
+
|
|
36
|
+
# Expose Circuit to the package namespace
|
|
37
|
+
from .circuits import Circuit
|
|
38
|
+
|
|
39
|
+
logger.debug(f"[System] Initializing Memory using '{backend}' backend.")
|
|
40
|
+
|
|
41
|
+
__all__ = ['Circuit', 'Memory']
|