Commit a0ff631
committed
Simplify validate_color, and make it slightly stricter.
Previously, validate_color would accept nonsensical strings such as
`".a2,.2f4,.6"` by dropping the letters and just reading the rest (i.e.
`(0.2, 0.24, 0.6)`. Reject such inputs now, and make the parsing much
simpler (it's just ast.literal_eval).
The only vaguely reasonable string that was accepted and that is not
accepted anymore is (e.g.) `'(0, 1, "0.5")'` (the quotes would be
dropped), i.e. one could write `rcParams["lines.color"] = '(0, 1, "0.5")'`.
I think this can also be dropped given that the corresponding
`rcParams["lines.color"] = (0, 1, "0.5")` (passing in the tuple
directly) didn't work...
I added a changelog entry just to be safe, but it's the kind of entry
that's probably just going to confuse everyone with no real benefit...1 parent a0eb716 commit a0ff631
3 files changed
Lines changed: 20 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | 332 | | |
337 | 333 | | |
338 | 334 | | |
| |||
341 | 337 | | |
342 | 338 | | |
343 | 339 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
361 | 348 | | |
362 | | - | |
| 349 | + | |
363 | 350 | | |
364 | 351 | | |
365 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
| 313 | + | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
316 | 316 | | |
317 | | - | |
318 | 317 | | |
319 | 318 | | |
320 | 319 | | |
321 | 320 | | |
322 | 321 | | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| |||
0 commit comments