Open file outside Spyder with the appropriate application
        If this does not work, opening unknown file in Spyder, as text file
337978
def open_outside_spyder(self, fnames):
        """"""
        for path in sorted(fnames):
            path = file_uri(path)
            ok = programs.start_file(path)
            if not ok:
                self.sig_edit.emit(path)
694981
def _text_or_file(input_):
    '''
    
    '''
    if _isfile(input_):
        with salt.utils.files.fopen(input_) as fp_:
            out = salt.utils.stringutils.to_str(fp_.read())
    else:
        out = salt.utils.stringutils.to_str(input_)

    return out
1307772
def open_file(self) :
        """"""
        if self.isdir() : raise Exception("FSQuery tried to open a directory as a file : %s" % self.abs)
        return open(self.abs)
1305717
def open(cls, path):
        
        filename = fspath(path)
        with _LeptonicaErrorTrap():
            return cls(lept.pixRead(os.fsencode(filename)))
6112
def open_file(file, mode):
	
	if hasattr(file, "read"):
		return file
	if hasattr(file, "open"):
		return file.open(mode)
	return open(file, mode)
312862
def OpenFile(self, filename):
    """"""
    (mime_type, encoding) = mimetypes.guess_type(filename)
    assert mime_type
    # A crude guess of when we should use binary mode. Without it non-unix
    # platforms may corrupt binary files.
    if mime_type.startswith('text/'):
      mode = 'r'
    else:
      mode = 'rb'
    return open(os.path.join(self.server.file_dir, filename), mode), mime_type
992349
def open_file(filename):
    
    if sys.platform.startswith("darwin"):
        subprocess.call(("open", filename))
    elif sys.platform == "cygwin":
        subprocess.call(("cygstart", filename))
    elif os.name == "nt":
        os.system("start %s" % filename)
    elif os.name == "posix":
        subprocess.call(("xdg-open", filename))
996272
def openfile(filename, mode="rt", *args, expanduser=False, expandvars=False,
             makedirs=False, **kwargs):
    """"""
    if filename in ("-", None):
        return sys.stdin if "r" in mode else sys.stdout
    if expanduser:
        filename = os.path.expanduser(filename)
    if expandvars:
        filename = os.path.expandvars(filename)
    if makedirs and ("a" in mode or "w" in mode):
        parentdir = os.path.dirname(filename)
        if not os.path.isdir(parentdir):
            os.makedirs(parentdir)
    if filename.endswith(".gz"):
        if gzip is None:
            raise NotImplementedError
        _open = gzip.open
    elif filename.endswith(".bz2"):
        if bz2 is None:
            raise NotImplementedError
        _open = bz2.open
    elif filename.endswith(".xz") or filename.endswith(".lzma"):
        if lzma is None:
            raise NotImplementedError
        _open = lzma.open
    else:
        _open = open
    return _open(filename, mode, *args, **kwargs)
787382
def start_file(filename):
    
    from qtpy.QtCore import QUrl
    from qtpy.QtGui import QDesktopServices

    # We need to use setUrl instead of setPath because this is the only
    # cross-platform way to open external files. setPath fails completely on
    # Mac and doesn't open non-ascii files on Linux.
    # Fixes Issue 740
    url = QUrl()
    url.setUrl(filename)
    return QDesktopServices.openUrl(url)
1373542
def load(self, filename="temp.pkl"):
    
    inputFile = open(filename, 'rb')
    self.tm = cPickle.load(inputFile)
507714
def ui_open(*files):
  
  if files:
    osname = get_os_name()
    opener = _OPENER_BY_OS.get(osname)
    if opener:
      opener(files)
    else:
      raise OpenError('Open currently not supported for ' + osname)
261680
def browse( parent, filename = '' ):
        
        dlg = XdkWindow(parent)
        dlg.show()
        
        if ( filename ):
            dlg.loadFilename(filename)
795638
def open_external_file(self, fname):
        
        fname = encoding.to_unicode_from_fs(fname)
        if osp.isfile(fname):
            self.open_file(fname, external=True)
        elif osp.isfile(osp.join(CWD, fname)):
            self.open_file(osp.join(CWD, fname), external=True)
583357
def open(self, filename, mode='r', **kwargs):
        '''
        
        '''
        if 'r' in mode and not self.backend.exists(filename):
            raise FileNotFound(filename)
        return self.backend.open(filename, mode, **kwargs)
665755
def _open_for_write(filename):
    """"""
    dirname = os.path.dirname(filename)
    pathlib.Path(dirname).mkdir(parents=True, exist_ok=True)

    return io.open(filename, 'w')
814008
def open(self, filename, mode='r'):
        """"""

        self._raise_if_none()
        fn = path_join(self.path, filename)

        return open(fn, mode)
75687
def open(safe_file):
    """"""
    if os.path.isdir(safe_file) or os.path.isfile(safe_file):
        return SentinelDataSet(safe_file)
    else:
        raise IOError("file not found: %s" % safe_file)