From 50a3a35f2a94e99c039e7f492f6e8097ef48d7e5 Mon Sep 17 00:00:00 2001 From: Philipp Rehner Date: Fri, 20 Oct 2023 17:23:01 +0200 Subject: [PATCH] move more text_signature to #[new] --- feos-core/src/python/state.rs | 2 +- feos-dft/src/lib.rs | 1 - feos-dft/src/python/adsorption/pore.rs | 6 +++--- feos-dft/src/python/interface/surface_tension_diagram.rs | 2 +- feos-dft/src/python/solvation.rs | 2 +- feos-dft/src/python/solver.rs | 2 +- src/estimator/python.rs | 2 +- src/gc_pcsaft/python/mod.rs | 6 ++++-- src/lib.rs | 1 - src/pcsaft/python.rs | 6 +++--- src/pets/python.rs | 6 +++--- src/saftvrqmie/python.rs | 8 ++++---- src/uvtheory/python.rs | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/feos-core/src/python/state.rs b/feos-core/src/python/state.rs index f1b5a5d58..497191e00 100644 --- a/feos-core/src/python/state.rs +++ b/feos-core/src/python/state.rs @@ -48,12 +48,12 @@ macro_rules! impl_state { /// When the state cannot be created using the combination of input. #[pyclass(name = "State")] #[derive(Clone)] - #[pyo3(text_signature = "(eos, temperature=None, volume=None, density=None, partial_density=None, total_moles=None, moles=None, molefracs=None, pressure=None, molar_enthalpy=None, molar_entropy=None, molar_internal_energy=None, density_initialization=None, initial_temperature=None)")] pub struct PyState(pub State<$eos>); #[pymethods] impl PyState { #[new] + #[pyo3(text_signature = "(eos, temperature=None, volume=None, density=None, partial_density=None, total_moles=None, moles=None, molefracs=None, pressure=None, molar_enthalpy=None, molar_entropy=None, molar_internal_energy=None, density_initialization=None, initial_temperature=None)")] pub fn new( eos: $py_eos, temperature: Option, diff --git a/feos-dft/src/lib.rs b/feos-dft/src/lib.rs index 4323b2303..2962fbeea 100644 --- a/feos-dft/src/lib.rs +++ b/feos-dft/src/lib.rs @@ -2,7 +2,6 @@ #![allow(clippy::suspicious_operation_groupings)] #![allow(clippy::too_many_arguments)] #![allow(clippy::new_ret_no_self)] -#![allow(deprecated)] pub mod adsorption; mod convolver; diff --git a/feos-dft/src/python/adsorption/pore.rs b/feos-dft/src/python/adsorption/pore.rs index 00f329cb9..2e210cb28 100644 --- a/feos-dft/src/python/adsorption/pore.rs +++ b/feos-dft/src/python/adsorption/pore.rs @@ -22,7 +22,6 @@ macro_rules! impl_pore { /// Pore1D /// #[pyclass(name = "Pore1D")] - #[pyo3(text_signature = "(geometry, pore_size, potential, n_grid=None, potential_cutoff=None)")] pub struct PyPore1D(Pore1D); #[pyclass(name = "PoreProfile1D")] @@ -33,6 +32,7 @@ macro_rules! impl_pore { #[pymethods] impl PyPore1D { #[new] + #[pyo3(text_signature = "(geometry, pore_size, potential, n_grid=None, potential_cutoff=None)")] fn new( geometry: Geometry, pore_size: PySINumber, @@ -135,7 +135,6 @@ macro_rules! impl_pore { } #[pyclass(name = "Pore2D")] - #[pyo3(text_signature = "(geometry, pore_size, potential, n_grid=None, potential_cutoff=None)")] pub struct PyPore2D(Pore2D); #[pyclass(name = "PoreProfile2D")] @@ -146,6 +145,7 @@ macro_rules! impl_pore { #[pymethods] impl PyPore2D { #[new] + #[pyo3(text_signature = "(system_size, angle, n_grid)")] fn new( system_size: [PySINumber; 2], angle: PyAngle, @@ -245,7 +245,6 @@ macro_rules! impl_pore { /// Pore3D /// #[pyclass(name = "Pore3D")] - #[pyo3(text_signature = "(system_size, angles, n_grid, coordinates, sigma_ss, epsilon_k_ss, potential_cutoff=None, cutoff_radius=None)")] pub struct PyPore3D(Pore3D); #[pyclass(name = "PoreProfile3D")] @@ -256,6 +255,7 @@ macro_rules! impl_pore { #[pymethods] impl PyPore3D { #[new] + #[pyo3(text_signature = "(system_size, n_grid, coordinates, sigma_ss, epsilon_k_ss, angles=None, potential_cutoff=None, cutoff_radius=None)")] fn new( system_size: [PySINumber; 3], n_grid: [usize; 3], diff --git a/feos-dft/src/python/interface/surface_tension_diagram.rs b/feos-dft/src/python/interface/surface_tension_diagram.rs index b45f91be4..8808f7a50 100644 --- a/feos-dft/src/python/interface/surface_tension_diagram.rs +++ b/feos-dft/src/python/interface/surface_tension_diagram.rs @@ -31,12 +31,12 @@ macro_rules! impl_surface_tension_diagram { /// SurfaceTensionDiagram /// #[pyclass(name = "SurfaceTensionDiagram")] - #[pyo3(text_signature = "(dia, init_densities=None, n_grid=None, l_grid=None, critical_temperature=None, fix_equimolar_surface=None, solver=None)")] pub struct PySurfaceTensionDiagram(SurfaceTensionDiagram<$func>); #[pymethods] impl PySurfaceTensionDiagram { #[new] + #[pyo3(text_signature = "(dia, init_densities=None, n_grid=None, l_grid=None, critical_temperature=None, fix_equimolar_surface=None, solver=None)")] pub fn isotherm( dia: Vec, init_densities: Option, diff --git a/feos-dft/src/python/solvation.rs b/feos-dft/src/python/solvation.rs index cc9b4d6a7..fc9cd6439 100644 --- a/feos-dft/src/python/solvation.rs +++ b/feos-dft/src/python/solvation.rs @@ -27,7 +27,6 @@ macro_rules! impl_solvation_profile { /// SolvationProfile /// #[pyclass(name = "SolvationProfile")] - #[pyo3(text_signature = "(bulk, n_grid, coordinates, sigma, epsilon_k, system_size=None, cutoff_radius=None, potential_cutoff=None)")] pub struct PySolvationProfile(SolvationProfile<$func>); impl_3d_profile!(PySolvationProfile, get_x, get_y, get_z); @@ -35,6 +34,7 @@ macro_rules! impl_solvation_profile { #[pymethods] impl PySolvationProfile { #[new] + #[pyo3(text_signature = "(bulk, n_grid, coordinates, sigma, epsilon_k, system_size=None, cutoff_radius=None, potential_cutoff=None)")] fn new( bulk: &PyState, n_grid: [usize; 3], diff --git a/feos-dft/src/python/solver.rs b/feos-dft/src/python/solver.rs index 2d61d5b34..b63a99af6 100644 --- a/feos-dft/src/python/solver.rs +++ b/feos-dft/src/python/solver.rs @@ -17,12 +17,12 @@ use quantity::python::PySIArray1; /// DFTSolver #[pyclass(name = "DFTSolver")] #[derive(Clone)] -#[pyo3(text_signature = "(verbosity=None)")] pub struct PyDFTSolver(pub DFTSolver); #[pymethods] impl PyDFTSolver { #[new] + #[pyo3(text_signature = "(verbosity=None)")] fn new(verbosity: Option) -> Self { Self(DFTSolver::new(verbosity)) } diff --git a/src/estimator/python.rs b/src/estimator/python.rs index 89ebd1b4b..01a398a26 100644 --- a/src/estimator/python.rs +++ b/src/estimator/python.rs @@ -485,12 +485,12 @@ macro_rules! impl_estimator { /// ------- /// Estimator #[pyclass(name = "Estimator")] - #[pyo3(text_signature = "(data, weights, losses)")] pub struct PyEstimator(Estimator<$eos>); #[pymethods] impl PyEstimator { #[new] + #[pyo3(text_signature = "(data, weights, losses)")] fn new(data: Vec, weights: Vec, losses: Vec) -> Self { Self(Estimator::new( data.iter().map(|d| d.0.clone()).collect(), diff --git a/src/gc_pcsaft/python/mod.rs b/src/gc_pcsaft/python/mod.rs index b73ad24a5..437226f69 100644 --- a/src/gc_pcsaft/python/mod.rs +++ b/src/gc_pcsaft/python/mod.rs @@ -19,14 +19,16 @@ use std::sync::Arc; mod micelles; #[pyclass(name = "GcPcSaftRecord")] -#[pyo3(text_signature = "(m, sigma, epsilon_k, mu=None, association_record=None, psi_dft=None)")] #[derive(Clone)] pub struct PyGcPcSaftRecord(GcPcSaftRecord); #[pymethods] impl PyGcPcSaftRecord { - #[pyo3(signature = (m, sigma, epsilon_k, mu=None, association_record=None, psi_dft=None))] #[new] + #[pyo3( + text_signature = "(m, sigma, epsilon_k, mu=None, association_record=None, psi_dft=None)", + signature = (m, sigma, epsilon_k, mu=None, association_record=None, psi_dft=None) + )] fn new( m: f64, sigma: f64, diff --git a/src/lib.rs b/src/lib.rs index 15698d217..97b89d804 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,6 @@ #![warn(clippy::all)] #![allow(clippy::too_many_arguments)] -#![allow(deprecated)] #[cfg(feature = "dft")] mod dft; diff --git a/src/pcsaft/python.rs b/src/pcsaft/python.rs index cb492c64b..a65efaa71 100644 --- a/src/pcsaft/python.rs +++ b/src/pcsaft/python.rs @@ -43,15 +43,15 @@ use std::sync::Arc; /// thermal_conductivity : List[float], optional /// Entropy-scaling parameters for thermal_conductivity. Defaults to `None`. #[pyclass(name = "PcSaftRecord")] -#[pyo3( - text_signature = "(m, sigma, epsilon_k, mu=None, q=None, kappa_ab=None, epsilon_k_ab=None, na=None, nb=None, viscosity=None, diffusion=None, thermal_conductivity=None)" -)] #[derive(Clone)] pub struct PyPcSaftRecord(PcSaftRecord); #[pymethods] impl PyPcSaftRecord { #[new] + #[pyo3( + text_signature = "(m, sigma, epsilon_k, mu=None, q=None, kappa_ab=None, epsilon_k_ab=None, na=None, nb=None, nc=None, viscosity=None, diffusion=None, thermal_conductivity=None)" + )] fn new( m: f64, sigma: f64, diff --git a/src/pets/python.rs b/src/pets/python.rs index 3caa96dbb..e10efb3d2 100644 --- a/src/pets/python.rs +++ b/src/pets/python.rs @@ -10,15 +10,15 @@ use std::sync::Arc; /// Create a set of PeTS parameters from records. #[pyclass(name = "PetsRecord")] -#[pyo3( - text_signature = "(sigma, epsilon_k, viscosity=None, diffusion=None, thermal_conductivity=None)" -)] #[derive(Clone)] pub struct PyPetsRecord(PetsRecord); #[pymethods] impl PyPetsRecord { #[new] + #[pyo3( + text_signature = "(sigma, epsilon_k, viscosity=None, diffusion=None, thermal_conductivity=None)" + )] fn new( sigma: f64, epsilon_k: f64, diff --git a/src/saftvrqmie/python.rs b/src/saftvrqmie/python.rs index 44682a086..6da5c2bd7 100644 --- a/src/saftvrqmie/python.rs +++ b/src/saftvrqmie/python.rs @@ -42,15 +42,15 @@ use std::sync::Arc; /// thermal_conductivity : List[float], optional /// Entropy-scaling parameters for thermal_conductivity. Defaults to `None`. #[pyclass(name = "SaftVRQMieRecord")] -#[pyo3( - text_signature = "(m, sigma, epsilon_k, lr, la, fh, viscosity=None, diffusion=None, thermal_conductivity=None)" -)] #[derive(Clone)] pub struct PySaftVRQMieRecord(SaftVRQMieRecord); #[pymethods] impl PySaftVRQMieRecord { #[new] + #[pyo3( + text_signature = "(m, sigma, epsilon_k, lr, la, fh, viscosity=None, diffusion=None, thermal_conductivity=None)" + )] fn new( m: f64, sigma: f64, @@ -122,13 +122,13 @@ impl PySaftVRQMieRecord { /// Create a binary record from k_ij and l_ij values. #[pyclass(name = "SaftVRQMieBinaryRecord")] -#[pyo3(text_signature = "(k_ij, l_ij)")] #[derive(Clone)] pub struct PySaftVRQMieBinaryRecord(SaftVRQMieBinaryRecord); #[pymethods] impl PySaftVRQMieBinaryRecord { #[new] + #[pyo3(text_signature = "(k_ij, l_ij)")] fn new(k_ij: f64, l_ij: f64) -> Self { Self(SaftVRQMieBinaryRecord { k_ij, l_ij }) } diff --git a/src/uvtheory/python.rs b/src/uvtheory/python.rs index baa06e093..00d6d71c8 100644 --- a/src/uvtheory/python.rs +++ b/src/uvtheory/python.rs @@ -18,13 +18,13 @@ struct PyNoRecord(NoRecord); /// Create a set of UV Theory parameters from records. #[pyclass(name = "UVRecord")] -#[pyo3(text_signature = "(rep, att, sigma, epsilon_k)")] #[derive(Clone)] pub struct PyUVRecord(UVRecord); #[pymethods] impl PyUVRecord { #[new] + #[pyo3(text_signature = "(rep, att, sigma, epsilon_k)")] fn new(rep: f64, att: f64, sigma: f64, epsilon_k: f64) -> Self { Self(UVRecord::new(rep, att, sigma, epsilon_k)) }