beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rober...@apache.org
Subject [beam] branch master updated: [BEAM-5879 ] Make write_record() in tfrecordio.py py3 compatible (#6953)
Date Wed, 07 Nov 2018 08:50:58 GMT
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 <44377718+ruoyu90@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):


Mime
View raw message