vtlengine 1.0__py3-none-any.whl → 1.0.2__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 vtlengine might be problematic. Click here for more details.

Files changed (56) hide show
  1. vtlengine/API/_InternalApi.py +159 -102
  2. vtlengine/API/__init__.py +110 -68
  3. vtlengine/AST/ASTConstructor.py +188 -98
  4. vtlengine/AST/ASTConstructorModules/Expr.py +402 -205
  5. vtlengine/AST/ASTConstructorModules/ExprComponents.py +248 -104
  6. vtlengine/AST/ASTConstructorModules/Terminals.py +158 -95
  7. vtlengine/AST/ASTEncoders.py +1 -1
  8. vtlengine/AST/ASTTemplate.py +24 -9
  9. vtlengine/AST/ASTVisitor.py +8 -12
  10. vtlengine/AST/DAG/__init__.py +43 -35
  11. vtlengine/AST/DAG/_words.py +4 -4
  12. vtlengine/AST/Grammar/Vtl.g4 +49 -20
  13. vtlengine/AST/Grammar/VtlTokens.g4 +13 -1
  14. vtlengine/AST/Grammar/lexer.py +2012 -1312
  15. vtlengine/AST/Grammar/parser.py +7524 -4343
  16. vtlengine/AST/Grammar/tokens.py +140 -128
  17. vtlengine/AST/VtlVisitor.py +16 -5
  18. vtlengine/AST/__init__.py +41 -11
  19. vtlengine/DataTypes/NumericTypesHandling.py +5 -4
  20. vtlengine/DataTypes/TimeHandling.py +196 -301
  21. vtlengine/DataTypes/__init__.py +304 -218
  22. vtlengine/Exceptions/__init__.py +96 -27
  23. vtlengine/Exceptions/messages.py +149 -69
  24. vtlengine/Interpreter/__init__.py +817 -497
  25. vtlengine/Model/__init__.py +172 -121
  26. vtlengine/Operators/Aggregation.py +156 -95
  27. vtlengine/Operators/Analytic.py +167 -79
  28. vtlengine/Operators/Assignment.py +7 -4
  29. vtlengine/Operators/Boolean.py +27 -32
  30. vtlengine/Operators/CastOperator.py +177 -131
  31. vtlengine/Operators/Clause.py +137 -99
  32. vtlengine/Operators/Comparison.py +148 -117
  33. vtlengine/Operators/Conditional.py +290 -98
  34. vtlengine/Operators/General.py +68 -47
  35. vtlengine/Operators/HROperators.py +91 -72
  36. vtlengine/Operators/Join.py +217 -118
  37. vtlengine/Operators/Numeric.py +129 -46
  38. vtlengine/Operators/RoleSetter.py +16 -15
  39. vtlengine/Operators/Set.py +61 -36
  40. vtlengine/Operators/String.py +213 -139
  41. vtlengine/Operators/Time.py +467 -215
  42. vtlengine/Operators/Validation.py +117 -76
  43. vtlengine/Operators/__init__.py +340 -213
  44. vtlengine/Utils/__init__.py +232 -41
  45. vtlengine/__init__.py +1 -1
  46. vtlengine/files/output/__init__.py +15 -6
  47. vtlengine/files/output/_time_period_representation.py +10 -9
  48. vtlengine/files/parser/__init__.py +79 -52
  49. vtlengine/files/parser/_rfc_dialect.py +6 -5
  50. vtlengine/files/parser/_time_checking.py +48 -37
  51. vtlengine-1.0.2.dist-info/METADATA +245 -0
  52. vtlengine-1.0.2.dist-info/RECORD +58 -0
  53. {vtlengine-1.0.dist-info → vtlengine-1.0.2.dist-info}/WHEEL +1 -1
  54. vtlengine-1.0.dist-info/METADATA +0 -104
  55. vtlengine-1.0.dist-info/RECORD +0 -58
  56. {vtlengine-1.0.dist-info → vtlengine-1.0.2.dist-info}/LICENSE.md +0 -0
@@ -6,6 +6,8 @@ Description
6
6
  -----------
7
7
  All exceptions exposed by the Vtl engine.
8
8
  """
9
+
10
+ from typing import Optional, Any, List
9
11
  from vtlengine.Exceptions.messages import centralised_messages
10
12
 
11
13
  dataset_output = None
@@ -14,7 +16,13 @@ dataset_output = None
14
16
  class VTLEngineException(Exception):
15
17
  """Base class for exceptions in this module."""
16
18
 
17
- def __init__(self, message, lino=None, colno=None, code=None):
19
+ def __init__(
20
+ self,
21
+ message: str,
22
+ lino: Optional[str] = None,
23
+ colno: Optional[str] = None,
24
+ code: Optional[str] = None,
25
+ ) -> None:
18
26
  if code is not None:
19
27
  super().__init__(message, code)
20
28
  else:
@@ -23,10 +31,9 @@ class VTLEngineException(Exception):
23
31
  self.colno = colno
24
32
 
25
33
  @property
26
- def pos(self):
27
- """
34
+ def pos(self) -> List[Optional[str]]:
35
+ """ """
28
36
 
29
- """
30
37
  return [self.lino, self.colno]
31
38
 
32
39
 
@@ -40,30 +47,40 @@ class DataTypeException(VTLEngineException):
40
47
  ))
41
48
  """
42
49
 
43
- def __init__(self, message='default_value', lino=None, colno=None):
50
+ def __init__(
51
+ self,
52
+ message: str = "default_value",
53
+ lino: Optional[str] = None,
54
+ colno: Optional[str] = None,
55
+ ) -> None:
44
56
  super().__init__(message, lino, colno)
45
57
 
46
58
 
47
59
  class SyntaxError(VTLEngineException):
48
- """
49
-
50
- """
51
-
52
- def __init__(self, message='default_value', lino=None, colno=None):
60
+ """ """
61
+
62
+ def __init__(
63
+ self,
64
+ message: str = "default_value",
65
+ lino: Optional[str] = None,
66
+ colno: Optional[str] = None,
67
+ ) -> None:
53
68
  super().__init__(message, lino, colno)
54
69
 
55
70
 
56
71
  class SemanticError(VTLEngineException):
57
- """
72
+ """ """
58
73
 
59
- """
60
74
  output_message = " Please check transformation with output dataset "
61
75
  comp_code = None
62
76
 
63
- def __init__(self, code, comp_code=None, **kwargs):
77
+ def __init__(self, code: str, comp_code: Optional[str] = None, **kwargs: Any) -> None:
64
78
  if dataset_output:
65
- message = centralised_messages[code].format(**kwargs) + self.output_message + str(
66
- dataset_output)
79
+ message = (
80
+ centralised_messages[code].format(**kwargs)
81
+ + self.output_message
82
+ + str(dataset_output)
83
+ )
67
84
  else:
68
85
  message = centralised_messages[code].format(**kwargs)
69
86
 
@@ -76,32 +93,84 @@ class SemanticError(VTLEngineException):
76
93
  class InterpreterError(VTLEngineException):
77
94
  output_message = " Please check transformation with output dataset "
78
95
 
79
- def __init__(self, code, **kwargs):
96
+ def __init__(self, code: str, **kwargs: Any) -> None:
80
97
  if dataset_output:
81
- message = centralised_messages[code].format(**kwargs) + self.output_message + str(
82
- dataset_output)
98
+ message = (
99
+ centralised_messages[code].format(**kwargs)
100
+ + self.output_message
101
+ + str(dataset_output)
102
+ )
83
103
  else:
84
104
  message = centralised_messages[code].format(**kwargs)
85
105
  super().__init__(message, None, None, code)
86
106
 
87
107
 
88
108
  class RuntimeError(VTLEngineException):
89
- """
90
-
91
- """
109
+ """ """
92
110
 
93
- def __init__(self, message, lino=None, colno=None):
111
+ def __init__(
112
+ self, message: str, lino: Optional[str] = None, colno: Optional[str] = None
113
+ ) -> None:
94
114
  super().__init__(message, lino, colno)
95
115
 
96
116
 
97
117
  class InputValidationException(VTLEngineException):
98
- """
99
-
100
- """
101
-
102
- def __init__(self, message='default_value', lino=None, colno=None, code=None, **kwargs):
118
+ """ """
119
+
120
+ def __init__(
121
+ self,
122
+ message: str = "default_value",
123
+ lino: Optional[str] = None,
124
+ colno: Optional[str] = None,
125
+ code: Optional[str] = None,
126
+ **kwargs: Any
127
+ ) -> None:
103
128
  if code is not None:
104
129
  message = centralised_messages[code].format(**kwargs)
105
130
  super().__init__(message, lino, colno, code)
106
131
  else:
107
132
  super().__init__(message, lino, colno)
133
+
134
+
135
+ def check_key(field: str, dict_keys: Any, key: str) -> None:
136
+ if key not in dict_keys:
137
+ closest_key = find_closest_key(dict_keys, key)
138
+ message_append = f". Did you mean {closest_key}?" if closest_key else ""
139
+ raise SemanticError("0-1-1-13", field=field, key=key, closest_key=message_append)
140
+
141
+
142
+ def find_closest_key(dict_keys: Any, key: str) -> Optional[str]:
143
+ closest_key = None
144
+ max_distance = 3
145
+ min_distance = float('inf')
146
+
147
+ for dict_key in dict_keys:
148
+ distance = key_distance(key, dict_key)
149
+ if distance < min_distance:
150
+ min_distance = distance
151
+ closest_key = dict_key
152
+
153
+ if min_distance <= max_distance:
154
+ return closest_key
155
+ return None
156
+
157
+
158
+ def key_distance(key: str, objetive: str) -> int:
159
+ dp = [[0] * (len(objetive) + 1) for _ in range(len(key) + 1)]
160
+
161
+ for i in range(len(key) + 1):
162
+ dp[i][0] = i
163
+ for j in range(len(objetive) + 1):
164
+ dp[0][j] = j
165
+
166
+ for i in range(1, len(key) + 1):
167
+ for j in range(1, len(objetive) + 1):
168
+ if key[i - 1] == objetive[j - 1]:
169
+ cost = 0
170
+ else:
171
+ cost = 1
172
+ dp[i][j] = min(dp[i - 1][j] + 1,
173
+ dp[i][j - 1] + 1,
174
+ dp[i - 1][j - 1] + cost)
175
+
176
+ return dp[-1][-1]
@@ -6,9 +6,11 @@ Description
6
6
  -----------
7
7
  All exceptions exposed by the Vtl engine.
8
8
  """
9
+
9
10
  centralised_messages = {
10
11
  # Input Validation errors
11
- "0-1-2-1": "Invalid json structure because additional properties have been supplied on file {filename}.",
12
+ "0-1-2-1": "Invalid json structure because additional properties have been supplied "
13
+ "on file {filename}.",
12
14
  "0-1-2-2": "Errors found on file {filename}: {errors}",
13
15
  "0-1-2-3": "Component {component} is duplicated.",
14
16
  "0-1-2-4": "Invalid json structure because {err} on file {filename}.",
@@ -18,18 +20,21 @@ centralised_messages = {
18
20
  # Infer Data Structure errors
19
21
  # "0-1-1-1": "A csv file or a dataframe is required.",
20
22
  "0-1-1-2": "The provided {source} must have data to can infer the data structure.",
21
- "0-1-1-3": "Can not infer data structure: {errors}",
22
- "0-1-1-4": "On Dataset {name} loading: An identifier cannot have null values, found null values on {null_identifier}.",
23
- "0-1-1-5": "On Dataset {name} loading: Datasets without identifiers must have 0 or 1 datapoints.",
23
+ "0-1-1-3": "Can not infer data structure: {errors}.",
24
+ "0-1-1-4": "On Dataset {name} loading: An identifier cannot have null values, found null "
25
+ "values on {null_identifier}.",
26
+ "0-1-1-5": "On Dataset {name} loading: Datasets without identifiers must have 0 or "
27
+ "1 datapoints.",
24
28
  "0-1-1-6": "Duplicated records. Combination of identifiers are repeated.",
25
- "0-1-1-7": "G1 - The provided CSV file is empty",
26
- "0-1-1-8": "The following identifiers {ids} were not found , review file {file}",
27
- "0-1-1-9": "You have a problem related with commas, review rfc4180 standard, review file {file}",
29
+ "0-1-1-7": "G1 - The provided CSV file is empty.",
30
+ "0-1-1-8": "The following identifiers {ids} were not found , review file {file}.",
31
+ "0-1-1-9": "You have a problem related with commas, review rfc4180 standard, review file "
32
+ "{file}.",
28
33
  "0-1-1-10": "On Dataset {name} loading: Component {comp_name} is missing in Datapoints.",
29
- "0-1-1-11": "Wrong data in the file for this scalardataset {name}",
30
- "0-1-1-12": "On Dataset {name} loading: not possible to cast column {column} to {type}",
31
- #
32
- "0-1-0-1": " Trying to redefine input datasets {dataset}", # Semantic Error
34
+ "0-1-1-11": "Wrong data in the file for this scalardataset {name}.",
35
+ "0-1-1-12": "On Dataset {name} loading: not possible to cast column {column} to {type}.",
36
+ "0-1-1-13": "Invalid key on {field} field: {key}{closest_key}.",
37
+ "0-1-0-1": " Trying to redefine input datasets {dataset}.", # Semantic Error
33
38
  # ------------Operators-------------
34
39
  # General Semantic errors
35
40
  # "1-1-1-1": "At op {op}. Unable to validate types.",
@@ -37,56 +42,69 @@ centralised_messages = {
37
42
  "1-1-1-2": "Invalid implicit cast from {type_1} and {type_2} to {type_check}.",
38
43
  "1-1-1-3": "At op {op}: {entity} {name} cannot be promoted to {target_type}.",
39
44
  # "1-1-1-2": "At op {op}: Component {comp_name} type must be '{type_1}', found '{type_2}'.",
40
- # "1-1-1-3": "At op {op}: Invalid data type for Component {comp_name} and Scalar {scalar_name}.",
45
+ # "1-1-1-3": "At op {op}: Invalid data type for Component {comp_name} and Scalar
46
+ # {scalar_name}.",
41
47
  "1-1-1-4": "At op {op}: Operation not allowed for multimeasure datasets.",
42
48
  # "1-1-1-5": "At op {op}: Invalid data type {type} for Scalar {scalar_name}.",
43
- # "1-1-1-6": "At op {op}: Internal error: Not same parents.", # TODO: Deprecated not in use, delete this.
49
+ # TODO: Deprecated not in use, delete this.
50
+ # "1-1-1-6": "At op {op}: Internal error: Not same parents.",
44
51
  # "1-1-1-7": "At op {op}: Invalid data type {type} for Component {name}.",
45
52
  "1-1-1-8": "At op {op}: Invalid Dataset {name}, no measures defined.",
46
53
  "1-1-1-9": "At op {op}: Invalid Dataset {name}, all measures must have the same type: {type}.",
47
54
  "1-1-1-10": "Component {comp_name} not found in Dataset {dataset_name}.",
48
55
  # "1-1-1-11": "At op {op}: Identifier {name} is specified more than once.",
49
- # "1-1-1-12": "At op {op}: Different scalar types for component {comp_name} and set {set_name}.",
56
+ # "1-1-1-12": "At op {op}: Different scalar types for component {comp_name} and set
57
+ # {set_name}.",
50
58
  "1-1-1-13": "At op {op}: Component {comp_name} role must be '{role_1}', found '{role_2}'.",
51
59
  # "1-1-1-14": "At op {op}: Dataset {name} type must be '{type_1}'.",
52
- "1-1-1-15": "At op {op}: Datasets {name_1} and {name_2} does not contain the same number of {type}.",
60
+ "1-1-1-15": "At op {op}: Datasets {name_1} and {name_2} does not contain the same number of "
61
+ "{type}.",
53
62
  "1-1-1-16": "Found structure not nullable and null values.",
54
63
  # "1-1-1-17": "At op {op}: Problem with nullability for this components {name_1} and {name_2}.",
55
64
  # "1-1-1-18": "No {type} {value} found.",
56
- # "1-1-1-19": "At op {op}: Invalid data type for Scalar {scalar_name_1} and Scalar {scalar_name_2}.",
65
+ # "1-1-1-19": "At op {op}: Invalid data type for Scalar {scalar_name_1} and Scalar
66
+ # {scalar_name_2}.",
57
67
  "1-1-1-20": "At op {op}: Only applies to datasets, instead of this a Scalar was provided.",
58
68
  # General Interpreter errors
59
69
  # "2-1-1-1": "At op {op}: Unable to evaluate.",
60
- # "2-1-1-2": "At op {op}: Dataset {name} is empty.", # TODO: Review this message, for unpivot for example we can't raise this error, because we can have a empty dataset
70
+ # "2-1-1-2": "At op {op}: Dataset {name} is empty.",
71
+ # TODO: Review this message, for unpivot for example we can't raise this error,
72
+ # because we can have a empty dataset
61
73
  # "2-1-1-3": "At op {op}: No rules have results.",
62
74
  # Aggregate errors
63
75
  # TODO: Use error message 1-1-1-8
64
76
  # "1-1-2-1": "At op {op}: No measures found to aggregate.",
65
- "1-1-2-2": "At op {op}: Only Identifiers are allowed for grouping, found {id_name} - {id_type}.",
77
+ "1-1-2-2": "At op {op}: Only Identifiers are allowed for grouping, "
78
+ "found {id_name} - {id_type}.",
66
79
  "1-1-2-3": "Having component output type must be boolean, found {type}.",
67
-
68
80
  # "1-1-2-4": "At op {op}: Component {id_name} not found in dataset",
69
81
  # Analytic errors
70
82
  # TODO: Use error message 1-1-1-8
71
83
  # "1-1-3-1": "At op {op}: No measures found to analyse.",
72
- "1-1-3-2": "At op {op}: Only Identifiers are allowed for partitioning, found {id_name} - {id_type}.",
84
+ "1-1-3-2": "At op {op}: Only Identifiers are allowed for partitioning, "
85
+ "found {id_name} - {id_type}.",
73
86
  # Cast errors
74
87
  "1-1-5-1": "Type {type_1}, cannot be cast to {type_2}.",
75
88
  "1-1-5-3": "Impossible to cast from type {type_1} to {type_2}, without providing a mask.",
76
89
  "1-1-5-4": "Invalid mask to cast from type {type_1} to {type_2}.",
77
- "1-1-5-5": "A mask can't be provided to cast from type {type_1} to {type_2}. Mask provided: {mask_value}.",
90
+ "1-1-5-5": "A mask can't be provided to cast from type {type_1} to {type_2}. Mask provided: "
91
+ "{mask_value}.",
78
92
  "2-1-5-1": "Impossible to cast {value} from type {type_1} to {type_2}.",
79
93
  # Clause errors
80
94
  # "1-1-6-1": "At op {op}: Component {comp_name} not found in dataset {dataset_name}.",
81
- "1-1-6-2": "At op {op}: The identifier {name} in dataset {dataset} could not be included in the {op} op.",
82
- # TODO: This is not possible at all, as calc clause adds a new column and identifiers are still unique
95
+ "1-1-6-2": "At op {op}: The identifier {name} in dataset {dataset} could not be included "
96
+ "in the {op} op.",
97
+ # TODO: This is not possible at all, as calc clause adds a new column and
98
+ # identifiers are still unique
83
99
  # "1-1-6-3": "Found duplicated values on identifiers after Calc clause.",
84
- "1-1-6-4": "At op {op}: Alias symbol cannot have the name of a component symbol: {symbol_name} - {comp_name}.",
100
+ "1-1-6-4": "At op {op}: Alias symbol cannot have the name of a component symbol: "
101
+ "{symbol_name} - {comp_name}.",
85
102
  "1-1-6-5": "At op {op}: Scalar values are not allowed at sub operator, found {name}.",
86
103
  "1-1-6-6": "Membership is not allowed inside a clause, found {dataset_name}#{comp_name}.",
87
104
  "1-1-6-7": "Cannot use component {comp_name} as it was generated in another calc expression.",
88
105
  # all the components used in calccomp must belong to the operand dataset
89
- "1-1-6-8": "Cannot use component {comp_name} for rename, it is already in the dataset {dataset_name}.",
106
+ "1-1-6-8": "Cannot use component {comp_name} for rename, it is already in the dataset "
107
+ "{dataset_name}.",
90
108
  # it is the same error that 1-1-8-1 AND similar but not the same 1-3-1
91
109
  "1-1-6-9": "At op {op}: The following components are repeated: {from_components}.",
92
110
  "1-1-6-10": "At op {op}: Component {operand} in dataset {dataset_name} is not an identifier",
@@ -96,64 +114,100 @@ centralised_messages = {
96
114
  "1-1-6-13": "At op {op}: Not allowed to overwrite an identifier: {comp_name}",
97
115
  # "1-1-6-15": "At op {op}: Component {comp_name} already exists in dataset {dataset_name}",
98
116
  # Comparison errors
99
- "1-1-7-1": "At op {op}: Value in {left_name} of type {left_type} is not comparable to value {right_name} of type {right_type}.",
117
+ "1-1-7-1": "At op {op}: Value in {left_name} of type {left_type} is not comparable to value "
118
+ "{right_name} of type {right_type}.",
100
119
  # Conditional errors
101
- "1-1-9-1": "At op {op}: The evaluation condition must result in a Boolean expression, found '{type}'.",
102
- "1-1-9-3": "At op {op}: Then clause {then_name} and else clause {else_name}, both must be Scalars.",
120
+ "1-1-9-1": "At op {op}: The evaluation condition must result in a Boolean "
121
+ "expression, found '{type}'.",
122
+ "1-1-9-3": "At op {op}: Then clause {then_name} and else clause {else_name}, both must be "
123
+ "Scalars.",
103
124
  "1-1-9-4": "At op {op}: The condition dataset {name} must contain an unique measure.",
104
125
  "1-1-9-5": "At op {op}: The condition dataset Measure must be a Boolean, found '{type}'.",
105
- "1-1-9-6": "At op {op}: Then-else datasets have different number of identifiers compared with condition dataset.",
106
- "1-1-9-9": "At op {op}: {clause} component {clause_name} role must be {role_1}, found {role_2}.",
107
- "1-1-9-10": "At op {op}: {clause} dataset have different number of identifiers compared with condition dataset.",
126
+ "1-1-9-6": "At op {op}: Then-else datasets have different number of identifiers compared "
127
+ "with condition dataset.",
128
+ "1-1-9-9": "At op {op}: {clause} component {clause_name} role must be {role_1}, found "
129
+ "{role_2}.",
130
+ "1-1-9-10": "At op {op}: {clause} dataset have different number of identifiers compared with "
131
+ "condition dataset.",
108
132
  "1-1-9-11": "At op {op}: Condition component {name} must be Boolean, found {type}.",
109
- "1-1-9-12": "At op {op}: then clause {then_symbol} and else clause {else_symbol}, both must be Datasets or at least one of them a Scalar.",
110
- "1-1-9-13": "At op {op}: then {then} and else {else_clause} datasets must contain the same number of components.",
133
+ "1-1-9-12": "At op {op}: then clause {then_symbol} and else clause {else_symbol}, both must "
134
+ "be Datasets or at least one of them a Scalar.",
135
+ "1-1-9-13": "At op {op}: then {then} and else {else_clause} datasets must contain the same "
136
+ "number of components.",
137
+ "2-1-9-1": "At op {op}: Condition operators must have the same operator type.",
138
+ "2-1-9-2": "At op {op}: Condition {name} it's not a boolean.",
139
+ "2-1-9-3": "At op {op}: All then and else operands must be scalars.",
140
+ "2-1-9-4": "At op {op}: Condition {name} must be boolean type.",
141
+ "2-1-9-5": "At op {op}: Condition Dataset {name} measure must be Boolean.",
142
+ "2-1-9-6": "At op {op}: At least a then or else operand must be Dataset.",
143
+ "2-1-9-7": "At op {op}: All Dataset operands must have the same components.",
144
+
111
145
  # Data Validation errors
112
146
  "1-1-10-1": "At op {op}: The {op_type} operand must have exactly one measure of type {me_type}",
113
147
  "1-1-10-2": "At op {op}: Number of variable has to be equal between the call and signature.",
114
- "1-1-10-3": "At op {op}: Name in the call {found} has to be equal to variable rule in signature {expected} .",
115
- "1-1-10-4": "At op {op}: When a hierarchical ruleset is defined for value domain, it is necessary to specify the component with the rule clause on call.",
148
+ "1-1-10-3": "At op {op}: Name in the call {found} has to be equal to variable rule in "
149
+ "signature {expected}.",
150
+ "1-1-10-4": "At op {op}: When a hierarchical ruleset is defined for value domain, it is "
151
+ "necessary to specify the component with the rule clause on call.",
116
152
  "1-1-10-5": "No rules to analyze on Hierarchy Roll-up as rules have no = operator.",
117
- "1-1-10-6": "At op {op}: Name in the call {found} has to be equal to variable condition in signature {expected} .",
153
+ "1-1-10-6": "At op {op}: Name in the call {found} has to be equal to variable condition in "
154
+ "signature {expected} .",
118
155
  "1-1-10-7": "Not found component {comp_name} on signature.",
119
156
  "1-1-10-8": "At op {op}: Measures involved have to be numerical, other types found {found}.",
120
- "1-1-10-9": "Invalid signature for the ruleset {ruleset}. On variables, condComp and ruleComp must be the same",
157
+ "1-1-10-9": "Invalid signature for the ruleset {ruleset}. On variables, condComp and "
158
+ "ruleComp must be the same",
121
159
  # General Operators
122
- # "1-1-12-1": "At op {op}: You could not recalculate the identifier {name} on dataset {dataset}.",
123
- # "2-1-12-1": "At op {op}: Create a null measure without a scalar type is not allowed. Please use cast operator.",
160
+ # "1-1-12-1": "At op {op}: You could not recalculate the identifier {name} on dataset "
161
+ # "{dataset}.",
162
+ # "2-1-12-1": "At op {op}: Create a null measure without a scalar type is not allowed. "
163
+ # "Please use cast operator.",
124
164
  # Join Operators
125
165
  "1-1-13-1": "At op {op}: Duplicated alias {duplicates}.",
126
166
  "1-1-13-2": "At op {op}: Missing mandatory aliasing.",
127
- "1-1-13-3": "At op {op}: Join conflict with duplicated names for column {name} from original datasets.",
128
- "1-1-13-4": "At op {op}: Using clause, using={using_names}, does not define all the identifiers, of non reference dataset {dataset}.",
129
- "1-1-13-5": "At op {op}: Invalid subcase B1, All the datasets must share as identifiers the using ones.",
167
+ "1-1-13-3": "At op {op}: Join conflict with duplicated names for column {name} from original "
168
+ "datasets.",
169
+ "1-1-13-4": "At op {op}: Using clause, using={using_names}, does not define all the "
170
+ "identifiers, of non reference dataset {dataset}.",
171
+ "1-1-13-5": "At op {op}: Invalid subcase B1, All the datasets must share as identifiers the "
172
+ "using ones.",
130
173
  # not in use but we keep for later, in use 1-1-13-4
131
- "1-1-13-6": "At op {op}: Invalid subcase B2, All the declared using components '{using_components}' must be present as components in the reference dataset '{reference}'.",
132
- "1-1-13-7": "At op {op}: Invalid subcase B2, All the non reference datasets must share as identifiers the using ones.",
174
+ "1-1-13-6": "At op {op}: Invalid subcase B2, All the declared using components "
175
+ "'{using_components}' must be present as components in the reference dataset "
176
+ "'{reference}'.",
177
+ "1-1-13-7": "At op {op}: Invalid subcase B2, All the non reference datasets must share as "
178
+ "identifiers the using ones.",
133
179
  "1-1-13-8": "At op {op}: No available using clause.",
134
180
  "1-1-13-9": "Ambiguity for this variable {comp_name} inside a join clause.",
135
181
  "1-1-13-10": "The join operator does not perform scalar/component operations.",
136
- "1-1-13-11": "At op {op}: Invalid subcase A, {dataset_reference} should be a superset but {component} not found.",
182
+ "1-1-13-11": "At op {op}: Invalid subcase A, {dataset_reference} should be a superset but "
183
+ "{component} not found.",
137
184
  # inner_join and left join
138
- "1-1-13-12": "At op {op}: Invalid subcase A. There are different identifiers for the provided datasets",
185
+ "1-1-13-12": "At op {op}: Invalid subcase A. There are different identifiers for the provided "
186
+ "datasets",
139
187
  # full_join
140
- "1-1-13-13": "At op {op}: Invalid subcase A. There are not same number of identifiers for the provided datasets",
188
+ "1-1-13-13": "At op {op}: Invalid subcase A. There are not same number of identifiers for the "
189
+ "provided datasets",
141
190
  # full_join
142
191
  "1-1-13-14": "Cannot perform a join over a Dataset Without Identifiers: {name}.",
143
- "1-1-13-15": "At op {op}: {comp_name} has to be a Measure for all the provided datasets inside the join",
192
+ "1-1-13-15": "At op {op}: {comp_name} has to be a Measure for all the provided datasets inside "
193
+ "the join",
144
194
  "1-1-13-16": "At op {op}: Invalid use, please review : {msg}.",
145
- "1-1-13-17": "At op {op}: {comp_name} not present in the dataset(result from join VDS) at the time it is called",
195
+ "1-1-13-17": "At op {op}: {comp_name} not present in the dataset(result from join VDS) at the "
196
+ "time it is called",
146
197
  # Operators general errors
147
198
  "1-1-14-1": "At op {op}: Measure names don't match: {left} - {right}.",
148
- "1-1-14-3": "At op {op}: Invalid scalar types for identifiers at DataSet {dataset}. One {type} identifier expected, {count} found.",
199
+ "1-1-14-3": "At op {op}: Invalid scalar types for identifiers at DataSet {dataset}. One {type} "
200
+ "identifier expected, {count} found.",
149
201
  "1-1-14-5": "At op {op}: {names} with type/s {types} is not compatible with {op}",
150
- "1-1-14-6": "At op {op}: {comp_name} with type {comp_type} and scalar_set with type {scalar_type} is not compatible with {op}",
202
+ "1-1-14-6": "At op {op}: {comp_name} with type {comp_type} and scalar_set with type "
203
+ "{scalar_type} is not compatible with {op}",
151
204
  # "1-1-14-8": "At op {op}: Operation not allowed for multimeasure datasets.",
152
- "1-1-14-9": "At op {op}: {names} with type/s {types} is not compatible with {op} on datasets {datasets}.",
153
-
205
+ "1-1-14-9": "At op {op}: {names} with type/s {types} is not compatible with {op} on datasets "
206
+ "{datasets}.",
154
207
  # Numeric Operators
155
208
  "1-1-15-8": "At op {op}: {op} operator cannot have a {comp_type} as parameter.",
156
- "2-1-15-1": "At op {op}: Component {comp_name} from dataset {dataset_name} contains negative values.",
209
+ "2-1-15-1": "At op {op}: Component {comp_name} from dataset {dataset_name} contains negative "
210
+ "values.",
157
211
  "2-1-15-2": "At op {op}: Value {value} could not be negative.",
158
212
  "2-1-15-3": "At op {op}: Base value {value} could not be less or equal 0.",
159
213
  "2-1-15-4": "At op {op}: Invalid values in Component {name}.",
@@ -161,7 +215,8 @@ centralised_messages = {
161
215
  "2-1-15-6": "At op {op}: Scalar division by Zero.",
162
216
  "2-1-15-7": "At op {op}: {op} operator cannot be a dataset.",
163
217
  # Set Operators
164
- "1-1-17-1": "At op {op}: Datasets {dataset_1} and {dataset_2} have different number of components",
218
+ "1-1-17-1": "At op {op}: Datasets {dataset_1} and {dataset_2} have different number of "
219
+ "components",
165
220
  # String Operators
166
221
  # "1-1-18-1": "At op {op}: Invalid Dataset {name}. Dataset with one measure expected.",
167
222
  "1-1-18-2": "At op {op}: Composition of DataSet and Component is not allowed.",
@@ -174,14 +229,30 @@ centralised_messages = {
174
229
  # Time operators
175
230
  "1-1-19-2": "At op {op}: Unknown date type for {op}.",
176
231
  "1-1-19-3": "At op {op}: Invalid {param} for {op}.",
177
- "1-1-19-4": "At op {op}: Invalid values {value_1} and {value_2}, periodIndTo parameter must be a larger duration value than periodIndFrom parameter.",
178
- "1-1-19-5": "At op {op}: periodIndTo parameter must be a larger duration value than the values to aggregate.",
232
+ "1-1-19-4": "At op {op}: Invalid values {value_1} and {value_2}, periodIndTo parameter must be "
233
+ "a larger duration value than periodIndFrom parameter.",
234
+ "1-1-19-5": "At op {op}: periodIndTo parameter must be a larger duration value than the values "
235
+ "to aggregate.",
179
236
  "1-1-19-6": "At op {op}: Time type used in the component {comp} is not supported.",
180
- "1-1-19-7": "At op {op}: can be applied only on Data Sets (of time series) and returns a Data Set (of time series).",
237
+ "1-1-19-7": "At op {op}: can be applied only on Data Sets (of time series) and returns a Data "
238
+ "Set (of time series).",
181
239
  # flow_to_stock, stock_to_flow
182
240
  "1-1-19-8": "At op {op}: {op} can only be applied to a {comp_type}",
183
241
  "1-1-19-9": "At op {op}: {op} can only be applied to a {comp_type} with a {param}",
184
- "2-1-19-1": "At op {op}: Invalid values {value_1} and {value_2} for duration, periodIndTo parameter must be a larger duration value than the values to aggregate.",
242
+ # Other time operators
243
+ "2-1-19-1": "At op {op}: Invalid values {value_1} and {value_2} for duration, "
244
+ "periodIndTo parameter must be a larger duration value than the "
245
+ "values to aggregate.",
246
+ "2-1-19-2": "Invalid period indicator {period}.",
247
+ "2-1-19-3": "Only same period indicator allowed for both parameters ({period1} != {period2}).",
248
+ "2-1-19-4": "Date setter, ({value} > {date}). Cannot set date1 with a value higher than date2.",
249
+ "2-1-19-5": "Date setter, ({value} < {date}). Cannot set date2 with a value lower than date1.",
250
+ "2-1-19-6": "Invalid period format, must be YYYY-(L)NNN: {period_format}",
251
+ "2-1-19-7": "Period Number must be between 1 and {periods} for period indicator "
252
+ "{period_indicator}.",
253
+ "2-1-19-8": "Invalid date format, must be YYYY-MM-DD: {str}",
254
+ "2-1-19-9": "Invalid day {day} for year {year}.",
255
+ "2-1-19-10": "Invalid year {year}, must be between 1900 and 9999.",
185
256
  # ----------- Interpreter Common ------
186
257
  "2-3-1": "{comp_type} {comp_name} not found.",
187
258
  "2-3-2": "{op_type} cannot be used with {node_op} operators.",
@@ -209,11 +280,14 @@ centralised_messages = {
209
280
  "1-3-21": "Value {value} not valid, kind {node_kind}.",
210
281
  "1-3-22": "Unable to categorize {node_value}.",
211
282
  "1-3-23": "Missing value domain '{name}' definition, please provide an structure.",
212
- "1-3-24": "Internal error on Analytic operators inside a calc, No partition or order symbol found.",
283
+ "1-3-24": "Internal error on Analytic operators inside a calc, No partition or "
284
+ "order symbol found.",
213
285
  "1-3-26": "Value domain {name} not found.",
214
286
  "1-3-27": "Dataset without identifiers are not allowed in {op} operator.",
215
- "1-3-28": "At op {op}: invalid number of parameters: received {received}, expected at least: {expected}",
216
- "1-3-29": "At op {op}: can not use user defined operator that returns a component outside clause operator or rule",
287
+ "1-3-28": "At op {op}: invalid number of parameters: received {received}, expected at "
288
+ "least: {expected}",
289
+ "1-3-29": "At op {op}: can not use user defined operator that returns a component outside "
290
+ "clause operator or rule",
217
291
  "1-3-30": "At op {op}: too many parameters: received {received}, expected: {expected}",
218
292
  "1-3-31": "Cannot use component {name} outside an aggregate function in a having clause.",
219
293
  "1-3-32": "Cannot perform operation {op} inside having clause.",
@@ -225,19 +299,25 @@ centralised_messages = {
225
299
  "1-4-1-1": "At op {op}: User defined {option} declared as {type_1}, found {type_2}.",
226
300
  "1-4-1-2": "Using variable {value}, not defined at {op} definition.",
227
301
  "1-4-1-3": "At op {op}: using variable {value}, not defined as an argument.",
228
- "1-4-1-4": "Found duplicates at arguments naming, please review {type} definition {op}.",
229
- "1-4-1-5": "Found duplicates at rule naming: {names}. Please review {type} {ruleset_name} definition.",
302
+ "1-4-1-4": "Found duplicates at arguments naming, please review {type} " "definition {op}.",
303
+ "1-4-1-5": "Found duplicates at rule naming: {names}. Please review {type} "
304
+ "{ruleset_name} definition.",
230
305
  "1-4-1-6": "At op {op}: Arguments incoherence, {defined} defined {passed} passed.",
231
- "1-4-1-7": "All rules must be named or not named, but found mixed criteria at {type} definition {name}.",
232
- "1-4-1-8": "All rules must have different code items in the left side of '=' in hierarchy operator at hierachical ruleset definition {name}.",
233
- "1-4-1-9": "At op check_datapoint: {name} has an invalid datatype expected DataSet, found Scalar.",
306
+ "1-4-1-7": "All rules must be named or not named, but found mixed criteria at {type} "
307
+ "definition {name}.",
308
+ "1-4-1-8": "All rules must have different code items in the left side of '=' in hierarchy "
309
+ "operator at hierachical ruleset definition {name}.",
310
+ "1-4-1-9": "At op check_datapoint: {name} has an invalid datatype expected DataSet, found "
311
+ "Scalar.",
234
312
  # AST Creation
235
313
  "1-4-2-1": "Eval could not be called without a {option} type definition.",
236
314
  "1-4-2-2": "Optional or empty expression node is not allowed in time_agg.",
237
315
  "1-4-2-3": "{value} could not be called in the count.",
238
- "1-4-2-4": "At op {op}: Only one order_by element must be used in Analytic with range windowing.",
316
+ "1-4-2-4": "At op {op}: Only one order_by element must be used in Analytic with range "
317
+ "windowing.",
239
318
  "1-4-2-5": "At op {op}: User defined operator without returns is not implemented.",
240
319
  "1-4-2-6": "At op {op}: Window must be provided.",
241
- "1-4-2-7": "At op {op}: Partition by or order by clause must be provided for Analytic operators.",
320
+ "1-4-2-7": "At op {op}: Partition by or order by clause must be provided for Analytic "
321
+ "operators.",
242
322
  # Not Implemented Error
243
323
  }