def needs_declaration(fullpath):
    try:
        infile = open(fullpath, 'rU')
    except __HOLE__: # Oops, the file was removed - ignore it
        return None

    line1 = infile.readline()
    line2 = infile.readline()

    if (get_declaration(line1) or
        blank_re.match(line1) and get_declaration(line2)):
        # the file does have an encoding declaration, so trust it
        infile.close()
        return False

    # check the whole file for non-ASCII characters
    rest = infile.read()
    infile.close()

    if has_correct_encoding(line1+line2+rest, "ascii"):
        return False

    return True
dataset/ETHPy150Open francelabs/datafari/windows/python/Tools/Scripts/findnocoding.py/needs_declaration