Ejemplo n.º 1
0
def _fbthrift_gen_metadata_struct_NonCopyableStruct(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.NonCopyableStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I64_TYPE),
            name="num",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # num

    return new_struct
Ejemplo n.º 2
0
def _fbthrift_gen_metadata_struct_Fields(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.Fields"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=100,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="injected_field",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # injected_field

    return new_struct
Ejemplo n.º 3
0
def _fbthrift_gen_metadata_struct_Foo(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "emptyns.Foo"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I64_TYPE),
            name="MyInt",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # MyInt

    return new_struct
Ejemplo n.º 4
0
def _fbthrift_gen_metadata_struct_NonCopyableUnion(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.NonCopyableUnion"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.NonCopyableStruct")),
            name="s",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_struct_NonCopyableStruct(
        new_struct)  # s

    return new_struct
Ejemplo n.º 5
0
def _fbthrift_gen_metadata_struct_SomeStruct(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.SomeStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.Metasyntactic")),
            name="reasonable",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.Metasyntactic")),
            name="fine",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.Metasyntactic")),
            name="questionable",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_set=_fbthrift_metadata.ThriftSetType(
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_I32_TYPE))),
            name="tags",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_enum_Metasyntactic(
        new_struct)  # reasonable
    new_struct = _fbthrift_gen_metadata_enum_Metasyntactic(new_struct)  # fine
    new_struct = _fbthrift_gen_metadata_enum_Metasyntactic(
        new_struct)  # questionable
    # tags

    return new_struct
Ejemplo n.º 6
0
def _fbthrift_gen_metadata_struct_struct2(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.struct2"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="a",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="b",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.struct1")),
            name="c",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_list=_fbthrift_metadata.ThriftListType(
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_I32_TYPE))),
            name="d",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # a
    # b
    new_struct = _fbthrift_gen_metadata_struct_struct1(new_struct)  # c
    # d

    return new_struct
Ejemplo n.º 7
0
def _fbthrift_gen_metadata_struct_union2(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.union2"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="i",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_FLOAT_TYPE),
            name="d",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.struct1")),
            name="s",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_union=_fbthrift_metadata.ThriftUnionType(
                    name="module.union1")),
            name="u",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # i
    # d
    new_struct = _fbthrift_gen_metadata_struct_struct1(new_struct)  # s
    new_struct = _fbthrift_gen_metadata_struct_union1(new_struct)  # u

    return new_struct
Ejemplo n.º 8
0
def _fbthrift_gen_metadata_struct_MyStruct(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum2")),
            name="me2_3",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum3")),
            name="me3_n3",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum1")),
            name="me1_t1",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=6,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum1")),
            name="me1_t2",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_enum_MyEnum2(new_struct)  # me2_3
    new_struct = _fbthrift_gen_metadata_enum_MyEnum3(new_struct)  # me3_n3
    new_struct = _fbthrift_gen_metadata_enum_MyEnum1(new_struct)  # me1_t1
    new_struct = _fbthrift_gen_metadata_enum_MyEnum1(new_struct)  # me1_t2

    return new_struct
Ejemplo n.º 9
0
def _fbthrift_gen_metadata_struct_Val(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.Val"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="strVal",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="intVal",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=9,
            type=_fbthrift_metadata.ThriftType(
                t_map=_fbthrift_metadata.ThriftMapType(
                    keyType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_I16_TYPE),
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_STRING_TYPE))),
            name="typedefValue",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # strVal
    # intVal
    # key
    # val  # typedefValue

    return new_struct
Ejemplo n.º 10
0
def _fbthrift_gen_metadata_struct_struct4(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.struct4"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="a",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_FLOAT_TYPE),
            name="b",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_BYTE_TYPE),
            name="c",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # a
    # b
    # c

    return new_struct
Ejemplo n.º 11
0
def _fbthrift_gen_metadata_struct_MyDataItem(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyDataItem"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = []
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    return new_struct
Ejemplo n.º 12
0
def _fbthrift_gen_metadata_struct_FieldsInjectedToStruct(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.FieldsInjectedToStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=-1100,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="injected_field",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="string_field",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[
            _fbthrift_metadata.ThriftConstStruct(
                type=_fbthrift_metadata.ThriftStructType(
                    name="internal.InjectMetadataFields"),
                fields={
                    "type":
                    _fbthrift_metadata.ThriftConstValue(cv_string="Fields"),
                }),
        ])
    new_struct = metadata_struct(structs=struct_dict)

    # string_field
    # injected_field

    return new_struct
Ejemplo n.º 13
0
def _fbthrift_gen_metadata_struct_UnionToBeRenamed(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.UnionToBeRenamed"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="reserved_field",
            is_optional=False,
            structured_annotations=[
                _fbthrift_metadata.ThriftConstStruct(
                    type=_fbthrift_metadata.ThriftStructType(name="hack.Name"),
                    fields={
                        "name":
                        _fbthrift_metadata.ThriftConstValue(
                            cv_string="renamed_field"),
                    }),
            ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[
            _fbthrift_metadata.ThriftConstStruct(
                type=_fbthrift_metadata.ThriftStructType(name="hack.Name"),
                fields={
                    "name":
                    _fbthrift_metadata.ThriftConstValue(
                        cv_string="MyRenamedUnion"),
                }),
        ])
    new_struct = metadata_struct(structs=struct_dict)

    # reserved_field

    return new_struct
Ejemplo n.º 14
0
def _fbthrift_gen_metadata_struct_BinaryUnionStruct(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.BinaryUnionStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_union=_fbthrift_metadata.ThriftUnionType(name="module.BinaryUnion")), name="u", is_optional=False, structured_annotations=[
        ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields,
        is_union=False,
        structured_annotations=[
        ])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_struct_BinaryUnion(new_struct) # u

    return new_struct
Ejemplo n.º 15
0
def _fbthrift_gen_metadata_struct_BinaryUnion(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.BinaryUnion"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BINARY_TYPE), name="iobuf_val", is_optional=False, structured_annotations=[
        ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields,
        is_union=True,
        structured_annotations=[
        ])
    new_struct = metadata_struct(structs=struct_dict)

     # iobuf_val

    return new_struct
Ejemplo n.º 16
0
def _fbthrift_gen_metadata_struct_ComplexStruct(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.ComplexStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_struct=_fbthrift_metadata.ThriftStructType(name="module.SimpleStruct")), name="structOne", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_struct=_fbthrift_metadata.ThriftStructType(name="module.SimpleStruct")), name="structTwo", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=3, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE), name="an_integer", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_STRING_TYPE), name="name", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=5, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.AnEnum")), name="an_enum", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=6, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BINARY_TYPE), name="some_bytes", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=7, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_STRING_TYPE), name="from", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=8, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_STRING_TYPE), name="cdef", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=9, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BINARY_TYPE), name="bytes_with_cpp_type", is_optional=False, structured_annotations=[
        ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields,
        is_union=False,
        structured_annotations=[
        ])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_struct_SimpleStruct(new_struct) # structOne
    new_struct = _fbthrift_gen_metadata_struct_SimpleStruct(new_struct) # structTwo
     # an_integer
     # name
    new_struct = _fbthrift_gen_metadata_enum_AnEnum(new_struct) # an_enum
     # some_bytes
     # from
     # cdef
     # bytes_with_cpp_type

    return new_struct
Ejemplo n.º 17
0
def _fbthrift_gen_metadata_struct_ListUnion(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.ListUnion"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_list=_fbthrift_metadata.ThriftListType(
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_I64_TYPE))),
            name="intListValue",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_list=_fbthrift_metadata.ThriftListType(
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_STRING_TYPE))),
            name="stringListValue",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # intListValue
    # stringListValue

    return new_struct
Ejemplo n.º 18
0
def _fbthrift_gen_metadata_struct_SimpleStruct(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.SimpleStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BOOL_TYPE), name="is_on", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BYTE_TYPE), name="tiny_int", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=3, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I16_TYPE), name="small_int", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE), name="nice_sized_int", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=5, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I64_TYPE), name="big_int", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=6, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_FLOAT_TYPE), name="real", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=7, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_DOUBLE_TYPE), name="smaller_real", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=8, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I16_TYPE), name="hidden_field", is_optional=False, structured_annotations=[
        ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields,
        is_union=False,
        structured_annotations=[
        ])
    new_struct = metadata_struct(structs=struct_dict)

     # is_on
     # tiny_int
     # small_int
     # nice_sized_int
     # big_int
     # real
     # smaller_real
     # hidden_field

    return new_struct
Ejemplo n.º 19
0
def _fbthrift_gen_metadata_struct_MyUnion(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyUnion"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum")),
            name="myEnum",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.MyStruct")),
            name="myDataItem",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_enum_MyEnum(new_struct)  # myEnum
    new_struct = _fbthrift_gen_metadata_struct_MyStruct(
        new_struct)  # myDataItem

    return new_struct
Ejemplo n.º 20
0
def _fbthrift_gen_metadata_struct_VirtualComplexUnion(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.VirtualComplexUnion"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="thingOne",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="thingTwo",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # thingOne
    # thingTwo

    return new_struct
Ejemplo n.º 21
0
def _fbthrift_gen_metadata_struct_Range(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.Range"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="min",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="max",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # min
    # max

    return new_struct
Ejemplo n.º 22
0
def _fbthrift_gen_metadata_struct_Internship(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.Internship"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I32_TYPE),
            name="weeks",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="title",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.Company")),
            name="employer",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_FLOAT_TYPE),
            name="compensation",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=5,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="school",
            is_optional=False,
            structured_annotations=[]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # weeks
    # title
    new_struct = _fbthrift_gen_metadata_enum_Company(new_struct)  # employer
    # compensation
    # school

    return new_struct
Ejemplo n.º 23
0
def _fbthrift_gen_metadata_struct_MyStruct(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_I64_TYPE),
            name="MyIntField",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="MyStringField",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.MyDataItem")),
            name="MyDataField",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum")),
            name="myEnum",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=5,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_BOOL_TYPE),
            name="oneway",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=6,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_BOOL_TYPE),
            name="readonly",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=7,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_BOOL_TYPE),
            name="idempotent",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=8,
            type=_fbthrift_metadata.ThriftType(
                t_set=_fbthrift_metadata.ThriftSetType(
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_DOUBLE_TYPE))),
            name="floatSet",
            is_optional=False,
            structured_annotations=[
                _fbthrift_metadata.ThriftConstStruct(
                    type=_fbthrift_metadata.ThriftStructType(
                        name="hack.SkipCodegen"),
                    fields={
                        "reason":
                        _fbthrift_metadata.ThriftConstValue(
                            cv_string="Invalid key type"),
                    }),
            ]),
        _fbthrift_metadata.ThriftField(
            id=9,
            type=_fbthrift_metadata.ThriftType(
                t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                THRIFT_STRING_TYPE),
            name="no_hack_codegen_field",
            is_optional=False,
            structured_annotations=[
                _fbthrift_metadata.ThriftConstStruct(
                    type=_fbthrift_metadata.ThriftStructType(
                        name="hack.SkipCodegen"),
                    fields={
                        "reason":
                        _fbthrift_metadata.ThriftConstValue(
                            cv_string="skip field codegen for deprecation"),
                    }),
            ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=False,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    # MyIntField
    # MyStringField
    new_struct = _fbthrift_gen_metadata_struct_MyDataItem(
        new_struct)  # MyDataField
    new_struct = _fbthrift_gen_metadata_enum_MyEnum(new_struct)  # myEnum
    # oneway
    # readonly
    # idempotent
    # floatSet
    # no_hack_codegen_field

    return new_struct
Ejemplo n.º 24
0
def _fbthrift_gen_metadata_struct_MyUnion(
    metadata_struct: _fbthrift_metadata.ThriftMetadata
) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyUnion"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(
            id=1,
            type=_fbthrift_metadata.ThriftType(
                t_enum=_fbthrift_metadata.ThriftEnumType(
                    name="module.MyEnum")),
            name="myEnum",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=2,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.MyStruct")),
            name="myStruct",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=3,
            type=_fbthrift_metadata.ThriftType(
                t_struct=_fbthrift_metadata.ThriftStructType(
                    name="module.MyDataItem")),
            name="myDataItem",
            is_optional=False,
            structured_annotations=[]),
        _fbthrift_metadata.ThriftField(
            id=4,
            type=_fbthrift_metadata.ThriftType(
                t_set=_fbthrift_metadata.ThriftSetType(
                    valueType=_fbthrift_metadata.ThriftType(
                        t_primitive=_fbthrift_metadata.ThriftPrimitiveType.
                        THRIFT_DOUBLE_TYPE))),
            name="floatSet",
            is_optional=False,
            structured_annotations=[
                _fbthrift_metadata.ThriftConstStruct(
                    type=_fbthrift_metadata.ThriftStructType(
                        name="hack.SkipCodegen"),
                    fields={
                        "reason":
                        _fbthrift_metadata.ThriftConstValue(
                            cv_string="Invalid key type"),
                    }),
            ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(
        name=qualified_name,
        fields=fields,
        is_union=True,
        structured_annotations=[])
    new_struct = metadata_struct(structs=struct_dict)

    new_struct = _fbthrift_gen_metadata_enum_MyEnum(new_struct)  # myEnum
    new_struct = _fbthrift_gen_metadata_struct_MyStruct(new_struct)  # myStruct
    new_struct = _fbthrift_gen_metadata_struct_MyDataItem(
        new_struct)  # myDataItem
    # floatSet

    return new_struct