def parse_bytesio(bytesio):
    """Parse the shebang from a file opened for reading binary."""
    if bytesio.read(2) != b'#!':
        return ()
    first_line = bytesio.readline()
    try:
        first_line = first_line.decode('US-ASCII')
    except __HOLE__:
        return ()

    # Require only printable ascii
    for c in first_line:
        if c not in printable:
            return ()

    # shlex.split is horribly broken in py26 on text strings
    cmd = tuple(shlex.split(five.n(first_line)))
    if cmd[0] == '/usr/bin/env':
        cmd = cmd[1:]
    return cmd
dataset/ETHPy150Open pre-commit/pre-commit/pre_commit/parse_shebang.py/parse_bytesio