czv/czv-python/src/count.rs
rzmk ce260e9491 refactor: use czv in czv-python
- Add `file_path` for czv-python count operations
- Refactor tests based on file path instead of data
- Use thiserror in czv
- Update examples to reflect changes
2024-06-20 01:03:54 -04:00

21 lines
510 B
Rust

use crate::Result;
use pyo3::pyfunction;
use std::path::PathBuf;
#[pyfunction]
pub fn row_count(
file_path: Option<PathBuf>,
file_data: Option<String>,
include_header_row: Option<bool>,
) -> Result<usize> {
Ok(czv::count::row_count(
file_path,
file_data,
include_header_row.unwrap_or(false),
)?)
}
#[pyfunction]
pub fn column_count(file_path: Option<PathBuf>, file_data: Option<String>) -> Result<usize> {
Ok(czv::count::column_count(file_path, file_data)?)
}