def _find_unused_static_warnings(filename, lines, ast_list):
static_declarations = dict(_get_static_declarations(ast_list))<EOL>def find_variables_use(body):<EOL><INDENT>for child in body:<EOL><INDENT>if child.name in static_declarations:<EOL><INDENT>static_use_counts[child.name] += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>static_use_counts = collections.Counter()<EOL>for node in ast_list:<EOL><INDENT>if isinstance(node, ast.Function) and node.body:<EOL><INDENT>find_variables_use(node.body)<EOL><DEDENT>elif isinstance(node, ast.Class) and node.body:<EOL><INDENT>for child in node.body:<EOL><INDENT>if isinstance(child, ast.Function) and child.body:<EOL><INDENT>find_variables_use(child.body)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>count = <NUM_LIT:0><EOL>for (name, _) in sorted(static_declarations.items(),<EOL>key=lambda x: x[<NUM_LIT:1>].start):<EOL><INDENT>if not static_use_counts[name]:<EOL><INDENT>print("<STR_LIT>".format(<EOL>filename,<EOL>lines.get_line_number(static_declarations[name].start),<EOL>name))<EOL>count += <NUM_LIT:1><EOL><DEDENT><DEDENT>return count<EOL>
Warn about unused static variables.