generate_encoders_by_class_tuples
Generates a dictionary mapping encoder functions to tuples of types they encode, based on an input dictionary that maps types to encoders.
def generate_encoders_by_class_tuples(
type_encoder_map: dict[Any, Callable[[Any], Any]]
) - > dict[Callable[[Any], Any], tuple[Any, ...]]
Generates a mapping from encoder functions to tuples of types they encode. This function is used to group multiple types that share the same encoder.
Parameters
| Name | Type | Description |
|---|---|---|
| type_encoder_map | dict[Any, Callable[[Any], Any]] | A dictionary mapping types to their corresponding encoder functions. Each type is associated with a single encoder. |
Returns
| Type | Description |
|---|---|
dict[Callable[[Any], Any], tuple[Any, ...]] | A dictionary where keys are encoder functions and values are tuples of types that each encoder handles. |