mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-06 02:28:27 +08:00
BUG: fix some ingestion issues for quantopian-quandl
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user