def is_executable_file(path):
 fpath = os.path.realpath(path)
 if (not os.path.isfile(fpath)):
  return False
 mode = os.stat(fpath).st_mode
 if (sys.platform.startswith('sunos') and (os.getuid() == 0)):
  return bool((mode & ((stat.S_IXUSR | stat.S_IXGRP) | stat.S_IXOTH)))
 return os.access(fpath, os.X_OK)

def is_executable_file ( path ) : fpath = os . path . realpath ( path ) if ( not os . path . isfile ( fpath ) ) : return False mode = os . stat ( fpath ) . st_mode if ( sys . platform . startswith ( 'sunos' ) and ( os . getuid ( ) == 0 ) ) : return bool ( ( mode & ( ( stat . S_IXUSR | stat . S_IXGRP ) | stat . S_IXOTH ) ) ) return os . access ( fpath , os . X_OK )
checks that path is an executable regular file .