crypticorn 2.8.0rc2__py3-none-any.whl → 2.8.0rc4__py3-none-any.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.
- crypticorn/__init__.py +1 -1
- crypticorn/common/ansi_colors.py +1 -0
- crypticorn/common/logging.py +2 -2
- crypticorn/common/middleware.py +5 -4
- crypticorn/common/mixins.py +2 -2
- crypticorn/common/router/admin_router.py +3 -3
- crypticorn/hive/client/__init__.py +3 -0
- crypticorn/hive/client/api/__init__.py +1 -0
- crypticorn/hive/client/api/admin_api.py +1453 -0
- crypticorn/hive/client/api/models_api.py +7 -7
- crypticorn/hive/client/api/status_api.py +4 -231
- crypticorn/hive/client/models/__init__.py +2 -0
- crypticorn/hive/client/models/log_level.py +38 -0
- crypticorn/hive/client/models/response_getuptime.py +159 -0
- crypticorn/hive/main.py +2 -1
- crypticorn/pay/client/__init__.py +3 -0
- crypticorn/pay/client/api/__init__.py +1 -0
- crypticorn/pay/client/api/admin_api.py +1453 -0
- crypticorn/pay/client/api/status_api.py +4 -231
- crypticorn/pay/client/models/__init__.py +2 -0
- crypticorn/pay/client/models/log_level.py +38 -0
- crypticorn/pay/client/models/response_getuptime.py +159 -0
- crypticorn/pay/client/models/scope.py +2 -0
- crypticorn/pay/main.py +2 -0
- {crypticorn-2.8.0rc2.dist-info → crypticorn-2.8.0rc4.dist-info}/METADATA +1 -1
- {crypticorn-2.8.0rc2.dist-info → crypticorn-2.8.0rc4.dist-info}/RECORD +29 -23
- {crypticorn-2.8.0rc2.dist-info → crypticorn-2.8.0rc4.dist-info}/WHEEL +0 -0
- {crypticorn-2.8.0rc2.dist-info → crypticorn-2.8.0rc4.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.8.0rc2.dist-info → crypticorn-2.8.0rc4.dist-info}/top_level.txt +0 -0
crypticorn/__init__.py
CHANGED
crypticorn/common/ansi_colors.py
CHANGED
crypticorn/common/logging.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
+
|
2
3
|
# shared_logger.py
|
3
4
|
import logging
|
4
5
|
import sys
|
@@ -110,7 +111,6 @@ def configure_logging(
|
|
110
111
|
|
111
112
|
|
112
113
|
def disable_logging():
|
113
|
-
"""Disable logging for the crypticorn logger.
|
114
|
-
"""
|
114
|
+
"""Disable logging for the crypticorn logger."""
|
115
115
|
logger = logging.getLogger("crypticorn")
|
116
116
|
logger.disabled = True
|
crypticorn/common/middleware.py
CHANGED
@@ -8,20 +8,21 @@ def add_cors_middleware(app: "FastAPI"):
|
|
8
8
|
app.add_middleware(
|
9
9
|
CORSMiddleware,
|
10
10
|
allow_origins=[
|
11
|
-
"http://localhost:5173",
|
12
|
-
"http://localhost:4173",
|
11
|
+
"http://localhost:5173", # vite dev server
|
12
|
+
"http://localhost:4173", # vite preview server
|
13
13
|
],
|
14
|
-
allow_origin_regex="^https:\/\/([a-zA-Z0-9-]+\.)*crypticorn\.(dev|com)\/?$",
|
14
|
+
allow_origin_regex="^https:\/\/([a-zA-Z0-9-]+\.)*crypticorn\.(dev|com)\/?$", # matches (multiple or no) subdomains of crypticorn.dev and crypticorn.com
|
15
15
|
allow_credentials=True,
|
16
16
|
allow_methods=["*"],
|
17
17
|
allow_headers=["*"],
|
18
18
|
)
|
19
19
|
|
20
|
+
|
20
21
|
async def default_lifespan(app: FastAPI):
|
21
22
|
"""Default lifespan for the applications.
|
22
23
|
This is used to configure the logging for the application.
|
23
24
|
To override this, pass a different lifespan to the FastAPI constructor or call this lifespan within a custom lifespan.
|
24
25
|
"""
|
25
|
-
configure_logging(__name__)
|
26
|
+
configure_logging(__name__) # for the consuming app
|
26
27
|
logger = logging.getLogger(__name__)
|
27
28
|
yield
|
crypticorn/common/mixins.py
CHANGED
@@ -32,14 +32,14 @@ class ValidateEnumMixin:
|
|
32
32
|
except ValueError:
|
33
33
|
return False
|
34
34
|
|
35
|
-
|
35
|
+
#This Mixin will be removed in a future version. And has no effect from now on
|
36
36
|
class ExcludeEnumMixin:
|
37
37
|
"""Mixin to exclude enum from OpenAPI schema. We use this to avoid duplicating enums when generating client code from the openapi spec."""
|
38
38
|
|
39
39
|
@classmethod
|
40
40
|
def __get_pydantic_json_schema__(cls, core_schema, handler):
|
41
41
|
schema = handler(core_schema)
|
42
|
-
schema.pop("enum", None)
|
42
|
+
#schema.pop("enum", None)
|
43
43
|
return schema
|
44
44
|
|
45
45
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
This module contains the admin router for the API.
|
3
3
|
It provides endpoints for monitoring the server and getting information about the environment.
|
4
4
|
ONLY ALLOW ACCESS TO THIS ROUTER WITH ADMIN SCOPES.
|
5
|
-
>>> app.include_router(admin_router, dependencies=[Security(auth_handler.combined_auth, scopes=[Scope.
|
5
|
+
>>> app.include_router(admin_router, dependencies=[Security(auth_handler.combined_auth, scopes=[Scope.READ_ADMIN, Scope.WRITE_ADMIN])])
|
6
6
|
"""
|
7
7
|
|
8
8
|
import os
|
@@ -29,11 +29,11 @@ async def get_logging_level() -> LogLevel:
|
|
29
29
|
|
30
30
|
|
31
31
|
@router.get("/uptime", operation_id="getUptime", status_code=200)
|
32
|
-
def get_uptime(type: Literal["seconds", "human"] = "seconds") ->
|
32
|
+
def get_uptime(type: Literal["seconds", "human"] = "seconds") -> str:
|
33
33
|
"""Return the server uptime in seconds or human-readable form."""
|
34
34
|
uptime_seconds = int(time.time() - START_TIME)
|
35
35
|
if type == "seconds":
|
36
|
-
return uptime_seconds
|
36
|
+
return str(uptime_seconds)
|
37
37
|
elif type == "human":
|
38
38
|
return time.strftime("%H:%M:%S", time.gmtime(uptime_seconds))
|
39
39
|
|
@@ -17,6 +17,7 @@ Do not edit the class manually.
|
|
17
17
|
__version__ = "1.0.0"
|
18
18
|
|
19
19
|
# import apis into sdk package
|
20
|
+
from crypticorn.hive.client.api.admin_api import AdminApi
|
20
21
|
from crypticorn.hive.client.api.data_api import DataApi
|
21
22
|
from crypticorn.hive.client.api.models_api import ModelsApi
|
22
23
|
from crypticorn.hive.client.api.status_api import StatusApi
|
@@ -46,10 +47,12 @@ from crypticorn.hive.client.models.evaluation import Evaluation
|
|
46
47
|
from crypticorn.hive.client.models.evaluation_response import EvaluationResponse
|
47
48
|
from crypticorn.hive.client.models.exception_detail import ExceptionDetail
|
48
49
|
from crypticorn.hive.client.models.feature_size import FeatureSize
|
50
|
+
from crypticorn.hive.client.models.log_level import LogLevel
|
49
51
|
from crypticorn.hive.client.models.model import Model
|
50
52
|
from crypticorn.hive.client.models.model_create import ModelCreate
|
51
53
|
from crypticorn.hive.client.models.model_status import ModelStatus
|
52
54
|
from crypticorn.hive.client.models.model_update import ModelUpdate
|
55
|
+
from crypticorn.hive.client.models.response_getuptime import ResponseGetuptime
|
53
56
|
from crypticorn.hive.client.models.target import Target
|
54
57
|
from crypticorn.hive.client.models.target_info import TargetInfo
|
55
58
|
from crypticorn.hive.client.models.target_type import TargetType
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# flake8: noqa
|
2
2
|
|
3
3
|
# import apis into api package
|
4
|
+
from crypticorn.hive.client.api.admin_api import AdminApi
|
4
5
|
from crypticorn.hive.client.api.data_api import DataApi
|
5
6
|
from crypticorn.hive.client.api.models_api import ModelsApi
|
6
7
|
from crypticorn.hive.client.api.status_api import StatusApi
|