Read file at the specified path.
    If file doesn't exist, it will be created with default-content.
    Returns the file content.
321152
def read_file(file_path, default_content=''):
    
    if not os.path.exists(file_path):
        write_file(file_path, default_content)

    handler = open(file_path, 'r')
    content = handler.read()
    handler.close()
    return content or default_content
763793
public static String readFirstLine(String path) throws FileNotFoundException, IOException {
        try (FileInputStream fis = new FileInputStream(path)) {
            try (InputStreamReader isr = new InputStreamReader(fis)) {
                try (BufferedReader br = new BufferedReader(isr)) {
                    return br.readLine();
                }
            }
        }
    }
74121
def read_file(filename):
    """"""
    p = path.abspath(path.dirname(__file__))
    filepath = path.join(p, filename)
    try:
        return open(filepath).read()
    except IOError:
        return ''
900637
def get_file_content(self, path):
        
        id = self._get_id_for_path(path)
        blob = self.repository._repo[id]
        return blob.as_pretty_string()
700124
def read_data(file_path):
    

    if not is_valid(file_path):
        write_data(file_path, {})

    db = open_file_for_reading(file_path)
    content = db.read()

    obj = decode(content)

    db.close()

    return obj
566412
def read(path):
    
    data = None
    with open(path, 'r') as f:
        data = f.read()
    f.close()
    return data
313480
public static String readFile(String path) throws IOException {
        if (path.startsWith(ValueConsts.CLASSPATH_PREFIX)) {
            return read(FileExecutor.class.getResourceAsStream(path.substring(ValueConsts.CLASSPATH_PREFIX.length())));
        }
        return readFile(new File(path));
    }
999010
def read_file(self, file_path):
        
        try:
            with open(self.cont_path(file_path)) as fd:
                return fd.read()
        except IOError as ex:
            logger.error("error while accessing file %s: %r", file_path, ex)
            raise ColinException(
                "There was an error while accessing file %s: %r" % (file_path, ex))
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()
1015512
private static BufferedReader open(final String path) throws IOException {
    if (path.equals("-")) {
      return new BufferedReader(new InputStreamReader(System.in));
    }

    InputStream is = new FileInputStream(path);
    if (path.endsWith(".gz")) {
      is = new GZIPInputStream(is);
    }
    // I <3 Java's IO library.
    return new BufferedReader(new InputStreamReader(is));
  }
141442
function readFile(path) {
  try {
    const contents = fs.readFileSync(path, { encoding: 'utf8' });

    return contents;
  } catch (error) {
    throw new Error(error);
  }
}
882430
def read_file(filepath: str) -> str:
    """"""
    # ? Check this is ok if absolute paths passed in
    filepath = os.path.expanduser(filepath)
    with open(filepath) as opened_file:  # type: IO
        file_read = opened_file.read()  # type: str
        return file_read
888576
public JSON readFromFile( String path ) {
      return readFromStream( Thread.currentThread()
            .getContextClassLoader()
            .getResourceAsStream( path ) );
   }
272388
def read_file(fpath):
    """"""
    with io.open(os.path.join(PATH_BASE, fpath)) as f:
        return f.read()
1123460
def read(self, path, encoding=None):
        
        b = common.read(path)

        if encoding is None:
            encoding = self.file_encoding

        return self.unicode(b, encoding)
24926
def read_from_file(self, path):
        
        if not os.path.exists(path):
            slog.warning("The file %s is not exist.", path)
            return False
        txt = read_file(path)
        dic = eval(txt)
        self.copy_from_dict(dic)
        return True
365755
def _find_file(self, path, silent=False):
        
        for filename in DEFAULT_FILENAMES:
            full_path = os.path.join(path, filename) if path else filename
            if os.path.exists(full_path):
                return full_path

        # Return default filename if silent
        if silent:
            return os.path.join(path, DEFAULT_FILENAME)

        raise ReadmeNotFoundError(path)