def annotations_to_instance_types(self, node, annots): """Get instance types for annotations not present in the members map.""" if annots: for name, typ in annots.get_annotations(node): contained_type = abstract_utils.match_type_container( typ, "typing.ClassVar") if contained_type: typ = contained_type yield name, typ.get_instance_type(node)
def match_classvar(var): """Unpack the type parameter from ClassVar[T].""" return abstract_utils.match_type_container(var, "typing.ClassVar")
def match_initvar(var): """Unpack the type parameter from InitVar[T].""" return abstract_utils.match_type_container(var, "dataclasses.InitVar")