almanac.types

is_matching_type(_type: Type, annotation: Any)bool[source]

Return whether a specified type matches an annotation.

This function does a bit more than a simple comparison, and performs the following extra checks:

  • If the annotation is a union, then the union is unwrapped and each of its types is compared against _type.

  • If the specified _type is generic, it will verify that all of its parameters match those of a matching annotation.