Skip to content

Commit fecb31f

Browse files
committed
Revert fancy math
1 parent 2fc9cae commit fecb31f

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

frameioclient/download.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@ def __init__(self, asset, download_folder, prefix, acceleration=False, concurren
2323
self.concurrency = concurrency
2424
self.futures = list()
2525
self.chunk_size = (52428800 / 2) # 25 MB chunk size or so
26-
self.chunks = self.calculate_chunk_count(self.file_size, self.chunk_size)
26+
self.chunks = math.floor(self.file_size/self.chunk_size)
2727
self.prefix = prefix
2828
self.filename = asset['name']
2929

30-
@staticmethod
31-
def calculate_chunk_count(file_size, chunk_size):
32-
return int(math.floor(file_size/chunk_size)) # Extra cast to handle Py2
33-
3430
def _get_session(self):
3531
if not hasattr(thread_local, "session"):
3632
thread_local.session = requests.Session()
@@ -129,7 +125,7 @@ def accelerated_download(self, url):
129125

130126
# Queue up threads
131127
with concurrent.futures.ThreadPoolExecutor(max_workers=self.concurrency) as executor:
132-
for i in range(self.chunks):
128+
for i in range(int(self.chunks)):
133129
out_byte = offset * (i+1) # Advance by one byte to get proper offset
134130
task = (url, in_byte, out_byte, i)
135131

0 commit comments

Comments
 (0)