Ejemplo n.º 1
0
    package=protox.String(number=2, required=False),
    dependency=protox.String.as_repeated(number=3),
    public_dependency=protox.Int32.as_repeated(number=10),
    weak_dependency=protox.Int32.as_repeated(number=11),
    message_type=DescriptorProto.as_repeated(number=4),
    enum_type=EnumDescriptorProto.as_repeated(number=5),
    service=ServiceDescriptorProto.as_repeated(number=6),
    extension=FieldDescriptorProto.as_repeated(number=7),
    options=FileOptions.as_field(number=8),
    source_code_info=SourceCodeInfo.as_field(number=9),
    syntax=protox.String(number=12, required=False),
)

protox.define_fields(
    DescriptorProto.ExtensionRange,
    start=protox.Int32(number=1, required=False),
    end=protox.Int32(number=2, required=False),
    options=ExtensionRangeOptions.as_field(number=3),
)

protox.define_fields(
    DescriptorProto.ReservedRange,
    start=protox.Int32(number=1, required=False),
    end=protox.Int32(number=2, required=False),
)

protox.define_fields(
    DescriptorProto,
    name=protox.String(number=1, required=False),
    field=FieldDescriptorProto.as_repeated(number=2),
    extension=FieldDescriptorProto.as_repeated(number=6),
Ejemplo n.º 2
0
import typing

import protox


class Duration(protox.Message):
    seconds: typing.Optional[int]
    nanos: typing.Optional[int]

    def __init__(
        self,
        *,
        seconds: typing.Optional[int] = None,
        nanos: typing.Optional[int] = None,
    ):
        super().__init__(
            seconds=seconds,
            nanos=nanos,
        )


protox.define_fields(
    Duration,
    seconds=protox.Int64(number=1, required=False),
    nanos=protox.Int32(number=2, required=False),
)
Ejemplo n.º 3
0
    ),
    syntax=protox.EnumField(
        number=6, py_enum=Syntax, required=False
    ),
)

protox.define_fields(
    Field,
    kind=protox.EnumField(
        number=1, py_enum=Field.Kind, required=False
    ),
    cardinality=protox.EnumField(
        number=2, py_enum=Field.Cardinality, required=False
    ),
    number=protox.Int32(
        number=3, required=False
    ),
    name=protox.String(
        number=4, required=False
    ),
    type_url=protox.String(
        number=6, required=False
    ),
    oneof_index=protox.Int32(
        number=7, required=False
    ),
    packed=protox.Bool(
        number=8, required=False
    ),
    options=Option.as_repeated(
        number=9
Ejemplo n.º 4
0
    def __init__(
        self,
        *,
        error: typing.Optional[str] = None,
        file: typing.List['CodeGeneratorResponse.File'] = None,
    ):
        super().__init__(
            error=error,
            file=file,
        )


protox.define_fields(
    Version,
    major=protox.Int32(number=1, required=False),
    minor=protox.Int32(number=2, required=False),
    patch=protox.Int32(number=3, required=False),
    suffix=protox.String(number=4, required=False),
)

protox.define_fields(
    CodeGeneratorRequest,
    file_to_generate=protox.String.as_repeated(number=1),
    parameter=protox.String(number=2, required=False),
    proto_file=FileDescriptorProto.as_repeated(number=15),
    compiler_version=Version.as_field(number=3),
)

protox.define_fields(
    CodeGeneratorResponse,
Ejemplo n.º 5
0
    value=protox.Float(number=1, required=False),
)

protox.define_fields(
    Int64Value,
    value=protox.Int64(number=1, required=False),
)

protox.define_fields(
    UInt64Value,
    value=protox.UInt64(number=1, required=False),
)

protox.define_fields(
    Int32Value,
    value=protox.Int32(number=1, required=False),
)

protox.define_fields(
    UInt32Value,
    value=protox.UInt32(number=1, required=False),
)

protox.define_fields(
    BoolValue,
    value=protox.Bool(number=1, required=False),
)

protox.define_fields(
    StringValue,
    value=protox.String(number=1, required=False),