TypeAdapters are heavy objects, and in an application context we’d typically
create them once in a global scope and reuse them as often as possible.
However, this isn’t feasible for user-generated functions. Instead, we use a
cache to minimize the cost of creating them as much as possible.
Check if cls is a member of base, even if cls is a type variable.Base can be a type, a UnionType, or an Annotated type. Generic types are not
considered members (e.g. T is not a member of list[T]).
Create a new function with the same code but without the specified parameters in annotations.This is used to exclude parameters from type adapter processing when they can’t be serialized.
The excluded parameters are removed from the function’s annotations dictionary.
Given a (possibly generic, nested, or otherwise complex) type, replaces all
instances of old_type with new_type.This is useful for transforming types when creating tools.Args:
type_: The type to replace instances of old_type with new_type.