def _find_unused_static_warnings(filename, lines, ast_list):
    static_declarations = dict(_get_static_declarations(ast_list))

    def find_variables_use(body):
        for child in body:
            if child.name in static_declarations:
                static_use_counts[child.name] += 1

    static_use_counts = collections.Counter()
    for node in ast_list:
        if isinstance(node, ast.Function) and node.body:
            find_variables_use(node.body)
        elif isinstance(node, ast.Class) and node.body:
            for child in node.body:
                if isinstance(child, ast.Function) and child.body:
                    find_variables_use(child.body)

    count = 0
    for (name, _) in sorted(static_declarations.items(),
                            key=lambda x: x[1].start):
        if not static_use_counts[name]:
            print("{}:{}: unused variable '{}'".format(
                filename,
                lines.get_line_number(static_declarations[name].start),
                name))
            count += 1

    return count
Warn about unused static variables.
dataset/ETHPy150Open myint/cppclean/cpp/static_data.py/_find_unused_static_warnings