Commit 70e4a8a
committed
improve docstring and add test fot to_rgb(<float>)
Even if the docstring was saing it, emphasis that to_rgb/to_rgba do not
accept float as input, but string representation of a float.
As one might be tempted to had float->gray conversion add failing test
in case the functionality is added.
Side fixes :
change tuple([value]*3) to (value,)*3 for speed
In [18]: %timeit tuple([0.4]*3)
1000000 loops, best of 3: 505 ns per loop
In [19]: %timeit (0.4,)*3
10000000 loops, best of 3: 23.5 ns per loop
In [20]: (0.4,)*3 == tuple([0.4]*3)
Out[20]: True
Closes gh-26091 parent 432d9d8 commit 70e4a8a
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
| 276 | + | |
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| 280 | + | |
| 281 | + | |
279 | 282 | | |
280 | 283 | | |
281 | 284 | | |
| |||
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
307 | | - | |
| 310 | + | |
308 | 311 | | |
309 | 312 | | |
310 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
195 | 208 | | |
196 | 209 | | |
197 | 210 | | |
0 commit comments