Skip to content

Fixed Code for 3 files#1947

Open
kartik-s21 wants to merge 5 commits intodatacommonsorg:masterfrom
kartik-s21:code_fix_unenergy
Open

Fixed Code for 3 files#1947
kartik-s21 wants to merge 5 commits intodatacommonsorg:masterfrom
kartik-s21:code_fix_unenergy

Conversation

@kartik-s21
Copy link
Copy Markdown

@kartik-s21 kartik-s21 commented Apr 7, 2026

Description of Changes

scripts/un/energy/download.py

  • Modified the years_list generation to convert year values to strings, ensuring compatibility with the batching logic and the range from start_year to end_year.
  • Added a check to ensure only files ending with .csv are appended to the output_files list, preventing the processing of non-data files in the output directory.

scripts/un/energy/process.py

  • Added a safety check within the process function to skip any non-CSV files found in the input paths.

scripts/un/energy/process_test.py

  • Removed the unnecessary app.run() call and replaced it with a standard unittest.main() entry point to ensure the tests execute correctly within a standard Python testing environment.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the energy dataset download and processing scripts by removing redundant code, implementing CSV file filtering, and cleaning up test execution. A significant issue was identified in download.py where output_files could be returned before initialization, potentially causing a NameError.

Comment thread scripts/un/energy/download.py
@kartik-s21 kartik-s21 requested a review from saanikaaa April 8, 2026 11:12
@kartik-s21
Copy link
Copy Markdown
Author

This has been resolved. The changes have been done.

@kartik-s21
Copy link
Copy Markdown
Author

Acknowledged.
Added the necessary logic to the program to address the requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants