Maintenance: Fix bugs, reduce duplication, and optimize scripts#183
Maintenance: Fix bugs, reduce duplication, and optimize scripts#183
Conversation
* Refactor `Dup.py`: - Fix bug where only the first duplicate was reported. - Consolidate duplicate candidate finding logic. - Reuse `multiprocessing.Pool` across hash steps. * Refactor `git-fetch.py`: - Extract `process_downloads` helper to remove duplication between GitHub and GitLab fetchers. - Fix bug where root-level files failed to download if output directory didn't exist. * Optimize `clean.sh`: - Use `nproc` for parallel SQLite optimization. - Fix `get_cache_size` error handling. - Refactor `clean_pkgs` variables. * Fix `cia_3ds_decryptor.py`: - Fix syntax error in `parse_twl_ctrtool_output`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello @Ven0m0, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses several key maintenance tasks across various utility scripts. It focuses on resolving existing bugs, enhancing script performance through refactoring and optimization, and improving overall code quality and robustness. The changes aim to ensure more reliable operation and greater efficiency for file duplication detection, GitHub/GitLab fetching, and system cleaning processes. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codacy's Analysis Summary3 new issues (≤ 0 issue) Review Pull Request in Codacy →
|
There was a problem hiding this comment.
Code Review
This pull request introduces a good set of maintenance changes, including bug fixes, performance optimizations, and code refactoring to reduce duplication. The changes in Dup.py to fix the duplicate reporting and reuse the process pool are excellent. The refactoring in git-fetch.py is also a good improvement. I have one suggestion for git-fetch.py to improve error handling and ensure that failures are correctly reported.
There was a problem hiding this comment.
Pull request overview
This PR addresses maintenance tasks across multiple scripts, focusing on bug fixes, code deduplication, and performance optimizations.
Changes:
- Fixed critical bugs in duplicate file detection (
Dup.py) and directory creation (git-fetch.py) - Improved performance through dynamic parallelism (
clean.sh) and process pool reuse (Dup.py) - Reduced code duplication by extracting common download logic (
git-fetch.py) - Corrected syntax error preventing script execution (
cia_3ds_decryptor.py)
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Cachyos/clean.sh | Refactored get_cache_size to use explicit conditionals, consolidated variable declarations, and implemented dynamic parallel worker detection using nproc |
| Cachyos/Scripts/WIP/gphotos/Dup.py | Fixed bug where only one duplicate file was written per hash group; optimized by reusing process pool; consolidated duplicate candidate filtering logic |
| Cachyos/Scripts/WIP/gh/git-fetch.py | Extracted process_downloads helper to eliminate code duplication; added output directory creation to fix failure when downloading root files |
| Cachyos/Scripts/WIP/emu/cia_3ds_decryptor.py | Removed erroneous space in m.group(1) that caused syntax error |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This PR addresses several maintenance tasks:
Dup.py: Fixed a bug where only one duplicate file was reported instead of the full list. Optimized performance by reusing the process pool and consolidated logic for finding candidates.git-fetch.py: Reduced code duplication by extracting aprocess_downloadshelper function. Fixed a bug where downloading a repo with files at the root (and no subdirectories) would fail because the output directory wasn't created.clean.sh: Improved performance by dynamically determining the number of parallel jobs usingnproc. Fixed potential errors inget_cache_sizeand cleaned up variable declarations inclean_pkgs.cia_3ds_decryptor.py: Corrected a syntax error in regex matching that prevented the script from running.PR created automatically by Jules for task 6786540254509387207 started by @Ven0m0