vtlengine 1.0.0__py3-none-any.whl → 1.0.1__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 (54) hide show
  1. vtlengine/API/_InternalApi.py +153 -100
  2. vtlengine/API/__init__.py +109 -67
  3. vtlengine/AST/ASTConstructor.py +188 -98
  4. vtlengine/AST/ASTConstructorModules/Expr.py +306 -200
  5. vtlengine/AST/ASTConstructorModules/ExprComponents.py +172 -102
  6. vtlengine/AST/ASTConstructorModules/Terminals.py +158 -95
  7. vtlengine/AST/ASTEncoders.py +1 -1
  8. vtlengine/AST/ASTTemplate.py +8 -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/lexer.py +732 -142
  13. vtlengine/AST/Grammar/parser.py +2188 -826
  14. vtlengine/AST/Grammar/tokens.py +128 -128
  15. vtlengine/AST/VtlVisitor.py +7 -4
  16. vtlengine/AST/__init__.py +22 -11
  17. vtlengine/DataTypes/NumericTypesHandling.py +5 -4
  18. vtlengine/DataTypes/TimeHandling.py +194 -301
  19. vtlengine/DataTypes/__init__.py +304 -218
  20. vtlengine/Exceptions/__init__.py +52 -27
  21. vtlengine/Exceptions/messages.py +134 -62
  22. vtlengine/Interpreter/__init__.py +781 -487
  23. vtlengine/Model/__init__.py +165 -121
  24. vtlengine/Operators/Aggregation.py +156 -95
  25. vtlengine/Operators/Analytic.py +115 -59
  26. vtlengine/Operators/Assignment.py +7 -4
  27. vtlengine/Operators/Boolean.py +27 -32
  28. vtlengine/Operators/CastOperator.py +177 -131
  29. vtlengine/Operators/Clause.py +137 -99
  30. vtlengine/Operators/Comparison.py +148 -117
  31. vtlengine/Operators/Conditional.py +149 -98
  32. vtlengine/Operators/General.py +68 -47
  33. vtlengine/Operators/HROperators.py +91 -72
  34. vtlengine/Operators/Join.py +217 -118
  35. vtlengine/Operators/Numeric.py +89 -44
  36. vtlengine/Operators/RoleSetter.py +16 -15
  37. vtlengine/Operators/Set.py +61 -36
  38. vtlengine/Operators/String.py +213 -139
  39. vtlengine/Operators/Time.py +334 -216
  40. vtlengine/Operators/Validation.py +117 -76
  41. vtlengine/Operators/__init__.py +340 -213
  42. vtlengine/Utils/__init__.py +195 -40
  43. vtlengine/__init__.py +1 -1
  44. vtlengine/files/output/__init__.py +15 -6
  45. vtlengine/files/output/_time_period_representation.py +10 -9
  46. vtlengine/files/parser/__init__.py +77 -52
  47. vtlengine/files/parser/_rfc_dialect.py +6 -5
  48. vtlengine/files/parser/_time_checking.py +46 -37
  49. vtlengine-1.0.1.dist-info/METADATA +236 -0
  50. vtlengine-1.0.1.dist-info/RECORD +58 -0
  51. {vtlengine-1.0.dist-info → vtlengine-1.0.1.dist-info}/WHEEL +1 -1
  52. vtlengine-1.0.dist-info/METADATA +0 -104
  53. vtlengine-1.0.dist-info/RECORD +0 -58
  54. {vtlengine-1.0.dist-info → vtlengine-1.0.1.dist-info}/LICENSE.md +0 -0
@@ -6,16 +6,31 @@ Description
6
6
  -----------
7
7
  Direct Acyclic Graph.
8
8
  """
9
+
9
10
  import copy
10
11
  from dataclasses import dataclass
11
12
  from typing import Any, Dict, Optional
12
13
 
13
14
  import networkx as nx
14
15
 
15
- from vtlengine.AST import AST, BinOp, VarID, Aggregation, Analytic, JoinOp, ParamOp, Operator, \
16
- Identifier, \
17
- DefIdentifier, Start, HRuleset, RegularAggregation, PersistentAssignment, Assignment, \
18
- DPRuleset
16
+ from vtlengine.AST import (
17
+ AST,
18
+ BinOp,
19
+ VarID,
20
+ Aggregation,
21
+ Analytic,
22
+ JoinOp,
23
+ ParamOp,
24
+ Operator,
25
+ Identifier,
26
+ DefIdentifier,
27
+ Start,
28
+ HRuleset,
29
+ RegularAggregation,
30
+ PersistentAssignment,
31
+ Assignment,
32
+ DPRuleset,
33
+ )
19
34
  from vtlengine.AST.ASTTemplate import ASTTemplate
20
35
  from vtlengine.AST.DAG._words import INSERT, DELETE, OUTPUTS, PERSISTENT, INPUTS, GLOBAL
21
36
  from vtlengine.AST.Grammar.tokens import AS, MEMBERSHIP, TO
@@ -116,9 +131,7 @@ class DAGAnalyzer(ASTTemplate):
116
131
 
117
132
  @classmethod
118
133
  def createDAG(cls, ast: AST):
119
- """
120
-
121
- """
134
+ """ """
122
135
  # Visit AST.
123
136
  dag = cls()
124
137
  dag.visit(ast)
@@ -142,17 +155,16 @@ class DAGAnalyzer(ASTTemplate):
142
155
  error_keys[aux_v1] = dag.dependencies[aux_v1]
143
156
  break
144
157
  raise Exception(
145
- 'Vtl Script contains Cycles, no DAG established.\nSuggestion {}, more_info:{}'.format(
146
- error, error_keys)) from None
158
+ "Vtl Script contains Cycles, no DAG established.\nSuggestion {}, "
159
+ "more_info:{}".format(error, error_keys)
160
+ ) from None
147
161
  except SemanticError as error:
148
162
  raise error
149
163
  except Exception as error:
150
- raise Exception('Error creating DAG.') from error
164
+ raise Exception("Error creating DAG.") from error
151
165
 
152
166
  def loadVertex(self):
153
- """
154
-
155
- """
167
+ """ """
156
168
  # For each vertex
157
169
  for key, statement in self.dependencies.items():
158
170
  output = statement[OUTPUTS] + statement[PERSISTENT]
@@ -164,9 +176,7 @@ class DAGAnalyzer(ASTTemplate):
164
176
  self.nov = len(self.vertex)
165
177
 
166
178
  def loadEdges(self):
167
- """
168
-
169
- """
179
+ """ """
170
180
  if len(self.vertex) != 0:
171
181
  countEdges = 0
172
182
  # For each vertex
@@ -182,9 +192,7 @@ class DAGAnalyzer(ASTTemplate):
182
192
  countEdges += 1
183
193
 
184
194
  def nx_topologicalSort(self):
185
- """
186
-
187
- """
195
+ """ """
188
196
  edges = list(self.edges.values())
189
197
  DAG = nx.DiGraph()
190
198
  DAG.add_nodes_from(self.vertex)
@@ -208,26 +216,23 @@ class DAGAnalyzer(ASTTemplate):
208
216
  non_repeated_outputs.append(statement.left.value)
209
217
 
210
218
  def sortAST(self, ast: AST):
211
- """
212
-
213
- """
219
+ """ """
214
220
  statements_nodes = ast.children
215
- HRuleStatements: list = [HRule for HRule in statements_nodes if
216
- isinstance(HRule, HRuleset)]
217
- DPRuleStatement: list = [DPRule for DPRule in statements_nodes if
218
- isinstance(DPRule, DPRuleset)]
221
+ HRuleStatements: list = [HRule for HRule in statements_nodes if isinstance(HRule, HRuleset)]
222
+ DPRuleStatement: list = [
223
+ DPRule for DPRule in statements_nodes if isinstance(DPRule, DPRuleset)
224
+ ]
219
225
  DOStatement: list = [DO for DO in statements_nodes if isinstance(DO, Operator)]
220
- MLStatements: list = [ML for ML in statements_nodes if
221
- not isinstance(ML, (HRuleset, DPRuleset, Operator))]
226
+ MLStatements: list = [
227
+ ML for ML in statements_nodes if not isinstance(ML, (HRuleset, DPRuleset, Operator))
228
+ ]
222
229
 
223
230
  intermediate = self.sort_elements(MLStatements)
224
231
  self.check_overwriting(intermediate)
225
232
  ast.children = HRuleStatements + DPRuleStatement + DOStatement + intermediate
226
233
 
227
234
  def statementStructure(self) -> dict:
228
- """
229
-
230
- """
235
+ """ """
231
236
  inputs = list(set(self.inputs))
232
237
  outputs = list(set(self.outputs))
233
238
  persistent = list(set(self.persistent))
@@ -267,9 +272,11 @@ class DAGAnalyzer(ASTTemplate):
267
272
 
268
273
  # Analyze inputs and outputs per each statement.
269
274
  self.dependencies[self.numberOfStatements] = copy.deepcopy(
270
- self.statementStructure())
275
+ self.statementStructure()
276
+ )
271
277
 
272
- # Count the number of statements in order to name the scope symbol table for each one.
278
+ # Count the number of statements in order to name the scope symbol table for
279
+ # each one.
273
280
  self.numberOfStatements += 1
274
281
 
275
282
  self.alias = []
@@ -376,8 +383,9 @@ class HRDAGAnalyzer(DAGAnalyzer):
376
383
  error_keys[aux_v1] = dag.dependencies[aux_v1]
377
384
  break
378
385
  raise Exception(
379
- f'Vtl Script contains Cycles, no DAG established.'
380
- f'\nSuggestion {error}, more_info:{error_keys}')
386
+ f"Vtl Script contains Cycles, no DAG established."
387
+ f"\nSuggestion {error}, more_info:{error_keys}"
388
+ )
381
389
 
382
390
  def visit_HRuleset(self, node: HRuleset) -> None:
383
391
  """
@@ -1,9 +1,9 @@
1
1
  # DS analysis
2
- INSERT = 'insertion'
3
- DELETE = 'deletion'
4
- GLOBAL = 'global_inputs'
2
+ INSERT = "insertion"
3
+ DELETE = "deletion"
4
+ GLOBAL = "global_inputs"
5
5
 
6
6
  INPUTS = "inputs"
7
7
  OUTPUTS = "outputs"
8
8
  PERSISTENT = "persistent"
9
- STATEMENT_ = 'statement'
9
+ STATEMENT_ = "statement"