Skip to content

Conversation

snbianco
Copy link
Contributor

@snbianco snbianco commented Sep 22, 2025

Previously, for filters not related to position or request in Mast.mast_query, users had to enclose filter values in a list for the expected response from the server. This PR handles the following cases so that filters are passed in correctly:

  • Single value not in a list.
  • Numpy array.
  • Set.
  • Tuple.
  • Dictionary specifying a range of values for a continuous column.

I also added more documentation, since this was unclear to users before.

@snbianco snbianco added the mast label Sep 22, 2025
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.57%. Comparing base (c588b25) to head (302f889).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3422      +/-   ##
==========================================
+ Coverage   70.54%   70.57%   +0.02%     
==========================================
  Files         232      232              
  Lines       20022    20037      +15     
==========================================
+ Hits        14125    14141      +16     
+ Misses       5897     5896       -1     

☔ 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.

@snbianco snbianco changed the title accepts different data types for MAST queries, tests, docs Expand the supported data types for filter values in Mast.mast_query Sep 22, 2025
@snbianco snbianco requested a review from bsipocz September 22, 2025 19:59
@snbianco snbianco marked this pull request as ready for review September 22, 2025 19:59
@bsipocz bsipocz added this to the 0.4.12 milestone Oct 17, 2025
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

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

Overall looks good, I have only one questions about the server being able to handle if there are more than min/max keys in the input dictionary.

Also needs a rebase to resolve the changelog conflict

----------
key : str
Parameter name (used for error messages).
val : any
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: general guideline to always spell out names, we don't need to save characters

Comment on lines -1178 to +1238
warnings.warn("'columns' parameter will not mask non-filtered services", InputWarning)
warnings.warn(
"'columns' parameter is ignored for non-filtered services.",
InputWarning
)
Copy link
Member

Choose a reason for hiding this comment

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

no need to change it back but in general we allow longer lines (120), so no need to cut up perfectly valid one liners

"""
# Range filters must be dicts with 'min' and 'max'
if isinstance(val, dict):
if not {"min", "max"}.issubset(val.keys()):
Copy link
Member

Choose a reason for hiding this comment

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

What happens when value has more than min/max, would the server handle dropping/using the extra ones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants