def data(self, value):
if isinstance(value, bool):
self._data_type = bool
self._pb.bool_data = value
elif isinstance(value, int):
self._data_type = int
self._pb.int64_data = value
elif isinstance(value, float):
self._data_type = float
self._pb.float64_data = value
elif isinstance(value, basestring):
self._data_type = str
self._pb.string_data = value
elif isinstance(value, bytes):
self._data_type = bytes
self._pb.bytes_data = value
else:
raise TypeError("Unsupported data type '{}'. (Supported: "
"int, long, float, str and bool)".format(value))
评论列表
文章目录