Commit cf42412
committed
Don't revalidate rcParams when exiting rc_context.
- Rewrite rc_context using contextmanager, which removes the need for
saving state.
- When `__exit__`ing rc_context, skip rcParam validation, as the items
have already been validated originally.
The rationale for not revalidating (beyond a minor gain in speed) is
that it may make sense to smuggle seemingly "invalid" values into the
rcParams (by calling `dict.__setitem__`), and we do not want them to
cause an error when exiting a rc_context (of course, they may or may not
cause an error at the backend level, but that is the responsibility of
whoever set this "invalid" value).
For example, the rcparam `lines.antialiased` is declared as a boolean,
but the mpl_cairo backend actually also recognizes any of cairo's
internal antialiasing enum values (NONE, FAST, GOOD, BEST, etc.).
(The rst docs needed to be slightly updated because .. autoclass::
rc_context won't work anymore, so I also took advantage of that to
reorder all the rc-related functions slightly more logically.)1 parent e7c9530 commit cf42412
File tree
2 files changed
+22
-33
lines changed- doc/api
- lib/matplotlib
2 files changed
+22
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 15 | + | |
20 | 16 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 17 | + | |
24 | 18 | | |
25 | | - | |
| 19 | + | |
26 | 20 | | |
27 | | - | |
| 21 | + | |
28 | 22 | | |
29 | | - | |
| 23 | + | |
30 | 24 | | |
31 | 25 | | |
32 | 26 | | |
33 | 27 | | |
34 | 28 | | |
35 | 29 | | |
36 | 30 | | |
37 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1222 | 1222 | | |
1223 | 1223 | | |
1224 | 1224 | | |
1225 | | - | |
| 1225 | + | |
| 1226 | + | |
1226 | 1227 | | |
1227 | 1228 | | |
1228 | 1229 | | |
| |||
1255 | 1256 | | |
1256 | 1257 | | |
1257 | 1258 | | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
1271 | | - | |
1272 | | - | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
1278 | 1269 | | |
1279 | 1270 | | |
1280 | 1271 | | |
| |||
0 commit comments