Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to eval to prevent distribution over arrays and dicts. #365

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

cmungall
Copy link
Member

Previously the eval function in eval_utils auto-distributes over
many-valued options. This allows for this to be controlled.

For example, in this case when looking up an object, we want to avoid
distribution:

  • pd = dict(name='x', aliases=['a', 'b', 'c'], address=Address(street='1 x street'))
  • assert eval_expr('p.name', p=pd, _distribute=False) == 'x'

Verified

This commit was signed with the committer’s verified signature.
danepowell Dane Powell
Previously the eval function in eval_utils auto-distributes over
many-valued options. This allows for this to be controlled.

For example, in this case when looking up an object, we want to avoid
distribution:

+    pd = dict(name='x', aliases=['a', 'b', 'c'], address=Address(street='1 x street'))
+    assert eval_expr('p.name', p=pd, _distribute=False) == 'x'
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.46%. Comparing base (1b5e9f7) to head (c03e72d).
Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
linkml_runtime/utils/eval_utils.py 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #365      +/-   ##
==========================================
+ Coverage   63.43%   63.46%   +0.02%     
==========================================
  Files          63       63              
  Lines        8982     8982              
  Branches     2574     2573       -1     
==========================================
+ Hits         5698     5700       +2     
+ Misses       2665     2664       -1     
+ Partials      619      618       -1     

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

Copy link
Contributor

@amc-corey-cox amc-corey-cox left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@cmungall cmungall merged commit f749489 into main Feb 13, 2025
9 checks passed
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.

None yet

2 participants