Skip to content

chore: add type-hints to gitlab/v4/objects/merge_requests.py #1673

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 1 commit into from
Nov 7, 2021

Conversation

JohnVillalovos
Copy link
Member

  • Add type-hints to gitlab/v4/objects/merge_requests.py
  • Add return value to cancel_merge_when_pipeline_succeeds() function
    as GitLab docs show it returns a value.
  • Add return value to approve() function as GitLab docs show it
    returns a value.
  • Add 'get()' method so that type-checkers will understand that
    getting a project merge request is of type ProjectMergeRequest.

@JohnVillalovos JohnVillalovos requested a review from nejch November 7, 2021 00:15
 * Add type-hints to gitlab/v4/objects/merge_requests.py
 * Add return value to cancel_merge_when_pipeline_succeeds() function
   as GitLab docs show it returns a value.
 * Add return value to approve() function as GitLab docs show it
   returns a value.
 * Add 'get()' method so that type-checkers will understand that
   getting a project merge request is of type ProjectMergeRequest.
@JohnVillalovos JohnVillalovos force-pushed the jlvillal/mypy_merge_requests branch from 8a0f9de to f9c0ad9 Compare November 7, 2021 00:17
@codecov-commenter
Copy link

Codecov Report

Merging #1673 (f9c0ad9) into main (4ab9e92) will decrease coverage by 0.03%.
The diff coverage is 84.21%.

@@            Coverage Diff             @@
##             main    #1673      +/-   ##
==========================================
- Coverage   91.99%   91.96%   -0.04%     
==========================================
  Files          75       75              
  Lines        4337     4345       +8     
==========================================
+ Hits         3990     3996       +6     
- Misses        347      349       +2     
Flag Coverage Δ
cli_func_v4 81.88% <73.68%> (-0.04%) ⬇️
py_func_v4 81.15% <84.21%> (-0.02%) ⬇️
unit 83.68% <68.42%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/v4/objects/merge_requests.py 85.18% <84.21%> (-0.65%) ⬇️

Comment on lines +459 to +462
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectMergeRequest:
return cast(ProjectMergeRequest, super().get(id=id, lazy=lazy, **kwargs))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe for a follow-up it'd be good to document this in the Development docs so we can point people to this in case they are adding new managers and get hit by mypy errors?

@nejch nejch merged commit 32ea954 into main Nov 7, 2021
@nejch nejch deleted the jlvillal/mypy_merge_requests branch November 7, 2021 09:31
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.

3 participants