-
Notifications
You must be signed in to change notification settings - Fork 410
Add merged attribute to pulls, fix #335 #462
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if it is not None. If it is
FalseorTrueit came back from the API. You may not want to do this at all though because the cached information can be out of date.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 thinking that if a pull is merged,
self.mergedwill always equalTruein the future (even reverting the pull doesn't seem to change that), so there wouldn't be a point in checking the API. However, ifself.mergedisFalse, you'd probably want to be able to check the API to see if it has been merged yet?The name of the method (
is_merged) is a bit problematic though, as it sounds more like a getter for themergedattribute than something that would actually fire of an API request.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.
So the name is confusing if this is the first part of github3.py with which you interact with. Everything else does not retrieve a specific attribute and the
mergedattribute is a new addition to what the API returns. (Hence why it was missing andis_mergedwas not a bad name choice at the time.)The pattern with the library is that attributes do not retrieve data for you or make API calls, but methods do. It's a logical distinction.
I would say someone can rely on
pr.mergedexisting but they need to check that it's actually a boolean instead of just usingis pr.merged. That said, I'm still conflicted about short-circuiting the method. I can't think of a place we do that elsewhere but I'm also in favor of saving people a request against their ratelimit.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.
Yep, I understand. I don't mind removing the short-circuiting if you feel that's a better solution, just thought it would work alright here since as far as I know a merged pull request can never change status.