Read the given file, if it exists.

  Args:
    filename: A path to a file.

  Returns:
    A string containing the file contents, or `None` if the file does
    not exist.
779108
def _maybe_read_file(filename):
  
  try:
    with open(filename) as infile:
      return infile.read()
  except IOError as e:
    if e.errno == errno.ENOENT:
      return None
579350
def _readfile(cls, filename):
        
        f = codecs.open(filename, encoding='utf-8')
        filedata = f.read()
        f.close()
        tokenz = LM.tokenize(filedata, mode='c')
        #print tokenz
        return tokenz
783685
def _read_file(name, encoding='utf-8') -> str:
    
    with open(name, encoding=encoding) as f:
        return f.read()
1006679
def read_file(filename):
    """"""
    path = os.path.abspath(os.path.dirname(__file__))
    filepath = os.path.join(path, filename)
    try:
        return open(filepath).read()
    except IOError:
        return ''
27988
def read(fname):
    
    fpath = os.path.join(os.path.dirname(__file__), fname)
    with codecs.open(fpath, 'r', 'utf8') as fhandle:
        return fhandle.read().strip()
1012539
def readme(filename, encoding='utf8'):
    

    with io.open(filename, encoding=encoding) as source:
        return source.read()
148284
def read_file(self, filepath=None, filename=None):
        
        name = filename if filename else self.filename
        path = filepath if filepath else self.filepath
        name = self._ends_with(name, ".json")
        path = self._ends_with(path, os.path.sep)

        try:
            return self._read_json(path, name)
        except EnvironmentError as error:
            self.logger.error("Error while opening or reading the file: {}".format(error))
            raise
        except ValueError as error:
            self.logger.error("File contents cannot be decoded to JSON: {}".format(error))
            raise
515494
def read_file(file):
	
	if hasattr(file, "read"):
		return file.read()
	if hasattr(file, "read_bytes"):
		return file.read_bytes()
	with open(file, "rb") as f:
		return f.read()
580739
def read_config_file(filename)
      contents = ""
      File.open(filename, "r") { |f| contents = f.read() } if File.exists?(filename)
      contents
    end
1368888
def read(self, filename):
        

        try:
            conf_file = open(filename, 'r')
            config = conf_file.read()
            config_keys = re.findall(r'\[.*\]', config)
            self.section_keys = [key[1:-1] for key in config_keys]
        except IOError as e:
            # Pass if file not found
            if e.errno != 2:
                raise

        return self.config_parser.read(filename)
1119335
def read_file(file_path_name):
    
    with io.open(os.path.join(os.path.dirname(__file__), file_path_name), mode='rt', encoding='utf-8') as fd:
        return fd.read()
745100
def read_file(filename):
        
        lines = []
        with open(filename) as f:
            for line in f:
                if len(line.strip()) != 0:
                    lines.append(line.strip())
        return lines
28555
def read(self, filename):
        '''
        
        '''
        if not self.backend.exists(filename):
            raise FileNotFound(filename)
        return self.backend.read(filename)
504623
def read (self, filename=None):
    
    if filename is None:
      filename = self.pathname

    stream = open(filename, 'rb')
    magic  = struct.unpack('>H', stream.read(2))[0]
    stream.close()

    if magic == Seq.Magic:
      self.readBinary(filename)
    else:
      self.readText(filename)
373601
def read_file(filename, prepend_paths=[]):
  
  if prepend_paths is True:
    prepend_paths = [
      os.path.abspath(os.path.dirname(__file__)),
    ]
  if prepend_paths:
    prepend_paths.append(filename)
    filename = os.path.join(*prepend_paths)
  print(filename)
  with open(filename, encoding='utf-8') as f:
    return f.read()
501661
def _read_file(self, file):  # type: (str) -> Optional[str]
        
        if not self.setup_file_name:
            return None
        source = None
        if os.path.isfile(file):
            with self.file_opener.open_this(file, "r") as setup_py:
                source = setup_py.read()
        return source
960613
def _read_python_source(self, filename):
        
        try:
            f = open(filename, "rb")
        except IOError as err:
            self.log_error("Can't open %s: %s", filename, err)
            return None, None
        try:
            encoding = tokenize.detect_encoding(f.readline)[0]
        finally:
            f.close()
        with _open_with_encoding(filename, "r", encoding=encoding) as f:
            return _from_system_newlines(f.read()), encoding