aboueleyes / cms-downloader-refined

a tiny script that automates downloading files from guc cms website
13 stars 2 forks source link

sweep: Use Iterfzf to select courses and files #9

Open aboueleyes opened 1 year ago

sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/aboueleyes/cms-downloader-refined/pull/10.

⚡ Sweep Free Trial: I used GPT-3.5 to create this ticket. You have 3 GPT-4 tickets left for the month and 0 for the day. For more GPT-4 tickets, visit our payment portal.To get Sweep to recreate this ticket, leave a comment prefixed with "sweep:" or edit the issue.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/aboueleyes/cms-downloader-refined/blob/dfeaf48b962b39d7a2c936ae85973280504cd7af/src/course.py#L1-L95 https://github.com/aboueleyes/cms-downloader-refined/blob/dfeaf48b962b39d7a2c936ae85973280504cd7af/src/scraper.py#L1-L204

Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
src/scraper.py In the Scraper class, import Iterfzf. In the __scrap_courses method, use Iterfzf to present the user with a list of course names to select from. Store the selected course names in a list. In the __scrap_files method, for each selected course, use Iterfzf to present the user with a list of file names to select from. Store the selected file names in a list.
src/course.py In the Course and CMSFile classes, modify the str method to return a string representation of the course or file that includes the course or file name.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

Implement Iterfzf for course and file selection sweep/iterfzf-selection

Description

This PR implements the use of Iterfzf library for interactive course and file selection in the Scraper class. It modifies the scrap_courses and __scrap_files methods to present the user with an interactive selection interface using Iterfzf. Additionally, it modifies the str__ method of the Course and CMSFile classes to return a string representation of the course or file that can be displayed in the Iterfzf interface.

Summary of Changes

  • Added Iterfzf library as a dependency in the pyproject.toml file.
  • Modified the Scraper class in the scraper.py file to use Iterfzf for course and file selection.
  • In the __scrap_courses method, used Iterfzf to present the user with a list of course names to select from and stored the selected course names in a list.
  • In the __scrap_files method, for each selected course, used Iterfzf to present the user with a list of file names to select from and stored the selected file names in a list.
  • Modified the str method of the Course and CMSFile classes in the course.py file to return a string representation of the course or file that includes the course or file name.

Step 4: ⌨️ Coding

File Instructions Progress
src/scraper.py In the Scraper class, import Iterfzf. In the __scrap_courses method, use Iterfzf to present the user with a list of course names to select from. Store the selected course names in a list. In the __scrap_files method, for each selected course, use Iterfzf to present the user with a list of file names to select from. Store the selected file names in a list. ✅ Commit d45c286
src/course.py In the Course and CMSFile classes, modify the str method to return a string representation of the course or file that includes the course or file name. ✅ Commit d45c286 I have finished coding the issue. I am now reviewing it for completeness.

Step 5: 🔁 Code Review

Here are the my self-reviews of my changes at sweep/iterfzf-selection.

Here is the 1st review

No changes required. The code changes in both src/course.py and src/scraper.py are correct and do not contain any errors or unimplemented sections. The addition of the iterfzf module in src/scraper.py enhances the functionality of the __scrap_courses and __scrap_files methods by allowing the user to select which courses and files they are interested in. Good job!

I finished incorporating these changes.


To recreate the pull request, leave a comment prefixed with "sweep:" or edit the issue. Join Our Discord