Read file and return contents.
326375
def read_from(value):
    """"""
    path = normalized_path(value)
    if not os.path.exists(path):
        raise argparse.ArgumentTypeError("%s is not a valid path." % path)
    LOG.debug("%s exists.", path)
    with open(path, 'r') as reader:
        read = reader.read()
    return read
1278186
def read(self, file_or_path):
        """"""
        if file_or_path in self._cached_templates:
            return self._cached_templates[file_or_path]

        if is_filelike(file_or_path):
            template = file_or_path.read()
            dirname = None
        else:
            with open(file_or_path, 'r') as f:
                template = f.read()
            dirname = os.path.dirname(file_or_path)

        template = self._engine(template,
                                dirname=dirname,
                                tolerant=self._tolerant)

        self._cached_templates[file_or_path] = template
        return template
565752
def _read_object(self, path):
    ''''''
    if not os.path.exists(path):
      return None

    if os.path.isdir(path):
      raise RuntimeError('%s is a directory, not a file.' % path)

    with open(path) as f:
      file_contents = f.read()

    return file_contents
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)
586886
def read_file(self, filename):
        
        logger.info("Reading file: %s", format_path(filename))
        contents = self.context.read_file(filename)
        num_lines = len(contents.splitlines())
        logger.debug("Read %s from %s.",
                     pluralize(num_lines, 'line'),
                     format_path(filename))
        return contents.rstrip()
653265
def read(self, fileobj):
        """"""

        fileobj.seek(self._dataoffset, 0)
        data = fileobj.read(self.datalength)
        return len(data) == self.datalength, data
680004
def read_raw(self, length, *, error=None):
        """"""
        if length is None:
            length = len(self)

        raw = dict(
            packet=self._read_fileng(length),
            error=error or None,
        )

        return raw
1314434
def read(filename, loader=None, implicit_tuple=True, allow_errors=False):
  """"""
  with open(filename, 'r') as f:
    return reads(f.read(),
                 filename=filename,
                 loader=loader,
                 implicit_tuple=implicit_tuple,
                 allow_errors=allow_errors)
1218693
def load_file_contents(file_path, as_list=True):
    """"""
    abs_file_path = join(HERE, file_path)
    with open(abs_file_path, encoding='utf-8') as file_pointer:
        if as_list:
            return file_pointer.read().splitlines()
        return file_pointer.read()
942957
def read(path, root_path=None):
    """"""
    try:
        root_path = root_path or get_root_path()
        real_path = os.path.realpath(os.path.join(root_path, path))
        with open(real_path) as fp:
            return fp.read().strip()
    except IOError:
        return ""
697789
def read(filename):
    """"""
    return codecs.open(os.path.join(__DIR__, filename), 'r').read()
510631
def read_file(cls, filepath):
        
        with open(filepath, mode='rb') as f:
            contents = f.read()
        return cls.decode(contents)
50967
def get_file(fn):
    """"""
    fn = os.path.join(os.path.dirname(__file__), 'data', fn)
    f = open(fn, 'rb')
    lines = [line.decode('utf-8').strip() for line in f.readlines()]
    return lines
486174
def get_readme():
    """"""
    base_dir = path.abspath(path.dirname(__file__))
    with open(path.join(base_dir, 'README.md'), encoding='utf-8') as readme_f:
        return readme_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
1025405
def read(*parts):
    """"""
    try:
        return io.open(os.path.join(*parts), 'r', encoding='utf-8').read()
    except IOError:
        return ''
461433
def read(fname):
    "  "
    if exists(fname):
        return open(join(dirname(__file__), fname)).read()