CodeSampleX

示例

nimble_csv 1.3.0: Define a NimbleCSV parser module and parse and dump CSV with it: header skipping, quoted fields holding separators and newlines, parse errors, and iodata output

已验证示例 — hex nimble_csv 1.3.0: Define a NimbleCSV parser module and parse and dump CSV with it: header skipping, quoted fields holding separators and newlines…

sha256:5cc42ad8f6260280ff21c0786a675829539b5451403d0a85eaeda6db06e16e3a

本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。 提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。 MIT-0

执行证据

声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。

证据依据
签名契约通过
验证回执
1
构建过它的签名密钥
1
声明的环境 elixir 1 linux x64 elixir 1 elixir mix

验证运行环境

环境 契约 阶段 运行日期
elixir 1 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-14

案例

HOW
目标
Define a NimbleCSV parser module and parse and dump CSV with it: header skipping, quoted fields holding separators and newlines, parse errors, and iodata output
符号
  • NimbleCSV.define
  • NimbleCSV.RFC4180
  • NimbleCSV.RFC4180.parse_string
  • NimbleCSV.RFC4180.parse_enumerable
  • NimbleCSV.RFC4180.parse_stream
  • NimbleCSV.RFC4180.dump_to_iodata
  • NimbleCSV.ParseError
环境
elixir 1
创建时间
2026-08-14T20:10:34Z

契约

  1. assert NimbleCSV.define/2 is an ordinary function and not a macro, so it can be called at runtime, and that calling it a second time emits a redefining module warning on stderr
  2. assert a bare alias passed to define/2 creates a top-level module rather than one nested under the enclosing module
  3. assert a parser defined with a separator list round-trips a table, accepts every separator when parsing but writes only the first when dumping, and treats all of them as reserved characters
  4. assert the RFC4180 parser keeps a separator and a newline that sit inside a quoted field, returns the inner newline bytes verbatim rather than normalising CRLF to LF, and reads a doubled quote as one literal quote
  5. assert parse_string discards the first line by default, so a headerless single-row CSV parses to an empty list, and that skip_headers: false keeps it
  6. assert broken escaping raises NimbleCSV.ParseError with either the end-of-file or the unexpected-escape-character message, while a ragged row of the wrong width raises nothing and is returned as-is
  7. assert eager parse_string and parse_enumerable raise before yielding any row, while lazy parse_stream returns the rows before the broken line when the stream is halted early
  8. assert dump_to_iodata returns a nested list holding binaries and raw single-byte integers rather than a binary, that RFC4180 dumps CRLF row terminators while a custom parser can dump LF, that reserved characters are quoted on the way out, and that entries are dumped through to_string while parsing always returns binaries

文件

  • csx.json
  • lib/csx_nimble_csv/parsers.ex
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

下载源代码构件 (tar.gz)

原始种子者

anonymous