refactor: extract styles configuration to separate method#741
Merged
hynek merged 9 commits intohynek:mainfrom Sep 12, 2025
Merged
refactor: extract styles configuration to separate method#741hynek merged 9 commits intohynek:mainfrom
hynek merged 9 commits intohynek:mainfrom
Conversation
Extract the styles configuration logic from ConsoleRenderer.__init__ into a dedicated configure_styles class method. This improves code readability and makes the styles setup logic reusable and testable. - Move colorama initialization and styles selection to configure_styles() - Add comprehensive docstring with args, returns, and raises sections - Remove noqa comment as method complexity is now reduced - Maintain existing behavior for colors and force_colors parameters
Contributor
Author
|
Docs CI said |
hynek
approved these changes
Sep 12, 2025
Owner
hynek
left a comment
There was a problem hiding this comment.
Thanks, your timing is impeccable!
I may jam on your work a bit further, but I've decided to make the usage of ConsoleRenderer more ergonomic, since everyone is using it in a way I never planned for.
My current plan is to offer the current renderer to the user and then change ConsoleRenderer to be amendable for mutation. Feel free to lmk what you think
Owner
|
jftr the work happens in #749 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract the styles configuration logic from ConsoleRenderer.init into a dedicated configure_styles class method. This improves code readability and makes the styles setup logic reusable and testable.
Pull Request Check List
mainbranch – use a separate branch!api.py.docs/api.rstby hand.versionadded,versionchanged, ordeprecateddirectives..rstand.mdfiles is written using semantic newlines.