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

🔧 split filter_needs func by needs type #1276

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Sep 4, 2024

This makes it clearer what representation of needs we are trying to filter (see #1264).

The idea is that eventually we might be able to analyse the filter string and perform "short-circuit" filters,
for example, if it is id == "abc" and filter_needs_view, then all we actually need to perform is an O(1) lookup of the mapping, rather than perform an O(N) iteration over all the needs.

This then begins to address #1219.

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.91%. Comparing base (4e10030) to head (b09375f).
Report is 44 commits behind head on master.

Files with missing lines Patch % Lines
sphinx_needs/functions/common.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1276      +/-   ##
==========================================
+ Coverage   86.87%   86.91%   +0.03%     
==========================================
  Files          56       60       +4     
  Lines        6532     6932     +400     
==========================================
+ Hits         5675     6025     +350     
- Misses        857      907      +50     
Flag Coverage Δ
pytests 86.91% <96.55%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@chrisjsewell chrisjsewell marked this pull request as ready for review September 6, 2024 20:31
Copy link
Member

@ubmarco ubmarco left a comment

Choose a reason for hiding this comment

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

Approved with a comment

@measure_time("filtering")
def filter_needs(
def _filter_needs(
Copy link
Member

Choose a reason for hiding this comment

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

need to deprecate the old name?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think no, because this is not part of the public api (i.e. https://sphinx-needs.readthedocs.io/en/latest/api.html), and anyhow it will force people to stop using it if they were 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

(in principle we should change almost every module to have an _, but eurgh that would be annoying 😅

@chrisjsewell chrisjsewell merged commit affe6be into master Sep 12, 2024
17 checks passed
@chrisjsewell chrisjsewell deleted the typing-needs-parts-filter branch September 12, 2024 21:39
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.

2 participants