Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds explicit support for boolean attribute filters in the tag‐matching logic for Tag.find_all.
- Introduces a
v is Truebranch to require that the attribute is present. - Updates the regex and exact‐match checks to handle missing attributes.
Comments suppressed due to low confidence (2)
webscout/scout/element.py:213
- Add unit tests for the new boolean‐attribute filtering logic, covering both
v=True(attribute must exist) andv=False(attribute must be absent) cases to verify correct behavior.
if v is True:
webscout/scout/element.py:210
- Update the function docstring (or upstream
Tag.find_alldocs) to mention support for boolean attribute filters (v=True/v=False) so users know these cases are handled explicitly.
def _match(tag):
| if not v.search(str(tag_attr)): | ||
| if v is True: | ||
| if tag_attr is None: | ||
| return False |
There was a problem hiding this comment.
The logic does not handle v is False explicitly, so filtering with v=False will fall through to the exact‐match branch and likely reject all tags. Consider adding an elif v is False: branch to exclude tags that have the attribute.
Suggested change
| return False | |
| return False | |
| elif v is False: | |
| if tag_attr is not None: | |
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tag.find_allTesting
pre-commit(fails: command not found)