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

Fix GFile reading CRLF bug #2791

Merged
merged 10 commits into from
Oct 25, 2019
Prev Previous commit
Next Next commit
Don't mask global function 'len()'
  • Loading branch information
davidsoergel committed Oct 23, 2019
commit c75c2bc295f997295b533e59c8de7da4e9534145
8 changes: 4 additions & 4 deletions tensorboard/compat/tensorflow_stub/io/gfile.py
Original file line number Diff line number Diff line change
@@ -197,10 +197,10 @@ def stat(self, filename):
# NOTE: Size of the file is given by .st_size as returned from
# os.stat(), but we convert to .length
try:
len = os.stat(compat.as_bytes(filename)).st_size
file_length = os.stat(compat.as_bytes(filename)).st_size
except OSError:
raise errors.NotFoundError(None, None, "Could not find file")
return StatData(len)
return StatData(file_length)


class S3FileSystem(object):
@@ -281,8 +281,8 @@ def read(self, filename, binary_mode=False, size=None, continue_from=None):
# in a second request so we don't check length in all cases.
client = boto3.client("s3")
obj = client.head_object(Bucket=bucket, Key=path)
len = obj['ContentLength']
endpoint = min(len, offset + size)
content_length = obj['ContentLength']
endpoint = min(content_length, offset + size)
if offset == endpoint:
# Asked for no bytes, so just return empty
stream = b''