Esempio n. 1
0
def calculate_class_properties(graph: 'Graph', scc: List[str], errors: Errors) -> None:
    for module in scc:
        tree = graph[module].tree
        assert tree
        # TODO: calculate properties also for classes nested in functions.
        for _, node, _ in tree.local_definitions():
            if isinstance(node.node, TypeInfo):
                calculate_class_abstract_status(node.node, tree.is_stub, errors)
                calculate_class_vars(node.node)
Esempio n. 2
0
def calculate_class_properties(graph: 'Graph', scc: List[str],
                               errors: Errors) -> None:
    for module in scc:
        tree = graph[module].tree
        assert tree
        for _, node, _ in tree.local_definitions():
            if isinstance(node.node, TypeInfo):
                calculate_class_abstract_status(node.node, tree.is_stub,
                                                errors)
                calculate_class_vars(node.node)
Esempio n. 3
0
def calculate_class_properties(graph: 'Graph', scc: List[str], errors: Errors) -> None:
    for module in scc:
        tree = graph[module].tree
        assert tree
        for _, node, _ in tree.local_definitions():
            if isinstance(node.node, TypeInfo):
                saved = (module, node.node, None)  # module, class, function
                with errors.scope.saved_scope(saved) if errors.scope else nothing():
                    calculate_class_abstract_status(node.node, tree.is_stub, errors)
                    check_protocol_status(node.node, errors)
                    calculate_class_vars(node.node)
                    add_type_promotion(node.node, tree.names, graph[module].options)
Esempio n. 4
0
def calculate_class_properties(graph: 'Graph', scc: List[str], errors: Errors) -> None:
    for module in scc:
        tree = graph[module].tree
        assert tree
        # TODO: calculate properties also for classes nested in functions.
        for _, node, _ in tree.local_definitions():
            if isinstance(node.node, TypeInfo):
                saved = (module, node.node, None)  # module, class, function
                with errors.scope.saved_scope(saved) if errors.scope else nothing():
                    calculate_class_abstract_status(node.node, tree.is_stub, errors)
                    check_protocol_status(node.node, errors)
                    calculate_class_vars(node.node)
                    add_type_promotion(node.node, tree.names, graph[module].options)