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

Remove redundant dependency checks #556

Merged
merged 1 commit into from
Jan 18, 2018
Merged

Remove redundant dependency checks #556

merged 1 commit into from
Jan 18, 2018

Conversation

jacobperron
Copy link
Contributor

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?

@jacobperron
Copy link
Contributor Author

My editor removed all the trailing whitespace from the modified file. If this is undesired, I can undo.

@wjwwood
Copy link
Contributor

wjwwood commented Oct 10, 2017

@jacobperron please avoid them in the future. I'll review this one wi the ?w=1 option on the diff url.

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

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))]
Copy link
Contributor

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]

Copy link
Contributor Author

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.

@jacobperron
Copy link
Contributor Author

Alright, simplified and removed the trailing space edits 👍

@wjwwood wjwwood merged commit 348ecd8 into ros-infrastructure:master Jan 18, 2018
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