darn-dmap 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/Cargo.lock +1 -1
  2. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/Cargo.toml +1 -1
  3. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/PKG-INFO +1 -1
  4. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/pyproject.toml +1 -1
  5. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/lib.rs +34 -8
  6. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/.github/workflows/CI.yml +0 -0
  7. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/README.md +0 -0
  8. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/benches/io_benchmarking.rs +0 -0
  9. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/error.rs +0 -0
  10. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/dmap.rs +0 -0
  11. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/fitacf.rs +0 -0
  12. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/grid.rs +0 -0
  13. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/iqdat.rs +0 -0
  14. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/map.rs +0 -0
  15. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/mod.rs +0 -0
  16. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/rawacf.rs +0 -0
  17. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/formats/snd.rs +0 -0
  18. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/record.rs +0 -0
  19. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/src/types.rs +0 -0
  20. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.fitacf +0 -0
  21. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.fitacf.bz2 +0 -0
  22. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.grid +0 -0
  23. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.grid.bz2 +0 -0
  24. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.iqdat +0 -0
  25. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.iqdat.bz2 +0 -0
  26. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.map +0 -0
  27. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.map.bz2 +0 -0
  28. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.rawacf +0 -0
  29. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.rawacf.bz2 +0 -0
  30. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.snd +0 -0
  31. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/test_files/test.snd.bz2 +0 -0
  32. {darn_dmap-0.2.0 → darn_dmap-0.2.1}/tests/tests.rs +0 -0
@@ -210,7 +210,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
210
210
 
211
211
  [[package]]
212
212
  name = "dmap"
213
- version = "0.2.0"
213
+ version = "0.2.1"
214
214
  dependencies = [
215
215
  "bzip2",
216
216
  "criterion",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "dmap"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  edition = "2021"
5
5
  rust-version = "1.63.0"
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: darn-dmap
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Classifier: Programming Language :: Python
5
5
  Classifier: Programming Language :: Rust
6
6
  Requires-Dist: numpy<3
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "darn-dmap"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  requires-python = ">=3.8"
9
9
  authors = [
10
10
  { name = "Remington Rohel" }
@@ -163,7 +163,7 @@ read_rust!(dmap);
163
163
  /// Generates two functions: `read_[type]` and `read_[type]_lax`, for strict and lax
164
164
  /// reading, respectively.
165
165
  macro_rules! read_py {
166
- ($name:ident, $py_name:literal, $lax_name:literal, $bytes_name:literal) => {
166
+ ($name:ident, $py_name:literal, $lax_name:literal, $bytes_name:literal, $lax_bytes_name:literal) => {
167
167
  paste! {
168
168
  #[doc = "Reads a `" $name:upper "` file, returning a list of dictionaries containing the fields." ]
169
169
  #[pyfunction]
@@ -204,27 +204,44 @@ macro_rules! read_py {
204
204
  .collect()
205
205
  )
206
206
  }
207
+
208
+ #[doc = "Reads a `" $name:upper "` file, returning a tuple of" ]
209
+ #[doc = "(list of dictionaries containing the fields, byte where first corrupted record starts). "]
210
+ #[pyfunction]
211
+ #[pyo3(name = $lax_bytes_name)]
212
+ #[pyo3(text_signature = "(buf: bytes, /)")]
213
+ fn [< read_ $name _bytes_lax_py >](
214
+ bytes: &[u8],
215
+ ) -> PyResult<(Vec<IndexMap<String, DmapField>>, Option<usize>)> {
216
+ let result = [< $name:camel Record >]::read_records_lax(bytes).map_err(PyErr::from)?;
217
+ Ok((
218
+ result.0.into_iter().map(|rec| rec.inner()).collect(),
219
+ result.1,
220
+ ))
221
+ }
207
222
  }
208
223
  }
209
224
  }
210
225
 
211
- read_py!(iqdat, "read_iqdat", "read_iqdat_lax", "read_iqdat_bytes");
226
+ read_py!(iqdat, "read_iqdat", "read_iqdat_lax", "read_iqdat_bytes", "read_iqdat_bytes_lax");
212
227
  read_py!(
213
228
  rawacf,
214
229
  "read_rawacf",
215
230
  "read_rawacf_lax",
216
- "read_rawacf_bytes"
231
+ "read_rawacf_bytes",
232
+ "read_rawacf_bytes_lax"
217
233
  );
218
234
  read_py!(
219
235
  fitacf,
220
236
  "read_fitacf",
221
237
  "read_fitacf_lax",
222
- "read_fitacf_bytes"
238
+ "read_fitacf_bytes",
239
+ "read_fitacf_bytes_lax"
223
240
  );
224
- read_py!(grid, "read_grid", "read_grid_lax", "read_grid_bytes");
225
- read_py!(map, "read_map", "read_map_lax", "read_map_bytes");
226
- read_py!(snd, "read_snd", "read_snd_lax", "read_snd_bytes");
227
- read_py!(dmap, "read_dmap", "read_dmap_lax", "read_dmap_bytes");
241
+ read_py!(grid, "read_grid", "read_grid_lax", "read_grid_bytes", "read_grid_bytes_lax");
242
+ read_py!(map, "read_map", "read_map_lax", "read_map_bytes", "read_map_bytes_lax");
243
+ read_py!(snd, "read_snd", "read_snd_lax", "read_snd_bytes", "read_snd_bytes_lax");
244
+ read_py!(dmap, "read_dmap", "read_dmap_lax", "read_dmap_bytes", "read_dmap_bytes_lax");
228
245
 
229
246
  /// Checks that a list of dictionaries contains DMAP records, then appends to outfile.
230
247
  ///
@@ -315,6 +332,15 @@ fn dmap(m: &Bound<'_, PyModule>) -> PyResult<()> {
315
332
  m.add_function(wrap_pyfunction!(read_grid_bytes_py, m)?)?;
316
333
  m.add_function(wrap_pyfunction!(read_map_bytes_py, m)?)?;
317
334
 
335
+ // Lax read functions from byte buffer
336
+ m.add_function(wrap_pyfunction!(read_dmap_bytes_lax_py, m)?)?;
337
+ m.add_function(wrap_pyfunction!(read_iqdat_bytes_lax_py, m)?)?;
338
+ m.add_function(wrap_pyfunction!(read_rawacf_bytes_lax_py, m)?)?;
339
+ m.add_function(wrap_pyfunction!(read_fitacf_bytes_lax_py, m)?)?;
340
+ m.add_function(wrap_pyfunction!(read_snd_bytes_lax_py, m)?)?;
341
+ m.add_function(wrap_pyfunction!(read_grid_bytes_lax_py, m)?)?;
342
+ m.add_function(wrap_pyfunction!(read_map_bytes_lax_py, m)?)?;
343
+
318
344
  // Write functions
319
345
  m.add_function(wrap_pyfunction!(write_dmap_py, m)?)?;
320
346
  m.add_function(wrap_pyfunction!(write_iqdat_py, m)?)?;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes