Skip to content
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

Remove accepted_kwargs decorator #1229

Merged
merged 2 commits into from
Jun 18, 2023

Conversation

lavigne958
Copy link
Collaborator

Remove the function decorator accepted_kwargs.
We can simply put all the args on the method signature.
The function filter_dict_values is useless too now, we can set
the params with some None values that does not break the API calls.

This:

  • simplifies the method signature
  • allows rich editors to find and display the right method signature
    and not just wrapper(*args, **kwargs).
  • allows us to better type arguments
  • allows us to set default value like any other method using param=Defaultvalue
  • simplifies the code in general

closes #1228

Remove the function decorator accepted_kwargs.
We can simply put all the args on the method signature.
The function filter_dict_values is useless too now, we can set
the params with some None values that does not break the API calls.

This:
- simplifies the method signature
- allows rich editors to find and display the right method signature
  and not just `wrapper(*args, **kwargs)`.
- allows us to better type arguments
- allows us to set default value like any other method using `param=Defaultvalue`
- simplifies the code in general

closes #1228
@lavigne958 lavigne958 self-assigned this Jun 18, 2023
@lavigne958 lavigne958 requested a review from alifeee June 18, 2023 11:07
@alifeee
Copy link
Collaborator

alifeee commented Jun 18, 2023

This sounds great to me. Those function decorators were certainly a lot. As you say, were they for Python 2?

This is a great change to me ♥

I added a test, because I wasn't fully sure how python 3 dealt with kwarguments used as arguments. I thought we may as well leave it in.

@alifeee alifeee merged commit cf66822 into feature/release_6_0_0 Jun 18, 2023
@alifeee alifeee deleted the feature/remove_decorators_kwargs branch June 18, 2023 13:29
@lavigne958
Copy link
Collaborator Author

This sounds great to me. Those function decorators were certainly a lot. As you say, were they for Python 2?

This is a great change to me hearts

I added a test, because I wasn't fully sure how python 3 dealt with kwarguments used as arguments. I thought we may as well leave it in.

thanks for the test ! 🤩 I did not think about it when removing code but that's a great addition.

yes arguments can be passed in the right order or named but in the order you want.

sure we'll leave it in, if we change the order of the parameters in the methods Worksheet.update or Worksheet.get we'll catch it with the test.

@alifeee
Copy link
Collaborator

alifeee commented Jun 18, 2023

sounds good!

@alifeee alifeee mentioned this pull request Jan 26, 2024
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.

2 participants