bump pyo3 from 0.20 to 0.21
This commit is contained in:
Generated
+10
-10
@@ -103,9 +103,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3"
|
||||
version = "0.20.3"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233"
|
||||
checksum = "a02a88a17e74cadbc8ce77855e1d6c8ad0ab82901a4a9b5046bd01c1c0bd95cd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"indoc",
|
||||
@@ -121,9 +121,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-build-config"
|
||||
version = "0.20.3"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7"
|
||||
checksum = "a5eb0b6ecba38961f6f4bd6cd5906dfab3cd426ff37b2eed5771006aa31656f1"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"target-lexicon",
|
||||
@@ -131,9 +131,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-ffi"
|
||||
version = "0.20.3"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa"
|
||||
checksum = "ba8a6e48a29b5d22e4fdaf132d8ba8d3203ee9f06362d48f244346902a594ec3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pyo3-build-config",
|
||||
@@ -141,9 +141,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-macros"
|
||||
version = "0.20.3"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158"
|
||||
checksum = "4e80493c5965f94a747d0782a607b2328a4eea5391327b152b00e2f3b001cede"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"pyo3-macros-backend",
|
||||
@@ -153,9 +153,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-macros-backend"
|
||||
version = "0.20.3"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185"
|
||||
checksum = "fcd7d86f42004025200e12a6a8119bd878329e6fddef8178eaafa4e4b5906c5b"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ name = "rosu_pp_py"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
pyo3 = { version = "0.20.3", features = ["extension-module", "macros"] }
|
||||
pyo3 = { version = "0.21", features = ["extension-module", "macros"] }
|
||||
rosu-pp = { git = "https://github.com/MaxOhn/rosu-pp", branch = "next", features = ["sync"] }
|
||||
|
||||
[profile.release]
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
use pyo3::{exceptions::PyTypeError, pyclass, pymethods, types::PyDict, PyRef, PyResult};
|
||||
use pyo3::{
|
||||
exceptions::PyTypeError,
|
||||
pyclass, pymethods,
|
||||
types::{PyAnyMethods, PyDict},
|
||||
Bound, PyRef, PyResult,
|
||||
};
|
||||
use rosu_pp::model::beatmap::{BeatmapAttributes, BeatmapAttributesBuilder, HitWindows};
|
||||
|
||||
use crate::{beatmap::PyBeatmap, error::ArgsError, mode::PyGameMode};
|
||||
@@ -24,14 +29,14 @@ pub struct PyBeatmapAttributesBuilder {
|
||||
impl PyBeatmapAttributesBuilder {
|
||||
#[new]
|
||||
#[pyo3(signature = (**kwargs))]
|
||||
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
||||
fn new(kwargs: Option<&Bound<'_, PyDict>>) -> PyResult<Self> {
|
||||
let mut this = Self::default();
|
||||
|
||||
let Some(kwargs) = kwargs else {
|
||||
return Ok(this);
|
||||
};
|
||||
|
||||
for (key, value) in kwargs.iter() {
|
||||
for (key, value) in kwargs {
|
||||
match key.extract()? {
|
||||
"map" => {
|
||||
let map = value
|
||||
|
||||
+8
-3
@@ -1,6 +1,11 @@
|
||||
use std::{error::Error as StdError, fmt::Write};
|
||||
|
||||
use pyo3::{exceptions::PyTypeError, pyclass, pymethods, types::PyDict, PyResult};
|
||||
use pyo3::{
|
||||
exceptions::PyTypeError,
|
||||
pyclass, pymethods,
|
||||
types::{PyAnyMethods, PyDict},
|
||||
Bound, PyResult,
|
||||
};
|
||||
use rosu_pp::{
|
||||
model::{
|
||||
hit_object::HitObjectKind,
|
||||
@@ -23,7 +28,7 @@ pub struct PyBeatmap {
|
||||
impl PyBeatmap {
|
||||
#[new]
|
||||
#[pyo3(signature = (**kwargs))]
|
||||
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
||||
fn new(kwargs: Option<&Bound<'_, PyDict>>) -> PyResult<Self> {
|
||||
let Some(kwargs) = kwargs else {
|
||||
return Err(ArgsError::new_err(
|
||||
"kwarg 'path', 'bytes', or 'content' must be specified",
|
||||
@@ -32,7 +37,7 @@ impl PyBeatmap {
|
||||
|
||||
let mut map_res = None;
|
||||
|
||||
for (key, value) in kwargs.iter() {
|
||||
for (key, value) in kwargs {
|
||||
match key.extract()? {
|
||||
"path" => {
|
||||
let path = value
|
||||
|
||||
+8
-3
@@ -1,4 +1,9 @@
|
||||
use pyo3::{exceptions::PyTypeError, pyclass, pymethods, types::PyDict, PyResult};
|
||||
use pyo3::{
|
||||
exceptions::PyTypeError,
|
||||
pyclass, pymethods,
|
||||
types::{PyAnyMethods, PyDict},
|
||||
Bound, PyResult,
|
||||
};
|
||||
use rosu_pp::Difficulty;
|
||||
|
||||
use crate::{
|
||||
@@ -31,14 +36,14 @@ pub struct PyDifficulty {
|
||||
impl PyDifficulty {
|
||||
#[new]
|
||||
#[pyo3(signature = (**kwargs))]
|
||||
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
||||
fn new(kwargs: Option<&Bound<'_, PyDict>>) -> PyResult<Self> {
|
||||
let mut this = Self::default();
|
||||
|
||||
let Some(kwargs) = kwargs else {
|
||||
return Ok(this);
|
||||
};
|
||||
|
||||
for (key, value) in kwargs.iter() {
|
||||
for (key, value) in kwargs {
|
||||
match key.extract()? {
|
||||
"mods" => {
|
||||
this.mods = value
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
use error::ConvertError;
|
||||
use performance::PyHitResultPriority;
|
||||
use pyo3::{pymodule, types::PyModule, PyResult, Python};
|
||||
use pyo3::{pymodule, types::PyModule, Bound, PyResult, Python};
|
||||
|
||||
use self::{
|
||||
attributes::{
|
||||
@@ -32,7 +32,7 @@ mod score_state;
|
||||
mod strains;
|
||||
|
||||
#[pymodule]
|
||||
fn rosu_pp_py(py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
||||
fn rosu_pp_py(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
m.add_class::<PyBeatmap>()?;
|
||||
m.add_class::<PyDifficulty>()?;
|
||||
m.add_class::<PyPerformance>()?;
|
||||
@@ -49,9 +49,9 @@ fn rosu_pp_py(py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
||||
m.add_class::<PyPerformanceAttributes>()?;
|
||||
m.add_class::<PyStrains>()?;
|
||||
|
||||
m.add("ParseError", py.get_type::<ParseError>())?;
|
||||
m.add("ArgsError", py.get_type::<ArgsError>())?;
|
||||
m.add("ConvertError", py.get_type::<ConvertError>())?;
|
||||
m.add("ParseError", py.get_type_bound::<ParseError>())?;
|
||||
m.add("ArgsError", py.get_type_bound::<ArgsError>())?;
|
||||
m.add("ConvertError", py.get_type_bound::<ConvertError>())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+10
-7
@@ -1,4 +1,9 @@
|
||||
use pyo3::{exceptions::PyTypeError, pyclass, pymethods, types::PyDict, PyAny, PyRef, PyResult};
|
||||
use pyo3::{
|
||||
exceptions::PyTypeError,
|
||||
pyclass, pymethods,
|
||||
types::{PyAnyMethods, PyDict},
|
||||
Bound, PyAny, PyRef, PyResult,
|
||||
};
|
||||
use rosu_pp::{
|
||||
any::{DifficultyAttributes, HitResultPriority},
|
||||
Difficulty, Performance,
|
||||
@@ -41,14 +46,14 @@ pub struct PyPerformance {
|
||||
impl PyPerformance {
|
||||
#[new]
|
||||
#[pyo3(signature = (**kwargs))]
|
||||
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
||||
fn new(kwargs: Option<&Bound<'_, PyDict>>) -> PyResult<Self> {
|
||||
let mut this = Self::default();
|
||||
|
||||
let Some(kwargs) = kwargs else {
|
||||
return Ok(this);
|
||||
};
|
||||
|
||||
for (key, value) in kwargs.iter() {
|
||||
for (key, value) in kwargs {
|
||||
match key.extract()? {
|
||||
"mods" => {
|
||||
this.mods = value
|
||||
@@ -175,13 +180,11 @@ impl PyPerformance {
|
||||
)
|
||||
}
|
||||
"hitresult_priority" => {
|
||||
let priority: PyHitResultPriority = value.extract().map_err(|_| {
|
||||
this.hitresult_priority = value.extract().map_err(|_| {
|
||||
PyTypeError::new_err(
|
||||
"kwarg 'hitresult_priority': must be a HitResultPriority",
|
||||
)
|
||||
})?;
|
||||
|
||||
this.hitresult_priority = priority.into()
|
||||
}
|
||||
kwarg => {
|
||||
let err = format!(
|
||||
@@ -201,7 +204,7 @@ impl PyPerformance {
|
||||
Ok(this)
|
||||
}
|
||||
|
||||
fn calculate(&self, args: &PyAny) -> PyResult<PyPerformanceAttributes> {
|
||||
fn calculate(&self, args: &Bound<'_, PyAny>) -> PyResult<PyPerformanceAttributes> {
|
||||
let _map;
|
||||
|
||||
let mut perf = if let Ok(attrs) = args.extract::<PyPerformanceAttributes>() {
|
||||
|
||||
+7
-2
@@ -1,6 +1,11 @@
|
||||
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
|
||||
|
||||
use pyo3::{exceptions::PyTypeError, pyclass, types::PyDict, PyResult};
|
||||
use pyo3::{
|
||||
exceptions::PyTypeError,
|
||||
pyclass,
|
||||
types::{PyAnyMethods, PyDict},
|
||||
Bound, PyResult,
|
||||
};
|
||||
use rosu_pp::any::ScoreState;
|
||||
|
||||
use crate::error::ArgsError;
|
||||
@@ -28,7 +33,7 @@ pub struct PyScoreState {
|
||||
impl PyScoreState {
|
||||
#[new]
|
||||
#[pyo3(signature = (**kwargs))]
|
||||
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
||||
fn new(kwargs: Option<&Bound<'_, PyDict>>) -> PyResult<Self> {
|
||||
let mut this = Self::default();
|
||||
|
||||
let Some(kwargs) = kwargs else {
|
||||
|
||||
Reference in New Issue
Block a user