get_origin

app.util.helpers.generics.get_origin(cls: type | GenericAlias, *, passthrough: bool = False) type[source]

Return the typing origin for cls or cls itself when passthrough is True.

Raises:

GenericsError – If cls has no origin and passthrough is False.

Parameters:
  • cls (type | GenericAlias)

  • passthrough (bool)

Return type:

type