2.0.0
This commit is contained in:
1 parent
a52ec3f1bb
commit
1ee16914bc
438 files changed
+5153
-3282
No files matched your search
+10
-29
@@ -1,6 +1,6 @@
|
||||
import json
|
||||
from warnings import warn
|
||||
from dynamix_sdk import config
|
||||
from dynamix_sdk.api.system.info.version import SystemInfoVersionResultModel
|
||||
from dynamix_sdk.exceptions import IncompatibleAPIError
|
||||
from dynamix_sdk.utils import F_DECORATOR
|
||||
from .api import API
|
||||
@@ -8,11 +8,11 @@ from .api import API
|
||||
|
||||
class Dynamix:
|
||||
_config: config.ConfigWithAuth
|
||||
_COMPATIBLE_DX_MINOR_VERSION: str = '4.6'
|
||||
_COMPATIBLE_DX_BUILD: int = 1524
|
||||
_COMPATIBLE_DX_MINOR_VERSION: str = '4.7'
|
||||
_COMPATIBLE_DX_BUILD: int = 1718
|
||||
_COMPATIBILITY_WITH_NEWER_DX_BUILDS: bool = True
|
||||
_dx_version: str
|
||||
_dx_build: int
|
||||
_sys_info_version_result: SystemInfoVersionResultModel
|
||||
api: API
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -22,7 +22,6 @@ class Dynamix:
|
||||
verify_ssl: bool = True,
|
||||
http503_attempts: int = 10,
|
||||
http503_attempts_interval: int = 5,
|
||||
result_extra_allow: bool = False,
|
||||
ignore_api_compatibility: bool = False,
|
||||
wrap_request_exceptions: bool = False,
|
||||
f_decorators: list[F_DECORATOR] | None = None,
|
||||
@@ -34,19 +33,16 @@ class Dynamix:
|
||||
verify_ssl=verify_ssl,
|
||||
http503_attempts=http503_attempts,
|
||||
http503_attempts_interval=http503_attempts_interval,
|
||||
result_extra_allow=result_extra_allow,
|
||||
wrap_request_exceptions=wrap_request_exceptions,
|
||||
f_decorators=f_decorators,
|
||||
)
|
||||
|
||||
self._dx_version, self._dx_build = self._get_dx_version_and_build()
|
||||
self.api = API(config=self._config)
|
||||
|
||||
self._sys_info_version_result = self.api.system.info.version()
|
||||
|
||||
self._check_dx_compatibility(ignore_api_compatibility)
|
||||
|
||||
@property
|
||||
def api(self):
|
||||
return API(config=self._config)
|
||||
|
||||
@property
|
||||
def compatible_dx_minor_version(self) -> str:
|
||||
return self._COMPATIBLE_DX_MINOR_VERSION
|
||||
@@ -61,26 +57,11 @@ class Dynamix:
|
||||
|
||||
@property
|
||||
def dx_version(self) -> str:
|
||||
return self._dx_version
|
||||
return self._sys_info_version_result.version
|
||||
|
||||
@property
|
||||
def dx_build(self) -> int:
|
||||
return self._dx_build
|
||||
|
||||
def _get_dx_version_and_build(self) -> tuple[str, int]:
|
||||
result = self.api.system.info.version()
|
||||
|
||||
decoded_data = json.loads(result.replace("'", '"'))
|
||||
|
||||
dx_version = decoded_data['version']
|
||||
if not isinstance(dx_version, str):
|
||||
raise TypeError(f'DX version must be an str, got {type(dx_version)}') # noqa: E501
|
||||
|
||||
dx_build = decoded_data['build']
|
||||
if not isinstance(dx_build, int):
|
||||
raise TypeError(f'DX build must be an int, got {type(dx_build)}')
|
||||
|
||||
return dx_version, dx_build
|
||||
return self._sys_info_version_result.build_num
|
||||
|
||||
def _check_dx_compatibility(self, ignore_api_compatibility: bool):
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user