-
Notifications
You must be signed in to change notification settings - Fork 171
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
Remove redundant dependency checks #556
Conversation
My editor removed all the trailing whitespace from the modified file. If this is undesired, I can undo. |
@jacobperron please avoid them in the future. I'll review this one wi the |
src/rosdep2/installers.py
Outdated
return [x for x in resolved if x not in self.detect_fn(resolved)] | ||
detected = set(self.detect_fn(resolved)) | ||
seen = set() | ||
seen_add = seen.add |
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.
Why do you need to do this? It's the same number of characters.
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.
For execution speed. Reference.
Perhaps it is overkill.
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.
It's fine, I just wasn't aware of why. You might want a comment, otherwise someone might just remove it as redundant.
src/rosdep2/installers.py
Outdated
detected = set(self.detect_fn(resolved)) | ||
seen = set() | ||
seen_add = seen.add | ||
return [x for x in resolved if (x not in detected) and (x not in seen or seen_add(x))] |
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.
What is the seen
set for? Would this not be simpler:
detected = self.detect_fn(resolved)
return [x for x in resolved if x not in detected]
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.
Yes, it would appear I overthought the problem.
Alright, simplified and removed the trailing space edits 👍 |
Fix for #555.
This should maintain dependency order (desired from #545) while eliminating duplicate dependencies from the returned list.
@LWisteria, does this negatively impact you?