pydpm_xl 0.1.10__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.
Files changed (94) hide show
  1. py_dpm/AST/ASTConstructor.py +503 -0
  2. py_dpm/AST/ASTObjects.py +827 -0
  3. py_dpm/AST/ASTTemplate.py +101 -0
  4. py_dpm/AST/ASTVisitor.py +13 -0
  5. py_dpm/AST/MLGeneration.py +588 -0
  6. py_dpm/AST/ModuleAnalyzer.py +79 -0
  7. py_dpm/AST/ModuleDependencies.py +203 -0
  8. py_dpm/AST/WhereClauseChecker.py +12 -0
  9. py_dpm/AST/__init__.py +0 -0
  10. py_dpm/AST/check_operands.py +302 -0
  11. py_dpm/DataTypes/ScalarTypes.py +324 -0
  12. py_dpm/DataTypes/TimeClasses.py +370 -0
  13. py_dpm/DataTypes/TypePromotion.py +195 -0
  14. py_dpm/DataTypes/__init__.py +0 -0
  15. py_dpm/Exceptions/__init__.py +0 -0
  16. py_dpm/Exceptions/exceptions.py +84 -0
  17. py_dpm/Exceptions/messages.py +114 -0
  18. py_dpm/OperationScopes/OperationScopeService.py +247 -0
  19. py_dpm/OperationScopes/__init__.py +0 -0
  20. py_dpm/Operators/AggregateOperators.py +138 -0
  21. py_dpm/Operators/BooleanOperators.py +30 -0
  22. py_dpm/Operators/ClauseOperators.py +159 -0
  23. py_dpm/Operators/ComparisonOperators.py +69 -0
  24. py_dpm/Operators/ConditionalOperators.py +362 -0
  25. py_dpm/Operators/NumericOperators.py +101 -0
  26. py_dpm/Operators/Operator.py +388 -0
  27. py_dpm/Operators/StringOperators.py +27 -0
  28. py_dpm/Operators/TimeOperators.py +53 -0
  29. py_dpm/Operators/__init__.py +0 -0
  30. py_dpm/Utils/ValidationsGenerationUtils.py +429 -0
  31. py_dpm/Utils/__init__.py +0 -0
  32. py_dpm/Utils/operands_mapping.py +73 -0
  33. py_dpm/Utils/operator_mapping.py +89 -0
  34. py_dpm/Utils/tokens.py +172 -0
  35. py_dpm/Utils/utils.py +2 -0
  36. py_dpm/ValidationsGeneration/PropertiesConstraintsProcessor.py +190 -0
  37. py_dpm/ValidationsGeneration/Utils.py +364 -0
  38. py_dpm/ValidationsGeneration/VariantsProcessor.py +265 -0
  39. py_dpm/ValidationsGeneration/__init__.py +0 -0
  40. py_dpm/ValidationsGeneration/auxiliary_functions.py +98 -0
  41. py_dpm/__init__.py +61 -0
  42. py_dpm/api/__init__.py +140 -0
  43. py_dpm/api/ast_generator.py +438 -0
  44. py_dpm/api/complete_ast.py +241 -0
  45. py_dpm/api/data_dictionary_validation.py +577 -0
  46. py_dpm/api/migration.py +77 -0
  47. py_dpm/api/semantic.py +224 -0
  48. py_dpm/api/syntax.py +182 -0
  49. py_dpm/client.py +106 -0
  50. py_dpm/data_handlers.py +99 -0
  51. py_dpm/db_utils.py +117 -0
  52. py_dpm/grammar/__init__.py +0 -0
  53. py_dpm/grammar/dist/__init__.py +0 -0
  54. py_dpm/grammar/dist/dpm_xlLexer.interp +428 -0
  55. py_dpm/grammar/dist/dpm_xlLexer.py +804 -0
  56. py_dpm/grammar/dist/dpm_xlLexer.tokens +106 -0
  57. py_dpm/grammar/dist/dpm_xlParser.interp +249 -0
  58. py_dpm/grammar/dist/dpm_xlParser.py +5224 -0
  59. py_dpm/grammar/dist/dpm_xlParser.tokens +106 -0
  60. py_dpm/grammar/dist/dpm_xlParserListener.py +742 -0
  61. py_dpm/grammar/dist/dpm_xlParserVisitor.py +419 -0
  62. py_dpm/grammar/dist/listeners.py +10 -0
  63. py_dpm/grammar/dpm_xlLexer.g4 +435 -0
  64. py_dpm/grammar/dpm_xlParser.g4 +260 -0
  65. py_dpm/migration.py +282 -0
  66. py_dpm/models.py +2139 -0
  67. py_dpm/semantics/DAG/DAGAnalyzer.py +158 -0
  68. py_dpm/semantics/DAG/__init__.py +0 -0
  69. py_dpm/semantics/SemanticAnalyzer.py +320 -0
  70. py_dpm/semantics/Symbols.py +223 -0
  71. py_dpm/semantics/__init__.py +0 -0
  72. py_dpm/utils/__init__.py +0 -0
  73. py_dpm/utils/ast_serialization.py +481 -0
  74. py_dpm/views/data_types.sql +12 -0
  75. py_dpm/views/datapoints.sql +65 -0
  76. py_dpm/views/hierarchy_operand_reference.sql +11 -0
  77. py_dpm/views/hierarchy_preconditions.sql +13 -0
  78. py_dpm/views/hierarchy_variables.sql +26 -0
  79. py_dpm/views/hierarchy_variables_context.sql +14 -0
  80. py_dpm/views/key_components.sql +18 -0
  81. py_dpm/views/module_from_table.sql +11 -0
  82. py_dpm/views/open_keys.sql +13 -0
  83. py_dpm/views/operation_info.sql +27 -0
  84. py_dpm/views/operation_list.sql +18 -0
  85. py_dpm/views/operations_versions_from_module_version.sql +30 -0
  86. py_dpm/views/precondition_info.sql +17 -0
  87. py_dpm/views/report_type_operand_reference_info.sql +18 -0
  88. py_dpm/views/subcategory_info.sql +17 -0
  89. py_dpm/views/table_info.sql +19 -0
  90. pydpm_xl-0.1.10.dist-info/LICENSE +674 -0
  91. pydpm_xl-0.1.10.dist-info/METADATA +50 -0
  92. pydpm_xl-0.1.10.dist-info/RECORD +94 -0
  93. pydpm_xl-0.1.10.dist-info/WHEEL +4 -0
  94. pydpm_xl-0.1.10.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,101 @@
1
+ from py_dpm.AST.ASTObjects import AggregationOp, BinOp, ComplexNumericOp, CondExpr, Constant, Dimension, FilterOp, GetOp, GroupingClause, \
2
+ OperationRef, ParExpr, PersistentAssignment, PreconditionItem, PropertyReference, RenameOp, Scalar, Set, Start, TemporaryAssignment, \
3
+ TimeShiftOp, UnaryOp, VarID, VarRef, WhereClauseOp, WithExpression
4
+ from py_dpm.AST.ASTVisitor import NodeVisitor
5
+
6
+
7
+ class ASTTemplate(NodeVisitor):
8
+ """
9
+ Template to start a new visitor for the AST
10
+ """
11
+
12
+ def __init__(self):
13
+ pass
14
+
15
+ def visit_Start(self, node: Start):
16
+ for child in node.children:
17
+ self.visit(child)
18
+
19
+ def visit_ParExpr(self, node: ParExpr):
20
+ self.visit(node.expression)
21
+
22
+ def visit_BinOp(self, node: BinOp):
23
+ self.visit(node.left)
24
+ self.visit(node.right)
25
+
26
+ def visit_UnaryOp(self, node: UnaryOp):
27
+ self.visit(node.operand)
28
+
29
+ def visit_CondExpr(self, node: CondExpr):
30
+ self.visit(node.condition)
31
+ self.visit(node.then_expr)
32
+ if node.else_expr:
33
+ self.visit(node.else_expr)
34
+
35
+ def visit_VarRef(self, node: VarRef):
36
+ pass
37
+
38
+ def visit_VarID(self, node: VarID):
39
+ pass
40
+
41
+ def visit_Constant(self, node: Constant):
42
+ pass
43
+
44
+ def visit_WithExpression(self, node: WithExpression):
45
+ self.visit(node.partial_selection)
46
+ self.visit(node.expression)
47
+
48
+ def visit_AggregationOp(self, node: AggregationOp):
49
+ self.visit(node.operand)
50
+ if node.grouping_clause:
51
+ self.visit(node.grouping_clause)
52
+
53
+ def visit_GroupingClause(self, node: GroupingClause):
54
+ pass
55
+
56
+ def visit_Dimension(self, node: Dimension):
57
+ pass
58
+
59
+ def visit_Set(self, node: Set):
60
+ for child in node.children:
61
+ self.visit(child)
62
+
63
+ def visit_Scalar(self, node: Scalar):
64
+ pass
65
+
66
+ def visit_ComplexNumericOp(self, node: ComplexNumericOp):
67
+ for operand in node.operands:
68
+ self.visit(operand)
69
+
70
+ def visit_RenameOp(self, node: RenameOp):
71
+ self.visit(node.operand)
72
+
73
+ def visit_TimeShiftOp(self, node: TimeShiftOp):
74
+ self.visit(node.operand)
75
+
76
+ def visit_FilterOp(self, node: FilterOp):
77
+ self.visit(node.selection)
78
+ self.visit(node.condition)
79
+
80
+ def visit_WhereClauseOp(self, node: WhereClauseOp):
81
+ self.visit(node.operand)
82
+ self.visit(node.condition.right)
83
+
84
+ def visit_GetOp(self, node: GetOp):
85
+ self.visit(node.operand)
86
+
87
+ def visit_PreconditionItem(self, node: PreconditionItem):
88
+ pass
89
+
90
+ def visit_PropertyReference(self, node: PropertyReference):
91
+ pass
92
+
93
+ def visit_OperationRef(self, node: OperationRef):
94
+ pass
95
+
96
+ def visit_PersistentAssignment(self, node: PersistentAssignment):
97
+ self.visit(node.left)
98
+ self.visit(node.right)
99
+
100
+ def visit_TemporaryAssignment(self, node: TemporaryAssignment):
101
+ self.visit(node.right)
@@ -0,0 +1,13 @@
1
+ class NodeVisitor(object):
2
+ """
3
+ Foundation of the Visit pattern. Gets the AST Object class name and checks if a method
4
+ named visit_ + class name is present. If not, raises a NotImplementedError.
5
+ """
6
+
7
+ def visit(self, node):
8
+ method_name = 'visit_' + type(node).__name__
9
+ visitor = getattr(self, method_name, self.generic_visit)
10
+ return visitor(node)
11
+
12
+ def generic_visit(self, node):
13
+ raise NotImplementedError('No visit_{} method'.format(type(node).__name__))