Merge pull request #249 from ralexstokes/fix-mypy-protos
Add `mypy` protobufs plugin and regenerate protobufs
This commit is contained in:
commit
ff5eaf2429
4
Makefile
4
Makefile
|
@ -11,5 +11,5 @@ lintroll:
|
|||
flake8 $(FILES_TO_LINT)
|
||||
|
||||
protobufs:
|
||||
cd libp2p/crypto/pb && protoc --python_out=. crypto.proto
|
||||
cd libp2p/pubsub/pb && protoc --python_out=. rpc.proto
|
||||
cd libp2p/crypto/pb && protoc --python_out=. --mypy_out=. crypto.proto
|
||||
cd libp2p/pubsub/pb && protoc --python_out=. --mypy_out=. rpc.proto
|
||||
|
|
84
libp2p/crypto/pb/crypto_pb2.pyi
Normal file
84
libp2p/crypto/pb/crypto_pb2.pyi
Normal file
|
@ -0,0 +1,84 @@
|
|||
# @generated by generate_proto_mypy_stubs.py. Do not edit!
|
||||
import sys
|
||||
from google.protobuf.descriptor import (
|
||||
Descriptor as google___protobuf___descriptor___Descriptor,
|
||||
EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
|
||||
)
|
||||
|
||||
from google.protobuf.message import (
|
||||
Message as google___protobuf___message___Message,
|
||||
)
|
||||
|
||||
from typing import (
|
||||
List as typing___List,
|
||||
Tuple as typing___Tuple,
|
||||
cast as typing___cast,
|
||||
)
|
||||
|
||||
from typing_extensions import (
|
||||
Literal as typing_extensions___Literal,
|
||||
)
|
||||
|
||||
|
||||
class KeyType(int):
|
||||
DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ...
|
||||
@classmethod
|
||||
def Name(cls, number: int) -> str: ...
|
||||
@classmethod
|
||||
def Value(cls, name: str) -> KeyType: ...
|
||||
@classmethod
|
||||
def keys(cls) -> typing___List[str]: ...
|
||||
@classmethod
|
||||
def values(cls) -> typing___List[KeyType]: ...
|
||||
@classmethod
|
||||
def items(cls) -> typing___List[typing___Tuple[str, KeyType]]: ...
|
||||
RSA = typing___cast(KeyType, 0)
|
||||
Ed25519 = typing___cast(KeyType, 1)
|
||||
Secp256k1 = typing___cast(KeyType, 2)
|
||||
ECDSA = typing___cast(KeyType, 3)
|
||||
RSA = typing___cast(KeyType, 0)
|
||||
Ed25519 = typing___cast(KeyType, 1)
|
||||
Secp256k1 = typing___cast(KeyType, 2)
|
||||
ECDSA = typing___cast(KeyType, 3)
|
||||
|
||||
class PublicKey(google___protobuf___message___Message):
|
||||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
|
||||
key_type = ... # type: KeyType
|
||||
data = ... # type: bytes
|
||||
|
||||
def __init__(self,
|
||||
*,
|
||||
key_type : KeyType,
|
||||
data : bytes,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def FromString(cls, s: bytes) -> PublicKey: ...
|
||||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ...
|
||||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def HasField(self, field_name: typing_extensions___Literal[u"data",u"key_type"]) -> bool: ...
|
||||
def ClearField(self, field_name: typing_extensions___Literal[u"data",u"key_type"]) -> None: ...
|
||||
else:
|
||||
def HasField(self, field_name: typing_extensions___Literal[u"data",b"data",u"key_type",b"key_type"]) -> bool: ...
|
||||
def ClearField(self, field_name: typing_extensions___Literal[u"data",b"data",u"key_type",b"key_type"]) -> None: ...
|
||||
|
||||
class PrivateKey(google___protobuf___message___Message):
|
||||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
|
||||
key_type = ... # type: KeyType
|
||||
data = ... # type: bytes
|
||||
|
||||
def __init__(self,
|
||||
*,
|
||||
key_type : KeyType,
|
||||
data : bytes,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def FromString(cls, s: bytes) -> PrivateKey: ...
|
||||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ...
|
||||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def HasField(self, field_name: typing_extensions___Literal[u"data",u"key_type"]) -> bool: ...
|
||||
def ClearField(self, field_name: typing_extensions___Literal[u"data",u"key_type"]) -> None: ...
|
||||
else:
|
||||
def HasField(self, field_name: typing_extensions___Literal[u"data",b"data",u"key_type",b"key_type"]) -> bool: ...
|
||||
def ClearField(self, field_name: typing_extensions___Literal[u"data",b"data",u"key_type",b"key_type"]) -> None: ...
|
|
@ -555,82 +555,82 @@ DESCRIPTOR.message_types_by_name['ControlPrune'] = _CONTROLPRUNE
|
|||
DESCRIPTOR.message_types_by_name['TopicDescriptor'] = _TOPICDESCRIPTOR
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
RPC = _reflection.GeneratedProtocolMessageType('RPC', (_message.Message,), {
|
||||
RPC = _reflection.GeneratedProtocolMessageType('RPC', (_message.Message,), dict(
|
||||
|
||||
'SubOpts' : _reflection.GeneratedProtocolMessageType('SubOpts', (_message.Message,), {
|
||||
'DESCRIPTOR' : _RPC_SUBOPTS,
|
||||
'__module__' : 'rpc_pb2'
|
||||
SubOpts = _reflection.GeneratedProtocolMessageType('SubOpts', (_message.Message,), dict(
|
||||
DESCRIPTOR = _RPC_SUBOPTS,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.RPC.SubOpts)
|
||||
})
|
||||
))
|
||||
,
|
||||
'DESCRIPTOR' : _RPC,
|
||||
'__module__' : 'rpc_pb2'
|
||||
DESCRIPTOR = _RPC,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.RPC)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(RPC)
|
||||
_sym_db.RegisterMessage(RPC.SubOpts)
|
||||
|
||||
Message = _reflection.GeneratedProtocolMessageType('Message', (_message.Message,), {
|
||||
'DESCRIPTOR' : _MESSAGE,
|
||||
'__module__' : 'rpc_pb2'
|
||||
Message = _reflection.GeneratedProtocolMessageType('Message', (_message.Message,), dict(
|
||||
DESCRIPTOR = _MESSAGE,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.Message)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(Message)
|
||||
|
||||
ControlMessage = _reflection.GeneratedProtocolMessageType('ControlMessage', (_message.Message,), {
|
||||
'DESCRIPTOR' : _CONTROLMESSAGE,
|
||||
'__module__' : 'rpc_pb2'
|
||||
ControlMessage = _reflection.GeneratedProtocolMessageType('ControlMessage', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CONTROLMESSAGE,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.ControlMessage)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(ControlMessage)
|
||||
|
||||
ControlIHave = _reflection.GeneratedProtocolMessageType('ControlIHave', (_message.Message,), {
|
||||
'DESCRIPTOR' : _CONTROLIHAVE,
|
||||
'__module__' : 'rpc_pb2'
|
||||
ControlIHave = _reflection.GeneratedProtocolMessageType('ControlIHave', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CONTROLIHAVE,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.ControlIHave)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(ControlIHave)
|
||||
|
||||
ControlIWant = _reflection.GeneratedProtocolMessageType('ControlIWant', (_message.Message,), {
|
||||
'DESCRIPTOR' : _CONTROLIWANT,
|
||||
'__module__' : 'rpc_pb2'
|
||||
ControlIWant = _reflection.GeneratedProtocolMessageType('ControlIWant', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CONTROLIWANT,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.ControlIWant)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(ControlIWant)
|
||||
|
||||
ControlGraft = _reflection.GeneratedProtocolMessageType('ControlGraft', (_message.Message,), {
|
||||
'DESCRIPTOR' : _CONTROLGRAFT,
|
||||
'__module__' : 'rpc_pb2'
|
||||
ControlGraft = _reflection.GeneratedProtocolMessageType('ControlGraft', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CONTROLGRAFT,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.ControlGraft)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(ControlGraft)
|
||||
|
||||
ControlPrune = _reflection.GeneratedProtocolMessageType('ControlPrune', (_message.Message,), {
|
||||
'DESCRIPTOR' : _CONTROLPRUNE,
|
||||
'__module__' : 'rpc_pb2'
|
||||
ControlPrune = _reflection.GeneratedProtocolMessageType('ControlPrune', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CONTROLPRUNE,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.ControlPrune)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(ControlPrune)
|
||||
|
||||
TopicDescriptor = _reflection.GeneratedProtocolMessageType('TopicDescriptor', (_message.Message,), {
|
||||
TopicDescriptor = _reflection.GeneratedProtocolMessageType('TopicDescriptor', (_message.Message,), dict(
|
||||
|
||||
'AuthOpts' : _reflection.GeneratedProtocolMessageType('AuthOpts', (_message.Message,), {
|
||||
'DESCRIPTOR' : _TOPICDESCRIPTOR_AUTHOPTS,
|
||||
'__module__' : 'rpc_pb2'
|
||||
AuthOpts = _reflection.GeneratedProtocolMessageType('AuthOpts', (_message.Message,), dict(
|
||||
DESCRIPTOR = _TOPICDESCRIPTOR_AUTHOPTS,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.TopicDescriptor.AuthOpts)
|
||||
})
|
||||
))
|
||||
,
|
||||
|
||||
'EncOpts' : _reflection.GeneratedProtocolMessageType('EncOpts', (_message.Message,), {
|
||||
'DESCRIPTOR' : _TOPICDESCRIPTOR_ENCOPTS,
|
||||
'__module__' : 'rpc_pb2'
|
||||
EncOpts = _reflection.GeneratedProtocolMessageType('EncOpts', (_message.Message,), dict(
|
||||
DESCRIPTOR = _TOPICDESCRIPTOR_ENCOPTS,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.TopicDescriptor.EncOpts)
|
||||
})
|
||||
))
|
||||
,
|
||||
'DESCRIPTOR' : _TOPICDESCRIPTOR,
|
||||
'__module__' : 'rpc_pb2'
|
||||
DESCRIPTOR = _TOPICDESCRIPTOR,
|
||||
__module__ = 'rpc_pb2'
|
||||
# @@protoc_insertion_point(class_scope:pubsub.pb.TopicDescriptor)
|
||||
})
|
||||
))
|
||||
_sym_db.RegisterMessage(TopicDescriptor)
|
||||
_sym_db.RegisterMessage(TopicDescriptor.AuthOpts)
|
||||
_sym_db.RegisterMessage(TopicDescriptor.EncOpts)
|
||||
|
|
Loading…
Reference in New Issue
Block a user