Skip to main content

annotation_issubclass

Test if a given annotation is of the given subclass.

def annotation_issubclass(
annotation: typing.Any,
cls: type
) - > bool

Test if a given annotation is of the given subclass.

Parameters

NameTypeDescription
annotationtyping.AnyThe type hint or annotation object to evaluate
clstypeThe class type against which the annotation is checked for a subclass relationship

Returns

TypeDescription
boolTrue if the annotation is a valid class and is a subclass of the specified type, otherwise False