[
https://issues.apache.org/jira/browse/BEAM-5315?focusedWorklogId=177214&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-177214
]
ASF GitHub Bot logged work on BEAM-5315:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Dec/18 22:03
Start Date: 19/Dec/18 22:03
Worklog Time Spent: 10m
Work Description: aaltay closed pull request #7318: [BEAM-5315]
[BEAM-5627] [BEAM-5623] Python 3 port io.filesystem module
URL: https://github.com/apache/beam/pull/7318
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/sdks/python/apache_beam/io/filesystem.py
b/sdks/python/apache_beam/io/filesystem.py
index 083d365ee700..7dd3a5b3419c 100644
--- a/sdks/python/apache_beam/io/filesystem.py
+++ b/sdks/python/apache_beam/io/filesystem.py
@@ -209,7 +209,7 @@ def _fetch_to_internal_buffer(self, num_bytes):
# objects for the unused compressed data.
if (self._compression_type == CompressionTypes.BZIP2 or
self._compression_type == CompressionTypes.GZIP):
- if self._decompressor.unused_data != '':
+ if self._decompressor.unused_data != b'':
buf = self._decompressor.unused_data
self._decompressor = (
bz2.BZ2Decompressor()
@@ -259,7 +259,7 @@ def readline(self):
line = self._read_from_internal_buffer(
lambda: self._read_buffer.readline())
bytes_io.write(line)
- if line.endswith('\n') or not line:
+ if line.endswith(b'\n') or not line:
break # Newline or EOF reached.
return bytes_io.getvalue()
diff --git a/sdks/python/apache_beam/io/filesystem_test.py
b/sdks/python/apache_beam/io/filesystem_test.py
index c39da9a837e7..abbadde97233 100644
--- a/sdks/python/apache_beam/io/filesystem_test.py
+++ b/sdks/python/apache_beam/io/filesystem_test.py
@@ -265,7 +265,7 @@ class TestCompressedFile(unittest.TestCase):
which will be deleted at the end of the tests (when tearDown() is called).
"""
- content = """- the BEAM -
+ content = b"""- the BEAM -
How things really are we would like to know.
Does
Time
@@ -291,10 +291,6 @@ def _create_temp_file(self):
self._tempfiles.append(path)
return path
- @unittest.skipIf(sys.version_info[0] == 3 and
- os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1',
- 'This test still needs to be fixed on Python 3'
- 'TODO: BEAM-5627')
def _create_compressed_file(self, compression_type, content):
file_name = self._create_temp_file()
@@ -395,7 +391,7 @@ def test_read_from_end_returns_no_data(self):
seek_position = 0
compressed_fd.seek(seek_position, os.SEEK_END)
- expected_data = ''
+ expected_data = b''
uncompressed_data = compressed_fd.read(10)
self.assertEqual(uncompressed_data, expected_data)
@@ -435,14 +431,10 @@ def test_read_and_seek_back_to_beginning(self):
self.assertEqual(first_pass, second_pass)
- @unittest.skipIf(sys.version_info[0] == 3 and
- os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1',
- 'This test still needs to be fixed on Python 3'
- 'TODO: BEAM-5627')
def test_tell(self):
- lines = ['line%d\n' % i for i in range(10)]
+ lines = [b'line%d\n' % i for i in range(10)]
tmpfile = self._create_temp_file()
- with open(tmpfile, 'w') as f:
+ with open(tmpfile, 'wb') as f:
writeable = CompressedFile(f)
current_offset = 0
for line in lines:
@@ -450,7 +442,7 @@ def test_tell(self):
current_offset += len(line)
self.assertEqual(current_offset, writeable.tell())
- with open(tmpfile) as f:
+ with open(tmpfile, 'rb') as f:
readable = CompressedFile(f)
current_offset = 0
while True:
----------------------------------------------------------------
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: 177214)
Time Spent: 7h 50m (was: 7h 40m)
> Finish Python 3 porting for io module
> -------------------------------------
>
> Key: BEAM-5315
> URL: https://issues.apache.org/jira/browse/BEAM-5315
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-py-core
> Reporter: Robbe
> Assignee: Robbe
> Priority: Major
> Time Spent: 7h 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)