[ 
https://issues.apache.org/jira/browse/BEAM-3981?focusedWorklogId=90326&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-90326
 ]

ASF GitHub Bot logged work on BEAM-3981:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Apr/18 08:39
            Start Date: 12/Apr/18 08:39
    Worklog Time Spent: 10m 
      Work Description: RobbeSneyders commented on a change in pull request 
#5053: [BEAM-3981] Futurize coders subpackage
URL: https://github.com/apache/beam/pull/5053#discussion_r181005086
 
 

 ##########
 File path: sdks/python/apache_beam/coders/coder_impl.py
 ##########
 @@ -279,21 +282,21 @@ def get_estimated_size_and_observables(self, value, 
nested=False):
 
   def encode_to_stream(self, value, stream, nested):
     t = type(value)
-    if t is NoneType:
+    if value is None:
       stream.write_byte(NONE_TYPE)
     elif t is int:
       stream.write_byte(INT_TYPE)
       stream.write_var_int64(value)
     elif t is float:
       stream.write_byte(FLOAT_TYPE)
       stream.write_bigendian_double(value)
-    elif t is str:
-      stream.write_byte(STR_TYPE)
+    elif t is bytes:
+      stream.write_byte(BYTES_TYPE)
       stream.write(value, nested)
-    elif t is six.text_type:
-      unicode_value = value  # for typing
-      stream.write_byte(UNICODE_TYPE)
-      stream.write(unicode_value.encode('utf-8'), nested)
+    elif t is unicode:
+      text_value = value  # for typing
 
 Review comment:
   I tried this, but it throws a 'not a type' error for `unicode`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 90326)
    Time Spent: 7h 50m  (was: 7h 40m)

> Futurize and fix python 2 compatibility for coders package
> ----------------------------------------------------------
>
>                 Key: BEAM-3981
>                 URL: https://issues.apache.org/jira/browse/BEAM-3981
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: Ahmet Altay
>            Priority: Major
>          Time Spent: 7h 50m
>  Remaining Estimate: 0h
>
> Run automatic conversion with futurize tool on coders subpackage and fix 
> python 2 compatibility. This prepares the subpackage for python 3 support.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to