dkist-header-validator 5.2.0__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.
@@ -0,0 +1,51 @@
1
+ """
2
+ Common Exceptions for the fits-validator
3
+ """
4
+
5
+
6
+ __all__ = [
7
+ "ValidationException",
8
+ "SpecSchemaDefinitionException",
9
+ "SpecValidationException",
10
+ "ReturnTypeException",
11
+ ]
12
+
13
+
14
+ class ValidationException(Exception):
15
+ """
16
+ Base Exception for the validator
17
+ """
18
+
19
+ def __init__(self, message: str = "Errors during validation", errors: dict = None):
20
+ self.message = message
21
+ self.errors = errors
22
+
23
+ def __str__(self):
24
+ return f"{self.message}: errors={self.errors}"
25
+
26
+
27
+ class SpecSchemaDefinitionException(ValidationException):
28
+ """
29
+ Exception when validating the YAML Schemas
30
+ """
31
+
32
+
33
+ class SpecValidationException(ValidationException):
34
+ """
35
+ Default spec validation exception
36
+ """
37
+
38
+
39
+ class TranslationException(ValidationException):
40
+ """
41
+ Exception when translating
42
+ """
43
+
44
+
45
+ class ReturnTypeException(Exception):
46
+ """
47
+ Exception when returning a BytesIO object
48
+ """
49
+
50
+ def __init__(self, message: str = "Return type error"):
51
+ self.message = message
@@ -0,0 +1,54 @@
1
+ """
2
+ Validators configured for specific Fits Specs
3
+ """
4
+ from dkist_fits_specifications.spec122 import load_processed_spec122
5
+ from dkist_fits_specifications.spec214 import load_processed_spec214
6
+ from dkist_fits_specifications.spec214.level0 import load_level0_spec214
7
+
8
+ from dkist_header_validator.base_validator import ProcessedSpecValidator
9
+ from dkist_header_validator.exceptions import SpecValidationException
10
+
11
+ __all__ = [
12
+ "spec122_validator",
13
+ "Spec122ValidationException",
14
+ "spec214_validator",
15
+ "spec214_l0_validator",
16
+ "Spec214ValidationException",
17
+ ]
18
+
19
+
20
+ ############
21
+ # SPEC-122 #
22
+ ############
23
+
24
+
25
+ class Spec122ValidationException(SpecValidationException):
26
+ """
27
+ Exception when validating a spec 122 file
28
+ """
29
+
30
+
31
+ spec122_validator = ProcessedSpecValidator(
32
+ spec_processor_function=load_processed_spec122,
33
+ SchemaValidationException=Spec122ValidationException,
34
+ )
35
+
36
+
37
+ ############
38
+ # SPEC-214 #
39
+ ############
40
+ class Spec214ValidationException(SpecValidationException):
41
+ """
42
+ Exception when validating a spec 214 file
43
+ """
44
+
45
+
46
+ spec214_l0_validator = ProcessedSpecValidator(
47
+ spec_processor_function=load_level0_spec214,
48
+ SchemaValidationException=Spec214ValidationException,
49
+ )
50
+
51
+ spec214_validator = ProcessedSpecValidator(
52
+ spec_processor_function=load_processed_spec214,
53
+ SchemaValidationException=Spec214ValidationException,
54
+ )
File without changes