synapse-sdk 1.0.0a85__py3-none-any.whl → 1.0.0a86__py3-none-any.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.

Potentially problematic release.


This version of synapse-sdk might be problematic. Click here for more details.

@@ -1,10 +1,82 @@
1
+ from enum import Enum
2
+ from typing import Any, Dict, List
3
+
4
+ from pydantic import BaseModel
5
+
1
6
  from synapse_sdk.plugins.categories.base import Action
2
7
  from synapse_sdk.plugins.categories.decorators import register_action
3
8
  from synapse_sdk.plugins.enums import PluginCategory, RunMethod
4
9
 
5
10
 
11
+ class ValidationDataStatus(str, Enum):
12
+ """Validation data status enumeration.
13
+
14
+ Represents the possible status values for validation operations.
15
+
16
+ Attributes:
17
+ SUCCESS: Validation completed successfully with no errors.
18
+ FAILED: Validation failed with one or more errors.
19
+ """
20
+
21
+ SUCCESS = 'success'
22
+ FAILED = 'failed'
23
+
24
+
25
+ class ValidationResult(BaseModel):
26
+ """Validation result model.
27
+
28
+ Args:
29
+ status: The validation status.
30
+ errors: List of validation errors.
31
+ """
32
+
33
+ status: ValidationDataStatus
34
+ errors: List[str]
35
+
36
+
37
+ class CriticalError(Exception):
38
+ """Critical error exception for validation processing.
39
+
40
+ Raised when a critical error occurs during validation that prevents
41
+ the validation process from continuing normally.
42
+
43
+ Args:
44
+ message: Custom error message. Defaults to a standard critical error message.
45
+
46
+ Attributes:
47
+ message: The error message associated with this exception.
48
+ """
49
+
50
+ def __init__(self, message: str = 'Critical error occured while processing validation'):
51
+ self.message = message
52
+ super().__init__(self.message)
53
+
54
+
55
+ class ValidationParams(BaseModel):
56
+ """Validation action parameters.
57
+
58
+ Args:
59
+ data (dict): The validation data.
60
+ """
61
+
62
+ data: Dict[str, Any]
63
+
64
+
6
65
  @register_action
7
66
  class ValidationAction(Action):
67
+ """Validation action for data validation processing.
68
+
69
+ This action handles the process of validating data with assignment IDs.
70
+ It supports validation methods and provides structured logging.
71
+
72
+ Attrs:
73
+ name (str): Action name, set to 'validation'.
74
+ category (PluginCategory): Plugin category, set to DATA_VALIDATION.
75
+ method (RunMethod): Execution method, set to TASK.
76
+ params_model (Type[ValidationParams]): Parameter validation model.
77
+ """
78
+
8
79
  name = 'validation'
9
80
  category = PluginCategory.DATA_VALIDATION
10
81
  method = RunMethod.TASK
82
+ params_model = ValidationParams
@@ -1,5 +1,29 @@
1
- def validate(data, assignment_id, **kwargs):
2
- errors = []
3
- if data.get('errors'):
4
- errors += data['errors']
5
- return errors
1
+ from typing import Any, Dict, List, Optional
2
+
3
+ from synapse_sdk.plugins.categories.data_validation.actions.validation import ValidationDataStatus, ValidationResult
4
+
5
+
6
+ def validate(data: Optional[Dict[str, Any]] = None, **kwargs: Any) -> ValidationResult:
7
+ """Validate data with assignment data.
8
+
9
+ * Custom validation logic can be added here.
10
+ * Error messages can be added to the errors list if errors exist in data.
11
+ * The validation result will be returned as a dict with ValidationResult structure.
12
+
13
+ Args:
14
+ data: The data to validate.
15
+ **kwargs: Additional arguments.
16
+
17
+ Returns:
18
+ ValidationResult: The validation result with status and errors.
19
+ """
20
+ errors: List[str] = []
21
+
22
+ # Add custom validation logic here
23
+
24
+ # Add error messages into errors list if errors exist in data
25
+
26
+ # Determine status based on errors
27
+ status = ValidationDataStatus.FAILED if errors else ValidationDataStatus.SUCCESS
28
+
29
+ return ValidationResult(status=status, errors=errors)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapse-sdk
3
- Version: 1.0.0a85
3
+ Version: 1.0.0a86
4
4
  Summary: synapse sdk
5
5
  Author-email: datamaker <developer@datamaker.io>
6
6
  License: MIT
@@ -117,10 +117,10 @@ synapse_sdk/plugins/categories/registry.py,sha256=KdQR8SUlLT-3kgYzDNWawS1uJnAhrc
117
117
  synapse_sdk/plugins/categories/templates.py,sha256=FF5FerhkZMeW1YcKLY5cylC0SkWSYdJODA_Qcm4OGYQ,887
118
118
  synapse_sdk/plugins/categories/data_validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  synapse_sdk/plugins/categories/data_validation/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
- synapse_sdk/plugins/categories/data_validation/actions/validation.py,sha256=U1lA36RyGmtRuF1AIpr1mE30z0cByCAC_PDKtEptDTc,338
120
+ synapse_sdk/plugins/categories/data_validation/actions/validation.py,sha256=E6irjH3aylnS_nIlXVDdqwpkvMxlTwzmedYeXj5sgSk,2262
121
121
  synapse_sdk/plugins/categories/data_validation/templates/config.yaml,sha256=Hijb-b3hy0msZsTV_bbr3Hvlk8ok-Rk0a05mlLGTCAg,66
122
122
  synapse_sdk/plugins/categories/data_validation/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
- synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py,sha256=90I5boUpEXvO3mEuKKBs528ls2A4h8Iw4ReOID2h00Y,139
123
+ synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py,sha256=_K1fAp027Q75msY-H_Vyv3hb60A4OthE2nmHtXjSCNw,1011
124
124
  synapse_sdk/plugins/categories/export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  synapse_sdk/plugins/categories/export/enums.py,sha256=gtyngvQ1DKkos9iKGcbecwTVQQ6sDwbrBPSGPNb5Am0,127
126
126
  synapse_sdk/plugins/categories/export/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -221,9 +221,9 @@ synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_n
221
221
  synapse_sdk/utils/storage/providers/http.py,sha256=2DhIulND47JOnS5ZY7MZUex7Su3peAPksGo1Wwg07L4,5828
222
222
  synapse_sdk/utils/storage/providers/s3.py,sha256=ZmqekAvIgcQBdRU-QVJYv1Rlp6VHfXwtbtjTSphua94,2573
223
223
  synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
224
- synapse_sdk-1.0.0a85.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
225
- synapse_sdk-1.0.0a85.dist-info/METADATA,sha256=lnvtAkzoGwUHFDJaquTJ4__V14LCGxF6qA9p-s-aGKY,3805
226
- synapse_sdk-1.0.0a85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
227
- synapse_sdk-1.0.0a85.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
228
- synapse_sdk-1.0.0a85.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
229
- synapse_sdk-1.0.0a85.dist-info/RECORD,,
224
+ synapse_sdk-1.0.0a86.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
225
+ synapse_sdk-1.0.0a86.dist-info/METADATA,sha256=Spzp2B5PSKr6fMRT2fiV_UhJtqgGQUmx1hg1-s7cDOY,3805
226
+ synapse_sdk-1.0.0a86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
227
+ synapse_sdk-1.0.0a86.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
228
+ synapse_sdk-1.0.0a86.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
229
+ synapse_sdk-1.0.0a86.dist-info/RECORD,,