You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2018/11/07 08:50:58 UTC
[beam] branch master updated: [BEAM-5879 ] Make write_record() in
tfrecordio.py py3 compatible (#6953)
This is an automated email from the ASF dual-hosted git repository.
robertwb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 5bb33a6 [BEAM-5879 ] Make write_record() in tfrecordio.py py3 compatible (#6953)
5bb33a6 is described below
commit 5bb33a6666a131ebd6976fdf5a31b3d6e7689f53
Author: ruoyu90 <44...@users.noreply.github.com>
AuthorDate: Wed Nov 7 00:50:50 2018 -0800
[BEAM-5879 ] Make write_record() in tfrecordio.py py3 compatible (#6953)
---
sdks/python/apache_beam/io/tfrecordio.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sdks/python/apache_beam/io/tfrecordio.py b/sdks/python/apache_beam/io/tfrecordio.py
index 489cfeb..d230dad 100644
--- a/sdks/python/apache_beam/io/tfrecordio.py
+++ b/sdks/python/apache_beam/io/tfrecordio.py
@@ -100,12 +100,13 @@ class _TFRecordUtil(object):
file_handle: The file to write to.
value: A string content of the record.
"""
- encoded_length = struct.pack('<Q', len(value))
- file_handle.write('{}{}{}{}'.format(
+ encoded_length = struct.pack(b'<Q', len(value))
+ file_handle.write(b''.join([
encoded_length,
- struct.pack('<I', cls._masked_crc32c(encoded_length)), #
+ struct.pack(b'<I', cls._masked_crc32c(encoded_length)),
value,
- struct.pack('<I', cls._masked_crc32c(value))))
+ struct.pack(b'<I', cls._masked_crc32c(value))
+ ]))
@classmethod
def read_record(cls, file_handle):