Skip to content

Commit 9238c73

Browse files
gvanrossummatthiaskramm
authored andcommitted
Make HasField and ClearField use Text instead of str (#1425)
This allows one to write `x.HasField("ok")` even if the file has `from __future__ import unicode_literals`"
1 parent 3505632 commit 9238c73

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

third_party/2/google/protobuf/message.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Sequence, Optional, Tuple
1+
from typing import Any, Sequence, Optional, Text, Tuple
22

33
from .descriptor import FieldDescriptor
44

@@ -21,8 +21,8 @@ class Message:
2121
def SerializeToString(self) -> str: ...
2222
def SerializePartialToString(self) -> str: ...
2323
def ListFields(self) -> Sequence[Tuple[FieldDescriptor, Any]]: ...
24-
def HasField(self, field_name: str) -> bool: ...
25-
def ClearField(self, field_name: str) -> None: ...
24+
def HasField(self, field_name: Text) -> bool: ...
25+
def ClearField(self, field_name: Text) -> None: ...
2626
def WhichOneof(self, oneof_group) -> Optional[str]: ...
2727
def HasExtension(self, extension_handle): ...
2828
def ClearExtension(self, extension_handle): ...

0 commit comments

Comments
 (0)