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

Method CSVReaderFromKey

mlx/data/stream/CSVReader.cpp:56–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56CSVReaderFromKey::CSVReaderFromKey(
57 std::shared_ptr<Stream> stream,
58 const std::string& key,
59 char sep,
60 char quote,
61 bool fromMemory,
62 const std::filesystem::path& local_prefix,
63 const std::shared_ptr<core::FileFetcher>& fetcher)
64 : Compose(stream, [=](const Sample& sample) {
65 if (fromMemory) {
66 auto array =
67 sample::check_key(sample, key, mlx::data::ArrayType::UInt8);
68 auto ms = std::make_shared<core::imemstream>(array);
69 return std::make_shared<CSVReader>(ms, sep, quote);
70 } else {
71 auto array =
72 sample::check_key(sample, key, mlx::data::ArrayType::Int8);
73 std::string filename(
74 reinterpret_cast<char*>(array->data()), array->size());
75 return std::make_shared<CSVReader>(
76 filename, sep, quote, local_prefix, fetcher);
77 }
78 }) {}
79
80} // namespace stream
81} // namespace data

Callers

nothing calls this directly

Calls 3

check_keyFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected