@@ -141,7 +141,7 @@ def decorator(handler_func: Callable[[Type, Dict[str, Any]], Any]) -> Callable[[
141141
142142 return decorator
143143
144- def get_serializer (self , obj : Any ) -> Optional [Callable ]:
144+ def get_serializer (self , obj : Any ) -> Optional [Callable [[ Any ], Dict [ str , Any ]] ]:
145145 """Gets the appropriate serializer for an object.
146146
147147 It first checks the type dictionary for a direct type match.
@@ -152,7 +152,7 @@ def get_serializer(self, obj: Any) -> Optional[Callable]:
152152 :param obj: The object to serialize.
153153 :type obj: any
154154 :return: The serializer function if found, otherwise None.
155- :rtype: Optional[Callable]
155+ :rtype: Optional[Callable[[Any], Dict[str, Any]] ]
156156 """
157157 obj_type = type (obj )
158158 if obj_type in self ._serializer_cache :
@@ -168,7 +168,7 @@ def get_serializer(self, obj: Any) -> Optional[Callable]:
168168 self ._serializer_cache [obj_type ] = handler
169169 return handler
170170
171- def get_deserializer (self , cls : Type ) -> Optional [Callable ]:
171+ def get_deserializer (self , cls : Type ) -> Optional [Callable [[ Dict [ str , Any ]], Any ] ]:
172172 """Gets the appropriate deserializer for a class.
173173
174174 It first checks the type dictionary for a direct type match.
@@ -178,8 +178,9 @@ def get_deserializer(self, cls: Type) -> Optional[Callable]:
178178
179179 :param cls: The class to deserialize.
180180 :type cls: type
181- :return: The deserializer function wrapped with the class if found, otherwise None.
182- :rtype: Optional[Callable]
181+ :return: A deserializer function bound to the specified class that takes a dictionary and returns
182+ an instance of that class, or None if no deserializer is found.
183+ :rtype: Optional[Callable[[Dict[str, Any]], Any]]
183184 """
184185 if cls in self ._deserializer_cache :
185186 return self ._deserializer_cache [cls ]
0 commit comments