mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
@@ -45,7 +45,11 @@ pub fn pyclass(
|
||||
) -> proc_macro::TokenStream {
|
||||
let attr = parse_macro_input!(attr as AttributeArgs);
|
||||
let item = parse_macro_input!(item as Item);
|
||||
result_to_tokens(pyclass::impl_pyclass(attr, item))
|
||||
if matches!(item, syn::Item::Impl(_) | syn::Item::Trait(_)) {
|
||||
result_to_tokens(pyclass::impl_pyimpl(attr, item))
|
||||
} else {
|
||||
result_to_tokens(pyclass::impl_pyclass(attr, item))
|
||||
}
|
||||
}
|
||||
|
||||
/// This macro serves a goal of generating multiple
|
||||
@@ -76,16 +80,6 @@ pub fn pyexception(
|
||||
result_to_tokens(pyclass::impl_pyexception(attr, item))
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn pyimpl(
|
||||
attr: proc_macro::TokenStream,
|
||||
item: proc_macro::TokenStream,
|
||||
) -> proc_macro::TokenStream {
|
||||
let attr = parse_macro_input!(attr as AttributeArgs);
|
||||
let item = parse_macro_input!(item as Item);
|
||||
result_to_tokens(pyclass::impl_pyimpl(attr, item))
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn pymodule(
|
||||
attr: proc_macro::TokenStream,
|
||||
|
||||
@@ -373,7 +373,7 @@ pub(crate) fn impl_define_exception(exc_def: PyExceptionDef) -> Result<TokenStre
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT))]
|
||||
impl #class_name {
|
||||
#[pyslot]
|
||||
pub(crate) fn slot_new(
|
||||
@@ -959,7 +959,7 @@ fn extract_impl_attrs(attr: AttributeArgs, item: &Ident) -> Result<ExtractedImpl
|
||||
let path = match meta {
|
||||
NestedMeta::Meta(Meta::Path(path)) => path,
|
||||
meta => {
|
||||
bail_span!(meta, "#[pyimpl(with(...))] arguments should be paths")
|
||||
bail_span!(meta, "#[pyclass(with(...))] arguments should be paths")
|
||||
}
|
||||
};
|
||||
let (extend_class, extend_slots) = if path_eq(&path, "PyRef") {
|
||||
@@ -993,12 +993,12 @@ fn extract_impl_attrs(attr: AttributeArgs, item: &Ident) -> Result<ExtractedImpl
|
||||
} else {
|
||||
bail_span!(
|
||||
path,
|
||||
"#[pyimpl(flags(...))] arguments should be ident"
|
||||
"#[pyclass(flags(...))] arguments should be ident"
|
||||
)
|
||||
}
|
||||
}
|
||||
meta => {
|
||||
bail_span!(meta, "#[pyimpl(flags(...))] arguments should be ident")
|
||||
bail_span!(meta, "#[pyclass(flags(...))] arguments should be ident")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1098,7 +1098,7 @@ where
|
||||
if ALL_ALLOWED_NAMES.contains(&attr_name.as_str()) {
|
||||
return Err(syn::Error::new_spanned(
|
||||
attr,
|
||||
format!("#[pyimpl] doesn't accept #[{}]", wrong_name),
|
||||
format!("#[pyclass] doesn't accept #[{}]", wrong_name),
|
||||
));
|
||||
} else {
|
||||
continue;
|
||||
|
||||
@@ -69,6 +69,10 @@ pub fn impl_pymodule(attr: AttributeArgs, module_item: Item) -> Result<TokenStre
|
||||
|
||||
// collect to context
|
||||
for item in items.iter_mut() {
|
||||
if matches!(item, Item::Impl(_) | Item::Trait(_)) {
|
||||
// #[pyclass] implementations
|
||||
continue;
|
||||
}
|
||||
let r = item.try_split_attr_mut(|attrs, item| {
|
||||
let (pyitems, cfgs) = attrs_to_module_items(attrs, module_item_new)?;
|
||||
for pyitem in pyitems.iter().rev() {
|
||||
|
||||
@@ -673,7 +673,7 @@ mod array {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(Comparable, AsBuffer, AsMapping, Iterable, Constructor)
|
||||
)]
|
||||
@@ -1293,7 +1293,7 @@ mod array {
|
||||
internal: PyMutex<PositionIterInternal<PyArrayRef>>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext), flags(HAS_DICT))]
|
||||
#[pyclass(with(IterNext), flags(HAS_DICT))]
|
||||
impl PyArrayIter {
|
||||
#[pymethod(magic)]
|
||||
fn setstate(&self, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
|
||||
@@ -14,7 +14,7 @@ mod _contextvars {
|
||||
#[derive(Debug, PyPayload)]
|
||||
struct PyContext {} // not to confuse with vm::Context
|
||||
|
||||
#[pyimpl(with(Initializer))]
|
||||
#[pyclass(with(Initializer))]
|
||||
impl PyContext {
|
||||
#[pymethod]
|
||||
fn run(
|
||||
@@ -99,7 +99,7 @@ mod _contextvars {
|
||||
default: OptionalArg<PyObjectRef>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(Initializer))]
|
||||
#[pyclass(with(Initializer))]
|
||||
impl ContextVar {
|
||||
#[pyproperty]
|
||||
fn name(&self) -> String {
|
||||
@@ -172,7 +172,7 @@ mod _contextvars {
|
||||
old_value: PyObjectRef,
|
||||
}
|
||||
|
||||
#[pyimpl(with(Initializer))]
|
||||
#[pyclass(with(Initializer))]
|
||||
impl ContextToken {
|
||||
#[pyproperty]
|
||||
fn var(&self, _vm: &VirtualMachine) -> PyObjectRef {
|
||||
|
||||
@@ -165,7 +165,7 @@ mod _csv {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl Reader {}
|
||||
impl IterNextIterable for Reader {}
|
||||
impl IterNext for Reader {
|
||||
@@ -255,7 +255,7 @@ mod _csv {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl Writer {
|
||||
#[pymethod]
|
||||
fn writerow(&self, row: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
|
||||
@@ -21,7 +21,7 @@ mod grp {
|
||||
gr_gid: u32,
|
||||
gr_mem: PyListRef,
|
||||
}
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl Group {
|
||||
fn from_unistd_group(group: unistd::Group, vm: &VirtualMachine) -> Self {
|
||||
let cstr_lossy = |s: std::ffi::CString| {
|
||||
|
||||
@@ -58,7 +58,7 @@ mod hashlib {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyHasher {
|
||||
fn new(name: &str, d: HashWrapper) -> Self {
|
||||
PyHasher {
|
||||
|
||||
@@ -64,7 +64,7 @@ mod _json {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Constructor))]
|
||||
#[pyclass(with(Callable, Constructor))]
|
||||
impl JsonScanner {
|
||||
fn parse(
|
||||
&self,
|
||||
|
||||
@@ -458,7 +458,7 @@ mod mmap {
|
||||
};
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, AsMapping, AsSequence, AsBuffer), flags(BASETYPE))]
|
||||
#[pyclass(with(Constructor, AsMapping, AsSequence, AsBuffer), flags(BASETYPE))]
|
||||
impl PyMmap {
|
||||
fn as_bytes_mut(&self) -> BorrowedValueMut<[u8]> {
|
||||
PyMutexGuard::map(self.mmap.lock(), |m| {
|
||||
|
||||
@@ -62,7 +62,7 @@ mod _pyexpat {
|
||||
vm.invoke(&handler.read().clone(), args).ok();
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyExpatLikeXmlParser {
|
||||
fn new(vm: &VirtualMachine) -> PyResult<PyExpatLikeXmlParserRef> {
|
||||
Ok(PyExpatLikeXmlParser {
|
||||
|
||||
@@ -197,7 +197,7 @@ pub(crate) mod _struct {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl UnpackIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
@@ -256,7 +256,7 @@ pub(crate) mod _struct {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl PyStruct {
|
||||
#[pyproperty]
|
||||
fn format(&self) -> PyStrRef {
|
||||
|
||||
@@ -78,7 +78,7 @@ mod _random {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Constructor))]
|
||||
#[pyclass(flags(BASETYPE), with(Constructor))]
|
||||
impl PyRandom {
|
||||
#[pymethod]
|
||||
fn random(&self) -> f64 {
|
||||
|
||||
@@ -317,7 +317,7 @@ mod re {
|
||||
#[pyfunction]
|
||||
fn purge(_vm: &VirtualMachine) {}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyPattern {
|
||||
#[pymethod(name = "match")]
|
||||
fn match_(&self, text: PyStrRef) -> Option<PyMatch> {
|
||||
@@ -364,7 +364,7 @@ mod re {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyMatch {
|
||||
#[pymethod]
|
||||
fn start(&self, group: OptionalArg, vm: &VirtualMachine) -> PyResult {
|
||||
|
||||
@@ -82,7 +82,7 @@ mod resource {
|
||||
ru_nivcsw: libc::c_long,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl Rusage {}
|
||||
|
||||
impl From<libc::rusage> for Rusage {
|
||||
|
||||
@@ -308,7 +308,7 @@ mod decl {
|
||||
|
||||
const DEFAULT_EVENTS: i16 = libc::POLLIN | libc::POLLPRI | libc::POLLOUT;
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyPoll {
|
||||
#[pymethod]
|
||||
fn register(&self, Fildes(fd): Fildes, eventmask: OptionalArg<u16>) {
|
||||
|
||||
@@ -1122,7 +1122,7 @@ mod _socket {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(DefaultConstructor, Initializer), flags(BASETYPE))]
|
||||
#[pyclass(with(DefaultConstructor, Initializer), flags(BASETYPE))]
|
||||
impl PySocket {
|
||||
fn _init(
|
||||
zelf: PyRef<Self>,
|
||||
|
||||
@@ -497,7 +497,7 @@ mod _ssl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Constructor))]
|
||||
#[pyclass(flags(BASETYPE), with(Constructor))]
|
||||
impl PySslContext {
|
||||
fn builder(&self) -> PyRwLockWriteGuard<'_, SslContextBuilder> {
|
||||
self.ctx.write()
|
||||
@@ -903,7 +903,7 @@ mod _ssl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PySslSocket {
|
||||
#[pyproperty]
|
||||
fn owner(&self) -> Option<PyObjectRef> {
|
||||
|
||||
@@ -64,7 +64,7 @@ mod unicodedata {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl Ucd {
|
||||
#[pymethod]
|
||||
fn category(&self, character: PyStrRef, vm: &VirtualMachine) -> PyResult<String> {
|
||||
|
||||
@@ -288,7 +288,7 @@ mod zlib {
|
||||
unused_data: PyMutex<PyBytesRef>,
|
||||
unconsumed_tail: PyMutex<PyBytesRef>,
|
||||
}
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyDecompress {
|
||||
#[pyproperty]
|
||||
fn eof(&self) -> bool {
|
||||
@@ -447,7 +447,7 @@ mod zlib {
|
||||
inner: PyMutex<CompressInner>,
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyCompress {
|
||||
#[pymethod]
|
||||
fn compress(&self, data: ArgBytesLike, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
|
||||
|
||||
@@ -26,7 +26,7 @@ impl PyPayload for PyAsyncGen {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl PyAsyncGen {
|
||||
pub fn as_coro(&self) -> &Coro {
|
||||
&self.inner
|
||||
@@ -140,7 +140,7 @@ impl PyPayload for PyAsyncGenWrappedValue {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyAsyncGenWrappedValue {}
|
||||
|
||||
impl PyAsyncGenWrappedValue {
|
||||
@@ -189,7 +189,7 @@ impl PyPayload for PyAsyncGenASend {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PyAsyncGenASend {
|
||||
#[pymethod(name = "__await__")]
|
||||
fn r#await(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyRef<Self> {
|
||||
@@ -284,7 +284,7 @@ impl PyPayload for PyAsyncGenAThrow {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PyAsyncGenAThrow {
|
||||
#[pymethod(name = "__await__")]
|
||||
fn r#await(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyRef<Self> {
|
||||
|
||||
@@ -108,7 +108,7 @@ impl Constructor for PyBool {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl PyBool {
|
||||
#[pymethod(magic)]
|
||||
fn repr(zelf: bool, vm: &VirtualMachine) -> PyStrRef {
|
||||
|
||||
@@ -118,7 +118,7 @@ impl Callable for PyBuiltinFunction {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Constructor), flags(HAS_DICT))]
|
||||
#[pyclass(with(Callable, Constructor), flags(HAS_DICT))]
|
||||
impl PyBuiltinFunction {
|
||||
#[pyproperty(magic)]
|
||||
fn module(&self, vm: &VirtualMachine) -> PyObjectRef {
|
||||
@@ -229,7 +229,7 @@ impl PyBuiltinMethod {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetDescriptor, Callable, Constructor), flags(METHOD_DESCR))]
|
||||
#[pyclass(with(GetDescriptor, Callable, Constructor), flags(METHOD_DESCR))]
|
||||
impl PyBuiltinMethod {
|
||||
#[pyproperty(magic)]
|
||||
fn name(&self) -> PyStrRef {
|
||||
|
||||
@@ -92,7 +92,7 @@ pub(crate) fn init(context: &Context) {
|
||||
PyByteArrayIterator::extend_class(context, context.types.bytearray_iterator_type);
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(
|
||||
Constructor,
|
||||
@@ -854,7 +854,7 @@ impl PyPayload for PyByteArrayIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyByteArrayIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -100,7 +100,7 @@ impl PyBytes {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(
|
||||
AsMapping,
|
||||
@@ -675,7 +675,7 @@ impl PyPayload for PyBytesIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyBytesIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -104,7 +104,7 @@ impl PyClassMethod {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetDescriptor, Constructor), flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(with(GetDescriptor, Constructor), flags(BASETYPE, HAS_DICT))]
|
||||
impl PyClassMethod {
|
||||
#[pyproperty(magic)]
|
||||
fn func(&self) -> PyObjectRef {
|
||||
|
||||
@@ -157,10 +157,10 @@ impl PyPayload for PyCode {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyRef))]
|
||||
#[pyclass(with(PyRef))]
|
||||
impl PyCode {}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyRef<PyCode> {
|
||||
#[pyslot]
|
||||
fn slot_new(_cls: PyTypeRef, _args: FuncArgs, vm: &VirtualMachine) -> PyResult {
|
||||
|
||||
@@ -206,7 +206,7 @@ impl PyComplex {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Comparable, Hashable, Constructor, AsNumber))]
|
||||
#[pyclass(flags(BASETYPE), with(Comparable, Hashable, Constructor, AsNumber))]
|
||||
impl PyComplex {
|
||||
#[pymethod(magic)]
|
||||
fn complex(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyRef<PyComplex> {
|
||||
|
||||
@@ -22,7 +22,7 @@ impl PyPayload for PyCoroutine {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyCoroutine {
|
||||
pub fn as_coro(&self) -> &Coro {
|
||||
&self.inner
|
||||
@@ -126,7 +126,7 @@ impl PyPayload for PyCoroutineWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PyCoroutineWrapper {
|
||||
#[pymethod]
|
||||
fn send(zelf: PyRef<Self>, val: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
|
||||
|
||||
@@ -217,7 +217,7 @@ impl PyDict {
|
||||
|
||||
// Python dict methods:
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(
|
||||
Constructor,
|
||||
Initializer,
|
||||
@@ -669,7 +669,7 @@ impl Iterator for DictIter {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
trait DictView: PyPayload + PyClassDef + Iterable
|
||||
where
|
||||
Self::ReverseIter: PyPayload,
|
||||
@@ -758,7 +758,7 @@ macro_rules! dict_view {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl $iter_name {
|
||||
fn new(dict: PyDictRef) -> Self {
|
||||
$iter_name {
|
||||
@@ -831,7 +831,7 @@ macro_rules! dict_view {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl $reverse_iter_name {
|
||||
fn new(dict: PyDictRef) -> Self {
|
||||
let size = dict.size();
|
||||
@@ -943,7 +943,7 @@ dict_view! {
|
||||
}
|
||||
|
||||
// Set operations defined on set-like views of the dictionary.
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
trait ViewSetOps: DictView {
|
||||
fn to_set(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PySetInner> {
|
||||
let len = zelf.dict().len();
|
||||
@@ -1035,7 +1035,7 @@ trait ViewSetOps: DictView {
|
||||
}
|
||||
|
||||
impl ViewSetOps for PyDictKeys {}
|
||||
#[pyimpl(with(DictView, Constructor, Comparable, Iterable, ViewSetOps, AsSequence))]
|
||||
#[pyclass(with(DictView, Constructor, Comparable, Iterable, ViewSetOps, AsSequence))]
|
||||
impl PyDictKeys {
|
||||
#[pymethod(magic)]
|
||||
fn contains(zelf: PyRef<Self>, key: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> {
|
||||
@@ -1074,7 +1074,7 @@ impl AsSequence for PyDictKeys {
|
||||
}
|
||||
|
||||
impl ViewSetOps for PyDictItems {}
|
||||
#[pyimpl(with(DictView, Constructor, Comparable, Iterable, ViewSetOps, AsSequence))]
|
||||
#[pyclass(with(DictView, Constructor, Comparable, Iterable, ViewSetOps, AsSequence))]
|
||||
impl PyDictItems {
|
||||
#[pymethod(magic)]
|
||||
fn contains(zelf: PyRef<Self>, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> {
|
||||
@@ -1126,7 +1126,7 @@ impl AsSequence for PyDictItems {
|
||||
};
|
||||
}
|
||||
|
||||
#[pyimpl(with(DictView, Constructor, Iterable, AsSequence))]
|
||||
#[pyclass(with(DictView, Constructor, Iterable, AsSequence))]
|
||||
impl PyDictValues {
|
||||
#[pyproperty]
|
||||
fn mapping(zelf: PyRef<Self>) -> PyMappingProxy {
|
||||
|
||||
@@ -51,7 +51,7 @@ impl Constructor for PyEnumerate {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyEnumerate {
|
||||
#[pyclassmethod(magic)]
|
||||
fn class_getitem(cls: PyTypeRef, args: PyObjectRef, vm: &VirtualMachine) -> PyGenericAlias {
|
||||
@@ -92,7 +92,7 @@ impl PyPayload for PyReverseSequenceIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PyReverseSequenceIterator {
|
||||
pub fn new(obj: PyObjectRef, len: usize) -> Self {
|
||||
let position = len.saturating_sub(1);
|
||||
|
||||
@@ -36,7 +36,7 @@ impl Constructor for PyFilter {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyFilter {
|
||||
#[pymethod(magic)]
|
||||
fn reduce(&self, vm: &VirtualMachine) -> (PyTypeRef, (PyObjectRef, PyIter)) {
|
||||
|
||||
@@ -187,7 +187,7 @@ fn float_from_string(val: PyObjectRef, vm: &VirtualMachine) -> PyResult<f64> {
|
||||
})
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Comparable, Hashable, Constructor, AsNumber))]
|
||||
#[pyclass(flags(BASETYPE), with(Comparable, Hashable, Constructor, AsNumber))]
|
||||
impl PyFloat {
|
||||
#[pymethod(magic)]
|
||||
fn format(&self, spec: PyStrRef, vm: &VirtualMachine) -> PyResult<String> {
|
||||
|
||||
@@ -14,11 +14,11 @@ pub fn init(context: &Context) {
|
||||
FrameRef::extend_class(context, context.types.frame_type);
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, PyRef))]
|
||||
#[pyclass(with(Constructor, PyRef))]
|
||||
impl Frame {}
|
||||
impl Unconstructible for Frame {}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl FrameRef {
|
||||
#[pymethod(magic)]
|
||||
fn repr(self) -> String {
|
||||
|
||||
@@ -327,7 +327,7 @@ impl PyPayload for PyFunction {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetDescriptor, Callable), flags(HAS_DICT, METHOD_DESCR))]
|
||||
#[pyclass(with(GetDescriptor, Callable), flags(HAS_DICT, METHOD_DESCR))]
|
||||
impl PyFunction {
|
||||
#[pyproperty(magic)]
|
||||
fn code(&self) -> PyRef<PyCode> {
|
||||
@@ -505,7 +505,7 @@ impl PyBoundMethod {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Comparable, GetAttr, Constructor), flags(HAS_DICT))]
|
||||
#[pyclass(with(Callable, Comparable, GetAttr, Constructor), flags(HAS_DICT))]
|
||||
impl PyBoundMethod {
|
||||
#[pymethod(magic)]
|
||||
fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
|
||||
@@ -596,7 +596,7 @@ impl Constructor for PyCell {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl PyCell {
|
||||
pub fn new(contents: Option<PyObjectRef>) -> Self {
|
||||
Self {
|
||||
|
||||
@@ -25,7 +25,7 @@ impl PyPayload for PyGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyGenerator {
|
||||
pub fn as_coro(&self) -> &Coro {
|
||||
&self.inner
|
||||
|
||||
@@ -56,7 +56,7 @@ impl Constructor for PyGenericAlias {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(AsMapping, Callable, Comparable, Constructor, GetAttr, Hashable),
|
||||
flags(BASETYPE)
|
||||
)]
|
||||
|
||||
@@ -236,7 +236,7 @@ impl PyGetSet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetDescriptor, Constructor))]
|
||||
#[pyclass(with(GetDescriptor, Constructor))]
|
||||
impl PyGetSet {
|
||||
// Descriptor methods
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ impl PyInt {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Comparable, Hashable, Constructor, AsNumber))]
|
||||
#[pyclass(flags(BASETYPE), with(Comparable, Hashable, Constructor, AsNumber))]
|
||||
impl PyInt {
|
||||
#[pymethod(name = "__radd__")]
|
||||
#[pymethod(magic)]
|
||||
|
||||
@@ -172,7 +172,7 @@ impl PyPayload for PySequenceIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PySequenceIterator {
|
||||
pub fn new(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<Self> {
|
||||
let seq = PySequence::try_protocol(obj.as_ref(), vm)?;
|
||||
@@ -229,7 +229,7 @@ impl PyPayload for PyCallableIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PyCallableIterator {
|
||||
pub fn new(callable: ArgCallable, sentinel: PyObjectRef) -> Self {
|
||||
Self {
|
||||
|
||||
@@ -88,7 +88,7 @@ pub(crate) struct SortOptions {
|
||||
|
||||
pub type PyListRef = PyRef<PyList>;
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(
|
||||
Constructor,
|
||||
Initializer,
|
||||
@@ -532,7 +532,7 @@ impl PyPayload for PyListIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyListIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
@@ -577,7 +577,7 @@ impl PyPayload for PyListReverseIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyListReverseIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -36,7 +36,7 @@ impl Constructor for PyMap {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyMap {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self, vm: &VirtualMachine) -> PyResult<usize> {
|
||||
|
||||
@@ -65,7 +65,7 @@ impl Constructor for PyMappingProxy {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(AsMapping, Iterable, Constructor, AsSequence, Comparable))]
|
||||
#[pyclass(with(AsMapping, Iterable, Constructor, AsSequence, Comparable))]
|
||||
impl PyMappingProxy {
|
||||
fn get_inner(&self, key: PyObjectRef, vm: &VirtualMachine) -> PyResult<Option<PyObjectRef>> {
|
||||
let opt = match &self.mapping {
|
||||
|
||||
@@ -61,7 +61,7 @@ impl Constructor for PyMemoryView {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Hashable, Comparable, AsBuffer, AsMapping, AsSequence, Constructor))]
|
||||
#[pyclass(with(Hashable, Comparable, AsBuffer, AsMapping, AsSequence, Constructor))]
|
||||
impl PyMemoryView {
|
||||
fn parse_format(format: &str, vm: &VirtualMachine) -> PyResult<FormatSpec> {
|
||||
FormatSpec::parse(format.as_bytes(), vm)
|
||||
|
||||
@@ -26,7 +26,7 @@ pub struct ModuleInitArgs {
|
||||
doc: Option<PyStrRef>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetAttr, Initializer), flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(with(GetAttr, Initializer), flags(BASETYPE, HAS_DICT))]
|
||||
impl PyModule {
|
||||
// pub(crate) fn new(d: PyDictRef) -> Self {
|
||||
// PyModule { dict: d.into() }
|
||||
|
||||
@@ -39,7 +39,7 @@ impl PyNamespace {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT), with(Constructor, Initializer, Comparable))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT), with(Constructor, Initializer, Comparable))]
|
||||
impl PyNamespace {
|
||||
#[pymethod(magic)]
|
||||
fn repr(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<String> {
|
||||
|
||||
@@ -25,7 +25,7 @@ impl PyPayload for PyBaseObject {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE))]
|
||||
#[pyclass(flags(BASETYPE))]
|
||||
impl PyBaseObject {
|
||||
/// Create and return a new object. See help(type) for accurate signature.
|
||||
#[pyslot]
|
||||
|
||||
@@ -87,7 +87,7 @@ impl GetDescriptor for PyProperty {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, Initializer, GetDescriptor), flags(BASETYPE))]
|
||||
#[pyclass(with(Constructor, Initializer, GetDescriptor), flags(BASETYPE))]
|
||||
impl PyProperty {
|
||||
// Descriptor methods
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ pub fn init(context: &Context) {
|
||||
PyRangeIterator::extend_class(context, context.types.range_iterator_type);
|
||||
}
|
||||
|
||||
#[pyimpl(with(AsMapping, AsSequence, Hashable, Comparable, Iterable))]
|
||||
#[pyclass(with(AsMapping, AsSequence, Hashable, Comparable, Iterable))]
|
||||
impl PyRange {
|
||||
fn new(cls: PyTypeRef, stop: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
|
||||
PyRange {
|
||||
@@ -531,7 +531,7 @@ impl PyPayload for PyLongRangeIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyLongRangeIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> BigInt {
|
||||
@@ -596,7 +596,7 @@ impl PyPayload for PyRangeIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyRangeIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -492,7 +492,7 @@ fn reduce_set(
|
||||
))
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(Constructor, Initializer, AsSequence, Hashable, Comparable, Iterable),
|
||||
flags(BASETYPE)
|
||||
)]
|
||||
@@ -820,7 +820,7 @@ impl Constructor for PyFrozenSet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(Constructor, AsSequence, Hashable, Comparable, Iterable)
|
||||
)]
|
||||
@@ -1073,7 +1073,7 @@ impl PyPayload for PySetIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PySetIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -43,7 +43,7 @@ impl Constructor for PyNone {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, AsNumber))]
|
||||
#[pyclass(with(Constructor, AsNumber))]
|
||||
impl PyNone {
|
||||
#[pymethod(magic)]
|
||||
fn repr(&self) -> String {
|
||||
@@ -84,7 +84,7 @@ impl Constructor for PyNotImplemented {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl PyNotImplemented {
|
||||
// TODO: As per https://bugs.python.org/issue35712, using NotImplemented
|
||||
// in boolean contexts will need to raise a DeprecationWarning in 3.9
|
||||
|
||||
@@ -25,7 +25,7 @@ impl PyPayload for PySlice {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Hashable, Comparable))]
|
||||
#[pyclass(with(Hashable, Comparable))]
|
||||
impl PySlice {
|
||||
#[pyproperty]
|
||||
fn start(&self, vm: &VirtualMachine) -> PyObjectRef {
|
||||
@@ -278,7 +278,7 @@ impl Constructor for PyEllipsis {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl PyEllipsis {
|
||||
#[pymethod(magic)]
|
||||
fn repr(&self) -> String {
|
||||
|
||||
@@ -73,7 +73,7 @@ impl PyStaticMethod {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, GetDescriptor, Constructor), flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(with(Callable, GetDescriptor, Constructor), flags(BASETYPE, HAS_DICT))]
|
||||
impl PyStaticMethod {
|
||||
#[pyproperty(magic)]
|
||||
fn func(&self) -> PyObjectRef {
|
||||
|
||||
@@ -247,7 +247,7 @@ impl PyPayload for PyStrIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyStrIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
@@ -394,7 +394,7 @@ impl PyStr {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(AsMapping, AsSequence, Hashable, Comparable, Iterable, Constructor)
|
||||
)]
|
||||
|
||||
@@ -97,7 +97,7 @@ impl Constructor for PySuper {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetAttr, GetDescriptor, Constructor))]
|
||||
#[pyclass(with(GetAttr, GetDescriptor, Constructor))]
|
||||
impl PySuper {
|
||||
fn new(typ: PyTypeRef, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<Self> {
|
||||
let obj = if vm.is_none(&obj) {
|
||||
|
||||
@@ -18,7 +18,7 @@ impl PyPayload for PyTraceback {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyTraceback {
|
||||
pub fn new(next: Option<PyRef<Self>>, frame: FrameRef, lasti: u32, lineno: usize) -> Self {
|
||||
PyTraceback {
|
||||
|
||||
@@ -172,7 +172,7 @@ impl PyTuple {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(AsMapping, AsSequence, Hashable, Comparable, Iterable, Constructor)
|
||||
)]
|
||||
@@ -413,7 +413,7 @@ impl PyPayload for PyTupleIterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor, IterNext))]
|
||||
#[pyclass(with(Constructor, IterNext))]
|
||||
impl PyTupleIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -283,7 +283,7 @@ impl PyTypeRef {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetAttr, SetAttr, Callable), flags(BASETYPE))]
|
||||
#[pyclass(with(GetAttr, SetAttr, Callable), flags(BASETYPE))]
|
||||
impl PyType {
|
||||
// bound method for every type
|
||||
pub(crate) fn __new__(zelf: PyRef<Self>, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
|
||||
|
||||
@@ -32,7 +32,7 @@ impl PyPayload for PyUnion {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Hashable, Comparable, AsMapping), flags(BASETYPE))]
|
||||
#[pyclass(with(Hashable, Comparable, AsMapping), flags(BASETYPE))]
|
||||
impl PyUnion {
|
||||
pub fn new(args: PyTupleRef, vm: &VirtualMachine) -> Self {
|
||||
let parameters = make_parameters(&args, vm);
|
||||
|
||||
@@ -58,7 +58,7 @@ crate::common::static_cell! {
|
||||
static WEAK_SUBCLASS: PyTypeRef;
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetAttr, SetAttr, Constructor, Comparable, AsSequence, AsMapping))]
|
||||
#[pyclass(with(GetAttr, SetAttr, Constructor, Comparable, AsSequence, AsMapping))]
|
||||
impl PyWeakProxy {
|
||||
fn try_upgrade(&self, vm: &VirtualMachine) -> PyResult {
|
||||
self.weak.upgrade().ok_or_else(|| new_reference_error(vm))
|
||||
|
||||
@@ -47,7 +47,7 @@ impl Constructor for PyWeak {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Hashable, Comparable, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(Callable, Hashable, Comparable, Constructor), flags(BASETYPE))]
|
||||
impl PyWeak {
|
||||
#[pymethod(magic)]
|
||||
fn repr(zelf: PyRef<Self>) -> String {
|
||||
|
||||
@@ -40,7 +40,7 @@ impl Constructor for PyZip {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyZip {
|
||||
#[pymethod(magic)]
|
||||
fn reduce(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyTupleRef> {
|
||||
|
||||
@@ -412,7 +412,7 @@ macro_rules! extend_exception {
|
||||
};
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT))]
|
||||
impl PyBaseException {
|
||||
pub(crate) fn new(args: Vec<PyObjectRef>, vm: &VirtualMachine) -> PyBaseException {
|
||||
PyBaseException {
|
||||
|
||||
@@ -401,7 +401,7 @@ pub struct VecBuffer {
|
||||
data: PyMutex<Vec<u8>>,
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE), with(Constructor))]
|
||||
#[pyclass(flags(BASETYPE), with(Constructor))]
|
||||
impl VecBuffer {
|
||||
pub fn take(&self) -> Vec<u8> {
|
||||
std::mem::take(&mut self.data.lock())
|
||||
|
||||
@@ -30,7 +30,7 @@ mod _ast {
|
||||
#[derive(Debug, PyPayload)]
|
||||
pub(crate) struct AstNode;
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT))]
|
||||
impl AstNode {
|
||||
#[pyslot]
|
||||
#[pymethod(magic)]
|
||||
|
||||
@@ -7,11 +7,11 @@ use crate::common::ascii;
|
||||
|
||||
#[pyclass(module = "_ast", name = "mod", base = "AstNode")]
|
||||
struct NodeKindMod;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindMod {}
|
||||
#[pyclass(module = "_ast", name = "Module", base = "NodeKindMod")]
|
||||
struct NodeModule;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeModule {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -28,7 +28,7 @@ impl NodeModule {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Interactive", base = "NodeKindMod")]
|
||||
struct NodeInteractive;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeInteractive {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -42,7 +42,7 @@ impl NodeInteractive {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Expression", base = "NodeKindMod")]
|
||||
struct NodeExpression;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeExpression {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -56,7 +56,7 @@ impl NodeExpression {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "FunctionType", base = "NodeKindMod")]
|
||||
struct NodeFunctionType;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeFunctionType {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -73,11 +73,11 @@ impl NodeFunctionType {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "stmt", base = "AstNode")]
|
||||
struct NodeKindStmt;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindStmt {}
|
||||
#[pyclass(module = "_ast", name = "FunctionDef", base = "NodeKindStmt")]
|
||||
struct NodeFunctionDef;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeFunctionDef {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -107,7 +107,7 @@ impl NodeFunctionDef {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "AsyncFunctionDef", base = "NodeKindStmt")]
|
||||
struct NodeAsyncFunctionDef;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAsyncFunctionDef {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -137,7 +137,7 @@ impl NodeAsyncFunctionDef {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "ClassDef", base = "NodeKindStmt")]
|
||||
struct NodeClassDef;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeClassDef {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -166,7 +166,7 @@ impl NodeClassDef {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Return", base = "NodeKindStmt")]
|
||||
struct NodeReturn;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeReturn {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -189,7 +189,7 @@ impl NodeReturn {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Delete", base = "NodeKindStmt")]
|
||||
struct NodeDelete;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeDelete {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -212,7 +212,7 @@ impl NodeDelete {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Assign", base = "NodeKindStmt")]
|
||||
struct NodeAssign;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAssign {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -239,7 +239,7 @@ impl NodeAssign {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "AugAssign", base = "NodeKindStmt")]
|
||||
struct NodeAugAssign;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAugAssign {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -266,7 +266,7 @@ impl NodeAugAssign {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "AnnAssign", base = "NodeKindStmt")]
|
||||
struct NodeAnnAssign;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAnnAssign {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -294,7 +294,7 @@ impl NodeAnnAssign {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "For", base = "NodeKindStmt")]
|
||||
struct NodeFor;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeFor {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -323,7 +323,7 @@ impl NodeFor {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "AsyncFor", base = "NodeKindStmt")]
|
||||
struct NodeAsyncFor;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAsyncFor {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -352,7 +352,7 @@ impl NodeAsyncFor {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "While", base = "NodeKindStmt")]
|
||||
struct NodeWhile;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeWhile {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -379,7 +379,7 @@ impl NodeWhile {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "If", base = "NodeKindStmt")]
|
||||
struct NodeIf;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeIf {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -406,7 +406,7 @@ impl NodeIf {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "With", base = "NodeKindStmt")]
|
||||
struct NodeWith;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeWith {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -433,7 +433,7 @@ impl NodeWith {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "AsyncWith", base = "NodeKindStmt")]
|
||||
struct NodeAsyncWith;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAsyncWith {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -460,7 +460,7 @@ impl NodeAsyncWith {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Raise", base = "NodeKindStmt")]
|
||||
struct NodeRaise;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeRaise {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -486,7 +486,7 @@ impl NodeRaise {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Try", base = "NodeKindStmt")]
|
||||
struct NodeTry;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeTry {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -514,7 +514,7 @@ impl NodeTry {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Assert", base = "NodeKindStmt")]
|
||||
struct NodeAssert;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAssert {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -540,7 +540,7 @@ impl NodeAssert {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Import", base = "NodeKindStmt")]
|
||||
struct NodeImport;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeImport {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -563,7 +563,7 @@ impl NodeImport {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "ImportFrom", base = "NodeKindStmt")]
|
||||
struct NodeImportFrom;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeImportFrom {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -590,7 +590,7 @@ impl NodeImportFrom {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Global", base = "NodeKindStmt")]
|
||||
struct NodeGlobal;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeGlobal {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -613,7 +613,7 @@ impl NodeGlobal {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Nonlocal", base = "NodeKindStmt")]
|
||||
struct NodeNonlocal;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeNonlocal {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -636,7 +636,7 @@ impl NodeNonlocal {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Expr", base = "NodeKindStmt")]
|
||||
struct NodeExpr;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeExpr {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -659,7 +659,7 @@ impl NodeExpr {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Pass", base = "NodeKindStmt")]
|
||||
struct NodePass;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodePass {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -678,7 +678,7 @@ impl NodePass {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Break", base = "NodeKindStmt")]
|
||||
struct NodeBreak;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeBreak {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -697,7 +697,7 @@ impl NodeBreak {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Continue", base = "NodeKindStmt")]
|
||||
struct NodeContinue;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeContinue {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -716,11 +716,11 @@ impl NodeContinue {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "expr", base = "AstNode")]
|
||||
struct NodeKindExpr;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindExpr {}
|
||||
#[pyclass(module = "_ast", name = "BoolOp", base = "NodeKindExpr")]
|
||||
struct NodeBoolOp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeBoolOp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -746,7 +746,7 @@ impl NodeBoolOp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "NamedExpr", base = "NodeKindExpr")]
|
||||
struct NodeNamedExpr;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeNamedExpr {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -772,7 +772,7 @@ impl NodeNamedExpr {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "BinOp", base = "NodeKindExpr")]
|
||||
struct NodeBinOp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeBinOp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -799,7 +799,7 @@ impl NodeBinOp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "UnaryOp", base = "NodeKindExpr")]
|
||||
struct NodeUnaryOp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeUnaryOp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -825,7 +825,7 @@ impl NodeUnaryOp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Lambda", base = "NodeKindExpr")]
|
||||
struct NodeLambda;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeLambda {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -851,7 +851,7 @@ impl NodeLambda {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "IfExp", base = "NodeKindExpr")]
|
||||
struct NodeIfExp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeIfExp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -878,7 +878,7 @@ impl NodeIfExp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Dict", base = "NodeKindExpr")]
|
||||
struct NodeDict;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeDict {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -904,7 +904,7 @@ impl NodeDict {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Set", base = "NodeKindExpr")]
|
||||
struct NodeSet;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeSet {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -927,7 +927,7 @@ impl NodeSet {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "ListComp", base = "NodeKindExpr")]
|
||||
struct NodeListComp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeListComp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -953,7 +953,7 @@ impl NodeListComp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "SetComp", base = "NodeKindExpr")]
|
||||
struct NodeSetComp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeSetComp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -979,7 +979,7 @@ impl NodeSetComp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "DictComp", base = "NodeKindExpr")]
|
||||
struct NodeDictComp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeDictComp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1006,7 +1006,7 @@ impl NodeDictComp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "GeneratorExp", base = "NodeKindExpr")]
|
||||
struct NodeGeneratorExp;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeGeneratorExp {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1032,7 +1032,7 @@ impl NodeGeneratorExp {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Await", base = "NodeKindExpr")]
|
||||
struct NodeAwait;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAwait {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1055,7 +1055,7 @@ impl NodeAwait {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Yield", base = "NodeKindExpr")]
|
||||
struct NodeYield;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeYield {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1078,7 +1078,7 @@ impl NodeYield {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "YieldFrom", base = "NodeKindExpr")]
|
||||
struct NodeYieldFrom;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeYieldFrom {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1101,7 +1101,7 @@ impl NodeYieldFrom {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Compare", base = "NodeKindExpr")]
|
||||
struct NodeCompare;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeCompare {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1128,7 +1128,7 @@ impl NodeCompare {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Call", base = "NodeKindExpr")]
|
||||
struct NodeCall;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeCall {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1155,7 +1155,7 @@ impl NodeCall {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "FormattedValue", base = "NodeKindExpr")]
|
||||
struct NodeFormattedValue;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeFormattedValue {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1182,7 +1182,7 @@ impl NodeFormattedValue {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "JoinedStr", base = "NodeKindExpr")]
|
||||
struct NodeJoinedStr;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeJoinedStr {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1205,7 +1205,7 @@ impl NodeJoinedStr {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Constant", base = "NodeKindExpr")]
|
||||
struct NodeConstant;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeConstant {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1231,7 +1231,7 @@ impl NodeConstant {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Attribute", base = "NodeKindExpr")]
|
||||
struct NodeAttribute;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAttribute {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1258,7 +1258,7 @@ impl NodeAttribute {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Subscript", base = "NodeKindExpr")]
|
||||
struct NodeSubscript;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeSubscript {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1285,7 +1285,7 @@ impl NodeSubscript {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Starred", base = "NodeKindExpr")]
|
||||
struct NodeStarred;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeStarred {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1311,7 +1311,7 @@ impl NodeStarred {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Name", base = "NodeKindExpr")]
|
||||
struct NodeName;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeName {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1337,7 +1337,7 @@ impl NodeName {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "List", base = "NodeKindExpr")]
|
||||
struct NodeList;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeList {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1363,7 +1363,7 @@ impl NodeList {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Tuple", base = "NodeKindExpr")]
|
||||
struct NodeTuple;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeTuple {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1389,7 +1389,7 @@ impl NodeTuple {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Slice", base = "NodeKindExpr")]
|
||||
struct NodeSlice;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeSlice {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1416,11 +1416,11 @@ impl NodeSlice {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "expr_context", base = "AstNode")]
|
||||
struct NodeKindExprContext;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindExprContext {}
|
||||
#[pyclass(module = "_ast", name = "Load", base = "NodeKindExprContext")]
|
||||
struct NodeLoad;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeLoad {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1430,7 +1430,7 @@ impl NodeLoad {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Store", base = "NodeKindExprContext")]
|
||||
struct NodeStore;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeStore {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1440,7 +1440,7 @@ impl NodeStore {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Del", base = "NodeKindExprContext")]
|
||||
struct NodeDel;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeDel {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1450,11 +1450,11 @@ impl NodeDel {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "boolop", base = "AstNode")]
|
||||
struct NodeKindBoolop;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindBoolop {}
|
||||
#[pyclass(module = "_ast", name = "And", base = "NodeKindBoolop")]
|
||||
struct NodeAnd;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAnd {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1464,7 +1464,7 @@ impl NodeAnd {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Or", base = "NodeKindBoolop")]
|
||||
struct NodeOr;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeOr {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1474,11 +1474,11 @@ impl NodeOr {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "operator", base = "AstNode")]
|
||||
struct NodeKindOperator;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindOperator {}
|
||||
#[pyclass(module = "_ast", name = "Add", base = "NodeKindOperator")]
|
||||
struct NodeAdd;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeAdd {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1488,7 +1488,7 @@ impl NodeAdd {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Sub", base = "NodeKindOperator")]
|
||||
struct NodeSub;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeSub {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1498,7 +1498,7 @@ impl NodeSub {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Mult", base = "NodeKindOperator")]
|
||||
struct NodeMult;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeMult {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1508,7 +1508,7 @@ impl NodeMult {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "MatMult", base = "NodeKindOperator")]
|
||||
struct NodeMatMult;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeMatMult {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1518,7 +1518,7 @@ impl NodeMatMult {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Div", base = "NodeKindOperator")]
|
||||
struct NodeDiv;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeDiv {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1528,7 +1528,7 @@ impl NodeDiv {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Mod", base = "NodeKindOperator")]
|
||||
struct NodeMod;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeMod {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1538,7 +1538,7 @@ impl NodeMod {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Pow", base = "NodeKindOperator")]
|
||||
struct NodePow;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodePow {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1548,7 +1548,7 @@ impl NodePow {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "LShift", base = "NodeKindOperator")]
|
||||
struct NodeLShift;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeLShift {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1558,7 +1558,7 @@ impl NodeLShift {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "RShift", base = "NodeKindOperator")]
|
||||
struct NodeRShift;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeRShift {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1568,7 +1568,7 @@ impl NodeRShift {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "BitOr", base = "NodeKindOperator")]
|
||||
struct NodeBitOr;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeBitOr {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1578,7 +1578,7 @@ impl NodeBitOr {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "BitXor", base = "NodeKindOperator")]
|
||||
struct NodeBitXor;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeBitXor {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1588,7 +1588,7 @@ impl NodeBitXor {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "BitAnd", base = "NodeKindOperator")]
|
||||
struct NodeBitAnd;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeBitAnd {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1598,7 +1598,7 @@ impl NodeBitAnd {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "FloorDiv", base = "NodeKindOperator")]
|
||||
struct NodeFloorDiv;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeFloorDiv {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1608,11 +1608,11 @@ impl NodeFloorDiv {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "unaryop", base = "AstNode")]
|
||||
struct NodeKindUnaryop;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindUnaryop {}
|
||||
#[pyclass(module = "_ast", name = "Invert", base = "NodeKindUnaryop")]
|
||||
struct NodeInvert;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeInvert {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1622,7 +1622,7 @@ impl NodeInvert {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Not", base = "NodeKindUnaryop")]
|
||||
struct NodeNot;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeNot {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1632,7 +1632,7 @@ impl NodeNot {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "UAdd", base = "NodeKindUnaryop")]
|
||||
struct NodeUAdd;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeUAdd {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1642,7 +1642,7 @@ impl NodeUAdd {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "USub", base = "NodeKindUnaryop")]
|
||||
struct NodeUSub;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeUSub {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1652,11 +1652,11 @@ impl NodeUSub {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "cmpop", base = "AstNode")]
|
||||
struct NodeKindCmpop;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindCmpop {}
|
||||
#[pyclass(module = "_ast", name = "Eq", base = "NodeKindCmpop")]
|
||||
struct NodeEq;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeEq {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1666,7 +1666,7 @@ impl NodeEq {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "NotEq", base = "NodeKindCmpop")]
|
||||
struct NodeNotEq;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeNotEq {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1676,7 +1676,7 @@ impl NodeNotEq {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Lt", base = "NodeKindCmpop")]
|
||||
struct NodeLt;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeLt {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1686,7 +1686,7 @@ impl NodeLt {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "LtE", base = "NodeKindCmpop")]
|
||||
struct NodeLtE;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeLtE {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1696,7 +1696,7 @@ impl NodeLtE {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Gt", base = "NodeKindCmpop")]
|
||||
struct NodeGt;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeGt {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1706,7 +1706,7 @@ impl NodeGt {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "GtE", base = "NodeKindCmpop")]
|
||||
struct NodeGtE;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeGtE {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1716,7 +1716,7 @@ impl NodeGtE {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "Is", base = "NodeKindCmpop")]
|
||||
struct NodeIs;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeIs {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1726,7 +1726,7 @@ impl NodeIs {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "IsNot", base = "NodeKindCmpop")]
|
||||
struct NodeIsNot;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeIsNot {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1736,7 +1736,7 @@ impl NodeIsNot {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "In", base = "NodeKindCmpop")]
|
||||
struct NodeIn;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeIn {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1746,7 +1746,7 @@ impl NodeIn {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "NotIn", base = "NodeKindCmpop")]
|
||||
struct NodeNotIn;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeNotIn {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1756,7 +1756,7 @@ impl NodeNotIn {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "comprehension", base = "AstNode")]
|
||||
struct Nodecomprehension;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl Nodecomprehension {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1775,7 +1775,7 @@ impl Nodecomprehension {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "excepthandler", base = "AstNode")]
|
||||
struct NodeKindExcepthandler;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindExcepthandler {}
|
||||
#[pyclass(
|
||||
module = "_ast",
|
||||
@@ -1783,7 +1783,7 @@ impl NodeKindExcepthandler {}
|
||||
base = "NodeKindExcepthandler"
|
||||
)]
|
||||
struct NodeExceptHandler;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeExceptHandler {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1810,7 +1810,7 @@ impl NodeExceptHandler {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "arguments", base = "AstNode")]
|
||||
struct Nodearguments;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl Nodearguments {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1832,7 +1832,7 @@ impl Nodearguments {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "arg", base = "AstNode")]
|
||||
struct Nodearg;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl Nodearg {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1859,7 +1859,7 @@ impl Nodearg {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "keyword", base = "AstNode")]
|
||||
struct Nodekeyword;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl Nodekeyword {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1885,7 +1885,7 @@ impl Nodekeyword {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "alias", base = "AstNode")]
|
||||
struct Nodealias;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl Nodealias {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1902,7 +1902,7 @@ impl Nodealias {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "withitem", base = "AstNode")]
|
||||
struct Nodewithitem;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl Nodewithitem {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
@@ -1919,11 +1919,11 @@ impl Nodewithitem {
|
||||
}
|
||||
#[pyclass(module = "_ast", name = "type_ignore", base = "AstNode")]
|
||||
struct NodeKindTypeIgnore;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeKindTypeIgnore {}
|
||||
#[pyclass(module = "_ast", name = "TypeIgnore", base = "NodeKindTypeIgnore")]
|
||||
struct NodeTypeIgnore;
|
||||
#[pyimpl(flags(HAS_DICT, BASETYPE))]
|
||||
#[pyclass(flags(HAS_DICT, BASETYPE))]
|
||||
impl NodeTypeIgnore {
|
||||
#[extend_class]
|
||||
fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {
|
||||
|
||||
@@ -54,7 +54,7 @@ mod _collections {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
flags(BASETYPE),
|
||||
with(Constructor, Initializer, AsSequence, Comparable, Hashable, Iterable)
|
||||
)]
|
||||
@@ -609,7 +609,7 @@ mod _collections {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyDequeIterator {
|
||||
pub(crate) fn new(deque: PyDequeRef) -> Self {
|
||||
PyDequeIterator {
|
||||
@@ -682,7 +682,7 @@ mod _collections {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyReverseDequeIterator {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self) -> usize {
|
||||
|
||||
@@ -379,7 +379,7 @@ mod _io {
|
||||
#[derive(Debug, PyPayload)]
|
||||
struct _IOBase;
|
||||
|
||||
#[pyimpl(with(IterNext, Destructor), flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(with(IterNext, Destructor), flags(BASETYPE, HAS_DICT))]
|
||||
impl _IOBase {
|
||||
#[pymethod]
|
||||
fn seek(
|
||||
@@ -587,7 +587,7 @@ mod _io {
|
||||
#[pyclass(name = "_RawIOBase", base = "_IOBase")]
|
||||
pub(super) struct _RawIOBase;
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT))]
|
||||
impl _RawIOBase {
|
||||
#[pymethod]
|
||||
fn read(instance: PyObjectRef, size: OptionalSize, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -645,7 +645,7 @@ mod _io {
|
||||
#[pyclass(name = "_BufferedIOBase", base = "_IOBase")]
|
||||
struct _BufferedIOBase;
|
||||
|
||||
#[pyimpl(flags(BASETYPE))]
|
||||
#[pyclass(flags(BASETYPE))]
|
||||
impl _BufferedIOBase {
|
||||
#[pymethod]
|
||||
fn read(zelf: PyObjectRef, _size: OptionalArg, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -704,7 +704,7 @@ mod _io {
|
||||
#[derive(Debug, PyPayload)]
|
||||
struct _TextIOBase;
|
||||
|
||||
#[pyimpl(flags(BASETYPE))]
|
||||
#[pyclass(flags(BASETYPE))]
|
||||
impl _TextIOBase {
|
||||
#[pyproperty]
|
||||
fn encoding(&self, vm: &VirtualMachine) -> PyObjectRef {
|
||||
@@ -1371,7 +1371,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
trait BufferedMixin: PyPayload {
|
||||
const CLASS_NAME: &'static str;
|
||||
const READABLE: bool;
|
||||
@@ -1586,7 +1586,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
trait BufferedReadable: PyPayload {
|
||||
type Reader: BufferedMixin;
|
||||
fn reader(&self) -> &Self::Reader;
|
||||
@@ -1688,7 +1688,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(DefaultConstructor, BufferedMixin, BufferedReadable),
|
||||
flags(BASETYPE, HAS_DICT)
|
||||
)]
|
||||
@@ -1696,7 +1696,7 @@ mod _io {
|
||||
|
||||
impl DefaultConstructor for BufferedReader {}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
trait BufferedWritable: PyPayload {
|
||||
type Writer: BufferedMixin;
|
||||
fn writer(&self) -> &Self::Writer;
|
||||
@@ -1738,7 +1738,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(DefaultConstructor, BufferedMixin, BufferedWritable),
|
||||
flags(BASETYPE, HAS_DICT)
|
||||
)]
|
||||
@@ -1774,7 +1774,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(DefaultConstructor, BufferedMixin, BufferedReadable, BufferedWritable),
|
||||
flags(BASETYPE, HAS_DICT)
|
||||
)]
|
||||
@@ -1818,7 +1818,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(
|
||||
#[pyclass(
|
||||
with(DefaultConstructor, Initializer, BufferedReadable, BufferedWritable),
|
||||
flags(BASETYPE, HAS_DICT)
|
||||
)]
|
||||
@@ -2294,7 +2294,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(DefaultConstructor, Initializer), flags(BASETYPE))]
|
||||
#[pyclass(with(DefaultConstructor, Initializer), flags(BASETYPE))]
|
||||
impl TextIOWrapper {
|
||||
#[pymethod]
|
||||
fn seekable(&self, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -3100,7 +3100,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT), with(PyRef, Constructor))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT), with(PyRef, Constructor))]
|
||||
impl StringIO {
|
||||
fn buffer(&self, vm: &VirtualMachine) -> PyResult<PyRwLockWriteGuard<'_, BufferedIO>> {
|
||||
if !self.closed.load() {
|
||||
@@ -3134,7 +3134,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl StringIORef {
|
||||
//write string to underlying vector
|
||||
#[pymethod]
|
||||
@@ -3236,7 +3236,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(flags(BASETYPE, HAS_DICT), with(PyRef, Constructor))]
|
||||
#[pyclass(flags(BASETYPE, HAS_DICT), with(PyRef, Constructor))]
|
||||
impl BytesIO {
|
||||
fn buffer(&self, vm: &VirtualMachine) -> PyResult<PyRwLockWriteGuard<'_, BufferedIO>> {
|
||||
if !self.closed.load() {
|
||||
@@ -3260,7 +3260,7 @@ mod _io {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl BytesIORef {
|
||||
#[pymethod]
|
||||
fn write(self, data: ArgBytesLike, vm: &VirtualMachine) -> PyResult<u64> {
|
||||
@@ -3910,7 +3910,7 @@ mod fileio {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(DefaultConstructor, Initializer), flags(BASETYPE, HAS_DICT))]
|
||||
#[pyclass(with(DefaultConstructor, Initializer), flags(BASETYPE, HAS_DICT))]
|
||||
impl FileIO {
|
||||
#[pyproperty]
|
||||
fn closed(&self) -> bool {
|
||||
|
||||
@@ -28,7 +28,7 @@ mod decl {
|
||||
active: PyRwLock<Option<PyIter>>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext), flags(BASETYPE))]
|
||||
impl PyItertoolsChain {
|
||||
#[pyslot]
|
||||
fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -140,7 +140,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsCompress {
|
||||
#[pymethod(magic)]
|
||||
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (PyIter, PyIter)) {
|
||||
@@ -209,7 +209,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsCount {
|
||||
// TODO: Implement this
|
||||
// if (lz->cnt == PY_SSIZE_T_MAX)
|
||||
@@ -263,7 +263,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsCycle {}
|
||||
impl IterNextIterable for PyItertoolsCycle {}
|
||||
impl IterNext for PyItertoolsCycle {
|
||||
@@ -327,7 +327,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsRepeat {
|
||||
#[pymethod(magic)]
|
||||
fn length_hint(&self, vm: &VirtualMachine) -> PyResult<usize> {
|
||||
@@ -403,7 +403,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsStarmap {
|
||||
#[pymethod(magic)]
|
||||
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (PyObjectRef, PyIter)) {
|
||||
@@ -466,7 +466,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsTakewhile {}
|
||||
impl IterNextIterable for PyItertoolsTakewhile {}
|
||||
impl IterNext for PyItertoolsTakewhile {
|
||||
@@ -531,7 +531,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsDropwhile {}
|
||||
impl IterNextIterable for PyItertoolsDropwhile {}
|
||||
impl IterNext for PyItertoolsDropwhile {
|
||||
@@ -634,7 +634,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsGroupBy {
|
||||
pub(super) fn advance(
|
||||
&self,
|
||||
@@ -710,7 +710,7 @@ mod decl {
|
||||
groupby: PyRef<PyItertoolsGroupBy>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl PyItertoolsGrouper {}
|
||||
impl IterNextIterable for PyItertoolsGrouper {}
|
||||
impl IterNext for PyItertoolsGrouper {
|
||||
@@ -781,7 +781,7 @@ mod decl {
|
||||
)))
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext), flags(BASETYPE))]
|
||||
impl PyItertoolsIslice {
|
||||
#[pyslot]
|
||||
fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -910,7 +910,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
#[pyclass(with(IterNext, Constructor), flags(BASETYPE))]
|
||||
impl PyItertoolsFilterFalse {
|
||||
#[pymethod(magic)]
|
||||
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (PyObjectRef, PyIter)) {
|
||||
@@ -978,7 +978,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsAccumulate {}
|
||||
|
||||
impl IterNextIterable for PyItertoolsAccumulate {}
|
||||
@@ -1090,7 +1090,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsTee {
|
||||
fn from_iter(iterator: PyIter, vm: &VirtualMachine) -> PyResult {
|
||||
let class = PyItertoolsTee::class(vm);
|
||||
@@ -1168,7 +1168,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsProduct {
|
||||
fn update_idxs(&self, mut idxs: PyRwLockWriteGuard<'_, Vec<usize>>) {
|
||||
if idxs.len() == 0 {
|
||||
@@ -1271,7 +1271,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsCombinations {}
|
||||
impl IterNextIterable for PyItertoolsCombinations {}
|
||||
impl IterNext for PyItertoolsCombinations {
|
||||
@@ -1362,7 +1362,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsCombinationsWithReplacement {}
|
||||
|
||||
impl IterNextIterable for PyItertoolsCombinationsWithReplacement {}
|
||||
@@ -1472,7 +1472,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsPermutations {}
|
||||
impl IterNextIterable for PyItertoolsPermutations {}
|
||||
impl IterNext for PyItertoolsPermutations {
|
||||
@@ -1575,7 +1575,7 @@ mod decl {
|
||||
fillvalue: PyObjectRef,
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsZipLongest {}
|
||||
impl IterNextIterable for PyItertoolsZipLongest {}
|
||||
impl IterNext for PyItertoolsZipLongest {
|
||||
@@ -1624,7 +1624,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext, Constructor))]
|
||||
#[pyclass(with(IterNext, Constructor))]
|
||||
impl PyItertoolsPairwise {}
|
||||
impl IterNextIterable for PyItertoolsPairwise {}
|
||||
impl IterNext for PyItertoolsPairwise {
|
||||
|
||||
@@ -430,7 +430,7 @@ mod _operator {
|
||||
attrs: Vec<PyStrRef>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Constructor))]
|
||||
#[pyclass(with(Callable, Constructor))]
|
||||
impl PyAttrGetter {
|
||||
#[pymethod(magic)]
|
||||
fn repr(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<String> {
|
||||
@@ -526,7 +526,7 @@ mod _operator {
|
||||
items: Vec<PyObjectRef>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Constructor))]
|
||||
#[pyclass(with(Callable, Constructor))]
|
||||
impl PyItemGetter {
|
||||
#[pymethod(magic)]
|
||||
fn repr(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<String> {
|
||||
@@ -595,7 +595,7 @@ mod _operator {
|
||||
args: FuncArgs,
|
||||
}
|
||||
|
||||
#[pyimpl(with(Callable, Constructor))]
|
||||
#[pyclass(with(Callable, Constructor))]
|
||||
impl PyMethodCaller {
|
||||
#[pymethod(magic)]
|
||||
fn repr(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<String> {
|
||||
|
||||
@@ -701,7 +701,7 @@ pub(super) mod _os {
|
||||
ino: AtomicCell<Option<u64>>,
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl DirEntry {
|
||||
#[pyproperty]
|
||||
fn name(&self, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -870,7 +870,7 @@ pub(super) mod _os {
|
||||
mode: OutputMode,
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl ScandirIterator {
|
||||
#[pymethod]
|
||||
fn close(&self) {
|
||||
@@ -963,7 +963,7 @@ pub(super) mod _os {
|
||||
pub st_ctime_ns: i128,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl StatResult {
|
||||
fn from_stat(stat: &StatStruct, vm: &VirtualMachine) -> Self {
|
||||
let (atime, mtime, ctime);
|
||||
@@ -1487,7 +1487,7 @@ pub(super) mod _os {
|
||||
}
|
||||
|
||||
#[cfg(all(any(unix, windows), not(target_os = "redox")))]
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl TimesResult {}
|
||||
|
||||
#[cfg(all(any(unix, windows), not(target_os = "redox")))]
|
||||
@@ -1706,7 +1706,7 @@ pub(super) mod _os {
|
||||
pub columns: usize,
|
||||
pub lines: usize,
|
||||
}
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl PyTerminalSize {}
|
||||
|
||||
#[pyattr]
|
||||
@@ -1720,7 +1720,7 @@ pub(super) mod _os {
|
||||
pub machine: String,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl UnameResult {}
|
||||
|
||||
pub(super) fn support_funcs() -> Vec<SupportFunc> {
|
||||
|
||||
@@ -534,7 +534,7 @@ pub mod module {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl SchedParam {
|
||||
#[pyproperty]
|
||||
fn sched_priority(&self, vm: &VirtualMachine) -> PyObjectRef {
|
||||
|
||||
@@ -24,7 +24,7 @@ mod pwd {
|
||||
pw_dir: String,
|
||||
pw_shell: String,
|
||||
}
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl Passwd {}
|
||||
|
||||
impl From<User> for Passwd {
|
||||
|
||||
@@ -134,7 +134,7 @@ mod _sre {
|
||||
pub isbytes: bool,
|
||||
}
|
||||
|
||||
#[pyimpl(with(Hashable, Comparable))]
|
||||
#[pyclass(with(Hashable, Comparable))]
|
||||
impl Pattern {
|
||||
fn with_str_drive<R, F: FnOnce(StrDrive) -> PyResult<R>>(
|
||||
&self,
|
||||
@@ -551,7 +551,7 @@ mod _sre {
|
||||
regs: Vec<(isize, isize)>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(AsMapping))]
|
||||
#[pyclass(with(AsMapping))]
|
||||
impl Match {
|
||||
pub(crate) fn new(state: &State, pattern: PyRef<Pattern>, string: PyObjectRef) -> Self {
|
||||
let mut regs = vec![(state.start as isize, state.string_position as isize)];
|
||||
@@ -805,7 +805,7 @@ mod _sre {
|
||||
must_advance: AtomicCell<bool>,
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl SreScanner {
|
||||
#[pyproperty]
|
||||
fn pattern(&self) -> PyRef<Pattern> {
|
||||
|
||||
@@ -50,7 +50,7 @@ mod symtable {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PySymbolTable {
|
||||
#[pymethod]
|
||||
fn get_name(&self) -> String {
|
||||
@@ -163,7 +163,7 @@ mod symtable {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PySymbol {
|
||||
#[pymethod]
|
||||
fn get_name(&self) -> String {
|
||||
|
||||
@@ -614,7 +614,7 @@ mod sys {
|
||||
warn_default_encoding: u8,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl Flags {
|
||||
fn from_settings(settings: &Settings) -> Self {
|
||||
Self {
|
||||
@@ -658,7 +658,7 @@ mod sys {
|
||||
radix: u32,
|
||||
rounds: i32,
|
||||
}
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl PyFloatInfo {
|
||||
const INFO: Self = PyFloatInfo {
|
||||
max: f64::MAX,
|
||||
@@ -689,7 +689,7 @@ mod sys {
|
||||
cutoff: usize,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl PyHashInfo {
|
||||
const INFO: Self = {
|
||||
use rustpython_common::hash::*;
|
||||
@@ -713,7 +713,7 @@ mod sys {
|
||||
bits_per_digit: usize,
|
||||
sizeof_digit: usize,
|
||||
}
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl PyIntInfo {
|
||||
const INFO: Self = PyIntInfo {
|
||||
bits_per_digit: 30, //?
|
||||
@@ -731,7 +731,7 @@ mod sys {
|
||||
serial: usize,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl VersionInfo {
|
||||
pub const VERSION: VersionInfo = VersionInfo {
|
||||
major: version::MAJOR,
|
||||
@@ -766,7 +766,7 @@ mod sys {
|
||||
platform_version: (u32, u32, u32),
|
||||
}
|
||||
#[cfg(windows)]
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl WindowsVersion {}
|
||||
|
||||
#[pyclass(noattr, name = "UnraisableHookArgs")]
|
||||
@@ -779,7 +779,7 @@ mod sys {
|
||||
pub object: PyObjectRef,
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl UnraisableHookArgs {}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ pub(crate) mod _thread {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(Constructor))]
|
||||
#[pyclass(with(Constructor))]
|
||||
impl Lock {
|
||||
#[pymethod]
|
||||
#[pymethod(name = "acquire_lock")]
|
||||
@@ -159,7 +159,7 @@ pub(crate) mod _thread {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl RLock {
|
||||
#[pyslot]
|
||||
fn slot_new(cls: PyTypeRef, _args: FuncArgs, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -322,7 +322,7 @@ pub(crate) mod _thread {
|
||||
data: ThreadLocal<PyDictRef>,
|
||||
}
|
||||
|
||||
#[pyimpl(with(GetAttr, SetAttr), flags(BASETYPE))]
|
||||
#[pyclass(with(GetAttr, SetAttr), flags(BASETYPE))]
|
||||
impl Local {
|
||||
fn ldict(&self, vm: &VirtualMachine) -> PyDictRef {
|
||||
self.data.get_or(|| vm.ctx.new_dict()).clone()
|
||||
|
||||
@@ -335,7 +335,7 @@ mod time {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(PyStructSequence))]
|
||||
#[pyclass(with(PyStructSequence))]
|
||||
impl PyStructTime {
|
||||
fn new(vm: &VirtualMachine, tm: NaiveDateTime, isdst: i32) -> Self {
|
||||
PyStructTime {
|
||||
|
||||
@@ -78,7 +78,7 @@ mod winreg {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyHkey {
|
||||
#[pymethod]
|
||||
fn Close(&self) {
|
||||
|
||||
@@ -440,7 +440,7 @@ impl PyType {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Constructor: PyPayload {
|
||||
type Args: FromArgs;
|
||||
|
||||
@@ -454,7 +454,7 @@ pub trait Constructor: PyPayload {
|
||||
fn py_new(cls: PyTypeRef, args: Self::Args, vm: &VirtualMachine) -> PyResult;
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait DefaultConstructor: PyPayload + Default {
|
||||
#[inline]
|
||||
#[pyslot]
|
||||
@@ -477,7 +477,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Initializer: PyPayload {
|
||||
type Args: FromArgs;
|
||||
|
||||
@@ -498,7 +498,7 @@ pub trait Initializer: PyPayload {
|
||||
fn init(zelf: PyRef<Self>, args: Self::Args, vm: &VirtualMachine) -> PyResult<()>;
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Destructor: PyPayload {
|
||||
#[inline] // for __del__
|
||||
#[pyslot]
|
||||
@@ -518,7 +518,7 @@ pub trait Destructor: PyPayload {
|
||||
fn del(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<()>;
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Callable: PyPayload {
|
||||
type Args: FromArgs;
|
||||
|
||||
@@ -540,7 +540,7 @@ pub trait Callable: PyPayload {
|
||||
fn call(zelf: &Py<Self>, args: Self::Args, vm: &VirtualMachine) -> PyResult;
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait GetDescriptor: PyPayload {
|
||||
#[pyslot]
|
||||
fn descr_get(
|
||||
@@ -608,7 +608,7 @@ pub trait GetDescriptor: PyPayload {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Hashable: PyPayload {
|
||||
#[inline]
|
||||
#[pyslot]
|
||||
@@ -645,7 +645,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Comparable: PyPayload {
|
||||
#[inline]
|
||||
#[pyslot]
|
||||
@@ -829,7 +829,7 @@ impl PyComparisonOp {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait GetAttr: PyPayload {
|
||||
#[pyslot]
|
||||
fn slot_getattro(obj: &PyObject, name: PyStrRef, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -849,7 +849,7 @@ pub trait GetAttr: PyPayload {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait SetAttr: PyPayload {
|
||||
#[pyslot]
|
||||
#[inline]
|
||||
@@ -891,7 +891,7 @@ pub trait SetAttr: PyPayload {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait AsBuffer: PyPayload {
|
||||
// TODO: `flags` parameter
|
||||
#[inline]
|
||||
@@ -906,7 +906,7 @@ pub trait AsBuffer: PyPayload {
|
||||
fn as_buffer(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyBuffer>;
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait AsMapping: PyPayload {
|
||||
const AS_MAPPING: PyMappingMethods;
|
||||
|
||||
@@ -922,7 +922,7 @@ pub trait AsMapping: PyPayload {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait AsSequence: PyPayload {
|
||||
const AS_SEQUENCE: PySequenceMethods;
|
||||
|
||||
@@ -937,7 +937,7 @@ pub trait AsSequence: PyPayload {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait AsNumber: PyPayload {
|
||||
#[pyslot]
|
||||
fn as_number() -> &'static PyNumberMethods;
|
||||
@@ -947,7 +947,7 @@ pub trait AsNumber: PyPayload {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait Iterable: PyPayload {
|
||||
#[pyslot]
|
||||
#[pymethod(name = "__iter__")]
|
||||
@@ -963,7 +963,7 @@ pub trait Iterable: PyPayload {
|
||||
}
|
||||
|
||||
// `Iterator` fits better, but to avoid confusion with rust std::iter::Iterator
|
||||
#[pyimpl(with(Iterable))]
|
||||
#[pyclass(with(Iterable))]
|
||||
pub trait IterNext: PyPayload + Iterable {
|
||||
#[pyslot]
|
||||
fn slot_iternext(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
AsObject, Py, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
|
||||
};
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
pub trait PyStructSequence: StaticType + PyClassImpl + Sized + 'static {
|
||||
const FIELD_NAMES: &'static [&'static str];
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ mod _browser {
|
||||
doc: web_sys::Document,
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl Document {
|
||||
#[pymethod]
|
||||
fn query(&self, query: PyStrRef, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -198,7 +198,7 @@ mod _browser {
|
||||
elem: web_sys::Element,
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl Element {
|
||||
#[pymethod]
|
||||
fn get_attr(
|
||||
|
||||
@@ -90,7 +90,7 @@ mod _js {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyJsValue {
|
||||
#[inline]
|
||||
pub fn new(value: impl Into<JsValue>) -> PyJsValue {
|
||||
@@ -301,7 +301,7 @@ mod _js {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl JsClosure {
|
||||
fn new(obj: PyObjectRef, once: bool, vm: &VirtualMachine) -> PyResult<Self> {
|
||||
let wasm_vm = WASMVirtualMachine {
|
||||
@@ -396,7 +396,7 @@ mod _js {
|
||||
PyRejected(PyBaseExceptionRef),
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyclass]
|
||||
impl PyPromise {
|
||||
pub fn new(value: Promise) -> PyPromise {
|
||||
PyPromise {
|
||||
@@ -566,7 +566,7 @@ mod _js {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(with(IterNext))]
|
||||
#[pyclass(with(IterNext))]
|
||||
impl AwaitPromise {
|
||||
#[pymethod]
|
||||
fn send(&self, val: Option<PyObjectRef>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
|
||||
|
||||
Reference in New Issue
Block a user