

def nits(self):
    with_contexts = set(self.iter_ast_types(ast.With))
    with_context_calls = set((node.context_expr for node in with_contexts if isinstance(node.context_expr, ast.Call)))
    for call in self.iter_ast_types(ast.Call):
        if (isinstance(call.func, ast.Name) and (call.func.id == 'open') and (with_contexts not in with_context_calls)):
            (yield self.warning('T802', 'open() calls should be made within a contextmanager.', call))

dataset/ETHPy150Open pantsbuild/pants/contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/missing_contextmanager.py MissingContextManager.nits/VarMisuse@88/108 `call`->`with_contexts`