fix: DataFrame plot was raising when some extra keywords were passed to encodings (e.g. x=alt.X(a, axis=alt.Axis(labelAngle=30)))#18836
Conversation
03c1c64 to
f792361
Compare
…to encodings (e.g. `x=alt.X(a, axis=alt.Axis(labelAngle=30))`)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #18836 +/- ##
=======================================
Coverage 79.86% 79.86%
=======================================
Files 1518 1518
Lines 205610 205641 +31
Branches 2893 2894 +1
=======================================
+ Hits 164202 164236 +34
+ Misses 40860 40857 -3
Partials 548 548 ☔ View full report in Codecov by Sentry. |
|
|
||
|
|
||
| def _maybe_extract_shorthand(encoding: Encoding) -> Encoding: | ||
| if isinstance(encoding, alt.SchemaBase) and hasattr(encoding, "shorthand"): |
There was a problem hiding this comment.
Will try to look at this properly tomorrow @MarcoGorelli
This could be a source of false positives, you may be safer using inspect.getattr_static
https://docs.python.org/3/library/inspect.html#fetching-attributes-statically
There was a problem hiding this comment.
thanks @dangotbanned !
the value does need returning, so maybe just using getattr directly is fine?
|
Alright, I will already merge to include in todays release. Can be improved upon later ofcourse! |
closes #18830
cc @dangotbanned in case you have time/interest to take a look
Summary: the solution used in #18625 breaks if some extra options (e.g.
sort,axis) are specified to theencodearguments. What I'm proposing is to extract'shorthand'in such cases, so that the tooltips can keep being shown by default