diff --git a/Cargo.lock b/Cargo.lock index 73ca27fa..de284ecd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -181,7 +181,7 @@ version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn", @@ -349,12 +349,6 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -487,15 +481,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "lock_api" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.21" @@ -563,29 +548,6 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - [[package]] name = "plotters" version = "0.3.6" @@ -631,15 +593,15 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.21.2" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8" +checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884" dependencies = [ "cfg-if", "indoc", "libc", "memoffset", - "parking_lot", + "once_cell", "portable-atomic", "pyo3-build-config", "pyo3-ffi", @@ -649,9 +611,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.21.2" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" +checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38" dependencies = [ "once_cell", "target-lexicon", @@ -659,9 +621,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.21.2" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403" +checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636" dependencies = [ "libc", "pyo3-build-config", @@ -669,9 +631,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.21.2" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c" +checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -681,11 +643,11 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.21.2" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c" +checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "pyo3-build-config", "quote", @@ -721,15 +683,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" version = "1.10.4" @@ -846,12 +799,6 @@ dependencies = [ "sudachi", ] -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - [[package]] name = "strsim" version = "0.11.1" diff --git a/python/Cargo.toml b/python/Cargo.toml index 53cd97e5..95b8b6ce 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -15,7 +15,7 @@ name = "sudachipy" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.21", features = ["extension-module"] } +pyo3 = { version = "0.22", features = ["extension-module"] } scopeguard = "1" # Apache 2.0/MIT thread_local = "1.1" # Apache 2.0/MIT diff --git a/python/src/build.rs b/python/src/build.rs index 986144b5..532eb1fa 100644 --- a/python/src/build.rs +++ b/python/src/build.rs @@ -74,7 +74,10 @@ fn create_file(p: &Path) -> std::io::Result { /// :type output: pathlib.Path | str /// :type description: str #[pyfunction] -#[pyo3(text_signature = "(matrix, lex, output, description=None) -> list[tuple[str, int, float]]")] +#[pyo3( + signature = (matrix, lex, output, description=None), + text_signature = "(matrix, lex, output, description=None) -> list[tuple[str, int, float]]", +)] fn build_system_dic<'py>( py: Python<'py>, matrix: &Bound<'py, PyAny>, @@ -120,7 +123,10 @@ fn build_system_dic<'py>( /// :type output: pathlib.Path | str /// :type description: str #[pyfunction] -#[pyo3(text_signature = "(system, lex, output, description=None) -> list[tuple[str, int, float]]")] +#[pyo3( + signature = (system, lex, output, description=None), + text_signature = "(system, lex, output, description=None) -> list[tuple[str, int, float]]", +)] fn build_user_dic<'py>( py: Python<'py>, system: &Bound<'py, PyAny>, diff --git a/python/src/dictionary.rs b/python/src/dictionary.rs index 8239d42b..fb9892ea 100644 --- a/python/src/dictionary.rs +++ b/python/src/dictionary.rs @@ -371,7 +371,10 @@ impl PyDictionary { /// /// :type surface: str /// :type out: MorphemeList | None - #[pyo3(text_signature = "(self, /, surface, out=None) -> MorphemeList")] + #[pyo3( + signature = (surface, out=None), + text_signature = "(self, /, surface, out=None) -> MorphemeList", + )] fn lookup<'py>( &'py self, py: Python<'py>, diff --git a/python/src/morpheme.rs b/python/src/morpheme.rs index 80853b10..55a29571 100644 --- a/python/src/morpheme.rs +++ b/python/src/morpheme.rs @@ -219,7 +219,7 @@ impl PyMorphemeIter { } let morpheme = PyMorpheme { - list: self.list.clone(), + list: self.list.clone_ref(py), index: self.index, }; @@ -364,7 +364,10 @@ impl PyMorpheme { /// :type mode: SplitMode | None /// :type out: MorphemeList | None /// :type add_single: bool - #[pyo3(text_signature = "(self, /, mode, out=None, add_single=False) -> MorphemeList")] + #[pyo3( + signature = (mode, out=None, add_single=false), + text_signature = "(self, /, mode, out=None, add_single=False) -> MorphemeList", + )] fn split<'py>( &'py self, py: Python<'py>, diff --git a/python/src/tokenizer.rs b/python/src/tokenizer.rs index 6dcdc7ce..d5b938d9 100644 --- a/python/src/tokenizer.rs +++ b/python/src/tokenizer.rs @@ -40,7 +40,7 @@ use crate::morpheme::{PyMorphemeListWrapper, PyProjector}; /// If None, returns SplitMode.C. /// /// :type mode: str | None -#[pyclass(module = "sudachipy.tokenizer", name = "SplitMode", frozen)] +#[pyclass(module = "sudachipy.tokenizer", name = "SplitMode", eq, eq_int, frozen)] #[derive(Clone, PartialEq, Eq, Copy, Debug)] #[repr(u8)] pub enum PySplitMode { @@ -79,8 +79,8 @@ impl PySplitMode { /// :type mode: str | None #[new] #[pyo3( - text_signature="(mode=None) -> SplitMode", - signature=(mode=None) + signature = (mode=None), + text_signature = "(mode=None) -> SplitMode" )] fn new(mode: Option<&str>) -> PyResult { let mode = match mode {