danielgtaylor / python-betterproto

Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC
MIT License
1.56k stars 218 forks source link

Simplify code: delete py_input_message #614

Closed AdrienVannson closed 2 months ago

AdrienVannson commented 2 months ago

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

Gobot1234 commented 2 months ago

Should be alright to cleanup the code I suppose