예제 #1
0
파일: output.py 프로젝트: mic1234/pytype
 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)
예제 #2
0
def match_classvar(var):
    """Unpack the type parameter from ClassVar[T]."""
    return abstract_utils.match_type_container(var, "typing.ClassVar")
예제 #3
0
def match_initvar(var):
    """Unpack the type parameter from InitVar[T]."""
    return abstract_utils.match_type_container(var, "dataclasses.InitVar")