Skip to content

Conversation

exislow
Copy link
Owner

@exislow exislow commented Jul 3, 2025

Adjust Python version constraints to exclude 3.13, ensuring compatibility with the current codebase. Introduce comprehensive coding standards for naming conventions, error handling, and documentation practices, emphasizing the use of type hints and modern generics. Improve docstrings across various functions and classes for better clarity and maintainability.

exislow added 27 commits July 1, 2025 09:56
* Introduced guidelines for naming conventions and error handling.
* Specified the use of `snake_case` for variables, `CamelCase` for classes, and PEP 8 compliance.
* Emphasized the importance of type hints and docstrings in code documentation.
* Adjusted `requires-python` in `pyproject.toml` to `>=3.12,<3.13`
* Modified `envlist` in `tox.ini` to remove Python 3.13
* Updated `python-versions` in `poetry.lock` to reflect the new constraints
* coloredlogs does not support py3.13, yet, see xolox/python-coloredlogs#119
* Changed "Write docstrings for all public modules, classes, functions, and methods" to "Always write doc strings for all modules, classes, functions, and methods."
* Added missing punctuation for consistency in error handling guidelines.
- Added a guideline to use the newest coding style supported by the used Python version.
- Added clarification to the docstring guidelines to include the use of `typing` in docstrings.
* Added detailed docstrings for `format_str_media` and related helper functions.
* Refactored media formatting logic to utilize dedicated functions for better readability and maintainability.
* Improved error handling in media formatting.
* Updated `file_unique_suffix` function to correct the spelling of `separator`.
- Changed the link to `cookiecutter-poetry` for consistency.
* Refined coding guidelines for clarity and structure.
* Added sections for type annotations and docstring requirements.
* Ensured consistency in documentation practices across the project.
…orts

* Enhanced docstrings for clarity and consistency across functions.
* Removed unused imports to clean up the codebase.
* Improved the structure of the `_download` function for better readability.
…_artist`

* Changed `item_id` type from `int` to `str` for better consistency.
* Updated related list type from `list[int]` to `list[str]`.
* Added type checks for `media_type`, `item_id`, and `file_template` in `_process_url` for improved error handling.
…helper functions

* Refactored `search_result_to_model` to use type hints with `list` instead of `[*SearchTypes]`.
* Added detailed docstring for better understanding of parameters and return types.
* Extracted logic into helper methods for better readability and maintainability.
* Improved handling of item availability and explicit content representation.
* Added detailed docstrings for methods in the `MainWindow` class.
* Improved clarity on parameters and return types for better understanding.
* Aims to facilitate future development and maintenance.
…and add PEP references

* Clarified type annotations usage for function parameters, return types, and variables.
* Added guidelines for using blank lines, coroutines, and string interpolation as per PEP standards.
* Updated type hints for several methods in `MainWindow` class to improve code clarity and type safety.
* Changed return types to `None` where applicable.
* Refined parameter types for better type checking and consistency.
* Refactored the filter extraction logic to directly use `header.filter_text(i)` for better clarity.
* Updated the filters list to store tuples of index and text, enhancing the data structure used.
* Ensured that the `proxy_model.filters` is set directly, simplifying the code.
* Updated type hints for various methods in  and  classes.
* Changed list types from  to  for better clarity and consistency.
* Improved function signatures to include return types for better type safety.
* Added a guideline to use modern built-in generics from the `typing` module.
* This change aligns with PEP 484 and promotes better coding practices.
…wnload` classes

* Improved documentation for methods in the `RequestsClient` and `Download` classes.
* Added detailed descriptions, parameters, and return types to enhance code readability and maintainability.
* Enhanced wording for better understanding of blank line usage.
* Clarified instructions on updating docstrings during refactoring.
* Specified the use of line comments for complex logic explanations.
…fficiency

* Renamed `_download` to `_get_media_urls` for better clarity on its purpose.
* Simplified URL extraction logic for `Track` and `Video` media types.
* Improved progress setup and error handling in the download process.
* Enhanced `_download_segments` and `_download_postprocess` methods for better readability and maintainability.
* Reordered parameters in `item` method for clarity.
* Added `_validate_media_instance` method to streamline media validation.
* Enhanced `_prepare_file_paths_and_skip_logic` for better file handling.
* Introduced `_perform_actual_download` to encapsulate download logic.
* Improved error handling and logging throughout the download process.
…execution

* Improved validation and preparation of media collections for downloads.
* Refactored download context setup and execution logic for better clarity and maintainability.
* Added progress tracking for download tasks and improved handling of download futures.
* Enhanced `_validate_and_prepare_media` method to support additional media types: `Album`, `Playlist`, `UserPlaylist`, and `Mix`.
* Updated media validation checks to ensure proper handling of unavailable media.
* Refactored `_validate_media_instance` to streamline media instance creation and validation.
* Removed redundant `_validate_and_prepare_media_collection` method for cleaner code.
* Refactored `_handle_track_or_video` and `_handle_album_playlist_mix_artist` to use `typer.Context` instead of `Settings` directly.
* Improved clarity by centralizing settings retrieval through context.
* Adjusted `_process_url` and `_download` functions to align with the new context-based approach.
…` function

- Enhanced clarity of the function's purpose and usage.
- Added detailed descriptions for arguments and return values.
@exislow exislow self-assigned this Jul 3, 2025
@exislow exislow merged commit 7da0d4c into master Jul 3, 2025
3 of 4 checks passed
@exislow exislow deleted the ai-refactoring branch July 3, 2025 07:57
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.

1 participant