amsdal 0.4.13__cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.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.
- amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +1334 -0
- amsdal/__about__.py +4 -0
- amsdal/__about__.pyi +1 -0
- amsdal/__init__.py +23 -0
- amsdal/__init__.pyi +9 -0
- amsdal/__migrations__/0000_initial.py +217 -0
- amsdal/__migrations__/0001_datetime_type.py +18 -0
- amsdal/__migrations__/0002_fixture_order.py +44 -0
- amsdal/__migrations__/0003_schema_type_in_class_meta.py +44 -0
- amsdal/cloud/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/__init__.pyi +0 -0
- amsdal/cloud/client.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/client.pyi +57 -0
- amsdal/cloud/constants.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/constants.pyi +13 -0
- amsdal/cloud/enums.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/enums.pyi +68 -0
- amsdal/cloud/models/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/__init__.pyi +0 -0
- amsdal/cloud/models/base.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/base.pyi +247 -0
- amsdal/cloud/services/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/__init__.pyi +0 -0
- amsdal/cloud/services/actions/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/__init__.pyi +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.pyi +21 -0
- amsdal/cloud/services/actions/add_dependency.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_dependency.pyi +19 -0
- amsdal/cloud/services/actions/add_secret.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_secret.pyi +20 -0
- amsdal/cloud/services/actions/base.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/base.pyi +122 -0
- amsdal/cloud/services/actions/create_deploy.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_deploy.pyi +41 -0
- amsdal/cloud/services/actions/create_env.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_env.pyi +19 -0
- amsdal/cloud/services/actions/create_session.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_session.pyi +17 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.pyi +20 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.pyi +21 -0
- amsdal/cloud/services/actions/delete_env.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_env.pyi +21 -0
- amsdal/cloud/services/actions/delete_secret.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_secret.pyi +21 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.pyi +18 -0
- amsdal/cloud/services/actions/expose_db.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/expose_db.pyi +22 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +21 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.pyi +21 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.pyi +21 -0
- amsdal/cloud/services/actions/list_deploys.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_deploys.pyi +19 -0
- amsdal/cloud/services/actions/list_envs.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_envs.pyi +20 -0
- amsdal/cloud/services/actions/list_secrets.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_secrets.pyi +22 -0
- amsdal/cloud/services/actions/manager.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/manager.pyi +278 -0
- amsdal/cloud/services/actions/signup_action.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/signup_action.pyi +20 -0
- amsdal/cloud/services/actions/update_deploy.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/update_deploy.pyi +19 -0
- amsdal/cloud/services/auth/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/__init__.pyi +0 -0
- amsdal/cloud/services/auth/base.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/base.pyi +6 -0
- amsdal/cloud/services/auth/credentials.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/credentials.pyi +30 -0
- amsdal/cloud/services/auth/manager.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/manager.pyi +26 -0
- amsdal/cloud/services/auth/signup_service.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/signup_service.pyi +32 -0
- amsdal/cloud/services/auth/token.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/token.pyi +27 -0
- amsdal/configs/__init__.py +0 -0
- amsdal/configs/__init__.pyi +0 -0
- amsdal/configs/constants.py +33 -0
- amsdal/configs/constants.pyi +22 -0
- amsdal/configs/main.py +258 -0
- amsdal/configs/main.pyi +173 -0
- amsdal/context/__init__.py +0 -0
- amsdal/context/__init__.pyi +0 -0
- amsdal/context/manager.py +69 -0
- amsdal/context/manager.pyi +50 -0
- amsdal/contrib/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/contrib/__init__.pyi +0 -0
- amsdal/contrib/app_config.py +7 -0
- amsdal/contrib/app_config.pyi +6 -0
- amsdal/contrib/auth/__init__.py +0 -0
- amsdal/contrib/auth/__init__.pyi +0 -0
- amsdal/contrib/auth/app.py +27 -0
- amsdal/contrib/auth/app.pyi +15 -0
- amsdal/contrib/auth/decorators/__init__.py +35 -0
- amsdal/contrib/auth/decorators/__init__.pyi +6 -0
- amsdal/contrib/auth/errors.py +7 -0
- amsdal/contrib/auth/errors.pyi +4 -0
- amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
- amsdal/contrib/auth/lifecycle/__init__.py +0 -0
- amsdal/contrib/auth/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/auth/lifecycle/consumer.py +394 -0
- amsdal/contrib/auth/lifecycle/consumer.pyi +108 -0
- amsdal/contrib/auth/migrations/0000_initial.py +84 -0
- amsdal/contrib/auth/models/__init__.py +0 -0
- amsdal/contrib/auth/models/__init__.pyi +0 -0
- amsdal/contrib/auth/models/login_session.py +118 -0
- amsdal/contrib/auth/models/login_session.pyi +37 -0
- amsdal/contrib/auth/models/permission.py +23 -0
- amsdal/contrib/auth/models/permission.pyi +18 -0
- amsdal/contrib/auth/models/user.py +106 -0
- amsdal/contrib/auth/models/user.pyi +46 -0
- amsdal/contrib/auth/settings.py +36 -0
- amsdal/contrib/auth/settings.pyi +26 -0
- amsdal/contrib/frontend_configs/__init__.py +0 -0
- amsdal/contrib/frontend_configs/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/app.py +24 -0
- amsdal/contrib/frontend_configs/app.pyi +19 -0
- amsdal/contrib/frontend_configs/constants.py +1 -0
- amsdal/contrib/frontend_configs/constants.pyi +1 -0
- amsdal/contrib/frontend_configs/conversion/__init__.py +5 -0
- amsdal/contrib/frontend_configs/conversion/__init__.pyi +3 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +286 -0
- amsdal/contrib/frontend_configs/conversion/convert.pyi +22 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.py +0 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +306 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +98 -0
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +256 -0
- amsdal/contrib/frontend_configs/models/__init__.py +0 -0
- amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
- amsdal/contrib/frontend_configs/utils.py +29 -0
- amsdal/contrib/frontend_configs/utils.pyi +17 -0
- amsdal/errors.py +31 -0
- amsdal/errors.pyi +12 -0
- amsdal/fixtures/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/__init__.pyi +0 -0
- amsdal/fixtures/manager.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/manager.pyi +170 -0
- amsdal/fixtures/utils.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/utils.pyi +9 -0
- amsdal/manager.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/manager.pyi +265 -0
- amsdal/mixins/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/__init__.pyi +0 -0
- amsdal/mixins/class_versions_mixin.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/class_versions_mixin.pyi +12 -0
- amsdal/models/__init__.py +19 -0
- amsdal/models/__init__.pyi +9 -0
- amsdal/models/core/__init__.py +0 -0
- amsdal/models/core/__init__.pyi +0 -0
- amsdal/models/core/class_object.py +37 -0
- amsdal/models/core/class_object.pyi +24 -0
- amsdal/models/core/class_object_meta.py +26 -0
- amsdal/models/core/class_object_meta.pyi +15 -0
- amsdal/models/core/class_property.py +20 -0
- amsdal/models/core/class_property.pyi +11 -0
- amsdal/models/core/class_property_meta.py +15 -0
- amsdal/models/core/class_property_meta.pyi +10 -0
- amsdal/models/core/file.py +156 -0
- amsdal/models/core/file.pyi +104 -0
- amsdal/models/core/fixture.py +25 -0
- amsdal/models/core/fixture.pyi +14 -0
- amsdal/models/core/option.py +11 -0
- amsdal/models/core/option.pyi +8 -0
- amsdal/models/core/validator.py +12 -0
- amsdal/models/core/validator.pyi +8 -0
- amsdal/models/types/__init__.py +0 -0
- amsdal/models/types/__init__.pyi +0 -0
- amsdal/models/types/object.py +26 -0
- amsdal/models/types/object.pyi +16 -0
- amsdal/py.typed +0 -0
- amsdal/queryset/__init__.py +21 -0
- amsdal/queryset/__init__.pyi +6 -0
- amsdal/schemas/__init__.py +0 -0
- amsdal/schemas/__init__.pyi +0 -0
- amsdal/schemas/core/class_object/model.json +31 -0
- amsdal/schemas/core/class_object/properties/display_name.py +9 -0
- amsdal/schemas/core/class_object_meta/model.json +59 -0
- amsdal/schemas/core/class_property/model.json +22 -0
- amsdal/schemas/core/class_property_meta/model.json +23 -0
- amsdal/schemas/core/file/hooks/pre_create.py +24 -0
- amsdal/schemas/core/file/hooks/pre_update.py +24 -0
- amsdal/schemas/core/file/model.json +23 -0
- amsdal/schemas/core/file/properties/from_file.py +34 -0
- amsdal/schemas/core/file/properties/mimetype.py +13 -0
- amsdal/schemas/core/file/properties/str.py +6 -0
- amsdal/schemas/core/file/properties/to_file.py +24 -0
- amsdal/schemas/core/file/properties/validate_data.py +32 -0
- amsdal/schemas/core/fixture/model.json +35 -0
- amsdal/schemas/core/option/model.json +19 -0
- amsdal/schemas/core/validator/model.json +19 -0
- amsdal/schemas/interfaces.py +25 -0
- amsdal/schemas/interfaces.pyi +20 -0
- amsdal/schemas/manager.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/schemas/manager.py +0 -0
- amsdal/schemas/manager.pyi +0 -0
- amsdal/schemas/mixins/__init__.py +0 -0
- amsdal/schemas/mixins/__init__.pyi +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +125 -0
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +45 -0
- amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
- amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
- amsdal/schemas/repository.py +84 -0
- amsdal/schemas/repository.pyi +22 -0
- amsdal/schemas/types/anything/model.json +7 -0
- amsdal/schemas/types/array/model.json +7 -0
- amsdal/schemas/types/binary/model.json +7 -0
- amsdal/schemas/types/boolean/model.json +17 -0
- amsdal/schemas/types/date/model.json +7 -0
- amsdal/schemas/types/datetime/model.json +7 -0
- amsdal/schemas/types/dictionary/model.json +8 -0
- amsdal/schemas/types/number/model.json +8 -0
- amsdal/schemas/types/object/model.json +53 -0
- amsdal/schemas/types/string/model.json +8 -0
- amsdal/schemas/utils.py +16 -0
- amsdal/schemas/utils.pyi +10 -0
- amsdal/services/__init__.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/services/__init__.pyi +0 -0
- amsdal/services/transaction_execution.cpython-311-x86_64-linux-gnu.so +0 -0
- amsdal/services/transaction_execution.pyi +93 -0
- amsdal/transactions/__init__.py +13 -0
- amsdal/transactions/__init__.pyi +4 -0
- amsdal/utils/__init__.py +0 -0
- amsdal/utils/__init__.pyi +0 -0
- amsdal/utils/contrib_paths.py +23 -0
- amsdal/utils/contrib_paths.pyi +14 -0
- amsdal/utils/rollback/__init__.py +440 -0
- amsdal/utils/rollback/__init__.pyi +38 -0
- amsdal/utils/tests/__init__.py +0 -0
- amsdal/utils/tests/enums.py +18 -0
- amsdal/utils/tests/factories.py +49 -0
- amsdal/utils/tests/helpers.py +499 -0
- amsdal-0.4.13.dist-info/METADATA +369 -0
- amsdal-0.4.13.dist-info/RECORD +269 -0
- amsdal-0.4.13.dist-info/WHEEL +6 -0
- amsdal-0.4.13.dist-info/licenses/LICENSE.txt +107 -0
- amsdal-0.4.13.dist-info/top_level.txt +1 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
from amsdal_models.classes.model import Model
|
2
|
+
from amsdal_utils.models.enums import ModuleType
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import BinaryIO, ClassVar
|
5
|
+
|
6
|
+
class File(Model):
|
7
|
+
__module_type__: ClassVar[ModuleType] = ...
|
8
|
+
filename: str = ...
|
9
|
+
data: bytes = ...
|
10
|
+
size: float | None = ...
|
11
|
+
def __repr__(self) -> str: ...
|
12
|
+
def __str__(self) -> str: ...
|
13
|
+
async def apre_create(self) -> None:
|
14
|
+
"""
|
15
|
+
Prepares the object for creation by setting its size attribute.
|
16
|
+
|
17
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
18
|
+
If the data is None, it defaults to an empty byte string.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
None
|
22
|
+
"""
|
23
|
+
async def apre_update(self) -> None:
|
24
|
+
"""
|
25
|
+
Prepares the object for update by setting its size attribute.
|
26
|
+
|
27
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
28
|
+
If the data is None, it defaults to an empty byte string.
|
29
|
+
|
30
|
+
Args:
|
31
|
+
None
|
32
|
+
"""
|
33
|
+
@classmethod
|
34
|
+
def data_base64_decode(cls, v: bytes) -> bytes:
|
35
|
+
"""
|
36
|
+
Decodes a base64-encoded byte string if it is base64-encoded.
|
37
|
+
|
38
|
+
This method checks if the provided byte string is base64-encoded and decodes it if true.
|
39
|
+
If the byte string is not base64-encoded, it returns the original byte string.
|
40
|
+
|
41
|
+
Args:
|
42
|
+
cls: The class this method belongs to.
|
43
|
+
v (bytes): The byte string to be checked and potentially decoded.
|
44
|
+
|
45
|
+
Returns:
|
46
|
+
bytes: The decoded byte string if it was base64-encoded, otherwise the original byte string.
|
47
|
+
"""
|
48
|
+
@classmethod
|
49
|
+
def from_file(cls, file_or_path: Path | BinaryIO) -> File:
|
50
|
+
"""
|
51
|
+
Creates a `File` object from a file path or a binary file object.
|
52
|
+
|
53
|
+
Args:
|
54
|
+
file_or_path (Path | BinaryIO): The file path or binary file object.
|
55
|
+
|
56
|
+
Returns:
|
57
|
+
File: The created `File` object.
|
58
|
+
|
59
|
+
Raises:
|
60
|
+
ValueError: If the provided path is a directory.
|
61
|
+
"""
|
62
|
+
@property
|
63
|
+
def mimetype(self) -> str | None:
|
64
|
+
"""
|
65
|
+
Returns the MIME type of the file based on its filename.
|
66
|
+
|
67
|
+
This method uses the `mimetypes` module to guess the MIME type of the file.
|
68
|
+
|
69
|
+
Returns:
|
70
|
+
str | None: The guessed MIME type of the file, or None if it cannot be determined.
|
71
|
+
"""
|
72
|
+
def pre_create(self) -> None:
|
73
|
+
"""
|
74
|
+
Prepares the object for creation by setting its size attribute.
|
75
|
+
|
76
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
77
|
+
If the data is None, it defaults to an empty byte string.
|
78
|
+
|
79
|
+
Args:
|
80
|
+
None
|
81
|
+
"""
|
82
|
+
def pre_update(self) -> None:
|
83
|
+
"""
|
84
|
+
Prepares the object for update by setting its size attribute.
|
85
|
+
|
86
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
87
|
+
If the data is None, it defaults to an empty byte string.
|
88
|
+
|
89
|
+
Args:
|
90
|
+
None
|
91
|
+
"""
|
92
|
+
def to_file(self, file_or_path: Path | BinaryIO) -> None:
|
93
|
+
"""
|
94
|
+
Writes the object's data to a file path or a binary file object.
|
95
|
+
|
96
|
+
Args:
|
97
|
+
file_or_path (Path | BinaryIO): The file path or binary file object where the data will be written.
|
98
|
+
|
99
|
+
Returns:
|
100
|
+
None
|
101
|
+
|
102
|
+
Raises:
|
103
|
+
ValueError: If the provided path is a directory.
|
104
|
+
"""
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from typing import Any
|
2
|
+
from typing import ClassVar
|
3
|
+
|
4
|
+
from amsdal_models.builder.validators.dict_validators import validate_non_empty_keys
|
5
|
+
from amsdal_models.classes.data_models.constraints import UniqueConstraint
|
6
|
+
from amsdal_models.classes.model import Model
|
7
|
+
from amsdal_utils.models.enums import ModuleType
|
8
|
+
from pydantic.fields import Field
|
9
|
+
from pydantic.functional_validators import field_validator
|
10
|
+
|
11
|
+
|
12
|
+
class Fixture(Model):
|
13
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
14
|
+
__constraints__: ClassVar[list[UniqueConstraint]] = [
|
15
|
+
UniqueConstraint(name='unq_fixture_external_id', fields=['external_id'])
|
16
|
+
]
|
17
|
+
class_name: str | None = Field(None, title='Class Name')
|
18
|
+
order: float | None = Field(None, title='Order')
|
19
|
+
external_id: str = Field(title='External ID')
|
20
|
+
data: dict[str, Any | None] = Field(title='Data')
|
21
|
+
|
22
|
+
@field_validator('data')
|
23
|
+
@classmethod
|
24
|
+
def _non_empty_keys_data(cls: type, value: Any) -> Any:
|
25
|
+
return validate_non_empty_keys(value)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from amsdal_models.classes.data_models.constraints import UniqueConstraint
|
2
|
+
from amsdal_models.classes.model import Model
|
3
|
+
from amsdal_utils.models.enums import ModuleType
|
4
|
+
from typing import Any, ClassVar
|
5
|
+
|
6
|
+
class Fixture(Model):
|
7
|
+
__module_type__: ClassVar[ModuleType] = ...
|
8
|
+
__constraints__: ClassVar[list[UniqueConstraint]] = ...
|
9
|
+
class_name: str | None = ...
|
10
|
+
order: float | None = ...
|
11
|
+
external_id: str = ...
|
12
|
+
data: dict[str, Any | None] = ...
|
13
|
+
@classmethod
|
14
|
+
def _non_empty_keys_data(cls, value: Any) -> Any: ...
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from typing import ClassVar
|
2
|
+
|
3
|
+
from amsdal_models.classes.model import TypeModel
|
4
|
+
from amsdal_utils.models.enums import ModuleType
|
5
|
+
from pydantic.fields import Field
|
6
|
+
|
7
|
+
|
8
|
+
class Option(TypeModel):
|
9
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
10
|
+
key: str = Field(title='Key')
|
11
|
+
value: str = Field(title='Value Type')
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from typing import Any
|
2
|
+
from typing import ClassVar
|
3
|
+
|
4
|
+
from amsdal_models.classes.model import TypeModel
|
5
|
+
from amsdal_utils.models.enums import ModuleType
|
6
|
+
from pydantic.fields import Field
|
7
|
+
|
8
|
+
|
9
|
+
class Validator(TypeModel):
|
10
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
11
|
+
name: str = Field(title='Validator Name')
|
12
|
+
data: Any = Field(title='Validator Data')
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from typing import Any
|
2
|
+
from typing import ClassVar
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from amsdal_models.builder.validators.dict_validators import validate_non_empty_keys
|
6
|
+
from amsdal_models.classes.model import Model
|
7
|
+
from amsdal_utils.models.enums import ModuleType
|
8
|
+
from pydantic.fields import Field
|
9
|
+
from pydantic.functional_validators import field_validator
|
10
|
+
|
11
|
+
|
12
|
+
class Object(Model):
|
13
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.TYPE
|
14
|
+
title: Optional[str] = Field(None, title='Title') # noqa: UP007
|
15
|
+
type: Optional[str] = Field(None, title='Type') # noqa: UP007
|
16
|
+
default: Optional[Any] = Field(None, title='Default') # noqa: UP007
|
17
|
+
properties: Optional[dict[str, Optional[Any]]] = Field(None, title='Properties') # noqa: UP007
|
18
|
+
required: Optional[list[str]] = Field(None, title='Required') # noqa: UP007
|
19
|
+
unique: Optional[list[list[str]]] = Field(None, title='Unique Fields') # noqa: UP007
|
20
|
+
custom_code: Optional[str] = Field(None, title='Custom Code') # noqa: UP007
|
21
|
+
meta_class: Optional[str] = Field(None, title='Meta Class') # noqa: UP007
|
22
|
+
|
23
|
+
@field_validator('properties')
|
24
|
+
@classmethod
|
25
|
+
def _non_empty_keys_properties(cls: type, value: Any) -> Any: # type: ignore # noqa: A003
|
26
|
+
return validate_non_empty_keys(value)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from amsdal_models.classes.model import Model
|
2
|
+
from amsdal_utils.models.enums import ModuleType
|
3
|
+
from typing import Any, ClassVar
|
4
|
+
|
5
|
+
class Object(Model):
|
6
|
+
__module_type__: ClassVar[ModuleType] = ...
|
7
|
+
title: str | None = ...
|
8
|
+
type: str | None = ...
|
9
|
+
default: Any | None = ...
|
10
|
+
properties: dict[str, Any | None] | None = ...
|
11
|
+
required: list[str] | None = ...
|
12
|
+
unique: list[list[str]] | None = ...
|
13
|
+
custom_code: str | None = ...
|
14
|
+
meta_class: str | None = ...
|
15
|
+
@classmethod
|
16
|
+
def _non_empty_keys_properties(cls, value: Any) -> Any: ...
|
amsdal/py.typed
ADDED
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from amsdal_models.querysets.base_queryset import QuerySet
|
2
|
+
from amsdal_models.querysets.base_queryset import QuerySetCount
|
3
|
+
from amsdal_models.querysets.base_queryset import QuerySetOne
|
4
|
+
from amsdal_models.querysets.base_queryset import QuerySetOneRequired
|
5
|
+
from amsdal_utils.query.data_models.filter import Filter
|
6
|
+
from amsdal_utils.query.enums import Lookup
|
7
|
+
from amsdal_utils.query.enums import OrderDirection
|
8
|
+
from amsdal_utils.query.utils import ConnectorEnum
|
9
|
+
from amsdal_utils.query.utils import Q
|
10
|
+
|
11
|
+
__all__ = [
|
12
|
+
'ConnectorEnum',
|
13
|
+
'Filter',
|
14
|
+
'Lookup',
|
15
|
+
'OrderDirection',
|
16
|
+
'Q',
|
17
|
+
'QuerySet',
|
18
|
+
'QuerySetCount',
|
19
|
+
'QuerySetOne',
|
20
|
+
'QuerySetOneRequired',
|
21
|
+
]
|
@@ -0,0 +1,6 @@
|
|
1
|
+
from amsdal_models.querysets.base_queryset import QuerySet as QuerySet, QuerySetCount as QuerySetCount, QuerySetOne as QuerySetOne, QuerySetOneRequired as QuerySetOneRequired
|
2
|
+
from amsdal_utils.query.data_models.filter import Filter as Filter
|
3
|
+
from amsdal_utils.query.enums import Lookup as Lookup, OrderDirection as OrderDirection
|
4
|
+
from amsdal_utils.query.utils import ConnectorEnum as ConnectorEnum, Q as Q
|
5
|
+
|
6
|
+
__all__ = ['ConnectorEnum', 'Filter', 'Lookup', 'OrderDirection', 'Q', 'QuerySet', 'QuerySetCount', 'QuerySetOne', 'QuerySetOneRequired']
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"title": "ClassObject",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"properties": {
|
6
|
+
"title": "Properties",
|
7
|
+
"type": "dictionary",
|
8
|
+
"items": {
|
9
|
+
"key": {
|
10
|
+
"type": "string"
|
11
|
+
},
|
12
|
+
"value": {
|
13
|
+
"type": "ClassProperty"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"required": {
|
18
|
+
"title": "Required",
|
19
|
+
"type": "array",
|
20
|
+
"items": {
|
21
|
+
"type": "string"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"meta_class": {
|
25
|
+
"title": "Meta Class",
|
26
|
+
"type": "string",
|
27
|
+
"default": "ClassObject"
|
28
|
+
}
|
29
|
+
},
|
30
|
+
"required": []
|
31
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
{
|
2
|
+
"title": "ClassObjectMeta",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"title": {
|
6
|
+
"title": "Title",
|
7
|
+
"type": "string"
|
8
|
+
},
|
9
|
+
"type": {
|
10
|
+
"title": "Type",
|
11
|
+
"type": "string"
|
12
|
+
},
|
13
|
+
"default": {
|
14
|
+
"title": "Default",
|
15
|
+
"type": "anything"
|
16
|
+
},
|
17
|
+
"class_schema_type": {
|
18
|
+
"title": "Schema Type",
|
19
|
+
"type": "string"
|
20
|
+
},
|
21
|
+
"properties": {
|
22
|
+
"title": "Properties",
|
23
|
+
"type": "dictionary",
|
24
|
+
"items": {
|
25
|
+
"key": {
|
26
|
+
"type": "string"
|
27
|
+
},
|
28
|
+
"value": {
|
29
|
+
"type": "ClassPropertyMeta"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
},
|
33
|
+
"indexed": {
|
34
|
+
"title": "Indexed",
|
35
|
+
"type": "array",
|
36
|
+
"items": {
|
37
|
+
"type": "string"
|
38
|
+
}
|
39
|
+
},
|
40
|
+
"unique": {
|
41
|
+
"title": "Unique Fields",
|
42
|
+
"type": "array",
|
43
|
+
"items": {
|
44
|
+
"type": "array",
|
45
|
+
"items": {
|
46
|
+
"type": "string"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"custom_code": {
|
51
|
+
"title": "Custom Code",
|
52
|
+
"type": "string"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
"required": [
|
56
|
+
"title",
|
57
|
+
"type"
|
58
|
+
]
|
59
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"title": "ClassProperty",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"type": {
|
6
|
+
"title": "Type",
|
7
|
+
"type": "string"
|
8
|
+
},
|
9
|
+
"items": {
|
10
|
+
"title": "Items",
|
11
|
+
"type": "dictionary",
|
12
|
+
"items": {
|
13
|
+
"key": {"type": "string"},
|
14
|
+
"value": {"type": "anything"}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"required": [
|
19
|
+
"type"
|
20
|
+
],
|
21
|
+
"meta_class": "TypeMeta"
|
22
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"title": "ClassPropertyMeta",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"title": {
|
6
|
+
"title": "Title",
|
7
|
+
"type": "string"
|
8
|
+
},
|
9
|
+
"default": {
|
10
|
+
"title": "Default",
|
11
|
+
"type": "anything"
|
12
|
+
},
|
13
|
+
"options": {
|
14
|
+
"title": "Options",
|
15
|
+
"type": "array",
|
16
|
+
"items": {
|
17
|
+
"type": "Option"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
},
|
21
|
+
"required": [],
|
22
|
+
"meta_class": "TypeMeta"
|
23
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
def pre_create(self) -> None: # type: ignore[no-untyped-def]
|
2
|
+
"""
|
3
|
+
Prepares the object for creation by setting its size attribute.
|
4
|
+
|
5
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
6
|
+
If the data is None, it defaults to an empty byte string.
|
7
|
+
|
8
|
+
Args:
|
9
|
+
None
|
10
|
+
"""
|
11
|
+
self.size = len(self.data or b'')
|
12
|
+
|
13
|
+
|
14
|
+
async def apre_create(self) -> None: # type: ignore[no-untyped-def]
|
15
|
+
"""
|
16
|
+
Prepares the object for creation by setting its size attribute.
|
17
|
+
|
18
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
19
|
+
If the data is None, it defaults to an empty byte string.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
None
|
23
|
+
"""
|
24
|
+
self.size = len(self.data or b'')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
def pre_update(self): # type: ignore[no-untyped-def]
|
2
|
+
"""
|
3
|
+
Prepares the object for update by setting its size attribute.
|
4
|
+
|
5
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
6
|
+
If the data is None, it defaults to an empty byte string.
|
7
|
+
|
8
|
+
Args:
|
9
|
+
None
|
10
|
+
"""
|
11
|
+
self.size = len(self.data or b'')
|
12
|
+
|
13
|
+
|
14
|
+
async def apre_update(self): # type: ignore[no-untyped-def]
|
15
|
+
"""
|
16
|
+
Prepares the object for update by setting its size attribute.
|
17
|
+
|
18
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
19
|
+
If the data is None, it defaults to an empty byte string.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
None
|
23
|
+
"""
|
24
|
+
self.size = len(self.data or b'')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"title": "File",
|
3
|
+
"type": "object",
|
4
|
+
"default": null,
|
5
|
+
"properties": {
|
6
|
+
"filename": {
|
7
|
+
"title": "Filename",
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
"data": {
|
11
|
+
"title": "Data",
|
12
|
+
"type": "binary"
|
13
|
+
},
|
14
|
+
"size": {
|
15
|
+
"title": "Size",
|
16
|
+
"type": "number"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"required": [
|
20
|
+
"filename",
|
21
|
+
"data"
|
22
|
+
]
|
23
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from typing import BinaryIO
|
3
|
+
|
4
|
+
|
5
|
+
@classmethod # type: ignore[misc, no-untyped-def]
|
6
|
+
def from_file( # type: ignore[no-untyped-def]
|
7
|
+
cls,
|
8
|
+
file_or_path: Path | BinaryIO,
|
9
|
+
) -> 'File': # type: ignore[name-defined] # noqa: F821
|
10
|
+
"""
|
11
|
+
Creates a `File` object from a file path or a binary file object.
|
12
|
+
|
13
|
+
Args:
|
14
|
+
file_or_path (Path | BinaryIO): The file path or binary file object.
|
15
|
+
|
16
|
+
Returns:
|
17
|
+
File: The created `File` object.
|
18
|
+
|
19
|
+
Raises:
|
20
|
+
ValueError: If the provided path is a directory.
|
21
|
+
"""
|
22
|
+
if isinstance(file_or_path, Path):
|
23
|
+
if file_or_path.is_dir():
|
24
|
+
msg = f'{file_or_path} is a directory'
|
25
|
+
raise ValueError(msg)
|
26
|
+
|
27
|
+
data = file_or_path.read_bytes()
|
28
|
+
filename = file_or_path.name
|
29
|
+
else:
|
30
|
+
file_or_path.seek(0)
|
31
|
+
data = file_or_path.read()
|
32
|
+
filename = Path(file_or_path.name).name
|
33
|
+
|
34
|
+
return cls(data=data, filename=filename)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@property # type: ignore[misc]
|
2
|
+
def mimetype(self) -> str | None: # type: ignore[no-untyped-def]
|
3
|
+
"""
|
4
|
+
Returns the MIME type of the file based on its filename.
|
5
|
+
|
6
|
+
This method uses the `mimetypes` module to guess the MIME type of the file.
|
7
|
+
|
8
|
+
Returns:
|
9
|
+
str | None: The guessed MIME type of the file, or None if it cannot be determined.
|
10
|
+
"""
|
11
|
+
import mimetypes
|
12
|
+
|
13
|
+
return mimetypes.guess_type(self.filename)[0]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from typing import BinaryIO
|
3
|
+
|
4
|
+
|
5
|
+
def to_file(self, file_or_path: Path | BinaryIO) -> None: # type: ignore[no-untyped-def]
|
6
|
+
"""
|
7
|
+
Writes the object's data to a file path or a binary file object.
|
8
|
+
|
9
|
+
Args:
|
10
|
+
file_or_path (Path | BinaryIO): The file path or binary file object where the data will be written.
|
11
|
+
|
12
|
+
Returns:
|
13
|
+
None
|
14
|
+
|
15
|
+
Raises:
|
16
|
+
ValueError: If the provided path is a directory.
|
17
|
+
"""
|
18
|
+
if isinstance(file_or_path, Path):
|
19
|
+
if file_or_path.is_dir():
|
20
|
+
file_or_path = file_or_path / self.name
|
21
|
+
file_or_path.write_bytes(self.data) # type: ignore[union-attr]
|
22
|
+
else:
|
23
|
+
file_or_path.write(self.data)
|
24
|
+
file_or_path.seek(0)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import base64
|
2
|
+
|
3
|
+
from pydantic import field_validator
|
4
|
+
|
5
|
+
|
6
|
+
@field_validator('data') # type: ignore[misc]
|
7
|
+
@classmethod
|
8
|
+
def data_base64_decode(cls, v: bytes) -> bytes: # type: ignore[no-untyped-def]
|
9
|
+
"""
|
10
|
+
Decodes a base64-encoded byte string if it is base64-encoded.
|
11
|
+
|
12
|
+
This method checks if the provided byte string is base64-encoded and decodes it if true.
|
13
|
+
If the byte string is not base64-encoded, it returns the original byte string.
|
14
|
+
|
15
|
+
Args:
|
16
|
+
cls: The class this method belongs to.
|
17
|
+
v (bytes): The byte string to be checked and potentially decoded.
|
18
|
+
|
19
|
+
Returns:
|
20
|
+
bytes: The decoded byte string if it was base64-encoded, otherwise the original byte string.
|
21
|
+
"""
|
22
|
+
is_base64: bool = False
|
23
|
+
|
24
|
+
try:
|
25
|
+
is_base64 = base64.b64encode(base64.b64decode(v)) == v
|
26
|
+
except Exception:
|
27
|
+
...
|
28
|
+
|
29
|
+
if is_base64:
|
30
|
+
return base64.b64decode(v)
|
31
|
+
|
32
|
+
return v
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"title": "Fixture",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"class_name": {
|
6
|
+
"title": "Class Name",
|
7
|
+
"type": "string"
|
8
|
+
},
|
9
|
+
"order": {
|
10
|
+
"title": "Order",
|
11
|
+
"type": "number"
|
12
|
+
},
|
13
|
+
"external_id": {
|
14
|
+
"title": "External ID",
|
15
|
+
"type": "string"
|
16
|
+
},
|
17
|
+
"data": {
|
18
|
+
"title": "Data",
|
19
|
+
"type": "dictionary",
|
20
|
+
"items": {
|
21
|
+
"key": {"type": "string"},
|
22
|
+
"value": {"type": "anything"}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"required": [
|
27
|
+
"data",
|
28
|
+
"external_id"
|
29
|
+
],
|
30
|
+
"unique": [
|
31
|
+
[
|
32
|
+
"external_id"
|
33
|
+
]
|
34
|
+
]
|
35
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"title": "Option",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"key": {
|
6
|
+
"title": "Key",
|
7
|
+
"type": "string"
|
8
|
+
},
|
9
|
+
"value": {
|
10
|
+
"title": "Value Type",
|
11
|
+
"type": "string"
|
12
|
+
}
|
13
|
+
},
|
14
|
+
"required": [
|
15
|
+
"key",
|
16
|
+
"value"
|
17
|
+
],
|
18
|
+
"meta_class": "TypeMeta"
|
19
|
+
}
|