Return a CFFI callback that reads from a file-like object.
519414
def _make_read_func(file_obj):
    """"""
    @ffi.callback("cairo_read_func_t", error=constants.STATUS_READ_ERROR)
    def read_func(_closure, data, length):
        string = file_obj.read(length)
        if len(string) < length:  # EOF too early
            return constants.STATUS_READ_ERROR
        ffi.buffer(data, length)[:len(string)] = string
        return constants.STATUS_SUCCESS
    return read_func
668777
def consume_file(self, infile):
        """"""
        reader = tag.reader.GFF3Reader(infilename=infile)
        self.consume(reader)
1326252
def read_plain_float(file_obj, count):
    """"""
    return struct.unpack("<{}f".format(count).encode("utf-8"), file_obj.read(4 * count))
777371
def _load_from_file(self, filename):
    """"""
    if not tf.gfile.Exists(filename):
      raise ValueError("File %s not found" % filename)
    with tf.gfile.Open(filename) as f:
      self._load_from_file_object(f)
540952
function parseFile(filePath, encoding, callback) {
	fs.readFile(filePath, encoding, function(err, fileString) {
		if (err) {
			return callback(err);
		}
		return parse(fileString, callback);
	});
}
94593
def from_obj(cls, container, file_obj):
        """"""
        # RFC 1123: Thu, 07 Jun 2007 18:57:07 GMT
        return cls(container,
                   name=file_obj.name,
                   size=file_obj.size,
                   content_type=file_obj.content_type,
                   last_modified=dt_from_header(file_obj.last_modified),
                   obj_type=cls.choose_type(file_obj.content_type))
594058
def get_filelikeobject(filename: str = None,
                       blob: bytes = None) -> BinaryIO:
    
    if not filename and not blob:
        raise ValueError("no filename and no blob")
    if filename and blob:
        raise ValueError("specify either filename or blob")
    if filename:
        return open(filename, 'rb')
    else:
        return io.BytesIO(blob)
958524
def read(self, fp):
        ""
        base_size = struct.unpack(str("=I"), fp.read(4))[0]
        self._units.fromfile(fp, base_size)
1238912
def get_reader_input_fn(train_config, preprocess_output_dir, model_type,
                        data_paths, batch_size, shuffle, num_epochs=None):
  """"""

  def get_input_features():
    """Read the input features from the given data paths."""
    _, examples = util.read_examples(
        input_files=data_paths,
        batch_size=batch_size,
        shuffle=shuffle,
        num_epochs=num_epochs)
    features = util.parse_example_tensor(examples=examples,
                                         train_config=train_config,
                                         keep_target=True)

    target_name = train_config['target_column']
    target = features.pop(target_name)
    features, target = util.preprocess_input(
        features=features,
        target=target,
        train_config=train_config,
        preprocess_output_dir=preprocess_output_dir,
        model_type=model_type)

    return features, target

  # Return a function to input the feaures into the model from a data path.
  return get_input_features
574968
def __getFileObj(self, f):
        """"""
        if not f:
            raise ShapefileException("Shapefile Reader requires a shapefile or file-like object.")
        if self.shp and self.shpLength is None:
            self.load()
        if self.dbf and len(self.fields) == 0:
            self.load()
        return f
1194582
def read_file(self, cfgparser, file):
        """"""

        if hasattr(file, 'readline'):
            # we have a file object
            if sys.version_info >= (3, 2):
                cfgparser.read_file(file)  # Added in Python 3.2
            else:
                cfgparser.readfp(file)  # Deprecated since Python 3.2

        else:
            # we have a file name
            cfgparser.read(file)
1180978
function parseFile(filePath, encoding, callback) {
	return fs.readFile(filePath, encoding, function(err, fileString) {
		if (err) {
			return callback(err);
		}

		fileString = expandIncludes(fileString, path.dirname(filePath));

		return parse(fileString, callback);
	});
}
314768
def read(file_or_stream, fmt, as_version=4, **kwargs):
    """"""
    fmt = long_form_one_format(fmt)
    if fmt['extension'] == '.ipynb':
        notebook = nbformat.read(file_or_stream, as_version, **kwargs)
        rearrange_jupytext_metadata(notebook.metadata)
        return notebook

    return reads(file_or_stream.read(), fmt, **kwargs)
372142
def is_filelike(ob):
    
    if hasattr(ob, 'read') and callable(ob.read):
        return True

    if hasattr(ob, 'write') and callable(ob.write):
        return True

    return False
398224
def load(f, dict_=dict):
    
    if not f.read:
        raise ValueError('The first parameter needs to be a file object, ',
                         '%r is passed' % type(f))
    return loads(f.read(), dict_)
850768
def readfp(self, fp, filename=None):
        """"""
        warnings.warn(
            "This method will be removed in future versions.  "
            "Use 'parser.read_file()' instead.",
            DeprecationWarning, stacklevel=2
        )
        self.read_file(fp, source=filename)
727580
def read(afile):
    """"""
    the_relative_file = os.path.join(HERE, afile)
    with codecs.open(the_relative_file, 'r', 'utf-8') as opened_file:
        content = filter_out_test_code(opened_file)
        content = "".join(list(content))
        return content