示例#1
0
    def factory(sequence_item: SequenceItem):

        previous_double_vertex = sequence_item.add_double_proxy_for(
            "double_vertex")
        assert previous_double_vertex._class == "DoubleProxyVertex"
        assert type(previous_double_vertex) == Double

        previous_int_vertex = sequence_item.add_integer_proxy_for("int_vertex")
        assert previous_int_vertex._class == "IntegerProxyVertex"
        assert type(previous_int_vertex) == Integer

        previous_bool_vertex = sequence_item.add_boolean_proxy_for(
            "bool_vertex")
        assert previous_bool_vertex._class == "BooleanProxyVertex"
        assert type(previous_bool_vertex) == Boolean

        double_vertex = previous_int_vertex + 1.0
        double_vertex.set_label("double_vertex")
        sequence_item.add(double_vertex)
        assert double_vertex._class == "AdditionVertex"
        assert type(double_vertex) == Double

        int_vertex = previous_int_vertex + 1
        int_vertex.set_label("int_vertex")
        sequence_item.add(int_vertex)
        assert int_vertex._class == "AdditionVertex"
        assert type(int_vertex) == Integer

        bool_vertex = previous_bool_vertex == True
        bool_vertex.set_label("bool_vertex")
        sequence_item.add(bool_vertex)
        assert bool_vertex._class == "EqualsVertex"
        assert type(bool_vertex) == Boolean
示例#2
0
def __check_sequence_output_links_to_input(item: SequenceItem,
                                           previous_output_label: str,
                                           current_input_label: str) -> None:
    input_children = item.get(previous_output_label).iter_children()
    optional_output_of_previous_timestep = next(input_children, None)

    assert optional_output_of_previous_timestep is not None
    assert next(input_children, None) is None

    label = optional_output_of_previous_timestep.get_label()
    assert label is not None

    without_namespace = ".".join(label.split(".")[2:])
    assert without_namespace == current_input_label
示例#3
0
 def create_vertices(item: SequenceItem, point: Dict[str, Any]) -> None:
     item.add(Const(point["x"], label="x"))
     item.add(Const(point["y"], label="y"))
示例#4
0
 def create_vertex(item: SequenceItem) -> None:
     v = Bernoulli(0.5)
     v.set_label(vertexLabel)
     item.add(v)