clean up remnants of deprecated & removed features
This commit is contained in:
parent
e42d8cf612
commit
46c3190a17
|
@ -2,9 +2,9 @@
|
|||
|
||||
The `#[pyfunction]` attribute also accepts parameters to control how the generated Python function accepts arguments. Just like in Python, arguments can be positional-only, keyword-only, or accept either. `*args` lists and `**kwargs` dicts can also be accepted. These parameters also work for `#[pymethods]` which will be introduced in the [Python Classes](../class.md) section of the guide.
|
||||
|
||||
Like Python, by default PyO3 accepts all arguments as either positional or keyword arguments. Most arguments are required by default, except for trailing `Option<_>` arguments, which are [implicitly given a default of `None`](#trailing-optional-arguments). There are two ways to modify this behaviour:
|
||||
- The `#[pyo3(signature = (...))]` option which allows writing a signature in Python syntax.
|
||||
- Extra arguments directly to `#[pyfunction]`. (See deprecated form)
|
||||
Like Python, by default PyO3 accepts all arguments as either positional or keyword arguments. Most arguments are required by default, except for trailing `Option<_>` arguments, which are [implicitly given a default of `None`](#trailing-optional-arguments). This behaviour can be configured by the `#[pyo3(signature = (...))]` option which allows writing a signature in Python syntax.
|
||||
|
||||
This section of the guide goes into detail about use of the `#[pyo3(signature = (...))]` option and its related option `#[pyo3(text_signature = "...")]`
|
||||
|
||||
## Using `#[pyo3(signature = (...))]`
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ use std::borrow::Cow;
|
|||
use crate::attributes::kw::frozen;
|
||||
use crate::attributes::{
|
||||
self, kw, take_pyo3_options, CrateAttribute, ExtendsAttribute, FreelistAttribute,
|
||||
ModuleAttribute, NameAttribute, NameLitStr, RenameAllAttribute, TextSignatureAttribute,
|
||||
TextSignatureAttributeValue,
|
||||
ModuleAttribute, NameAttribute, NameLitStr, RenameAllAttribute,
|
||||
};
|
||||
use crate::deprecations::Deprecations;
|
||||
use crate::konst::{ConstAttributes, ConstSpec};
|
||||
|
@ -68,7 +67,6 @@ pub struct PyClassPyO3Options {
|
|||
pub sequence: Option<kw::sequence>,
|
||||
pub set_all: Option<kw::set_all>,
|
||||
pub subclass: Option<kw::subclass>,
|
||||
pub text_signature: Option<TextSignatureAttribute>,
|
||||
pub unsendable: Option<kw::unsendable>,
|
||||
pub weakref: Option<kw::weakref>,
|
||||
}
|
||||
|
@ -886,18 +884,6 @@ impl<'a> PyClassImplsBuilder<'a> {
|
|||
fn impl_pyclassimpl(&self) -> Result<TokenStream> {
|
||||
let cls = self.cls;
|
||||
let doc = self.doc.as_ref().map_or(quote! {"\0"}, |doc| quote! {#doc});
|
||||
let deprecated_text_signature = match self
|
||||
.attr
|
||||
.options
|
||||
.text_signature
|
||||
.as_ref()
|
||||
.map(|attr| &attr.value)
|
||||
{
|
||||
Some(TextSignatureAttributeValue::Str(s)) => quote!(::std::option::Option::Some(#s)),
|
||||
Some(TextSignatureAttributeValue::Disabled(_)) | None => {
|
||||
quote!(::std::option::Option::None)
|
||||
}
|
||||
};
|
||||
let is_basetype = self.attr.options.subclass.is_some();
|
||||
let base = self
|
||||
.attr
|
||||
|
@ -1040,7 +1026,7 @@ impl<'a> PyClassImplsBuilder<'a> {
|
|||
static DOC: _pyo3::sync::GILOnceCell<::std::borrow::Cow<'static, ::std::ffi::CStr>> = _pyo3::sync::GILOnceCell::new();
|
||||
DOC.get_or_try_init(py, || {
|
||||
let collector = PyClassImplCollector::<Self>::new();
|
||||
build_pyclass_doc(<#cls as _pyo3::PyTypeInfo>::NAME, #doc, #deprecated_text_signature.or_else(|| collector.new_text_signature()))
|
||||
build_pyclass_doc(<#cls as _pyo3::PyTypeInfo>::NAME, #doc, collector.new_text_signature())
|
||||
}).map(::std::ops::Deref::deref)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue