Skip to content

Commit

Permalink
#537 removed download method and requests dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Dec 29, 2023
1 parent 1b6da5e commit 0e7d0b8
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions arekit/common/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
import os
import requests
from tqdm import tqdm


Expand Down Expand Up @@ -104,26 +103,3 @@ def get_default_download_dir():
return os.path.join(homedir, ".arekit")


def download(dest_file_path, source_url):
""" Refered to https://github.com/nicolay-r/ner-bilstm-crf-tensorflow/blob/master/ner/utils.py
Simple http file downloader
"""
print(('Downloading from {src} to {dest}'.format(src=source_url, dest=dest_file_path)))

sys.stdout.flush()
datapath = os.path.dirname(dest_file_path)

if not os.path.exists(datapath):
os.makedirs(datapath, mode=0o755)

dest_file_path = os.path.abspath(dest_file_path)

r = requests.get(source_url, stream=True)
total_length = int(r.headers.get('content-length', 0))

with open(dest_file_path, 'wb') as f:
pbar = tqdm(total=total_length, unit='B', unit_scale=True)
for chunk in r.iter_content(chunk_size=32 * 1024):
if chunk: # filter out keep-alive new chunks
pbar.update(len(chunk))
f.write(chunk)

0 comments on commit 0e7d0b8

Please sign in to comment.