mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-02 12:30:45 +08:00
TST: Use xlsx format instead of xls.
The xls conversion was corrupting some equations, so switching to use Excel produced xlsx.
This commit is contained in:
+13
-21
@@ -34,12 +34,10 @@ DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
ANSWER_KEY_CHECKSUMS_PATH = os.path.join(DIR, 'risk-answer-key-checksums')
|
||||
ANSWER_KEY_CHECKSUMS = open(ANSWER_KEY_CHECKSUMS_PATH, 'r').read().splitlines()
|
||||
|
||||
ANSWER_KEY_PATH = os.path.join(DIR, 'risk-answer-key.xls')
|
||||
|
||||
ANSWER_KEY_EXISTS = os.path.exists(ANSWER_KEY_PATH)
|
||||
ANSWER_KEY_PATH = os.path.join(DIR, 'risk-answer-key.xlsx')
|
||||
|
||||
ANSWER_KEY_DL_TEMPLATE = """
|
||||
https://s3.amazonaws.com/zipline-test-data/risk/{md5}+/risk-answer-key.xls
|
||||
https://s3.amazonaws.com/zipline-test-data/risk/{md5}/risk-answer-key.xlsx
|
||||
""".strip()
|
||||
|
||||
|
||||
@@ -49,29 +47,23 @@ def ensure_latest_answer_key():
|
||||
|
||||
Logic for determining what and when to download is as such:
|
||||
|
||||
- If there is no local xls file, then get the lastest answer key,
|
||||
- If there is no local spreadsheet file, then get the lastest answer key,
|
||||
as defined by the last row in the checksum file.
|
||||
- If there is a local xls file:
|
||||
-- If the xls's checksum is in the checksum file:
|
||||
--- If the xls's checksum does not match the latest, then grab the
|
||||
- If there is a local spreadsheet file:
|
||||
-- If the spreadsheet's checksum is in the checksum file:
|
||||
--- If the spreadsheet's checksum does not match the latest, then grab the
|
||||
the latest checksum and replace the local checksum file.
|
||||
--- If the xls's checksum matches the latest, then skip download, and
|
||||
use the local xls as a cached copy.
|
||||
-- If the xls's checksum is not in the checksum file, then leave the
|
||||
local file alone, assuming that the local xls's md5 is not in the list due
|
||||
to local modifications during development.
|
||||
--- If the spreadsheet's checksum matches the latest, then skip download,
|
||||
and use the local spreadsheet as a cached copy.
|
||||
-- If the spreadsheet's checksum is not in the checksum file, then leave
|
||||
the local file alone, assuming that the local xls's md5 is not in the list
|
||||
due to local modifications during development.
|
||||
|
||||
It is possible that md5's could collide, if that is ever case, we should
|
||||
then find an alternative naming scheme.
|
||||
|
||||
The xls answer sheet is not kept in SCM, because its size is on the order
|
||||
of 20MB, and every edit would increase the repo size.
|
||||
|
||||
xlsx and ods have smaller outputs and could be more friendly to SCM, but:
|
||||
- not using xlsx, because currently the xlsx that is generated by
|
||||
LibreOffice is not readable by the xldr module.
|
||||
- not using ods, because of the lack of a module as facile as xldr for
|
||||
extracting the data from the ods format.
|
||||
The spreadsheet answer sheet is not kept in SCM, as every edit would
|
||||
increase the repo size by the file size, since it is treated as a binary.
|
||||
"""
|
||||
|
||||
answer_key_dl_checksum = None
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
3ac0773c4be4e9e5bacd9c6fa0e03e15
|
||||
3a5fae958c8bac684f1773fa8dff7810
|
||||
|
||||
Reference in New Issue
Block a user