rust-pgn-reader-python-binding 2.2.0__tar.gz → 2.3.0__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.
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/Cargo.lock +1 -1
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/Cargo.toml +1 -1
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/PKG-INFO +1 -1
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/lib.rs +11 -1
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/test.py +18 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/.github/workflows/CI.yml +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/.gitignore +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/README.md +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/benches/parquet_bench.rs +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/pyproject.toml +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/bench.py +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/bench_parquet.py +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/bench_parquet_parallel.py +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/comment_parsing.rs +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/example_rowgroup.py +0 -0
- {rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/example_str.py +0 -0
|
@@ -1229,7 +1229,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
|
|
1229
1229
|
|
|
1230
1230
|
[[package]]
|
|
1231
1231
|
name = "rust_pgn_reader_python_binding"
|
|
1232
|
-
version = "2.
|
|
1232
|
+
version = "2.3.0"
|
|
1233
1233
|
dependencies = [
|
|
1234
1234
|
"arrow",
|
|
1235
1235
|
"criterion",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rust_pgn_reader_python_binding
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use crate::comment_parsing::parse_comments;
|
|
2
2
|
use crate::comment_parsing::CommentContent;
|
|
3
|
-
use pgn_reader::{BufferedReader, RawComment, SanPlus, Skip, Visitor};
|
|
3
|
+
use pgn_reader::{BufferedReader, RawComment, RawHeader, SanPlus, Skip, Visitor};
|
|
4
4
|
use pyo3::prelude::*;
|
|
5
5
|
use rayon::prelude::*;
|
|
6
6
|
use rayon::ThreadPoolBuilder;
|
|
@@ -30,6 +30,9 @@ pub struct MoveExtractor {
|
|
|
30
30
|
#[pyo3(get)]
|
|
31
31
|
outcome: Option<String>,
|
|
32
32
|
|
|
33
|
+
#[pyo3(get)]
|
|
34
|
+
headers: Vec<(String, String)>,
|
|
35
|
+
|
|
33
36
|
pos: Chess,
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -45,6 +48,7 @@ impl MoveExtractor {
|
|
|
45
48
|
evals: Vec::with_capacity(100),
|
|
46
49
|
clock_times: Vec::with_capacity(100),
|
|
47
50
|
outcome: None,
|
|
51
|
+
headers: Vec::with_capacity(10),
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
}
|
|
@@ -52,6 +56,12 @@ impl MoveExtractor {
|
|
|
52
56
|
impl Visitor for MoveExtractor {
|
|
53
57
|
type Result = bool;
|
|
54
58
|
|
|
59
|
+
fn header(&mut self, key: &[u8], value: RawHeader<'_>) {
|
|
60
|
+
let key_str = String::from_utf8_lossy(key).into_owned();
|
|
61
|
+
let value_str = String::from_utf8_lossy(value.as_bytes()).into_owned();
|
|
62
|
+
self.headers.push((key_str, value_str));
|
|
63
|
+
}
|
|
64
|
+
|
|
55
65
|
fn begin_game(&mut self) {
|
|
56
66
|
self.moves.clear();
|
|
57
67
|
self.pos = Chess::default();
|
|
@@ -183,12 +183,30 @@ class TestPgnExtraction(unittest.TestCase):
|
|
|
183
183
|
valid_reference = True
|
|
184
184
|
evals_reference = []
|
|
185
185
|
clock_times_reference = []
|
|
186
|
+
headers_reference = [
|
|
187
|
+
("Event", "Rated Classical game"),
|
|
188
|
+
("Site", "https://lichess.org/lhy6ehiv"),
|
|
189
|
+
("White", "goerch"),
|
|
190
|
+
("Black", "niltonrosao001"),
|
|
191
|
+
("Result", "0-1"),
|
|
192
|
+
("UTCDate", "2013.06.30"),
|
|
193
|
+
("UTCTime", "22:10:02"),
|
|
194
|
+
("WhiteElo", "1702"),
|
|
195
|
+
("BlackElo", "2011"),
|
|
196
|
+
("WhiteRatingDiff", "-3"),
|
|
197
|
+
("BlackRatingDiff", "+5"),
|
|
198
|
+
("ECO", "A46"),
|
|
199
|
+
("Opening", "Indian Game: Spielmann-Indian"),
|
|
200
|
+
("TimeControl", "600+8"),
|
|
201
|
+
("Termination", "Normal"),
|
|
202
|
+
]
|
|
186
203
|
|
|
187
204
|
self.assertTrue(extractor.moves == moves_reference)
|
|
188
205
|
self.assertTrue(extractor.comments == comments_reference)
|
|
189
206
|
self.assertTrue(extractor.valid_moves == valid_reference)
|
|
190
207
|
self.assertTrue(extractor.evals == evals_reference)
|
|
191
208
|
self.assertTrue(extractor.clock_times == clock_times_reference)
|
|
209
|
+
self.assertTrue(extractor.headers == headers_reference)
|
|
192
210
|
|
|
193
211
|
def test_full_pgn_annotated(self):
|
|
194
212
|
pgn_moves = """
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/bench_parquet.py
RENAMED
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/comment_parsing.rs
RENAMED
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.2.0 → rust_pgn_reader_python_binding-2.3.0}/src/example_str.py
RENAMED
|
File without changes
|