Add signature extraction to HelperHandlerRegistry

This commit is contained in:
Pragyansh Chaturvedi
2025-11-04 05:19:22 +05:30
parent 33e18f6d6d
commit d8cddb9799

View File

@ -40,3 +40,22 @@ class HelperHandlerRegistry:
def has_handler(cls, helper_name):
"""Check if a handler function is registered for a helper"""
return helper_name in cls._handlers
@classmethod
def get_signature(cls, helper_name):
"""Get the signature of a helper function"""
return cls._handlers.get(helper_name)
@classmethod
def get_param_type(cls, helper_name, index):
"""Get the type of a parameter of a helper function by the index"""
signature = cls.get_signature(helper_name)
if signature and 0 <= index < len(signature.arg_types):
return signature.arg_types[index]
return None
@classmethod
def get_return_type(cls, helper_name):
"""Get the return type of a helper function"""
signature = cls.get_signature(helper_name)
return signature.return_type if signature else None