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`"
This commit is contained in:
Guido van Rossum
2017-06-21 10:51:49 -07:00
committed by Matthias Kramm
parent 350563223f
commit 9238c737de

View File

@@ -1,4 +1,4 @@
from typing import Any, Sequence, Optional, Tuple
from typing import Any, Sequence, Optional, Text, Tuple
from .descriptor import FieldDescriptor
@@ -21,8 +21,8 @@ class Message:
def SerializeToString(self) -> str: ...
def SerializePartialToString(self) -> str: ...
def ListFields(self) -> Sequence[Tuple[FieldDescriptor, Any]]: ...
def HasField(self, field_name: str) -> bool: ...
def ClearField(self, field_name: str) -> None: ...
def HasField(self, field_name: Text) -> bool: ...
def ClearField(self, field_name: Text) -> None: ...
def WhichOneof(self, oneof_group) -> Optional[str]: ...
def HasExtension(self, extension_handle): ...
def ClearExtension(self, extension_handle): ...