cnzakii commented on code in PR #51:
URL: https://github.com/apache/dubbo-python/pull/51#discussion_r2207894890
##########
src/dubbo/proxy/handlers.py:
##########
@@ -27,57 +28,96 @@
class RpcMethodHandler:
- """
- Rpc method handler
- """
-
__slots__ = ["_method_descriptor"]
def __init__(self, method_descriptor: MethodDescriptor):
- """
- Initialize the RpcMethodHandler
- :param method_descriptor: the method descriptor.
- :type method_descriptor: MethodDescriptor
- """
self._method_descriptor = method_descriptor
@property
def method_descriptor(self) -> MethodDescriptor:
- """
- Get the method descriptor
- :return: the method descriptor
- :rtype: MethodDescriptor
- """
return self._method_descriptor
+ @staticmethod
+ def get_codec(**kwargs) -> tuple:
+ return DubboTransportService.create_serialization_functions(**kwargs)
+
+ @classmethod
+ def _infer_types_from_method(cls, method: Callable) -> tuple:
+ try:
+ type_hints = get_type_hints(method)
+ sig = inspect.signature(method)
+ method_name = method.__name__
+ params = list(sig.parameters.values())
+ if params and params[0].name == "self":
Review Comment:
This case is invalid — 'self' should not appear in the signature of a bound
method. Instead of silently skipping it, consider raising an exception to catch
incorrect usage early.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]