Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add attr.validators.in_() #181
I wrote this for one of my projects and I thought it could be useful to others too. This is a validator called
US_STATES = ['AB', 'AG', 'AK', ...] @attr(slots=True) class Location(object): city = attr.ib(validator=instance_of(str)) state = attr.ib(validator=in_(US_STATES))
I was wondering if you had any thoughts and whether it would make sense to add it to attrs. If that's the case, I'd be more than happy to adjust the code with your suggestions.
Pull Request Check List
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!
If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!
@@ Coverage Diff @@ ## master #181 +/- ## ===================================== Coverage 100% 100% ===================================== Files 9 9 Lines 579 589 +10 Branches 126 128 +2 ===================================== + Hits 579 589 +10