ShaneEverittM commented on code in PR #2523:
URL: https://github.com/apache/thrift/pull/2523#discussion_r1034265059
##########
compiler/cpp/src/thrift/generate/t_py_generator.cc:
##########
@@ -2742,8 +2765,71 @@ string t_py_generator::type_name(t_type* ttype) {
return ttype->get_name();
}
+string t_py_generator::arg_hint(t_type* type) {
+ if(gen_type_hints_) {
+ return ": " + type_to_py_hint(type);
+ }
+
+ return "";
+}
+
+string t_py_generator::func_hint(t_type* type) {
+ if(gen_type_hints_) {
+ return " -> " + type_to_py_hint(type);
+ }
+
+ return "";
+}
+
+/**
+ * Converts the parse type to a Python type hint
+ */
+string t_py_generator::type_to_py_hint(t_type* type) {
+ return "typing.Optional[" + type_to_py_type(type) + "]";
Review Comment:
Sure, I'll run it when I get home. Ping me if I forget. It was a rust server
and a python client with a single optional i32 argument on a service that just
added 1 and returned it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]