gh-148330: Add docstrings to module colorsys in all functions#148332
gh-148330: Add docstrings to module colorsys in all functions#148332aiwonderland wants to merge 3 commits intopython:mainfrom
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
4a1a16c to
5209a13
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Lib/colorsys.py
Outdated
| # The ones in this library uses constants from the FCC version of NTSC. | ||
|
|
||
| def rgb_to_yiq(r, g, b): | ||
| """Convert RGB to YIQ. |
There was a problem hiding this comment.
This is good, but just to clean it up a little more, just put the string next to the start of the doctoring on another line. For example:
Instead of
"""Convert RGB to YIQ.
"""
It becomes
"""
Convert RGB to YIQ.
"""
And this change would apply to the other lines that follow this pattern as well.
|
@aiwonderland Could you please retry signing the CLA? |
|
OK. |
sharktide
left a comment
There was a problem hiding this comment.
I basically added @MazinSharaf suggestions so you can commit them without editing the file yourself :)
| return (y, i, q) | ||
|
|
||
| def yiq_to_rgb(y, i, q): | ||
| """Convert YIQ to RGB. |
There was a problem hiding this comment.
| """Convert YIQ to RGB. | |
| """ | |
| Convert YIQ to RGB. |
| # V: color brightness | ||
|
|
||
| def rgb_to_hsv(r, g, b): | ||
| """Convert RGB to HSV (Hue, Saturation, Value). |
There was a problem hiding this comment.
| """Convert RGB to HSV (Hue, Saturation, Value). | |
| """ | |
| Convert RGB to HSV (Hue, Saturation, Value). |
| # S: color saturation | ||
|
|
||
| def rgb_to_hls(r, g, b): | ||
| """Convert RGB to HLS (Hue, Lightness, Saturation). |
There was a problem hiding this comment.
| """Convert RGB to HLS (Hue, Lightness, Saturation). | |
| """ | |
| Convert RGB to HLS (Hue, Lightness, Saturation). |
| return h, l, s | ||
|
|
||
| def hls_to_rgb(h, l, s): | ||
| """Convert HLS (Hue, Lightness, Saturation) to RGB. |
There was a problem hiding this comment.
| """Convert HLS (Hue, Lightness, Saturation) to RGB. | |
| """ | |
| Convert HLS (Hue, Lightness, Saturation) to RGB. |
| return h, s, v | ||
|
|
||
| def hsv_to_rgb(h, s, v): | ||
| """Convert HSV (Hue, Saturation, Value) to RGB. |
There was a problem hiding this comment.
| """Convert HSV (Hue, Saturation, Value) to RGB. | |
| """ | |
| Convert HSV (Hue, Saturation, Value) to RGB. |
|
Alright changes look good now. Looks neater! |
|
/rerun |
Co-authored-by: Rihaan Meher <sharktidedev@gmail.com>
gh-148330: colorsys: Add docstrings to module and all functions
Add module-level
__doc__and consistent docstrings to all colorsys conversion functions.Fixes help() output for colorsys APIs and follows standard library style.