codosdk 1.0.46__tar.gz → 1.0.47__tar.gz
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.
- {codosdk-1.0.46 → codosdk-1.0.47}/PKG-INFO +1 -1
- {codosdk-1.0.46 → codosdk-1.0.47}/codosdk.egg-info/PKG-INFO +1 -1
- {codosdk-1.0.46 → codosdk-1.0.47}/codosdk.egg-info/SOURCES.txt +2 -1
- {codosdk-1.0.46 → codosdk-1.0.47}/setup.py +1 -1
- codosdk-1.0.47/websdk2/utils/pydantic_utils_v2.py +45 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/LICENSE +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/README.md +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/codosdk.egg-info/dependency_links.txt +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/codosdk.egg-info/requires.txt +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/codosdk.egg-info/top_level.txt +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/opssdk/__init__.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/opssdk/utils/__init__.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/pyproject.toml +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/setup.cfg +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/__init__.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/api_set.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/__init__.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/admin_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/agent_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/cmdb_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/kerrigan_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/mgv4_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/notice_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/apis/task_apis.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/application.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/base_handler.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/cache.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/cache_context.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/client.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/cloud/__init__.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/cloud/qcloud_api.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/cloud/ucloud_api.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/cloud_utils.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/configs.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/consts.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/crud_utils.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/db_context.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/error.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/fetch_coroutine.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/jwt_token.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/ldap.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/logger.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/model_utils.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/mqhelper.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/program.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/salt_api.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/sqlalchemy_pagination.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/tools.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/utils/__init__.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/utils/cc_crypto.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/utils/date_format.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/utils/pydantic_utils.py +0 -0
- {codosdk-1.0.46 → codosdk-1.0.47}/websdk2/web_logs.py +0 -0
|
@@ -9,7 +9,7 @@ desc : CODO SDK
|
|
|
9
9
|
import sys
|
|
10
10
|
from setuptools import setup, find_packages
|
|
11
11
|
|
|
12
|
-
VERSION = '1.0.
|
|
12
|
+
VERSION = '1.0.47'
|
|
13
13
|
|
|
14
14
|
if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 6):
|
|
15
15
|
print('This program requires at least Python 2.7 or 3.6 to run.')
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Version : 0.0.9
|
|
5
|
+
Contact : 191715030@qq.com
|
|
6
|
+
Author : shenshuo
|
|
7
|
+
Date : 2024/12/30 20:28
|
|
8
|
+
Desc : https://github.com/tiangolo/pydantic-sqlalchemy
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
####
|
|
12
|
+
from typing import Container, Optional, Type
|
|
13
|
+
from pydantic import BaseModel, create_model, ValidationError, ConfigDict
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# 删除的时候一般只有id
|
|
17
|
+
class PydanticDel(BaseModel):
|
|
18
|
+
id: int
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class PydanticDelList(BaseModel):
|
|
22
|
+
id_list: list[int]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def sqlalchemy_to_pydantic(db_model: Type, *, exclude: Container[str] = ()) -> Type[BaseModel]:
|
|
26
|
+
table = db_model.metadata.tables[db_model.__tablename__]
|
|
27
|
+
fields = {}
|
|
28
|
+
config = ConfigDict(from_attributes=True)
|
|
29
|
+
for column in table.columns:
|
|
30
|
+
name = column.name
|
|
31
|
+
if name in exclude:
|
|
32
|
+
continue
|
|
33
|
+
python_type: Optional[type] = None
|
|
34
|
+
if hasattr(column.type, "impl"):
|
|
35
|
+
if hasattr(column.type.impl, "python_type"):
|
|
36
|
+
python_type = column.type.impl.python_type
|
|
37
|
+
elif hasattr(column.type, "python_type"):
|
|
38
|
+
python_type = column.type.python_type
|
|
39
|
+
assert python_type, f"Could not infer python_type for {column}"
|
|
40
|
+
|
|
41
|
+
default = ... if column.default is None and not column.nullable else None
|
|
42
|
+
|
|
43
|
+
fields[name] = (python_type, default)
|
|
44
|
+
|
|
45
|
+
return create_model(db_model.__name__, __config__=config, **fields)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|