Skip to content

Commit 980b93f

Browse files
committed
Fix typechecking
1 parent 96f2c09 commit 980b93f

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

src/betterproto2/__init__.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ def load(
927927
return self
928928

929929
@classmethod
930-
def parse(cls, data: bytes) -> T:
930+
def parse(cls, data: bytes) -> Self:
931931
"""
932932
Parse the binary encoded Protobuf into this message instance. This
933933
returns the instance itself and is therefore assignable and chainable.
@@ -1206,21 +1206,22 @@ def _validate_field_groups(cls, values):
12061206
Message.__annotations__ = {} # HACK to avoid typing.get_type_hints breaking :)
12071207

12081208

1209-
try:
1210-
import betterproto2_rust_codec # pyright: ignore[reportMissingImports]
1211-
except ModuleNotFoundError:
1212-
pass
1213-
else:
1209+
# The Rust codec is not available for now
1210+
# try:
1211+
# import betterproto2_rust_codec # pyright: ignore[reportMissingImports]
1212+
# except ModuleNotFoundError:
1213+
# pass
1214+
# else:
12141215

1215-
def parse_patched(self, data: bytes) -> Message:
1216-
betterproto2_rust_codec.deserialize(self, data)
1217-
return self
1216+
# def parse_patched(self, data: bytes) -> Message:
1217+
# betterproto2_rust_codec.deserialize(self, data)
1218+
# return self
12181219

1219-
def bytes_patched(self) -> bytes:
1220-
return betterproto2_rust_codec.serialize(self)
1220+
# def bytes_patched(self) -> bytes:
1221+
# return betterproto2_rust_codec.serialize(self)
12211222

1222-
Message.parse = parse_patched
1223-
Message.__bytes__ = bytes_patched
1223+
# Message.parse = parse_patched
1224+
# Message.__bytes__ = bytes_patched
12241225

12251226

12261227
def which_one_of(message: Message, group_name: str) -> tuple[str, Any | None]:

0 commit comments

Comments
 (0)