BjornPrime commented on code in PR #25965:
URL: https://github.com/apache/beam/pull/25965#discussion_r1196696610
##########
sdks/python/apache_beam/io/filesystem.py:
##########
@@ -219,28 +219,33 @@ def _initialize_compressor(self):
def readable(self):
# type: () -> bool
- mode = self._file.mode
- return 'r' in mode or 'a' in mode
+ try:
+ return 'r' in self._file.mode or 'a' in self._file.mode
+ except AttributeError:
+ return self._file.readable is True
def writeable(self):
# type: () -> bool
- mode = self._file.mode
- return 'w' in mode or 'a' in mode
+ try:
+ return 'w' in self._file.mode or 'a' in self._file.mode
+ except AttributeError:
+ return self._file.writable is True
def write(self, data):
# type: (bytes) -> None
"""Write data to file."""
if not self._compressor:
- raise ValueError('compressor not initialized')
+ self._initialize_compressor()
Review Comment:
As discussed, I'll be restoring this file and implementing a wrapper class
for BlobReader and BlobWriter in gcsio.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]