Skip to content

Commit ad98102

Browse files
committed
chore: fixed parsing type
1 parent b8a143e commit ad98102

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "shr_parser_py"
33
description = "Python bindings for the shr_parser Rust crate"
4-
version = "0.1.7"
4+
version = "0.1.9"
55
edition = "2021"
66
license = "GPL-3.0-only"
77
authors = ["Lasse Nielsen <lasse@xerrion.dk>"]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ A class representing a parser for SHR files.
6565
Here is an example usage of the SHRParser class:
6666
6767
```python
68-
import shr_parser
68+
from shr_parser import SHRParser, SHRParsingType
6969
7070
# Define the file path and parsing type
7171
file_path = "path/to/your/shrfile.shr"
72-
parsing_type = 0 # SHRParsingType::Peak
72+
parsing_type = SHRParsingType.PEAK
7373
7474
# Create a parser instance
75-
parser = shr_parser.SHRParser(file_path, parsing_type)
75+
parser = SHRParser(file_path, parsing_type)
7676
7777
# Get file path
7878
print(parser.get_file_path())

src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,8 @@ impl PySHRParser {
132132

133133
/// Create a new SHRParser instance.
134134
#[pyfunction]
135-
fn create_parser(file_path: &str, parsing_type: i32) -> PyResult<PySHRParser> {
136-
let py_parsing_type: PySHRParsingType = parsing_type
137-
.try_into()
138-
.map_err(|e| pyo3::exceptions::PyValueError::new_err(e))?;
139-
PySHRParser::new(file_path, py_parsing_type)
135+
fn create_parser(file_path: &str, parsing_type: PySHRParsingType) -> PyResult<PySHRParser> {
136+
PySHRParser::new(file_path, parsing_type)
140137
}
141138

142139
/// A Python module implemented in Rust.

0 commit comments

Comments
 (0)