

def is_python_script(filename):
    "Checks a file to see if it's a python script of some sort.\n    "
    if filename.lower().endswith('.py'):
        return True
    if (not os.path.isfile(filename)):
        return False
    try:
        with open(filename, 'rb') as fp:
            if (fp.read(2) != b'#!'):
                return False
            return re.match('.*python', str_(filename.readline()))
    except IOError:
        pass
    return False

dataset/ETHPy150Open tweekmonster/moult/moult/utils.py is_python_script/VarMisuse@92/141 `fp`->`filename`