(var, block, func_ir)
return False, None
Search given block for variable usages. If it is used only in one assignment and one Del - remove this variable
Search given block for variable usages. If it is used only in one assignment and one Del - remove this variable
Search given block for variable usages . If it is used only in one assignment and one Del - remove this variable
def _remove_unused_internal(var, block, func_ir):
    """
    Search given block for variable usages. If it is used only in one assignment and one Del - remove this variable
    """

    usage_list = []
    use_count = 0

    for stmt in find_usage(var, block):
        usage_list.append(stmt)
        if isinstance(stmt, Assign) and var == stmt.target:
            continue
        elif isinstance(stmt, Del):
            continue
        else:
            use_count += 1

    if use_count == 0:
        for stmt in usage_list:
            block.remove(stmt)

        del func_ir._definitions[var.name]

        return True, usage_list

    return False, None
def _remove_unused_internal ( var , block , func_ir ) : usage_list = [ ] use_count = 0 for stmt in find_usage ( var , block ) : usage_list . append ( stmt ) if isinstance ( stmt , Assign ) and var == stmt . target : continue elif isinstance ( stmt , Del ) : continue else : use_count += 1 if use_count == 0 : for stmt in usage_list : block . remove ( stmt ) del func_ir . _definitions [ var . name ] return True , usage_list return False , None