diff --git a/.test-infra/jenkins/dependency_check/dependency_check_report_generator_test.py b/.test-infra/jenkins/dependency_check/dependency_check_report_generator_test.py index b89907581f54..b4281cc5dd3f 100644 --- a/.test-infra/jenkins/dependency_check/dependency_check_report_generator_test.py +++ b/.test-infra/jenkins/dependency_check/dependency_check_report_generator_test.py @@ -19,6 +19,7 @@ # This script performs testing of scenarios from verify_performance_test_results.py # +from __future__ import print_function import unittest, mock from mock import patch, mock_open from datetime import datetime @@ -44,7 +45,7 @@ class DependencyCheckReportGeneratorTest(unittest.TestCase): """Tests for `dependency_check_report_generator.py`.""" def setUp(self): - print "\n\nTest : " + self._testMethodName + print("\n\nTest : " + self._testMethodName) @patch('dependency_check.bigquery_client_utils.BigQueryClientUtils') @@ -134,4 +135,4 @@ def test_invalid_dep_input(self, *args): if __name__ == '__main__': unittest.main() - \ No newline at end of file + diff --git a/.test-infra/jenkins/jira_utils/jira_manager.py b/.test-infra/jenkins/jira_utils/jira_manager.py index cdc4450d1062..70daf0cd44c7 100644 --- a/.test-infra/jenkins/jira_utils/jira_manager.py +++ b/.test-infra/jenkins/jira_utils/jira_manager.py @@ -1,3 +1,4 @@ +from __future__ import print_function # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -66,7 +67,7 @@ def run(self, dep_name, dep_latest_version, sdk_type, group_id=None): Created a parent issue for {1}""".format(summary, group_id)) try: parent_issue = self._create_issue(group_id, None) - print parent_issue.key + print(parent_issue.key) except: logging.error("""Failed creating a parent issue for {0}. Stop handling the JIRA issue for {1}, {2}""".format(group_id, dep_name, dep_latest_version)) diff --git a/.test-infra/jenkins/jira_utils/jira_manager_test.py b/.test-infra/jenkins/jira_utils/jira_manager_test.py index 15677d08bb3d..dcf11a69e5c2 100644 --- a/.test-infra/jenkins/jira_utils/jira_manager_test.py +++ b/.test-infra/jenkins/jira_utils/jira_manager_test.py @@ -1,3 +1,4 @@ +from __future__ import print_function # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -42,7 +43,7 @@ class JiraManagerTest(unittest.TestCase): """Tests for `jira_manager.py`.""" def setUp(self): - print "\n\nTest : " + self._testMethodName + print("\n\nTest : " + self._testMethodName) def test_find_owners_with_single_owner(self, *args): @@ -240,4 +241,3 @@ def _get_expected_description(self, dep_name, dep_latest_version, owners): if __name__ == '__main__': unittest.main() - diff --git a/sdks/python/apache_beam/io/tfrecordio_test.py b/sdks/python/apache_beam/io/tfrecordio_test.py index ded8d7941596..dfc660d2ec04 100644 --- a/sdks/python/apache_beam/io/tfrecordio_test.py +++ b/sdks/python/apache_beam/io/tfrecordio_test.py @@ -62,7 +62,7 @@ # >>> writer.close() # >>> with open('/tmp/python_foo.tfrecord', 'rb') as f: # ... data = base64.b64encode(f.read()) -# ... print data +# ... print(data) FOO_RECORD_BASE64 = 'AwAAAAAAAACwmUkOZm9vYYq+/g==' # Same as above but containing two records ['foo', 'bar'] diff --git a/sdks/python/apache_beam/utils/annotations.py b/sdks/python/apache_beam/utils/annotations.py index 7ec7150d174e..29121329fc23 100644 --- a/sdks/python/apache_beam/utils/annotations.py +++ b/sdks/python/apache_beam/utils/annotations.py @@ -41,7 +41,7 @@ same function 'multiply'.:: def multiply(arg1, arg2): - print arg1, '*', arg2, '=', + print(arg1, '*', arg2, '=', end=' ') return arg1*arg2 # This annotation marks 'old_multiply' as deprecated since 'v.1' and suggests @@ -52,7 +52,7 @@ def old_multiply(arg1, arg2): result = 0 for i in xrange(arg1): result += arg2 - print arg1, '*', arg2, '(the old way)=', + print(arg1, '*', arg2, '(the old way)=', end=' ') return result # This annotation marks 'exp_multiply' as experimental and suggests @@ -60,15 +60,15 @@ def old_multiply(arg1, arg2): @experimental(since='v.1', current='multiply') def exp_multiply(arg1, arg2): - print arg1, '*', arg2, '(the experimental way)=', + print(arg1, '*', arg2, '(the experimental way)=', end=' ') return (arg1*arg2)*(arg1/arg2)*(arg2/arg1) # Set a warning filter to control how often warnings are produced.:: warnings.simplefilter("always") - print multiply(5, 6) - print old_multiply(5,6) - print exp_multiply(5,6) + print(multiply(5, 6)) + print(old_multiply(5,6)) + print(exp_multiply(5,6)) """ from __future__ import absolute_import