boto3-assist 0.5.2__tar.gz → 0.6.1__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.
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.gitignore +2 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.vscode/settings.json +1 -2
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/PKG-INFO +1 -1
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/pyproject.toml +1 -1
- boto3_assist-0.6.1/run_unit_tests.sh +22 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_model_base.py +19 -108
- boto3_assist-0.6.1/src/boto3_assist/models/serializable_model.py +9 -0
- boto3_assist-0.6.1/src/boto3_assist/utilities/serialization_utility.py +449 -0
- boto3_assist-0.6.1/src/boto3_assist/version.py +1 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/__top/__init__.py +4 -1
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/cms/page.py +1 -1
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/dynamodb/dynamodb_model_base_test.py +3 -4
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/dynamodb/dynamodb_model_projections_test.py +2 -2
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/dynamodb/dynamodb_model_serializtion_test.py +2 -2
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/dynamodb/dynamodb_moto_sorting_test.py +3 -5
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/models/serializable_model_test.py +14 -0
- boto3_assist-0.6.1/tests/models/serializable_model_wide_test.py +246 -0
- boto3_assist-0.6.1/tests/utilities/__init__.py +0 -0
- boto3_assist-0.5.2/src/boto3_assist/models/serializable_model.py +0 -34
- boto3_assist-0.5.2/src/boto3_assist/utilities/serialization_utility.py +0 -187
- boto3_assist-0.5.2/src/boto3_assist/version.py +0 -1
- boto3_assist-0.5.2/tests/utilities/__init__.py +0 -16
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.env.docker +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.env.docker.001 +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.env.docker.nosql.workbench +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.env.unittest +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.vscode/launch.json +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/.vscode/tasks.json +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/LICENSE-EXPLAINED.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/LICENSE.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/README.md +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/aws_regions_with_status.csv +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/aws_regions_with_status.json +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/devops/build.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/devops/readme.md +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/cloudwatch/log_report.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/models/order_item_model.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/models/order_model.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/models/product_model.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/models/user_model.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/models/user_post_model.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/order_example/main.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/order_example/products.json +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/order_item_service.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/order_service.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/product_service.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/table_service.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/user_post_service.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/user_service.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/user_service_client_example.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/services/user_service_resource_example.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/dynamodb/user_post_example/main.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/examples/ec2/regions_report.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/module-headers.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/mypy.ini +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/requirements-dev.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/requirements.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/run-checks.sh +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/aws_lambda/event_info.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/boto3session.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cloudwatch/cloudwatch_connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cloudwatch/cloudwatch_connection_tracker.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cloudwatch/cloudwatch_log_connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cloudwatch/cloudwatch_logs.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cloudwatch/cloudwatch_query.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cognito/cognito_authorizer.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cognito/cognito_connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cognito/cognito_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cognito/jwks_cache.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/cognito/user.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/connection_tracker.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_helpers.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_importer.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_index.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_iservice.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_key.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_model_base_interfaces.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_reindexer.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_reserved_words.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/dynamodb_reserved_words.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/readme.md +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/dynamodb/troubleshooting.md +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/ec2/ec2_connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/environment_services/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/environment_services/environment_loader.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/environment_services/environment_variables.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/errors/custom_exceptions.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/http_status_codes.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/s3/s3.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/s3/s3_connection.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/datetime_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/dictionaroy_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/file_operations.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/http_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/logging_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/numbers_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/src/boto3_assist/utilities/string_utility.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/dynamodb/__init__.py +0 -0
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/cms/base.py +0 -0
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/cms/content_block.py +0 -0
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/cms/template.py +0 -0
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/simple_model.py +0 -0
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/user_model.py +0 -0
- {boto3_assist-0.5.2/tests/dynamodb/models → boto3_assist-0.6.1/tests/dynamodb/dbmodels}/user_required_fields_model.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/dynamodb/dynamodb_reindex_test.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/examples_test/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/examples_test/user_service_test.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/lambda/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/lambda/event_info_test.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/models/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/s3/__init__.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/s3/files/test.txt +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/s3/s3_file_upload_test.py +0 -0
- {boto3_assist-0.5.2 → boto3_assist-0.6.1}/tests/utilities/serialization_utility_test.py +0 -0
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"python.analysis.extraPaths": [
|
|
13
13
|
"${workspaceFolder}",
|
|
14
14
|
"${workspaceFolder}/examples",
|
|
15
|
-
"${workspaceFolder}/src",
|
|
16
|
-
"${workspaceFolder}/src/boto3_assist",
|
|
15
|
+
"${workspaceFolder}/src",
|
|
17
16
|
"${workspaceFolder}/tests",
|
|
18
17
|
"${workspaceFolder}/devops",
|
|
19
18
|
"${workspaceFolder}/devops/cdk",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
python --version
|
|
4
|
+
python -m venv .unittest
|
|
5
|
+
source ./.unittest/bin/activate
|
|
6
|
+
which python
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
pip install --upgrade pip
|
|
10
|
+
pip install -r ./requirements.txt
|
|
11
|
+
pip install -r ./requirements-dev.txt
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
echo "running unit test"
|
|
15
|
+
python -m unittest discover -s tests -p "*_test.py"
|
|
16
|
+
|
|
17
|
+
if [ $? -eq 0 ]; then
|
|
18
|
+
echo "Tests passed successfully"
|
|
19
|
+
else
|
|
20
|
+
echo "No tests found or tests failed"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
@@ -6,9 +6,10 @@ MIT License. See Project Root for the license information.
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
import datetime as dt
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
|
|
10
|
+
# import decimal
|
|
11
|
+
# import inspect
|
|
12
|
+
# import uuid
|
|
12
13
|
from typing import TypeVar, List, Dict, Any
|
|
13
14
|
from boto3.dynamodb.types import TypeSerializer
|
|
14
15
|
from boto3_assist.utilities.serialization_utility import Serialization
|
|
@@ -19,6 +20,7 @@ from boto3_assist.dynamodb.dynamodb_index import (
|
|
|
19
20
|
)
|
|
20
21
|
from boto3_assist.dynamodb.dynamodb_reserved_words import DynamoDBReservedWords
|
|
21
22
|
from boto3_assist.utilities.datetime_utility import DatetimeUtility
|
|
23
|
+
from boto3_assist.models.serializable_model import SerializableModel
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
def exclude_from_serialization(method):
|
|
@@ -37,7 +39,7 @@ def exclude_indexes_from_serialization(method):
|
|
|
37
39
|
return method
|
|
38
40
|
|
|
39
41
|
|
|
40
|
-
class DynamoDBModelBase:
|
|
42
|
+
class DynamoDBModelBase(SerializableModel):
|
|
41
43
|
"""DyanmoDb Model Base"""
|
|
42
44
|
|
|
43
45
|
T = TypeVar("T", bound="DynamoDBModelBase")
|
|
@@ -270,7 +272,9 @@ class DynamoDBSerializer:
|
|
|
270
272
|
return mapped
|
|
271
273
|
|
|
272
274
|
@staticmethod
|
|
273
|
-
def to_client_dictionary(
|
|
275
|
+
def to_client_dictionary(
|
|
276
|
+
instance: DynamoDBModelBase, include_indexes: bool = True
|
|
277
|
+
) -> Dict[str, Any]:
|
|
274
278
|
"""
|
|
275
279
|
Convert a Python class instance to a dictionary suitable for DynamoDB client.
|
|
276
280
|
|
|
@@ -281,16 +285,19 @@ class DynamoDBSerializer:
|
|
|
281
285
|
- dict: A dictionary representation of the class instance suitable for DynamoDB client.
|
|
282
286
|
"""
|
|
283
287
|
serializer = TypeSerializer()
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
d = Serialization.to_dict(instance, serializer.serialize)
|
|
289
|
+
|
|
290
|
+
if include_indexes:
|
|
291
|
+
d = DynamoDBSerializer._add_indexes(instance=instance, instance_dict=d)
|
|
292
|
+
|
|
293
|
+
return d
|
|
287
294
|
|
|
288
295
|
@staticmethod
|
|
289
296
|
def to_resource_dictionary(
|
|
290
297
|
instance: DynamoDBModelBase,
|
|
291
298
|
include_indexes: bool = True,
|
|
292
299
|
include_none: bool = False,
|
|
293
|
-
):
|
|
300
|
+
) -> Dict[str, Any]:
|
|
294
301
|
"""
|
|
295
302
|
Convert a Python class instance to a dictionary suitable for DynamoDB resource.
|
|
296
303
|
|
|
@@ -300,112 +307,16 @@ class DynamoDBSerializer:
|
|
|
300
307
|
Returns:
|
|
301
308
|
- dict: A dictionary representation of the class instance suitable for DynamoDB resource.
|
|
302
309
|
"""
|
|
303
|
-
|
|
310
|
+
d = Serialization.to_dict(
|
|
304
311
|
instance,
|
|
305
312
|
lambda x: x,
|
|
306
|
-
include_indexes=include_indexes,
|
|
307
313
|
include_none=include_none,
|
|
308
314
|
)
|
|
309
315
|
|
|
310
|
-
@staticmethod
|
|
311
|
-
def _serialize(
|
|
312
|
-
instance: DynamoDBModelBase,
|
|
313
|
-
serialize_fn,
|
|
314
|
-
include_indexes: bool = True,
|
|
315
|
-
include_none: bool = True,
|
|
316
|
-
):
|
|
317
|
-
def is_primitive(value):
|
|
318
|
-
"""Check if the value is a primitive data type."""
|
|
319
|
-
return isinstance(value, (str, int, bool, type(None)))
|
|
320
|
-
|
|
321
|
-
def serialize_value(value):
|
|
322
|
-
"""Serialize the value using the provided function."""
|
|
323
|
-
|
|
324
|
-
if isinstance(value, DynamoDBModelBase):
|
|
325
|
-
return serialize_fn(
|
|
326
|
-
value.to_resource_dictionary(
|
|
327
|
-
include_indexes=False, include_none=include_none
|
|
328
|
-
)
|
|
329
|
-
)
|
|
330
|
-
if isinstance(value, dt.datetime):
|
|
331
|
-
return serialize_fn(value.isoformat())
|
|
332
|
-
elif isinstance(value, float):
|
|
333
|
-
v = serialize_fn(decimal.Decimal(str(value)))
|
|
334
|
-
return v
|
|
335
|
-
elif isinstance(value, decimal.Decimal):
|
|
336
|
-
return serialize_fn(value)
|
|
337
|
-
elif isinstance(value, uuid.UUID):
|
|
338
|
-
return serialize_fn(str(value))
|
|
339
|
-
elif isinstance(value, (bytes, bytearray)):
|
|
340
|
-
return serialize_fn(value.hex())
|
|
341
|
-
elif is_primitive(value):
|
|
342
|
-
return serialize_fn(value)
|
|
343
|
-
elif isinstance(value, list):
|
|
344
|
-
return serialize_fn([serialize_value(v) for v in value])
|
|
345
|
-
elif isinstance(value, dict):
|
|
346
|
-
return serialize_fn({k: serialize_value(v) for k, v in value.items()})
|
|
347
|
-
else:
|
|
348
|
-
return serialize_fn(
|
|
349
|
-
DynamoDBSerializer._serialize(
|
|
350
|
-
value,
|
|
351
|
-
serialize_fn,
|
|
352
|
-
include_indexes=include_indexes,
|
|
353
|
-
include_none=include_none,
|
|
354
|
-
)
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
instance_dict = DynamoDBSerializer._add_properties(
|
|
358
|
-
instance, serialize_value, include_none=include_none
|
|
359
|
-
)
|
|
360
|
-
|
|
361
316
|
if include_indexes:
|
|
362
|
-
|
|
363
|
-
return instance_dict
|
|
317
|
+
d = DynamoDBSerializer._add_indexes(instance=instance, instance_dict=d)
|
|
364
318
|
|
|
365
|
-
|
|
366
|
-
def _add_properties(
|
|
367
|
-
instance: DynamoDBModelBase,
|
|
368
|
-
serialize_value,
|
|
369
|
-
include_none: bool = True,
|
|
370
|
-
) -> dict:
|
|
371
|
-
instance_dict = {}
|
|
372
|
-
|
|
373
|
-
# Add instance variables
|
|
374
|
-
for attr, value in instance.__dict__.items():
|
|
375
|
-
if str(attr) == "T":
|
|
376
|
-
continue
|
|
377
|
-
# don't get the private properties
|
|
378
|
-
if not str(attr).startswith("_"):
|
|
379
|
-
if value is not None or include_none:
|
|
380
|
-
instance_dict[attr] = serialize_value(value)
|
|
381
|
-
|
|
382
|
-
# Add properties
|
|
383
|
-
for name, _ in inspect.getmembers(
|
|
384
|
-
instance.__class__, predicate=inspect.isdatadescriptor
|
|
385
|
-
):
|
|
386
|
-
prop = None
|
|
387
|
-
try:
|
|
388
|
-
prop = getattr(instance.__class__, name)
|
|
389
|
-
except AttributeError:
|
|
390
|
-
continue
|
|
391
|
-
if isinstance(prop, property):
|
|
392
|
-
# Exclude properties marked with the exclude_from_serialization decorator
|
|
393
|
-
# Check if the property should be excluded
|
|
394
|
-
exclude = getattr(prop.fget, "exclude_from_serialization", False)
|
|
395
|
-
if exclude:
|
|
396
|
-
continue
|
|
397
|
-
|
|
398
|
-
# Skip TypeVar T or instances of DynamoDBModelBase
|
|
399
|
-
if str(name) == "T":
|
|
400
|
-
continue
|
|
401
|
-
|
|
402
|
-
# don't get the private properties
|
|
403
|
-
if not str(name).startswith("_"):
|
|
404
|
-
value = getattr(instance, name)
|
|
405
|
-
if value is not None or include_none:
|
|
406
|
-
instance_dict[name] = serialize_value(value)
|
|
407
|
-
|
|
408
|
-
return instance_dict
|
|
319
|
+
return d
|
|
409
320
|
|
|
410
321
|
@staticmethod
|
|
411
322
|
def _add_indexes(instance: DynamoDBModelBase, instance_dict: dict) -> dict:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Geek Cafe, LLC
|
|
3
|
+
Maintainers: Eric Wilson
|
|
4
|
+
MIT License. See Project Root for the license information.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from boto3_assist.utilities.serialization_utility import SerializableModel # noqa: F401 # pylint: disable=unused-import
|