Esempio n. 1
0
def deploy_test():
    loop_node = LoopNode()
    iter_node = IncrementNode()
    eq_node = EqualsNode()
    not_node = NotNode()
    var_node = VariableNode(0)
    split_node = DummyNode()
    add_node = AddNode()
    out_node = PassThroughNode()
    BaseNode.connect(loop_node, out_node, 'value', 'in')
    BaseNode.connect(split_node, loop_node, 'out', 'iter')
    BaseNode.connect(not_node, split_node, 'out', 'in')
    BaseNode.connect(eq_node, not_node, 'result', 'in')
    BaseNode.connect(iter_node, eq_node, 'increment', 'arg1')
    BaseNode.connect(DataSourceNode(50), eq_node, 'data', 'arg2')
    BaseNode.connect(var_node, loop_node, 'value', 'value')

    BaseNode.connect(var_node, split_node, 'update', 'extra')
    BaseNode.connect(add_node, var_node, 'result', 'value')
    BaseNode.connect(iter_node, add_node, 'value', 'arg1')
    BaseNode.connect(var_node, add_node, 'value', 'arg2')

    code = LanguageConcat(deploy(out_node, 'out'),
                          FunctionCall(VariableName('main')))
    print(code.__py__(DeployContext()))
 def deploy_output__out(self):
     return LanguageConcat(
         self.resolve_input_deploy('in'),
         VariableSetStatement(
             NodeOutputVariableName(self.id, 'out'),
             FunctionCall(VariableName('utils_type'),
                          self.get_input_connection_variable_name('in'))))
Esempio n. 3
0
 def deploy_output__value(self):
     return VariableSetStatement(
         NodeOutputVariableName(self.id, 'value'),
         VariableName('env')
     )
Esempio n. 4
0
 def __es6__(self, c):
     return FunctionCall(VariableName('Math.pow'), self.base,
                         self.power).__es6__(c)
Esempio n. 5
0
 def __py__(self, c):
     return FunctionCall(VariableName(f'math.{self.func}'),
                         self.value).__py__(c)
Esempio n. 6
0
 def __py__(self, c):
     return FunctionCall(VariableName('abs'), self.value).__py__(c)
Esempio n. 7
0
 def __es6__(self, c):
     return FunctionCall(VariableName('Math.abs'), self.value).__es6__(c)
Esempio n. 8
0
 def __py__(self, c):
     return FunctionCall(VariableName('math.log'), self.value,
                         self.base).__py__(c)
Esempio n. 9
0
 def __es6__(self, c):
     return LanguageOperation(
         DivideSymbol(), FunctionCall(VariableName('Math.log'), self.value),
         FunctionCall(VariableName('Math.log'), self.base)).__es6__(c)
Esempio n. 10
0
 def __py__(self, c):
     return FunctionCall(
         VariableName('math.pow'), self.value,
         LanguageOperation(DivideSymbol(), LanguageValue(1),
                           self.root)).__py__(c)