本文整理汇总了Python中sicpythontask.InputPort.InputPort.get_data方法的典型用法代码示例。如果您正苦于以下问题:Python InputPort.get_data方法的具体用法?Python InputPort.get_data怎么用?Python InputPort.get_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sicpythontask.InputPort.InputPort
的用法示例。
在下文中一共展示了InputPort.get_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DataControl
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataControl(PythonTask):
def __init_ports__(self):
self.in_ = InputPort(name="in", data_type=Control)
self.out = OutputPort(name="out", data_type=Control)
def execute(self, grp):
self.in_.get_data(Control);
self.out.put_data(Control());
示例2: Default
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class Default(PythonTask):
def __init_ports__(self):
self.in1 = InputPort(name="in1", data_type=Text)
self.in2 = InputPort(name="in2", data_type=Text, hold=True)
self.out = OutputPort(name="out", data_type=Text)
def execute(self, grp):
self.out.put_data(Text(self.in1.get_data(Text).values[0] + self.in2.get_data(Text).values[0]));
示例3: Constant2Add
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class Constant2Add(PythonTask):
def __init_ports__(self):
self.in_1 = InputPort(name="In 1", data_type=Int32)
self.in_2 = InputPort(name="In 2", data_type=Int32)
self.out = OutputPort(name="Out", data_type=Int32)
def execute(self, grp):
suma = Int32(self.in_1.get_data(Int32).value + self.in_2.get_data(Int32).value)
self.out.put_data(suma)
示例4: DataFloat32
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataFloat32(PythonTask):
def __init_ports__(self):
self.in1 = InputPort(name="in1", data_type=Float32)
self.in2 = InputPort(name="in2", data_type=Float32)
self.out = OutputPort(name="out", data_type=Float32)
def execute(self, grp):
in1Data = self.in1.get_data(Float32)
in2Data = self.in2.get_data(Float32)
self.out.put_data(Float32(in1Data.value + in2Data.value))
示例5: DataBool
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataBool(PythonTask):
def __init_ports__(self):
self.in1 = InputPort(name="in1", data_type=Bool)
self.in2 = InputPort(name="in2", data_type=Bool)
self.out = OutputPort(name="out", data_type=Bool)
def execute(self, grp):
in1Bool = self.in1.get_data(Bool)
in2Bool = self.in2.get_data(Bool)
self.out.put_data(Bool(in1Bool.values[0] and in2Bool.values[0]))
示例6: DataInt64Dims
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataInt64Dims(PythonTask):
def __init_ports__(self):
self.in1 = InputPort(name="in1", data_type=Int64)
self.in2 = InputPort(name="in2", data_type=Int64)
self.out = OutputPort(name="out", data_type=Int64)
def execute(self, grp):
in1Data = self.in1.get_data(Int64)
in2Data = self.in2.get_data(Int64)
ret = list(map(add, in1Data.values, in2Data.values))
self.out.put_data(Int64(ret, in1Data.dims))
示例7: DataBoolDims
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataBoolDims(PythonTask):
def __init_ports__(self):
self.in1 = InputPort(name="in1", data_type=Bool)
self.in2 = InputPort(name="in2", data_type=Bool)
self.out = OutputPort(name="out", data_type=Bool)
def execute(self, grp):
in1Bool = self.in1.get_data(Bool)
in2Bool = self.in2.get_data(Bool)
ret = list(map(and_, in1Bool.values, in2Bool.values))
self.out.put_data(Bool(ret, in1Bool.dims))
示例8: Lib
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class Lib(PythonTask):
def __init_ports__(self):
self.x = InputPort(name="x", data_type=Int32)
self.fun = InputPort(name="fun", data_type=Text)
self.out = OutputPort(name="out", data_type=Int32)
def execute(self, grp):
x = symbols('x')
x_val = self.x.get_data(Int32).values[0]
fun = self.fun.get_data(Text).values[0]
expr = parse_expr(fun)
res = expr.subs(x, x_val)
self.out.put_data(Int32(int(res)))
示例9: Atomic2SIn2AIn1Out
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class Atomic2SIn2AIn1Out(PythonTask):
def __init_ports__(self):
self.in1 = InputPort(name="in1", data_type=Text)
self.in2 = InputPort(name="in2", data_type=Text)
self.in3 = InputPort(name="in3", data_type=Text, asynchronous=True)
self.in4 = InputPort(name="in4", data_type=Text, asynchronous=True)
self.out = OutputPort(name="out", data_type=Text)
def execute_async(self, async_in):
asynchInText = async_in.get_data(Text)
self.out.put_data(Text("From port " + async_in.name + ": " + asynchInText.values[0]))
def execute(self, grp):
in1Text = self.in1.get_data(Text)
in2Text = self.in2.get_data(Text)
self.out.put_data(Text(in1Text.values[0] + " " + in2Text.values[0]))
示例10: Break
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class Break(PythonTask):
def __init_ports__(self):
self.in_1 = InputPort(name="In", data_type=Int32)
def execute(self, grp):
i = self.in_1.get_data(Int32).values[0]
if i == 3:
self.exit_runner()
示例11: DataTextCastedBool
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataTextCastedBool(PythonTask):
def __init_ports__(self):
self.in_ = InputPort(name="in", data_type=Bool)
self.out = OutputPort(name="out", data_type=Text)
def execute(self, grp):
inData = self.in_.get_data(Text)
self.out.put_data(Text(inData.value.upper()))
示例12: DataDecimal
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataDecimal(PythonTask):
def __init_ports__(self):
self.in_ = InputPort(name="in", data_type=Decimal)
self.out = OutputPort(name="out", data_type=Decimal)
def execute(self, grp):
in1Data = self.in_.get_data(Decimal)
dec = in1Data.values[0] * D(10)
self.out.put_data(Decimal(dec))
示例13: DataTextDims
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataTextDims(PythonTask):
def __init_ports__(self):
self.in_ = InputPort(name="in", data_type=Text)
self.out = OutputPort(name="out", data_type=Text)
def execute(self, grp):
inData = self.in_.get_data(Text)
inText = inData.values
self.out.put_data(Text(inText, inData.dims))
示例14: DataRawDims
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class DataRawDims(PythonTask):
def __init_ports__(self):
self.in_ = InputPort(name="in", data_type=Raw)
self.out = OutputPort(name="out", data_type=Raw)
def execute(self, grp):
inData = self.in_.get_data(Raw)
inRaw = inData.values
self.out.put_data(Raw(inRaw, inData.dims))
示例15: Parameters
# 需要导入模块: from sicpythontask.InputPort import InputPort [as 别名]
# 或者: from sicpythontask.InputPort.InputPort import get_data [as 别名]
class Parameters(PythonTask):
def __init_ports__(self):
self.in_ = InputPort(name="in", data_type=Int32)
self.out = OutputPort(name="out", data_type=Int32)
def runner_start(self):
self.n = int(self.get_parameter('N'))
self.m = int(self.get_parameter('M'))
def execute(self, grp):
self.out.put_data(Int32(self.in_.get_data(Int32).values[0]*self.n + self.m))