eliminating blank space

This commit is contained in:
Catalina Syddall
2019-07-23 17:56:52 -03:00
parent a86e99e641
commit 91f4b90406
5 changed files with 3 additions and 26 deletions
+1 -10
View File
@@ -9,13 +9,11 @@ from .notifications import slack_notification
logger = logging.getLogger(__name__)
def file_hash_matches_data(file_path, data):
file_hash = file_md5(file_path)
data_md5 = hashlib.md5(data.encode()).hexdigest()
return file_hash == data_md5
def file_md5(file, chunk_size=4096):
md5 = hashlib.md5()
with open(file, "rb") as f:
@@ -24,7 +22,6 @@ def file_md5(file, chunk_size=4096):
return md5.hexdigest()
def validate_dates_in_month(symbol, date_range):
"""Compares `date_range` (month) with NYSE trading calendar.
Returns `True` if there are no missing days.
@@ -46,7 +43,6 @@ def validate_dates_in_month(symbol, date_range):
missing_days)
return missing_days.empty
def validate_historical_dates(symbol, date_range):
"""Compares `date_range` (any time range) with trading calendar.
Returns `True` if there are no missing days.
@@ -67,11 +63,9 @@ def validate_historical_dates(symbol, date_range):
return missing_days.empty
def validate_columns(expected, received):
"""Verify that the `received` columns scraped are equal to `expected`"""
valid = all(expected == received)
if not valid:
expected_cols = ", ".join(expected)
received_cols = ", ".join(received)
@@ -80,13 +74,10 @@ def validate_columns(expected, received):
Received: {}""".format(expected_cols, received_cols)
logger.error(msg)
slack_notification(msg, __name__)
return valid
def validate_aggregate_file(aggregate_file, daily_files):
"""Compares `aggregate_file` with the data from `daily_files`."""
aggregate_df = pd.read_csv(aggregate_file)
recreated_df = cboe.concatenate_files(daily_files)
return aggregate_df.equals(recreated_df)
return aggregate_df.equals(recreated_df)