Consolidate and clean-up Fetch CSV file interactions#284
Consolidate and clean-up Fetch CSV file interactions#284
Conversation
| def check_for_completion(): | ||
| try: | ||
| with open(FILE1_COUNT, "r", newline="") as file_obj: | ||
| with open(FILE_COUNT, "r", newline="") as file_obj: |
There was a problem hiding this comment.
Please update per #217:
with open(FILE_COUNT, "r", encoding="utf-8") as file_obj:
TimidRobot
left a comment
There was a problem hiding this comment.
This PR is looking great!
Please also update gcs_fetch.py to use shared.rows_to_csv() along with changes requested below.
| completed_units = False | ||
|
|
||
| try: | ||
| with open(FILE_1_METRICS, "r", newline="") as file_obj: |
There was a problem hiding this comment.
This is inconsistency is not the consequence of your work, but please update per #217:
with open(FILE_1_METRICS, "r", encoding="utf-8") as file_obj:| pass # File may not be found without --enable-save, etc. | ||
|
|
||
| try: | ||
| with open(FILE_2_UNITS, "r", newline="") as file_obj: |
There was a problem hiding this comment.
This is inconsistency is not the consequence of your work, but please update per #217:
with open(FILE_1_METRICS, "r", encoding="utf-8") as file_obj:| return paths_list | ||
|
|
||
|
|
||
| def rows_to_csv(args, file_path, fieldnames, rows): |
There was a problem hiding this comment.
Please add optional append argument so that fetch scripts like gcs_fetch.py can call it with append=True.
Continue to use mode "w" (open for writing, truncating the file first) by default and then mode "a" (open for writing, appending to the end of file if it exists) when append is True.
See also: open — Built-in Functions — Python 3.11.14 documentation
Also note that writer.writeheader() should be skipped if appending.
Fixes
Description
Checklist
Update index.md).mainormaster).visible errors.
Developer Certificate of Origin
For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."
Developer Certificate of Origin