-
Notifications
You must be signed in to change notification settings - Fork 2
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
Don't make duplicate PatternsMatcher instances. #11
Conversation
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
==========================================
- Coverage 99.00% 99.00% -0.01%
==========================================
Files 6 6
Lines 303 300 -3
==========================================
- Hits 300 297 -3
Misses 3 3
|
@@ -35,7 +35,8 @@ def __init__(self, include: List[str], exclude: Optional[List[str]] = None, prio | |||
|
|||
def get_domains(self) -> List[str]: | |||
domains = [get_pattern_domain(pattern) for pattern in self.include] | |||
return [domain for domain in domains if domain] | |||
# remove duplicate domains preserving the order | |||
return list(dict.fromkeys(domain for domain in domains if domain)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if preserving the order is important but why not.
Would this remove the need for checking the uniqueness of the identifier? if matcher.identifier not in unique:
... |
Yes. |
Fixes #10