Skip to content

Commit a3f30ac

Browse files
committed
PullRequest: 27 v0.0.2
Merge branch v0.0.2 of [email protected]:oceanbase/OBShell-SDK-Python.git into master https://code.alipay.com/oceanbase/OBShell-SDK-Python/pull_requests/27 Signed-off-by: 阿绿 <[email protected]> * feat: v0.0.2 * chore: revert .gitignore
1 parent 0e3732e commit a3f30ac

File tree

11 files changed

+37
-21
lines changed

11 files changed

+37
-21
lines changed

obshell/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
from .service.client_set import ClientSet
17-
from .service.client_v1 import TaskExecuteFailedError, OBShellHandleError
17+
from .service.client_v1 import TaskExecuteFailedError, OBShellHandleError, IllegalOperatorError
1818
from .service.client_v1 import IllegalOperatorError, ClientV1
1919

2020
__all__ = ('ClientSet', 'TaskExecuteFailedError',

obshell/model/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
16+
from .tenant import ZoneParam,ModifyReplicaParam

obshell/model/format.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# coding: utf-8
2+
# Copyright (c) 2024 OceanBase.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
def model_str(cls):
17+
def __convert_value(value):
18+
if isinstance(value, list):
19+
return [__convert_value(item) for item in value]
20+
elif isinstance(value, dict):
21+
return {f"{key}": __convert_value(value) for key, value in value.items()}
22+
else:
23+
return str(value)
24+
members = ", ".join(
25+
f"\"{k}\":\"{__convert_value(v)}\"" for k, v in cls.__dict__.items())
26+
return '{' + members.replace("'", "\"") + '}'

obshell/model/info.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,11 @@
1616
from typing import List
1717
from enum import Enum
1818

19+
from .format import model_str
1920
from obshell.model.version import Version
2021
from obshell.auth.base import AuthVersion
2122

2223

23-
def model_str(cls):
24-
def __convert_value(value):
25-
if isinstance(value, list):
26-
return [__convert_value(item) for item in value]
27-
elif isinstance(value, dict):
28-
return {f"{key}": __convert_value(value) for key, value in value.items()}
29-
else:
30-
return str(value)
31-
members = ", ".join(
32-
f"\"{k}\":\"{__convert_value(v)}\"" for k, v in cls.__dict__.items())
33-
return '{' + members.replace("'", "\"") + '}'
34-
35-
3624
class AgentInfo:
3725

3826
def __init__(self,

obshell/model/ob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from .info import model_str
16+
from .format import model_str
1717

1818

1919
class UpgradePkgInfo:

obshell/model/recyclebin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from .info import model_str
16+
from .format import model_str
1717

1818

1919
class RecyclebinTenantInfo:

obshell/model/resource_pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from .info import model_str
16+
from .format import model_str
1717
from .unit import UnitConfig
1818

1919

obshell/model/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import json
1717
from enum import Enum
18-
from .info import model_str
18+
from .format import model_str
1919

2020

2121
class State(Enum):

obshell/model/tenant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from .info import model_str
16+
from .format import model_str
1717
from .resource_pool import ResourcePoolWithUnit
1818

1919

obshell/model/unit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from .info import model_str
16+
from .format import model_str
1717

1818

1919
class UnitConfig:

0 commit comments

Comments
 (0)