Skip to content

Ensure named_objs does not fail on unhashable objects - #632

Merged
philippjfr merged 4 commits into
masterfrom
named_objs_not_hashable
May 26, 2022
Merged

philippjfr merged 4 commits into
masterfrom
named_objs_not_hashable

Conversation

@philippjfr

@philippjfr philippjfr commented May 25, 2022 •

Copy link
Copy Markdown
Member

Not all objects are hashable so the named_objs implementation has started causing some errors (e.g. because mpl colormaps aren't hashable anymore). For unhashable objects we try to reverse map the objects by identity.

@codecov-commenter

codecov-commenter commented May 25, 2022 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.86%. Comparing base (d960230) to head (91399e5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #632      +/-   ##
==========================================
- Coverage   82.91%   82.86%   -0.06%     
==========================================
  Files           5        5              
  Lines        3073     3081       +8     
==========================================
+ Hits         2548     2553       +5     
- Misses        525      528       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jbednar

jbednar commented May 26, 2022

Copy link
Copy Markdown
Member

y main confusion here is why it even attempts a reverse mapping at all if an explicit namesdict has already been provided.

Even if an explicit namesdict has been provided, it isn't required to be complete. Where that matters is if check_on_set=False for this Selector, in which case someone can do Obj.x=val, for any val, whether that value is in the namesdict or not. The namesdict will then be incomplete, and so named_objs attempts to complete it by providing some representation for every item in the object list. Here you could maybe skip any unhashable items while still attempting to provide a representation for hashable items? But you'd then need the rest of the code to gracefully handle the case of an object not being in the namesdict.

@philippjfr

Copy link
Copy Markdown
Member Author

But you'd then need the rest of the code to gracefully handle the case of an object not being in the namesdict.

The rest of the code being what in this case? Panel already does and afaik that's the only thing that actually uses the names.

Comment thread param/__init__.py Resolved
Comment thread param/__init__.py Resolved

@jbednar jbednar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As revised this seems ok to merge, though really Selector needs to just store proper mappings as outlined in other PRs and issues...

@philippjfr
philippjfr merged commit 9f1f855 into master May 26, 2022
@philippjfr
philippjfr deleted the named_objs_not_hashable branch May 26, 2022 14:56
@maximlt maximlt mentioned this pull request Mar 10, 2023
8 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants