Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Python code from python2 to python3 #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tallamjr
Copy link

@tallamjr tallamjr commented May 19, 2020

This has been completed using the tool: 2to3

Note, "Structured_APIs-Chapter_6_Working_with_Different_Types_of_Data.py"
could not be updated due to parsing error:

Error:

RefactoringTool: There was 1 error:
RefactoringTool: Can't parse
Structured_APIs-Chapter_6_Working_with_Different_Types_of_Data.py:
ParseError: bad input: type=1, value='as', context=(' ', (334, 69))

Thus, the command run was:

$ 2to3 -w `ls *.py | grep -v *Chapter_6*.py`

See PR #58 for stdout of command for detailed changes

modified:   A_Gentle_Introduction_to_Spark-Chapter_3_A_Tour_of_Sparks_Toolset.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_24_Advanced_Analytics_and_Machine_Learning.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_26_Classification.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_27_Regression.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_29_Unsupervised_Learning.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_30_Graph_Analysis.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py
modified:   Ecosystem-Chapter_32_Language_Specifics.py
modified:   Low_Level_APIs-Chapter_12_RDD_Basics.py
modified:   Low_Level_APIs-Chapter_13_Advanced_RDDs.py
modified:   Production_Applications-Chapter_16_Spark_Applications.py
modified:   Structured_APIs-Chapter_5_Basic_Structured_Operations.py
modified:   Structured_APIs-Chapter_9_Data_Sources.py

tallamjr added 3 commits May 20, 2020 14:28
This has been completed using the tool: 2to3

Note, "Structured_APIs-Chapter_6_Working_with_Different_Types_of_Data.py"
could not be updated due to parsing error:

Error:

    RefactoringTool: There was 1 error:
    RefactoringTool: Can't parse
    Structured_APIs-Chapter_6_Working_with_Different_Types_of_Data.py:
    ParseError: bad input: type=1, value='as', context=(' ', (334, 69))

Thus, the command run was:

    $ 2to3 -w `ls *.py | grep -v *Chapter_6*.py`

See PR databricks#58 for stdout of command for detailed changes

	modified:   A_Gentle_Introduction_to_Spark-Chapter_3_A_Tour_of_Sparks_Toolset.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_24_Advanced_Analytics_and_Machine_Learning.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_26_Classification.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_27_Regression.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_29_Unsupervised_Learning.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_30_Graph_Analysis.py
	modified:   Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py
	modified:   Ecosystem-Chapter_32_Language_Specifics.py
	modified:   Low_Level_APIs-Chapter_12_RDD_Basics.py
	modified:   Low_Level_APIs-Chapter_13_Advanced_RDDs.py
	modified:   Production_Applications-Chapter_16_Spark_Applications.py
	modified:   Structured_APIs-Chapter_5_Basic_Structured_Operations.py
	modified:   Structured_APIs-Chapter_9_Data_Sources.py
This reverts the changes made in 17655ce to 3 specific files as the
changed introduced by 2to3 script are not required for the code to run
in Python 3.

This has been tested locally in a Jupyter notebook running Python 3.7.6

REF:
    - databricks@17655ce

	modified:   code/Ecosystem-Chapter_32_Language_Specifics.py
	modified:   code/Low_Level_APIs-Chapter_12_RDD_Basics.py
	modified:   code/Low_Level_APIs-Chapter_13_Advanced_RDDs.py
The 2to3 script added extra brackets around print functions that were
already compatible with Python 3. This has now been removed

	modified:   code/Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py
	modified:   code/Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py
	modified:   code/Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py
@tallamjr tallamjr force-pushed the issues/11/python2to3 branch from e6084fa to e551473 Compare May 20, 2020 13:29
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.

2 participants