Open an ftp object for the file.
166596
def _open_ftp(self):
        # type: () -> FTP
        """"""
        ftp = self.fs._open_ftp()
        ftp.voidcmd(str("TYPE I"))
        return ftp
1091901
def file(value, **kwarg):
    
    #a bit weird, but I don't want to hard code default values
    try:
        f = open(value, **kwarg)
    except IOError as e:
        raise ValueError("unable to open %s : %s" % (path.abspath(value), e))
    return f
738378
def open(self, path, mode='r'):
        """"""

        entry = self.find(path)
        if entry is None:
            if mode == 'r':
                raise ValueError("stream does not exists: %s" % path)
            entry = self.create_dir_entry(path, 'stream', None)

        else:
            if not entry.isfile():
                raise ValueError("can only open stream type DirEntry's")

            if mode == 'w':
                logging.debug("stream: %s exists, overwriting" % path)
                self.free_fat_chain(entry.sector_id, entry.byte_size < self.min_stream_max_size)
                entry.sector_id = None
                entry.byte_size = 0
                entry.class_id = None
            elif mode == 'rw':
                pass

        s = Stream(self, entry, mode)
        return s
314104
def from_file(cls, f):
        

        with open_file_like(f, 'r') as fp:
            return cls(json.load(fp))
259532
def open(cls, filename):
        """"""
        file_info = cls.parse_remote(filename)
        blob_service = cls.connect(filename)
        return BlobHandle(blob_service=blob_service,
                          container=file_info.container,
                          blob=file_info.blob,
                          chunk_size=cls._BLOB_CHUNK_DATA_SIZE)
301964
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
    return fs.open(f, bufferSize);
  }
217838
def open_file_like(f, mode):
    """"""
    new_fd = isinstance(f, (str, pathlib.Path))
    if new_fd:
        f = open(f, mode)
    try:
        yield f
    finally:
        if new_fd:
            f.close()
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)
645188
def open(self, file, mode='r', buffering=-1, encoding=None,
             errors=None, newline=None, closefd=True, opener=None):
        
        if opener is not None and sys.version_info < (3, 3):
            raise TypeError(
                "open() got an unexpected keyword argument 'opener'")
        fake_open = FakeFileOpen(self.filesystem, use_io=True)
        return fake_open(file, mode, buffering, encoding, errors,
                         newline, closefd, opener)
271719
def open(self, path, binary=False):
        """"""
        if binary:
            return open(path, "rb")
        return open(path, encoding="utf-8")
951854
def reopen(self, file_obj):
        """"""
        file_obj.open('U')
        if sys.version_info[0] <= 2:
            return file_obj
        else:
            return codecs.getreader('utf-8')(file_obj)
1090228
def open(self, mode='r', buffering=-1, encoding=None,
             errors=None, newline=None):
        
        if self._closed:
            self._raise_closed()
        return FakeFileOpen(self.filesystem, use_io=True)(
            self._path(), mode, buffering, encoding, errors, newline)
194604
def open_file(loc):
    """"""
    loc = ensure_path(loc)
    if tarfile.is_tarfile(str(loc)):
        return tarfile.open(str(loc), "r:gz")
    elif loc.parts[-1].endswith("gz"):
        return (line.decode("utf8") for line in gzip.open(str(loc), "r"))
    elif loc.parts[-1].endswith("zip"):
        zip_file = zipfile.ZipFile(str(loc))
        names = zip_file.namelist()
        file_ = zip_file.open(names[0])
        return (line.decode("utf8") for line in file_)
    else:
        return loc.open("r", encoding="utf8")
673747
def read_file(*path):
    """"""
    real_path = os.path.realpath(os.path.join(*path))
    with click.open_file(real_path, "r") as fp:
        return fp.read()
992104
def _open_file(self, filename):
        """"""
        if not self._os_is_windows:
            self._fh = open(filename, "rb")
            self.filename = filename

            self._fh.seek(0, os.SEEK_SET)
            self.oldsize = 0
            return

        # if we're in Windows, we need to use the WIN32 API to open the
        # file without locking it
        import win32file
        import msvcrt

        handle = win32file.CreateFile(filename,
                                      win32file.GENERIC_READ,
                                      win32file.FILE_SHARE_DELETE |
                                      win32file.FILE_SHARE_READ |
                                      win32file.FILE_SHARE_WRITE,
                                      None,
                                      win32file.OPEN_EXISTING,
                                      0,
                                      None)
        detached_handle = handle.Detach()
        file_descriptor = msvcrt.open_osfhandle(
            detached_handle, os.O_RDONLY)

        self._fh = open(file_descriptor, "rb")
        self.filename = filename

        self._fh.seek(0, os.SEEK_SET)
        self.oldsize = 0
958436
def open(self, mode='r', **kwargs):
        """"""
        _fs, filename = opener.parse(self.uri)
        return _fs.open(filename, mode=mode, **kwargs)
631477
def open(self, encoding=None):
        """"""
        try:
            if IS_GZIPPED_FILE.search(self._filename):
                _file = gzip.open(self._filename, 'rb')
            else:
                if encoding:
                    _file = io.open(self._filename, 'r', encoding=encoding, errors='replace')
                elif self._encoding:
                    _file = io.open(self._filename, 'r', encoding=self._encoding, errors='replace')
                else:
                    _file = io.open(self._filename, 'r', errors='replace')
        except IOError, e:
            self._log_warning(str(e))
            _file = None
            self.close()

        return _file