Read file from disk.
2992
def read(self, location):
        
        location = os.path.expanduser(location)

        # Try to open this file, using different encodings.
        for e in ENCODINGS:
            try:
                with codecs.open(location, 'r', e) as f:
                    return f.read(), e
            except UnicodeDecodeError:
                pass  # Try next codec.

        # Unable to open.
        raise Exception('Unable to open file: %r' % location)
1309666
function readFile(file) {
    try {
        file = require(path.relative(__dirname, file));
    } catch (err) {
        return err;
    }

    return file;
}
454290
def read(cls, f):
    """"""
    url = None

    line = f.readline()
    if not line:
      # EOF
      return None
    while not line.startswith(cls.LENGTH_HEADER):
      if line.startswith(cls.URI_HEADER):
        url = line[len(cls.URI_HEADER):].strip()
      line = f.readline()

    # Consume empty separator
    f.readline()

    # Read content
    length = int(line.split(':')[1])

    return cls(url, length)
1301891
def read(filename):
    
    fname = os.path.join(here, filename)
    with codecs.open(fname, encoding='utf-8') as f:
        return f.read()
809742
def _read_from_file(self, filename):
        """"""
        try:
            with open(filename, 'rb') as f:
                return self._loads(f.read())
        except (IOError, OSError):
            logger.warning('Error opening file: {}'.format(filename))
            return None
649001
def read_file(name):
    """"""
    cur_path = os.path.dirname(__file__)
    exts = ('txt', 'rst')
    for ext in exts:
        path = os.path.join(cur_path, '.'.join((name, ext)))
        if os.path.exists(path):
            with open(path, 'rt') as file_obj:
                return file_obj.read()

    return ''
327091
def read_file(self, file: Union[IO, asyncio.StreamWriter]=None):
        '''
        '''
        if file:
            file_is_async = hasattr(file, 'drain')

        while True:
            data = yield from self._connection.read(4096)

            if not data:
                break

            if file:
                file.write(data)

                if file_is_async:
                    yield from file.drain()

            self._data_event_dispatcher.notify_read(data)
112817
def Read(self, length):
    """"""
    result = b""

    # The total available size in the file
    length = int(length)
    length = min(length, self.size - self.offset)

    while length > 0:
      data = self._ReadPartial(length)
      if not data:
        break

      length -= len(data)
      result += data
    return result
144165
def read_file(path):
    """"""
    file_path = os.path.join(here, *path)
    with open(file_path, encoding="utf-8") as f:
        return f.read()
857505
def read(self):
        """"""
        if self._is_initialized:
            return
        self._is_initialized = True

        if not isinstance(self._file_or_files, (tuple, list)):
            files_to_read = [self._file_or_files]
        else:
            files_to_read = list(self._file_or_files)
        # end assure we have a copy of the paths to handle

        seen = set(files_to_read)
        num_read_include_files = 0
        while files_to_read:
            file_path = files_to_read.pop(0)
            fp = file_path
            file_ok = False

            if hasattr(fp, "seek"):
                self._read(fp, fp.name)
            else:
                # assume a path if it is not a file-object
                try:
                    with open(file_path, 'rb') as fp:
                        file_ok = True
                        self._read(fp, fp.name)
                except IOError:
                    continue

            # Read includes and append those that we didn't handle yet
            # We expect all paths to be normalized and absolute (and will assure that is the case)
            if self._has_includes():
                for _, include_path in self.items('include'):
                    if include_path.startswith('~'):
                        include_path = osp.expanduser(include_path)
                    if not osp.isabs(include_path):
                        if not file_ok:
                            continue
                        # end ignore relative paths if we don't know the configuration file path
                        assert osp.isabs(file_path), "Need absolute paths to be sure our cycle checks will work"
                        include_path = osp.join(osp.dirname(file_path), include_path)
                    # end make include path absolute
                    include_path = osp.normpath(include_path)
                    if include_path in seen or not os.access(include_path, os.R_OK):
                        continue
                    seen.add(include_path)
                    # insert included file to the top to be considered first
                    files_to_read.insert(0, include_path)
                    num_read_include_files += 1
                # each include path in configuration file
            # end handle includes
        # END for each file object to read

        # If there was no file included, we can safely write back (potentially) the configuration file
        # without altering it's meaning
        if num_read_include_files == 0:
            self._merge_includes = False
90067
def read(self):
        """"""
        if 'r' == self._mode:
            return self._read_response.text
        elif 'rb' == self._mode:
            return self._read_response.content
        else:
            raise IOError("File not opened in read mode.")
899919
def read_file_to_string(path):
  """"""
  bytes_string = tf.gfile.Open(path, 'r').read()
  return dlutils.python_portable_string(bytes_string)
356216
def read_bytes(self, path):
        """"""
        file = staticfiles_storage.open(path)
        content = file.read()
        file.close()
        return content
465946
def read_file(path):
    
    if os.path.isabs(path):
        with wrap_file_exceptions():
            with open(path, 'rb') as stream:
                return stream.read()

    with wrap_file_exceptions():
        stream = ca_storage.open(path)

    try:
        return stream.read()
    finally:
        stream.close()
1031854
def read_file(self, path, **kwargs):
        
        try:
            parsed_data = Parser().parse_file(path)
            return parsed_data
        except (IOError, TypeError, ImportError):
            LOGGER.warning("Error reading file: {0}".format(path))
        return None
225608
def read(self, size=None):
        """"""
        blob = self.s.read(size)
        if size is not None and len(blob) < size:
            raise EOFError
        if self._captured:
            self._captured.write(blob)
        return blob
1318857
def read(self, encoding=None):
        """"""
        encoding = encoding or ENCODING
        try:
            with codecs.open(self.path, encoding=encoding) as fi:
                return fi.read()
        except:
            return None