internal 0.1.10__tar.gz → 0.1.12__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.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

Files changed (22) hide show
  1. {internal-0.1.10 → internal-0.1.12}/PKG-INFO +2 -1
  2. {internal-0.1.10 → internal-0.1.12}/pyproject.toml +2 -1
  3. internal-0.1.12/src/internal/model/operate.py +31 -0
  4. internal-0.1.10/src/internal/model/operate.py +0 -9
  5. {internal-0.1.10 → internal-0.1.12}/README.md +0 -0
  6. {internal-0.1.10 → internal-0.1.12}/src/internal/__init__.py +0 -0
  7. {internal-0.1.10 → internal-0.1.12}/src/internal/base_config.py +0 -0
  8. {internal-0.1.10 → internal-0.1.12}/src/internal/base_factory.py +0 -0
  9. {internal-0.1.10 → internal-0.1.12}/src/internal/const.py +0 -0
  10. {internal-0.1.10 → internal-0.1.12}/src/internal/database.py +0 -0
  11. {internal-0.1.10 → internal-0.1.12}/src/internal/exception/__init__.py +0 -0
  12. {internal-0.1.10 → internal-0.1.12}/src/internal/exception/base_exception.py +0 -0
  13. {internal-0.1.10 → internal-0.1.12}/src/internal/ext/__init__.py +0 -0
  14. {internal-0.1.10 → internal-0.1.12}/src/internal/ext/amazon/__init__.py +0 -0
  15. {internal-0.1.10 → internal-0.1.12}/src/internal/ext/amazon/aws/__init__.py +0 -0
  16. {internal-0.1.10 → internal-0.1.12}/src/internal/ext/amazon/aws/const.py +0 -0
  17. {internal-0.1.10 → internal-0.1.12}/src/internal/http/__init__.py +0 -0
  18. {internal-0.1.10 → internal-0.1.12}/src/internal/http/requests.py +0 -0
  19. {internal-0.1.10 → internal-0.1.12}/src/internal/http/responses.py +0 -0
  20. {internal-0.1.10 → internal-0.1.12}/src/internal/model/__init__.py +0 -0
  21. {internal-0.1.10 → internal-0.1.12}/src/internal/model/base_model.py +0 -0
  22. {internal-0.1.10 → internal-0.1.12}/src/internal/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: internal
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Requires-Dist: arrow (>=1.3.0,<2.0.0)
12
12
  Requires-Dist: beanie (>=1.24.0,<2.0.0)
13
+ Requires-Dist: deepdiff (>=6.7.1,<7.0.0)
13
14
  Requires-Dist: fastapi (>=0.109.0,<0.110.0)
14
15
  Requires-Dist: httpx (>=0.26.0,<0.27.0)
15
16
  Requires-Dist: pydantic-settings (>=2.1.0,<3.0.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "internal"
3
- version = "0.1.10"
3
+ version = "0.1.12"
4
4
  description = ""
5
5
  authors = ["Ray <ray@cruisys.com>"]
6
6
  readme = "README.md"
@@ -14,6 +14,7 @@ pydantic-settings = "^2.1.0"
14
14
  watchtower = "^3.0.1"
15
15
  httpx = "^0.26.0"
16
16
  beanie = "^1.24.0"
17
+ deepdiff = "^6.7.1"
17
18
 
18
19
 
19
20
  [build-system]
@@ -0,0 +1,31 @@
1
+ from typing import Optional
2
+
3
+ from .base_model import InternalBaseModel
4
+ from deepdiff import DeepDiff
5
+ from beanie import Document
6
+
7
+
8
+ class Operate(Document):
9
+ add: Optional[dict] = None
10
+ remove: Optional[dict] = None
11
+ change: Optional[dict] = None
12
+
13
+ @classmethod
14
+ async def compare_diff(cls, original: dict, compare: dict):
15
+ original = cls.remove_ignore_field(original)
16
+ compare = cls.remove_ignore_field(compare)
17
+
18
+ diff_result = DeepDiff(original, compare, ignore_order=True)
19
+ if not diff_result:
20
+ return None
21
+
22
+ operate = Operate(
23
+ add=diff_result.get("iterable_items_added", None),
24
+ remove=diff_result.get("iterable_items_removed", None),
25
+ change=diff_result.get("values_changed", None)
26
+ )
27
+ return operate
28
+
29
+ @classmethod
30
+ async def remove_ignore_field(cls, model_dict: dict):
31
+ return {k: v for k, v in model_dict.items() if k not in ['create_time', 'update_time']}
@@ -1,9 +0,0 @@
1
- from typing import Optional
2
-
3
- from .base_model import InternalBaseModel
4
-
5
-
6
- class Operate(InternalBaseModel):
7
- add: Optional[dict] = None
8
- remove: Optional[dict] = None
9
- change: Optional[dict] = None
File without changes