Skip to content

[BEAM-1251] Change unicode --> six.text_type for Python 3#4697

Merged
aaltay merged 1 commit into
apache:masterfrom
cclauss:unicode-to-six.text_type
Mar 6, 2018
Merged

[BEAM-1251] Change unicode --> six.text_type for Python 3#4697
aaltay merged 1 commit into
apache:masterfrom
cclauss:unicode-to-six.text_type

Conversation

@cclauss

@cclauss cclauss commented Feb 16, 2018

Copy link
Copy Markdown

unicode was removed in Python 3 because all str are Unicode so this PR:

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from 0b7cc25 to 8e8ca07 Compare February 16, 2018 09:20
@cclauss cclauss changed the title Unicode to six.text type Change unicode --> six.text_type for Python 3 Feb 17, 2018
@cclauss cclauss force-pushed the unicode-to-six.text_type branch from 7ff98d8 to 193ea24 Compare February 17, 2018 09:49
@pabloem

pabloem commented Feb 21, 2018

Copy link
Copy Markdown
Member

Python Precommits are broken for now (fix incoming). As advice, it'd be good for you to add a reviewer for your PR. I'll take a look in the next few days.

@cclauss

cclauss commented Feb 21, 2018

Copy link
Copy Markdown
Author

How do I "add a reviewer"?

@pabloem

pabloem commented Feb 21, 2018

Copy link
Copy Markdown
Member

There was some breakage in the Python SDK earlier. Could you rebase to master branch?

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from 193ea24 to b713651 Compare February 21, 2018 17:54
@pabloem

pabloem commented Feb 21, 2018

Copy link
Copy Markdown
Member

Jenkins retest this please

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from dde3cb3 to 103e9b3 Compare February 21, 2018 21:03
@lukecwik lukecwik requested a review from robertwb February 21, 2018 21:54
from apache_beam.transforms.display import DisplayDataItem
from apache_beam.transforms.display import HasDisplayData
from apache_beam.transforms.display import (DisplayData, DisplayDataItem,
HasDisplayData)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Lint is complaining about these:

 import apache_beam as beam
 from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.transforms.display import (DisplayData, DisplayDataItem,
-                                            HasDisplayData)
+from apache_beam.transforms.display import DisplayData
+from apache_beam.transforms.display import DisplayDataItem
+from apache_beam.transforms.display import HasDisplayData

from datetime import datetime

import six

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Lint is complaining of the ordering of this import:

+import hamcrest as hc
 import six
-
-import hamcrest as hc
 from hamcrest.core.base_matcher import BaseMatcher

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one complains when the hamcrest imports are split but also complains when they are put together. The desired order is also different than iSort. A bit difficult to find the correct order.

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from 103e9b3 to a29ce85 Compare February 21, 2018 23:43
@cclauss

cclauss commented Feb 22, 2018

Copy link
Copy Markdown
Author

So now it is saying:

 import hamcrest as hc
+import six
 from hamcrest.core.base_matcher import BaseMatcher
-
-import six

But when I move import six up in between the two hamcrest imports, it will complain that they can not be split. Trying that now...

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from a29ce85 to 1a5f292 Compare February 22, 2018 05:20
@cclauss

cclauss commented Feb 22, 2018

Copy link
Copy Markdown
Author

Now...

Running pylint for module apache_beam:
************* Module apache_beam.transforms.display_test
C: 27, 0: Imports from package hamcrest are not grouped (ungrouped-imports)

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from 26822f3 to d5eeab4 Compare February 24, 2018 06:34
@cclauss

cclauss commented Feb 24, 2018

Copy link
Copy Markdown
Author

Hopefully the # pylint: disable=ungrouped-imports and # pylint: enable=ungrouped-imports trick that I learned from @luke-zhu should placate pylint and this PR should be good to go.

@cclauss cclauss force-pushed the unicode-to-six.text_type branch from d5eeab4 to cd1f728 Compare February 24, 2018 07:40
@luke-zhu

Copy link
Copy Markdown
Contributor

Glad that worked. I've added https://issues.apache.org/jira/browse/BEAM-3745 to track this.

@cclauss

cclauss commented Feb 24, 2018

Copy link
Copy Markdown
Author

Can someone please advise how I can fix the failing test?

@luke-zhu

Copy link
Copy Markdown
Contributor

Looks like the problem is unrelated. It's on the java branch and I saw that a different build on the same computer (beam 5) failed similarly here: https://builds.apache.org/job/beam_PreCommit_Java_GradleBuild/2529/console

You could also type in "retest this please" to the the checks again

@cclauss cclauss force-pushed the unicode-to-six.text_type branch 3 times, most recently from 247bdce to 42c125a Compare March 2, 2018 09:24
@cclauss cclauss force-pushed the unicode-to-six.text_type branch from 42c125a to 80fb5ff Compare March 5, 2018 15:52
@cclauss cclauss changed the title Change unicode --> six.text_type for Python 3 [BEAM-1251] Change unicode --> six.text_type for Python 3 Mar 5, 2018
@cclauss

cclauss commented Mar 6, 2018

Copy link
Copy Markdown
Author

@aaltay Your review please?

@aaltay

aaltay commented Mar 6, 2018

Copy link
Copy Markdown
Member

@cclauss LGTM. I will merge. As a side question, is it possible for us to update linter rules to avoid regressing?

How do I "add a reviewer"?
You could either tag someone as R: @altay, or add them as a reviewer in the UI on the top right.

@aaltay aaltay merged commit 5b99fe2 into apache:master Mar 6, 2018
@cclauss cclauss deleted the unicode-to-six.text_type branch March 6, 2018 17:32
@cclauss

cclauss commented Mar 6, 2018

Copy link
Copy Markdown
Author

On update linter rules to keep from backsliding see #4798

On the reviewer tips, they only work if you have the commit bit which I do not have and do not need.

@aaltay

aaltay commented Mar 6, 2018

Copy link
Copy Markdown
Member

On update linter rules to keep from backsliding see #4798

Thank you, will review it there.

On the reviewer tips, they only work if you have the commit bit which I do not have and do not need

You can add R; .. as a comment to the PR. Beam committer typically look for that tagging. You do not need to be a committer to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants