parameters: (filename)
docstring: Return 'True' if 'filename' names a valid file which is likely
      an executable. A file is considered an executable if it starts with the
      magic bytes for a EXE, Mach O, or ELF file.
docstring_summary: Return 'True' if 'filename' names a valid file which is likely
      an executable. A file is considered an executable if it starts with the
      magic bytes for a EXE, Mach O, or ELF file.
docstring_tokens: Return True if filename names a valid file which is likely an executable . A file is considered an executable if it starts with the magic bytes for a EXE Mach O or ELF file .
function: def is_executable_file(filename):
      """
      Return 'True' if 'filename' names a valid file which is likely
      an executable. A file is considered an executable if it starts with the
      magic bytes for a EXE, Mach O, or ELF file.
      """
      if not os.path.isfile(filename):
          return False
      with open(filename, mode='rb') as f:
          magic_bytes = f.read(_num_magic_bytes)
      if sys.platform == 'darwin':
          return magic_bytes in [
              b'\xfe\xed\xfa\xce',  # MH_MAGIC
              b'\xce\xfa\xed\xfe',  # MH_CIGAM
              b'\xfe\xed\xfa\xcf',  # MH_MAGIC_64
              b'\xcf\xfa\xed\xfe',  # MH_CIGAM_64
              b'\xca\xfe\xba\xbe',  # FAT_MAGIC
              b'\xbe\xba\xfe\xca'   # FAT_CIGAM
          ]
      elif sys.platform.startswith('win'):
          return magic_bytes == b'MZ'
      else:
          return magic_bytes == b'\x7FELF'
function_tokens: def is_executable_file ( filename ) : if not os . path . isfile ( filename ) : return False with open ( filename , mode = 'rb' ) as f : magic_bytes = f . read ( _num_magic_bytes ) if sys . platform == 'darwin' : return magic_bytes in [ b'\xfe\xed\xfa\xce' , # MH_MAGIC b'\xce\xfa\xed\xfe' , # MH_CIGAM b'\xfe\xed\xfa\xcf' , # MH_MAGIC_64 b'\xcf\xfa\xed\xfe' , # MH_CIGAM_64 b'\xca\xfe\xba\xbe' , # FAT_MAGIC b'\xbe\xba\xfe\xca' # FAT_CIGAM ] elif sys . platform . startswith ( 'win' ) : return magic_bytes == b'MZ' else : return magic_bytes == b'\x7FELF'