-
-
Notifications
You must be signed in to change notification settings - Fork 72
Improve report sections and avoid regenerating existing files #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
TimidRobot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can leave the files with their original name, except notes.py which can be renamed zzz-notes.py to ensure it is last.
|
@TimidRobot I worked on the updatereadme function, it inserts the sections in an order. I just have a little issue with what I pushed to this PR. I am trying to resolve that. |
TimidRobot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work here! Please also update the PR description and title to better represent all of the work now included.
| raise shared.QuantifyingException( | ||
| f"Processed data already exists for {QUARTER}", 0 | ||
| ) | ||
| def check_for_data_files(args, file_paths): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would exit function early if args.force (avoids doing filesystem lookups):
if args.force:
returnWe already do a similar thing in shared.py:
Lines 153 to 155 in 925e721
| def git_push_changes(args, repo_path): | |
| if not args.enable_git: | |
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, maybe it's worth moving this function to shared.py since it's the same in multiple files
|
@oree-xx Please ensure all of the report scripts are executable ( See also: File permissions — Foundational technologies — Creative Commons Open Source |
scripts/shared.py
Outdated
| logger.info("ordered_sections:", ordered_sections) | ||
| logger.info("section_title:", repr(section_title)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect you converted these from print() statements. As they are now, I get a stack trace. Please convert to f-strings. For example:
logger.info(f"ordered_sections: {ordered_sections}")There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more information on the arguments accepted by logger.info(), see Logger.debug(): https://docs.python.org/3.11/library/logging.html#logging.Logger.debug
| def section_order(): | ||
| report_dir = os.path.join(os.path.dirname(__file__), "3-report") | ||
| report_files = os.listdir(report_dir) | ||
| return report_files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function doesn't establish section order. please update to use .sort() or sorted()
scripts/3-report/gcs_report.py
Outdated
| # Constants | ||
| QUARTER = os.path.basename(PATHS["data_quarter"]) | ||
| SECTION = "Google Custom Search (GCS)" | ||
| SECTION = Path(__file__).name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, I didn't think about the displayed section title.
I think we need both SECTION_FILE and SECTION_TITLE or something similar. One for comments and one for heading/display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so the update readme function would have SECTION_FILE and SECTION_TITLE as argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
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