diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..baa721a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [rzmk] diff --git a/README.md b/README.md index 642569c..183a4b3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ czv includes libraries for Rust, Python, and WebAssembly (JavaScript and TypeScr ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) @@ -29,11 +29,8 @@ apple,2.50 banana,3.00 strawberry,1.50 "; - let output: usize = RowCount::new() - .file_data(data) - .include_header_row(true) - .execute()?; - println!("{output}"); // 4 + let output: usize = RowCount::new().file_data(data).execute()?; + println!("{output}"); // 3 Ok(()) } ``` diff --git a/czv-python/README.md b/czv-python/README.md index db51388..284e5c9 100644 --- a/czv-python/README.md +++ b/czv-python/README.md @@ -5,7 +5,7 @@ Python library for [czv](https://github.com/rzmk/czv). czv is a library of CSV-r ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-python/czv.pyi b/czv-python/czv.pyi index 775c69e..ed45162 100644 --- a/czv-python/czv.pyi +++ b/czv-python/czv.pyi @@ -27,7 +27,7 @@ print(output) # 4 ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-python/tests/test_count.py b/czv-python/tests/test_count.py index e5b2f9a..c796835 100644 --- a/czv-python/tests/test_count.py +++ b/czv-python/tests/test_count.py @@ -2,12 +2,12 @@ import czv import pytest from .test_data import test_data -class TestRowCount: +class TestCountFunc: @pytest.mark.parametrize( "file_name,expected", [("fruits.csv", 3), ("constituents_altnames.csv", 33971)], ) - def test_row_count(self, file_name, expected): + def test_count(self, file_name, expected): """Count the total number of non-header rows.""" result = czv.row_count(file_path=test_data[file_name]) @@ -17,19 +17,8 @@ class TestRowCount: "file_name,expected", [("fruits.csv", 4), ("constituents_altnames.csv", 33972)], ) - def test_row_count_include_header_row(self, file_name, expected): + def test_include_header_row(self, file_name, expected): """Count the total number of rows including the header row.""" result = czv.row_count(file_path=test_data[file_name], include_header_row=True) assert result == expected - -class TestColumnCount: - @pytest.mark.parametrize( - "file_name,expected", - [("fruits.csv", 2), ("constituents_altnames.csv", 6)], - ) - def test_column_count(self, file_name, expected): - """Count the total number of columns.""" - - result = czv.column_count(file_path=test_data[file_name]) - assert result == expected diff --git a/czv-wasm/README.md b/czv-wasm/README.md index 18ef562..6e5cbde 100644 --- a/czv-wasm/README.md +++ b/czv-wasm/README.md @@ -5,7 +5,7 @@ WebAssembly (JavaScript and TypeScript) library for [czv](https://github.com/rzm ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-wasm/examples/node-demo/sample.ts b/czv-wasm/examples/node-demo/sample.ts index 8197c19..f969962 100644 --- a/czv-wasm/examples/node-demo/sample.ts +++ b/czv-wasm/examples/node-demo/sample.ts @@ -1,5 +1,3 @@ -// See the README.md file in this file's folder -// for how to run this example import czv from "../../pkg/czv-ts"; const options: czv.RowCountOptions = { @@ -7,7 +5,6 @@ const options: czv.RowCountOptions = { apple,2.50 banana,3.00 strawberry,1.50`, - include_header_row: true }; const output: number = czv.rowCount(options); diff --git a/czv-wasm/src/lib.rs b/czv-wasm/src/lib.rs index 54bb076..286e831 100644 --- a/czv-wasm/src/lib.rs +++ b/czv-wasm/src/lib.rs @@ -29,7 +29,7 @@ //! # Links //! //! - czv GitHub repository: -//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) //! - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) //! - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) diff --git a/czv-wasm/tests/count.rs b/czv-wasm/tests/count.rs index 7b04e7a..d0b8164 100644 --- a/czv-wasm/tests/count.rs +++ b/czv-wasm/tests/count.rs @@ -1,12 +1,12 @@ use czv_wasm; -use czv_wasm::count::{ColumnCountOptions, RowCountOptions}; +use czv_wasm::count::RowCountOptions; use czv_wasm::Result; use wasm_bindgen_test::*; wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); #[test] #[wasm_bindgen_test] -fn row_count_nonheader() -> Result<()> { +fn basic() -> Result<()> { let options = RowCountOptions { file_data: "fruit,price apple,2.00 @@ -19,34 +19,3 @@ strawberry,3.00" assert_eq!(result, 3); Ok(()) } - -#[test] -#[wasm_bindgen_test] -fn row_count_header() -> Result<()> { - let options = RowCountOptions { - file_data: "fruit,price -apple,2.00 -banana,1.50 -strawberry,3.00" - .to_string(), - include_header_row: Some(true), - }; - let result = czv_wasm::count::row_count(options)?; - assert_eq!(result, 4); - Ok(()) -} - -#[test] -#[wasm_bindgen_test] -fn column_count() -> Result<()> { - let options = ColumnCountOptions { - file_data: "fruit,price -apple,2.00 -banana,1.50 -strawberry,3.00" - .to_string(), - }; - let result = czv_wasm::count::column_count(options)?; - assert_eq!(result, 2); - Ok(()) -} diff --git a/czv/README.md b/czv/README.md index 022987f..5b73a3c 100644 --- a/czv/README.md +++ b/czv/README.md @@ -5,7 +5,7 @@ Rust library for [czv](https://github.com/rzmk/czv). czv is a library of CSV-rel ## Links - czv GitHub repository: -- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) @@ -67,9 +67,9 @@ For benchmarks we use [criterion.rs](https://github.com/bheisler/criterion.rs). Licensed under either of - Apache License, Version 2.0 - (http://www.apache.org/licenses/LICENSE-2.0) + ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) - MIT license - (http://opensource.org/licenses/MIT) + ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. diff --git a/czv/src/count.rs b/czv/src/count.rs index f84bb0b..d00cb33 100644 --- a/czv/src/count.rs +++ b/czv/src/count.rs @@ -207,7 +207,6 @@ impl< __file_path: typed_builder::Optional>, > ColumnCountBuilder<(__file_path, __file_data)> { - /// Returns the column count. pub fn execute(self) -> Result { let builder = self.__build(); column_count(builder.file_path, builder.file_data) diff --git a/czv/src/lib.rs b/czv/src/lib.rs index fcf36c8..32e7969 100644 --- a/czv/src/lib.rs +++ b/czv/src/lib.rs @@ -33,7 +33,7 @@ //! # Links //! //! - czv GitHub repository: -//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) ([docs](https://docs.rs/czv)) +//! - Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv)) //! - WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv-wasm](https://www.npmjs.com/package/czv-wasm) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm)) //! - Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python)) @@ -41,7 +41,7 @@ pub mod count; #[doc(inline)] pub use count::{ColumnCount, RowCount}; -// Extract a section of rows. +/// Extract a section of rows. // pub mod slice; // #[doc(inline)] // pub use slice::Slice;