MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / next

Method next

python/src/wrap_stream.cpp:42–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 }
41
42 virtual Sample next() const {
43 Sample sample;
44 {
45 std::unique_lock lock(mutex_);
46 py::gil_scoped_acquire gil;
47 try {
48 sample = mlx::pybind::to_sample(next_().cast<py::dict>());
49 } catch (py::error_already_set& e) {
50 if (e.matches(PyExc_StopIteration)) {
51 // do nothing
52 } else {
53 throw;
54 }
55 } catch (...) {
56 throw;
57 }
58 }
59 return sample;
60 }
61
62 private:
63 py::function iterable_factory_;

Callers 2

init_mlx_data_coreFunction · 0.45
init_mlx_data_streamFunction · 0.45

Calls 1

to_sampleFunction · 0.85

Tested by

no test coverage detected