get_specialized_type_var_map

Get a type var map for specialized types.

Consider the following:

class Foo(Generic[T]): ...
class Bar(Generic[K]): ...
class IntBar(Bar[int]): ...
class IntBarSubclass(IntBar): ...
class IntBarFoo(IntBar, Foo[str]): ...

This would return:

get_specialized_type_var_map(object)
# None
get_specialized_type_var_map(Foo)
# {}
get_specialized_type_var_map(Bar)
# {~T: ~T}
get_specialized_type_var_map(IntBar)
# {~T: int}
get_specialized_type_var_map(IntBarSubclass)
# {~T: int}
get_specialized_type_var_map(IntBarFoo)
# {~T: int, ~K: str}

Signature:

def get_specialized_type_var_map(cls: type) -> Dict[str, type] | None:
...