{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/20838","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/20838/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/20838/comments","events_url":"https://api.github.com/repos/apache/spark/issues/20838/events","html_url":"https://github.com/apache/spark/pull/20838","id":305751767,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc1NDAzNzAx","number":20838,"title":"[SPARK-23698] Resolve undefined names in Python 3","user":{"login":"cclauss","id":3709715,"node_id":"MDQ6VXNlcjM3MDk3MTU=","avatar_url":"https://avatars3.githubusercontent.com/u/3709715?v=4","gravatar_id":"","url":"https://api.github.com/users/cclauss","html_url":"https://github.com/cclauss","followers_url":"https://api.github.com/users/cclauss/followers","following_url":"https://api.github.com/users/cclauss/following{/other_user}","gists_url":"https://api.github.com/users/cclauss/gists{/gist_id}","starred_url":"https://api.github.com/users/cclauss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cclauss/subscriptions","organizations_url":"https://api.github.com/users/cclauss/orgs","repos_url":"https://api.github.com/users/cclauss/repos","events_url":"https://api.github.com/users/cclauss/events{/privacy}","received_events_url":"https://api.github.com/users/cclauss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":48,"created_at":"2018-03-15T23:18:00Z","updated_at":"2018-08-10T22:04:52Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/20838","html_url":"https://github.com/apache/spark/pull/20838","diff_url":"https://github.com/apache/spark/pull/20838.diff","patch_url":"https://github.com/apache/spark/pull/20838.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nFix issues arising from the fact that builtins __file__, __long__, __raw_input()__, __unicode__, __xrange()__, etc. were all removed from Python 3.  __Undefined names__ have the potential to raise [NameError](https://docs.python.org/3/library/exceptions.html#NameError) at runtime.  ~~Where practical, apply the Python porting best practice: [Use feature detection instead of version detection](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection).~~\r\n\r\n## How was this patch tested?\r\n* $ __python2 -m flake8 . --count --select=E9,F82 --show-source --statistics__\r\n* $ __python3 -m flake8 . --count --select=E9,F82 --show-source --statistics__\r\n\r\nPlease review http://spark.apache.org/contributing.html before opening a pull request.\r\n\r\n@holdenk\r\n\r\nflake8 testing of https://github.com/apache/spark on Python 3.6.3\r\n\r\n$ __python3 -m flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__\r\n```\r\n./dev/merge_spark_pr.py:98:14: F821 undefined name 'raw_input'\r\n    result = raw_input(\"\\n%s (y/n): \" % prompt)\r\n             ^\r\n./dev/merge_spark_pr.py:136:22: F821 undefined name 'raw_input'\r\n    primary_author = raw_input(\r\n                     ^\r\n./dev/merge_spark_pr.py:186:16: F821 undefined name 'raw_input'\r\n    pick_ref = raw_input(\"Enter a branch name [%s]: \" % default_branch)\r\n               ^\r\n./dev/merge_spark_pr.py:233:15: F821 undefined name 'raw_input'\r\n    jira_id = raw_input(\"Enter a JIRA id [%s]: \" % default_jira_id)\r\n              ^\r\n./dev/merge_spark_pr.py:278:20: F821 undefined name 'raw_input'\r\n    fix_versions = raw_input(\"Enter comma-separated fix version(s) [%s]: \" % default_fix_versions)\r\n                   ^\r\n./dev/merge_spark_pr.py:317:28: F821 undefined name 'raw_input'\r\n            raw_assignee = raw_input(\r\n                           ^\r\n./dev/merge_spark_pr.py:430:14: F821 undefined name 'raw_input'\r\n    pr_num = raw_input(\"Which pull request would you like to merge? (e.g. 34): \")\r\n             ^\r\n./dev/merge_spark_pr.py:442:18: F821 undefined name 'raw_input'\r\n        result = raw_input(\"Would you like to use the modified title? (y/n): \")\r\n                 ^\r\n./dev/merge_spark_pr.py:493:11: F821 undefined name 'raw_input'\r\n    while raw_input(\"\\n%s (y/n): \" % pick_prompt).lower() == \"y\":\r\n          ^\r\n./dev/create-release/releaseutils.py:58:16: F821 undefined name 'raw_input'\r\n    response = raw_input(\"%s [y/n]: \" % msg)\r\n               ^\r\n./dev/create-release/releaseutils.py:152:38: F821 undefined name 'unicode'\r\n        author = unidecode.unidecode(unicode(author, \"UTF-8\")).strip()\r\n                                     ^\r\n./python/setup.py:37:11: F821 undefined name '__version__'\r\nVERSION = __version__\r\n          ^\r\n./python/pyspark/cloudpickle.py:275:18: F821 undefined name 'buffer'\r\n        dispatch[buffer] = save_buffer\r\n                 ^\r\n./python/pyspark/cloudpickle.py:807:18: F821 undefined name 'file'\r\n        dispatch[file] = save_file\r\n                 ^\r\n./python/pyspark/sql/conf.py:61:61: F821 undefined name 'unicode'\r\n        if not isinstance(obj, str) and not isinstance(obj, unicode):\r\n                                                            ^\r\n./python/pyspark/sql/streaming.py:25:21: F821 undefined name 'long'\r\n    intlike = (int, long)\r\n                    ^\r\n./python/pyspark/streaming/dstream.py:405:35: F821 undefined name 'long'\r\n        return self._sc._jvm.Time(long(timestamp * 1000))\r\n                                  ^\r\n./sql/hive/src/test/resources/data/scripts/dumpdata_script.py:21:10: F821 undefined name 'xrange'\r\nfor i in xrange(50):\r\n         ^\r\n./sql/hive/src/test/resources/data/scripts/dumpdata_script.py:22:14: F821 undefined name 'xrange'\r\n    for j in xrange(5):\r\n             ^\r\n./sql/hive/src/test/resources/data/scripts/dumpdata_script.py:23:18: F821 undefined name 'xrange'\r\n        for k in xrange(20022):\r\n                 ^\r\n20    F821 undefined name 'raw_input'\r\n20\r\n```"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/412218619","html_url":"https://github.com/apache/spark/pull/20838#issuecomment-412218619","issue_url":"https://api.github.com/repos/apache/spark/issues/20838","id":412218619,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjIxODYxOQ==","user":{"login":"AmplabJenkins","id":4031291,"node_id":"MDQ6VXNlcjQwMzEyOTE=","avatar_url":"https://avatars3.githubusercontent.com/u/4031291?v=4","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T22:04:52Z","updated_at":"2018-08-10T22:04:52Z","author_association":"NONE","body":"Test FAILed.\nRefer to this link for build results (access rights to CI server needed): \nhttps://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/94576/\nTest FAILed."}}
{"actor":{"display_login":"AmplabJenkins"}}