-
Notifications
You must be signed in to change notification settings - Fork 79
Adding check_restrictions functionality #1141
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
Conversation
|
Your friend pep(e)8 is calling ... |
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.
Will it be better to do this in a set operation?
|
Thanks @antgonza |
|
👍 |
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 not just do {col for restriction in restrictions for col in restriction.columns}? The generator is immediately consumed so it isn't clear what the benefit of lazy eval is here
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 was just avoiding the double list comprehension, as sometimes it has been criticized. I think it is not too complicated, so I'll change it.
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.
makes sense. in that case though, it would be better to just create the set
using two for loops. eg
cols = set()
for restriction in restrictions:
for col in restriction.columns:
cols.add(col)
On Mon, May 4, 2015 at 2:29 PM, josenavas notifications@github.com wrote:
In qiita_db/metadata_template/base_metadata_template.py
#1141 (comment):
Parameters
restrictions : list of RestrictionThe restrictions to test if the template fulfills
Returns
set of strThe missing columns"""def _col_iter():for restriction in restrictions:for col in restriction.columns:yield col
I was just avoiding the double list comprehension, as sometimes it has
been criticized. I think it is not too complicated, so I'll change it.—
Reply to this email directly or view it on GitHub
https://github.com/biocore/qiita/pull/1141/files#r29620275.
|
Just one comment, 👍 otherwise |
Adding check_restrictions functionality
This adds the
check_restrictionsfunctionality to the metadata template objects. This functionality is needed to check the restrictions from the GUI and disable functionality as needed.Should be easy to review!