-
Notifications
You must be signed in to change notification settings - Fork 668
feat: add support for mutually exclusive attributes, consolidate attribute validation, fix boards.py _create_attr #2037
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
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.
Thanks for this PR @walterrowe! Just a few tiny suggestions to get CI passing.
updates made .. |
updated utils.py _validate_attrs() .. it was unintentionally indented. |
looks like utils.py doesn't know type RequiredOptional used in _validate_attrs param types? does utils.py need "from gitlab import base"? |
added base to imports ( |
Thanks for your patience @walterrowe, getting closer now ;) I suggest you always run a quick
Thanks for this. Our linters are quite strict so likely it'll need to be alphabetical, sorry 😁
You're right, sorry I missed this when I looked at the PR. Because |
looked at the error .. looking for suggestions on how to resolve |
I followed the contributors doc and set up all the pre-commit items. I have addressed them all except these two.
utils.py where we declare attributes arg type
mixins.py where we set excludes
|
In utils.py ...
This resolves the RequiredOptional type error and the circular imports between base and utils. I tried moving RequiredOptional from base to utils and two dozen other files then said they didn't know RequiredOptional so moving it is quite involved. Looking at the groups.py object file I see it tries to import RequiredOptional from base (from gitlab.base import RequiredOptional, RESTManager, RESTObject) so I took the same approach in utils.py. @nejch - I still get pre-commit complaining about _id_attr in the update method of UpdateMixins in mixins.py:
It comes from this line:
I moved this ref from the old _check_missing_update_attrs() method.
I need help with that one. Tracing backwards it appears _id_attr would be inherited from RESTObject, its optional, and defaults to "id". Perhaps in the update method of the UpdateMixin we don't need this, or need to first check if its not None? |
added check for self._obj_cls is not None .. pre-commit runs clean |
@nejch .. now I'm stuck .. any guidance would be helpful. |
Just jumping in here without doing a full review. It might make sense to move As |
Thanks @JohnVillalovos that makes sense. @walterrowe you can move it to |
I created a PR for moving the |
@walterrowe the PR above was merged, so if you now rebase your PR on top of our main you should be able to do this pretty easily, just import it from |
If you need assistance rebasing please let us know. I may be busy today, but starting tomorrow I will have more free time. |
Sure wish I had seen this before I pushed my commit to update almost all those same files with the same changes. I have the pre-commit setup so it warned me about all of them. @JohnVillalovos - I might need some assistance at this point since I have pushed my commits to my fork associated with the PR. |
Give me a few minutes and I will attempt to rebase. |
@walterrowe I rebased and squashed the PR. I have pushed it to your branch. You will need to re-clone it most likely. Please let me know if you have questions. Might be easiest to just do a new: |
who would have thought implementing mutually exclusive attributes would require this much effort! thanks for all the assistance and guidance through this. definitely learning a great deal about python and code review that I didn't know before. |
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.
Getting there. Need to figure out the unit test failures.
Thanks!
fixed the test_mixins_methods refs to _check_missing_create_attrs and _check_missing_update_attrs |
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.
@walterrowe LGTM (Looks Good To Me) 👍
Thanks for all the work on this. I will let @nejch review it too.
And by the way. Nice photography 😊 I'm a complete amateur but enjoying playing with off-camera flash and other stuff on occasion.
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.
@walterrowe Oh I forgot one thing. Can you "squash" it down to one commit?
I can do it for you if you like.
Basic idea is:
git rebase --interactive HEAD~4
Change the last three lines from pick
to squash
and edit the commit message.
Codecov Report
@@ Coverage Diff @@
## main #2037 +/- ##
==========================================
- Coverage 93.78% 93.68% -0.10%
==========================================
Files 78 78
Lines 4984 4985 +1
==========================================
- Hits 4674 4670 -4
- Misses 310 315 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@JohnVillalovos - I think I successfully did this .. double check? |
Squash was successful 👍 Can you do a
|
…ibute validation, fix boards.py _create_attr add exclusive tuple to RequiredOptional data class to support for mutually exclusive attributes consolidate _check_missing_create_attrs and _check_missing_update_attrs from mixins.py into _validate_attrs in utils.py change _create_attrs in board list manager classes from required=('label_ld',) to exclusive=('label_id','asignee_id','milestone_id') closes #1897
commit message amended |
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.
LGTM 👍
thanks @JohnVillalovos is this now pending @nejch review? |
Thanks for all the work on this @walterrowe! I had some thoughts on the logic for optionals as we said and I'd like to add some tests for this, but I'll do that in a follow-up, let's get this merged :) |
feat: add support for mutually exclusive attributes, consolidate attribute validation, fix boards.py _create_attr
closes #1897