mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Move builtin types to own directory
This commit is contained in:
@@ -4,9 +4,9 @@ use std::collections::HashMap;
|
||||
use std::io::{self, Write};
|
||||
|
||||
use super::compile;
|
||||
use super::obj::objstr;
|
||||
use super::obj::objtype;
|
||||
use super::objbool;
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
AttributeProtocol, DictProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind,
|
||||
PyObjectRef, PyResult, Scope, TypeProtocol,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::objstr;
|
||||
use super::obj::objstr;
|
||||
use super::pyobject::{
|
||||
create_type, AttributeProtocol, PyContext, PyFuncArgs, PyObjectRef, PyResult,
|
||||
};
|
||||
|
||||
@@ -20,16 +20,11 @@ pub mod eval;
|
||||
mod exceptions;
|
||||
mod frame;
|
||||
mod import;
|
||||
mod obj;
|
||||
mod objbool;
|
||||
mod objdict;
|
||||
mod objfloat;
|
||||
mod objfunction;
|
||||
mod objint;
|
||||
mod objlist;
|
||||
mod objobject;
|
||||
mod objsequence;
|
||||
mod objstr;
|
||||
mod objtype;
|
||||
pub mod pyobject;
|
||||
pub mod stdlib;
|
||||
mod sysmodule;
|
||||
|
||||
6
vm/src/obj/mod.rs
Normal file
6
vm/src/obj/mod.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
pub mod objdict;
|
||||
pub mod objfloat;
|
||||
pub mod objint;
|
||||
pub mod objlist;
|
||||
pub mod objstr;
|
||||
pub mod objtype;
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
use super::super::pyobject::{
|
||||
AttributeProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef, PyResult,
|
||||
TypeProtocol,
|
||||
};
|
||||
use super::vm::VirtualMachine;
|
||||
use super::super::vm::VirtualMachine;
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub fn _set_item(
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::objint;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
use super::super::pyobject::{
|
||||
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
|
||||
};
|
||||
use super::vm::VirtualMachine;
|
||||
use super::super::vm::VirtualMachine;
|
||||
use super::objint;
|
||||
use super::objtype;
|
||||
|
||||
fn str(vm: &mut VirtualMachine, args: PyFuncArgs) -> Result<PyObjectRef, PyObjectRef> {
|
||||
arg_check!(vm, args, required = [(float, Some(vm.ctx.float_type()))]);
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::objfloat;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
use super::super::pyobject::{
|
||||
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
|
||||
};
|
||||
use super::vm::VirtualMachine;
|
||||
use super::super::vm::VirtualMachine;
|
||||
use super::objfloat;
|
||||
use super::objtype;
|
||||
|
||||
fn str(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
|
||||
arg_check!(vm, args, required = [(int, Some(vm.ctx.int_type()))]);
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::objsequence::PySliceableSequence;
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
use super::super::objsequence::PySliceableSequence;
|
||||
use super::super::pyobject::{
|
||||
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
|
||||
};
|
||||
use super::vm::VirtualMachine;
|
||||
use super::super::vm::VirtualMachine;
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
|
||||
// set_item:
|
||||
pub fn set_item(
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::objint;
|
||||
use super::objsequence::PySliceableSequence;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
use super::super::objsequence::PySliceableSequence;
|
||||
use super::super::pyobject::{
|
||||
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
|
||||
};
|
||||
use super::vm::VirtualMachine;
|
||||
use super::super::vm::VirtualMachine;
|
||||
use super::objint;
|
||||
use super::objtype;
|
||||
|
||||
pub fn init(context: &PyContext) {
|
||||
let ref str_type = context.str_type;
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::objdict;
|
||||
use super::objtype; // Required for arg_check! to use isinstance
|
||||
use super::pyobject::{
|
||||
use super::super::pyobject::{
|
||||
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef,
|
||||
PyResult, ToRust, TypeProtocol,
|
||||
};
|
||||
use super::vm::VirtualMachine;
|
||||
use super::super::vm::VirtualMachine;
|
||||
use super::objdict;
|
||||
use super::objtype; // Required for arg_check! to use isinstance
|
||||
|
||||
/*
|
||||
* The magical type type
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::objtype;
|
||||
use super::obj::objtype;
|
||||
use super::pyobject::{
|
||||
AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::objdict;
|
||||
use super::objtype;
|
||||
use super::obj::objdict;
|
||||
use super::obj::objtype;
|
||||
use super::pyobject::{
|
||||
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef,
|
||||
PyResult, TypeProtocol,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use super::bytecode;
|
||||
use super::exceptions;
|
||||
use super::obj::objdict;
|
||||
use super::obj::objfloat;
|
||||
use super::obj::objint;
|
||||
use super::obj::objlist;
|
||||
use super::obj::objstr;
|
||||
use super::obj::objtype;
|
||||
use super::objbool;
|
||||
use super::objdict;
|
||||
use super::objfloat;
|
||||
use super::objfunction;
|
||||
use super::objint;
|
||||
use super::objlist;
|
||||
use super::objobject;
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
use super::vm::VirtualMachine;
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
@@ -6,12 +6,13 @@ use serde::de::Visitor;
|
||||
use serde::ser::{SerializeMap, SerializeSeq};
|
||||
use serde_json;
|
||||
|
||||
use super::super::obj::{objdict, objfloat, objint, objlist, objstr, objtype};
|
||||
use super::super::pyobject::{
|
||||
DictProtocol, PyContext, PyFuncArgs, PyObject, PyObjectKind, PyObjectRef, PyResult,
|
||||
TypeProtocol,
|
||||
};
|
||||
use super::super::VirtualMachine;
|
||||
use super::super::{objbool, objdict, objfloat, objint, objlist, objsequence, objstr, objtype};
|
||||
use super::super::{objbool, objsequence};
|
||||
|
||||
// We need to have a VM available to serialise a PyObject based on its subclass, so we implement
|
||||
// PyObject serialisation via a proxy object which holds a reference to a VM
|
||||
|
||||
@@ -15,11 +15,11 @@ use super::builtins;
|
||||
use super::bytecode;
|
||||
use super::frame::{copy_code, Block, Frame};
|
||||
use super::import::import;
|
||||
use super::obj::objlist;
|
||||
use super::obj::objstr;
|
||||
use super::obj::objtype;
|
||||
use super::objbool;
|
||||
use super::objlist;
|
||||
use super::objobject;
|
||||
use super::objstr;
|
||||
use super::objtype;
|
||||
use super::pyobject::{
|
||||
AttributeProtocol, DictProtocol, IdProtocol, ParentProtocol, PyContext, PyFuncArgs, PyObject,
|
||||
PyObjectKind, PyObjectRef, PyResult,
|
||||
@@ -969,7 +969,7 @@ impl VirtualMachine {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::objint;
|
||||
use super::super::obj::objint;
|
||||
use super::objstr;
|
||||
use super::VirtualMachine;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user