aboutsummaryrefslogtreecommitdiff
path: root/python/cru/__init__.py
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-02-23 16:40:32 +0800
committerYuqian Yang <crupest@crupest.life>2025-02-23 16:40:32 +0800
commit90868bf85dc295f70620dbcbd5790999fe239550 (patch)
tree08c0f73597a751acff14a4d224446e87b2d8775d /python/cru/__init__.py
parent1e9b2436eaffa4130f6a69c3a108f6feb9dd4ac8 (diff)
downloadcrupest-90868bf85dc295f70620dbcbd5790999fe239550.tar.gz
crupest-90868bf85dc295f70620dbcbd5790999fe239550.tar.bz2
crupest-90868bf85dc295f70620dbcbd5790999fe239550.zip
feat(python): move python codes.
Diffstat (limited to 'python/cru/__init__.py')
-rw-r--r--python/cru/__init__.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/python/cru/__init__.py b/python/cru/__init__.py
new file mode 100644
index 0000000..17799a9
--- /dev/null
+++ b/python/cru/__init__.py
@@ -0,0 +1,60 @@
+import sys
+
+from ._base import CRU, CruNamespaceError, CRU_NAME_PREFIXES
+from ._error import (
+ CruException,
+ CruLogicError,
+ CruInternalError,
+ CruUnreachableError,
+ cru_unreachable,
+)
+from ._const import (
+ CruConstantBase,
+ CruDontChange,
+ CruNotFound,
+ CruNoValue,
+ CruPlaceholder,
+ CruUseDefault,
+)
+from ._func import CruFunction
+from ._iter import CruIterable, CruIterator
+from ._event import CruEvent, CruEventHandlerToken
+from ._type import CruTypeSet, CruTypeCheckError
+
+
+class CruInitError(CruException):
+ pass
+
+
+def check_python_version(required_version=(3, 11)):
+ if sys.version_info < required_version:
+ raise CruInitError(f"Python version must be >= {required_version}!")
+
+
+check_python_version()
+
+__all__ = [
+ "CRU",
+ "CruNamespaceError",
+ "CRU_NAME_PREFIXES",
+ "check_python_version",
+ "CruException",
+ "CruInternalError",
+ "CruLogicError",
+ "CruUnreachableError",
+ "cru_unreachable",
+ "CruInitError",
+ "CruConstantBase",
+ "CruDontChange",
+ "CruNotFound",
+ "CruNoValue",
+ "CruPlaceholder",
+ "CruUseDefault",
+ "CruFunction",
+ "CruIterable",
+ "CruIterator",
+ "CruEvent",
+ "CruEventHandlerToken",
+ "CruTypeSet",
+ "CruTypeCheckError",
+]