Skip to content

Conversation

@guzman-raphael
Copy link
Collaborator

Fix #928

:init_string: string to initialize the checksum
byte_count = stream.getbuffer().nbytes
if chunk_count is None or byte_count <= chunk_size * chunk_count:
for _ in range(math.ceil(byte_count / chunk_size)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'do not need the math module for rounding up.

Suggested change
for _ in range(math.ceil(byte_count / chunk_size)):
for _ in range((byte_count + chunk_size - 1) // chunk_size):

yield stream.read(chunk_size)
else:
for _ in range(chunk_count):
stream.seek(round(byte_count/(chunk_count + 1)) - int(chunk_size / 2.), 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stream.seek(round(byte_count/(chunk_count + 1)) - int(chunk_size / 2.), 1)
stream.seek(byte_count // (chunk_count + 1) - chunk_size // 2, 1)

@guzman-raphael
Copy link
Collaborator Author

With #1025 ready soon and upcoming new features, this is no longer necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speed up retrieval of files from stores

2 participants