BUG: fix some ingestion issues for quantopian-quandl

This commit is contained in:
Joe Jevnik
2016-05-16 16:15:17 -04:00
parent 784d5f4a16
commit 46cc417b9b
3 changed files with 16 additions and 1 deletions
+1
View File
@@ -333,6 +333,7 @@ def download_with_progress(url, chunk_size, **progress_kwargs):
data.write(chunk)
pbar.update(len(chunk))
data.seek(0)
return data
+14
View File
@@ -45,6 +45,20 @@ def ensure_directory_containing(path):
ensure_directory(os.path.dirname(path))
def ensure_file(path):
"""
Ensure that a file exists. This will create any parent directories needed
and create an empty file if it does not exists.
Parameters
----------
path : str
The file path to ensure exists.
"""
ensure_directory_containing(path)
open(path, 'a+').close() # touch the file
def last_modified_time(path):
"""
Get the last modified time of path as a Timestamp.
+1 -1
View File
@@ -187,7 +187,7 @@ def load_extensions(default, extensions, strict, environ, reload=False):
"""
if default:
default_extension_path = pth.default_extension(environ=environ)
open(default_extension_path, 'a+').close() # touch the file
pth.ensure_file(default_extension_path)
# put the default extension first so other extensions can depend on
# the order they are loaded
extensions = concatv([default_extension_path], extensions)