rust-pgn-reader-python-binding 2.4.0__tar.gz → 2.5.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.4.0 → rust_pgn_reader_python_binding-2.5.0}/Cargo.lock +11 -11
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/Cargo.toml +1 -1
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/PKG-INFO +1 -1
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/lib.rs +16 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/test.py +26 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/.github/workflows/CI.yml +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/.gitignore +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/README.md +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/benches/parquet_bench.rs +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/pyproject.toml +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/bench.py +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/bench_parquet.py +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/bench_parquet_parallel.py +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/comment_parsing.rs +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/example_rowgroup.py +0 -0
- {rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/example_str.py +0 -0
|
@@ -382,9 +382,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
|
|
382
382
|
|
|
383
383
|
[[package]]
|
|
384
384
|
name = "cc"
|
|
385
|
-
version = "1.2.
|
|
385
|
+
version = "1.2.7"
|
|
386
386
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
387
|
-
checksum = "
|
|
387
|
+
checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7"
|
|
388
388
|
dependencies = [
|
|
389
389
|
"jobserver",
|
|
390
390
|
"libc",
|
|
@@ -1171,9 +1171,9 @@ dependencies = [
|
|
|
1171
1171
|
|
|
1172
1172
|
[[package]]
|
|
1173
1173
|
name = "quote"
|
|
1174
|
-
version = "1.0.
|
|
1174
|
+
version = "1.0.38"
|
|
1175
1175
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1176
|
-
checksum = "
|
|
1176
|
+
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
|
1177
1177
|
dependencies = [
|
|
1178
1178
|
"proc-macro2",
|
|
1179
1179
|
]
|
|
@@ -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.5.0"
|
|
1233
1233
|
dependencies = [
|
|
1234
1234
|
"arrow",
|
|
1235
1235
|
"criterion",
|
|
@@ -1280,18 +1280,18 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
|
|
|
1280
1280
|
|
|
1281
1281
|
[[package]]
|
|
1282
1282
|
name = "serde"
|
|
1283
|
-
version = "1.0.
|
|
1283
|
+
version = "1.0.217"
|
|
1284
1284
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1285
|
-
checksum = "
|
|
1285
|
+
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
|
1286
1286
|
dependencies = [
|
|
1287
1287
|
"serde_derive",
|
|
1288
1288
|
]
|
|
1289
1289
|
|
|
1290
1290
|
[[package]]
|
|
1291
1291
|
name = "serde_derive"
|
|
1292
|
-
version = "1.0.
|
|
1292
|
+
version = "1.0.217"
|
|
1293
1293
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1294
|
-
checksum = "
|
|
1294
|
+
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
|
1295
1295
|
dependencies = [
|
|
1296
1296
|
"proc-macro2",
|
|
1297
1297
|
"quote",
|
|
@@ -1342,9 +1342,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|
|
1342
1342
|
|
|
1343
1343
|
[[package]]
|
|
1344
1344
|
name = "syn"
|
|
1345
|
-
version = "2.0.
|
|
1345
|
+
version = "2.0.94"
|
|
1346
1346
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1347
|
-
checksum = "
|
|
1347
|
+
checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3"
|
|
1348
1348
|
dependencies = [
|
|
1349
1349
|
"proc-macro2",
|
|
1350
1350
|
"quote",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rust_pgn_reader_python_binding
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -55,6 +55,9 @@ pub struct MoveExtractor {
|
|
|
55
55
|
#[pyo3(get)]
|
|
56
56
|
headers: Vec<(String, String)>,
|
|
57
57
|
|
|
58
|
+
#[pyo3(get)]
|
|
59
|
+
castling_rights: Vec<(bool, bool, bool, bool)>,
|
|
60
|
+
|
|
58
61
|
#[pyo3(get)]
|
|
59
62
|
position_status: Option<PositionStatus>,
|
|
60
63
|
|
|
@@ -74,6 +77,7 @@ impl MoveExtractor {
|
|
|
74
77
|
clock_times: Vec::with_capacity(100),
|
|
75
78
|
outcome: None,
|
|
76
79
|
headers: Vec::with_capacity(10),
|
|
80
|
+
castling_rights: Vec::with_capacity(100),
|
|
77
81
|
position_status: None,
|
|
78
82
|
}
|
|
79
83
|
}
|
|
@@ -129,6 +133,17 @@ impl Visitor for MoveExtractor {
|
|
|
129
133
|
self.pos.play_unchecked(&m);
|
|
130
134
|
let uci = UciMove::from_standard(&m);
|
|
131
135
|
self.moves.push(uci.to_string());
|
|
136
|
+
// self.pos.castles().castling_rights();
|
|
137
|
+
// println!("castling {:?}", self.pos.castles());
|
|
138
|
+
let castling_bitboard = self.pos.castles().castling_rights();
|
|
139
|
+
let castling_rights = (
|
|
140
|
+
castling_bitboard.contains(shakmaty::Square::A1),
|
|
141
|
+
castling_bitboard.contains(shakmaty::Square::H1),
|
|
142
|
+
castling_bitboard.contains(shakmaty::Square::A8),
|
|
143
|
+
castling_bitboard.contains(shakmaty::Square::H8),
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
self.castling_rights.push(castling_rights);
|
|
132
147
|
}
|
|
133
148
|
Err(err) => {
|
|
134
149
|
eprintln!("error in game: {} {}", err, san_plus);
|
|
@@ -257,6 +272,7 @@ fn parse_games(pgns: Vec<String>, num_threads: Option<usize>) -> PyResult<Vec<Mo
|
|
|
257
272
|
.map_err(|err| pyo3::exceptions::PyValueError::new_err(err))
|
|
258
273
|
}
|
|
259
274
|
|
|
275
|
+
// Parser for chess PGN notation
|
|
260
276
|
#[pymodule]
|
|
261
277
|
fn rust_pgn_reader_python_binding(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
262
278
|
m.add_function(wrap_pyfunction!(parse_game, m)?)?;
|
|
@@ -448,6 +448,32 @@ class TestPgnExtraction(unittest.TestCase):
|
|
|
448
448
|
self.assertTrue(extractor[1].position_status.turn == 1)
|
|
449
449
|
self.assertTrue(extractor[1].position_status.insufficient_material == (0, 0))
|
|
450
450
|
|
|
451
|
+
def test_castling(self):
|
|
452
|
+
pgn_moves = """
|
|
453
|
+
1. e4 e5 2. Bc4 c6 3. Nf3 d6 4. Rg1 f6 5. Rh1 g6 6. Ke2 b6 7. Ke1 g5
|
|
454
|
+
"""
|
|
455
|
+
|
|
456
|
+
extractor = self.run_extractor(pgn_moves)
|
|
457
|
+
|
|
458
|
+
castling_reference = [
|
|
459
|
+
(True, True, True, True),
|
|
460
|
+
(True, True, True, True),
|
|
461
|
+
(True, True, True, True),
|
|
462
|
+
(True, True, True, True),
|
|
463
|
+
(True, True, True, True),
|
|
464
|
+
(True, True, True, True),
|
|
465
|
+
(True, False, True, True),
|
|
466
|
+
(True, False, True, True),
|
|
467
|
+
(True, False, True, True),
|
|
468
|
+
(True, False, True, True),
|
|
469
|
+
(False, False, True, True),
|
|
470
|
+
(False, False, True, True),
|
|
471
|
+
(False, False, True, True),
|
|
472
|
+
(False, False, True, True),
|
|
473
|
+
]
|
|
474
|
+
|
|
475
|
+
self.assertTrue(extractor.castling_rights == castling_reference)
|
|
476
|
+
|
|
451
477
|
|
|
452
478
|
if __name__ == "__main__":
|
|
453
479
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/bench_parquet.py
RENAMED
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/comment_parsing.rs
RENAMED
|
File without changes
|
|
File without changes
|
{rust_pgn_reader_python_binding-2.4.0 → rust_pgn_reader_python_binding-2.5.0}/src/example_str.py
RENAMED
|
File without changes
|