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

Simplify code: delete py_input_message #614

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

AdrienVannson
Copy link
Contributor

@AdrienVannson AdrienVannson commented Sep 11, 2024

Summary

This PR removes the py_input_message function from ServiceMethodCompiler. This function was only used in two places, in the template file. The return value was not actually used, it was only checked whether it was None or not.

However, the function should never actually return None, since an rpc always takes an existing message as parameter. If the function returns None, as far as understand, it means that there is a problem somewhere in betterproto.

In any case, the check is not useful: if the condition that I deleted was not satisfied (which should not happen from what I understand), an invalid code would have been generated since the variable method.py_input_message_param would have been used later without having being declared.

I sometimes see things like that in the code, I imagine that it is better that I do small pull-requests each time, what do you think? Or is there any reason to keep the code for now, for example for future use?

Checklist

  • If code changes were made then they have been tested.

@Gobot1234
Copy link
Collaborator

Should be alright to cleanup the code I suppose

@Gobot1234 Gobot1234 merged commit 8d25c96 into danielgtaylor:master Sep 17, 2024
19 checks passed
@AdrienVannson AdrienVannson deleted the py_input_message2 branch October 8, 2024 11:16
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