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

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

                Author: ASF GitHub Bot
            Created on: 02/Apr/18 19:57
            Start Date: 02/Apr/18 19:57
    Worklog Time Spent: 10m 
      Work Description: charlesccychen commented on a change in pull request 
#4990: [BEAM-3981] Futurize and fix python 2 compatibility for coders subpackage
URL: https://github.com/apache/beam/pull/4990#discussion_r178633429
 
 

 ##########
 File path: sdks/python/apache_beam/coders/coders_test_common.py
 ##########
 @@ -40,10 +44,11 @@
 class CustomCoder(coders.Coder):
 
   def encode(self, x):
-    return str(x+1)
+    x = x + 1
+    return int(x).to_bytes((x.bit_length() + 7) // 8, 'big', signed=True)
 
 Review comment:
   <!--new_thread; commit:57a73055b9447e7a1fe6ad674673254d9a614eeb; 
resolved:0-->
   What is the rationale for changing the coder behavior here to use a binary 
encoding instead of using a printable decimal string, for what is intended to 
be a simple example?  Is there something simpler we can do? (e.g. we could 
coerce to `str` and encode as `.encode('latin-1')`)

----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 86719)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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