Skip to content

fix: avoid passing redundant arguments to API #1965

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
Apr 14, 2022

Conversation

nejch
Copy link
Member

@nejch nejch commented Apr 4, 2022

Closes #987.

This was already fixed in b9ecc9a but partially reintroduced with the global retry_transient_errors feature.

@codecov-commenter
Copy link

Codecov Report

Merging #1965 (3431887) into main (0353bd4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1965   +/-   ##
=======================================
  Coverage   92.56%   92.56%           
=======================================
  Files          78       78           
  Lines        4909     4910    +1     
=======================================
+ Hits         4544     4545    +1     
  Misses        365      365           
Flag Coverage Δ
cli_func_v4 81.58% <100.00%> (+<0.01%) ⬆️
py_func_v4 80.12% <100.00%> (+<0.01%) ⬆️
unit 83.48% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
gitlab/client.py 90.58% <100.00%> (+0.02%) ⬆️

@nejch nejch requested a review from JohnVillalovos April 5, 2022 07:19
@max-wittig
Copy link
Member

@nejch Mhmm but where is that retry_transient_errors is actually removed. I just see that it's set as a self attribute.

@nejch
Copy link
Member Author

nejch commented Apr 6, 2022

@nejch Mhmm but where is that retry_transient_errors is actually removed. I just see that it's set as a self attribute.

@max-wittig previously it would just get picked from the method's **kwargs via .get():

retry_transient_errors = kwargs.get(
"retry_transient_errors", self.retry_transient_errors
)

but all kwargs are passed as query parameters to the API because they're copied to params earlier:

utils.copy_dict(src=kwargs, dest=params)

I added it as an explicit argument to avoid that. I could have done.pop() from kwargs instead, but it would have to be done before that dict is copied, so I thought it'd be cleaner like this.

@nejch nejch assigned max-wittig and unassigned nejch Apr 6, 2022
@nejch nejch requested a review from max-wittig April 14, 2022 09:44
@max-wittig max-wittig merged commit ba7692a into main Apr 14, 2022
@max-wittig max-wittig deleted the fix/redundant-args-api branch April 14, 2022 17:36
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.

Additional arguments are passed on to the API
3 participants