GeezerVison is showing github.com — Rename stdlib files to match Python module names (#7397) · RustPython/RustPython@a854ef2
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: crates/stdlib/src/array.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,7 @@ mod array { | 35 | 35 | SaturatedSlice, SequenceIndex, SequenceIndexOp, SliceableSequenceMutOp, | 36 | 36 | SliceableSequenceOp, | 37 | 37 | }, | 38 | | - stdlib::warnings, | | 38 | + stdlib::_warnings, | 39 | 39 | types::{ | 40 | 40 | AsBuffer, AsMapping, AsSequence, Comparable, Constructor, IterNext, Iterable, | 41 | 41 | PyComparisonOp, Representable, SelfIter, | @@ -647,7 +647,7 @@ mod array { | 647 | 647 | } | 648 | 648 |
| 649 | 649 | if spec == 'u' { | 650 | | - warnings::warn( | | 650 | + _warnings::warn( | 651 | 651 | vm.ctx.exceptions.deprecation_warning, | 652 | 652 | "The 'u' type code is deprecated and will be removed in Python 3.16".to_owned(), | 653 | 653 | 1, | |
Collapse file Copy file name to clipboardExpand all lines: crates/stdlib/src/faulthandler.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -405,7 +405,7 @@ mod decl { | 405 | 405 | // Get all threads' frame stacks from the shared registry | 406 | 406 | #[cfg(feature = "threading")] | 407 | 407 | { | 408 | | - let current_tid = rustpython_vm::stdlib::thread::get_ident(); | | 408 | + let current_tid = rustpython_vm::stdlib::_thread::get_ident(); | 409 | 409 | let registry = vm.state.thread_frames.lock(); | 410 | 410 |
| 411 | 411 | // First dump non-current threads, then current thread last | |
Collapse file Copy file name to clipboardExpand all lines: crates/stdlib/src/fcntl.rs +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ mod fcntl { | 8 | 8 | PyResult, VirtualMachine, | 9 | 9 | builtins::PyIntRef, | 10 | 10 | function::{ArgMemoryBuffer, ArgStrOrBytesLike, Either, OptionalArg}, | 11 | | - stdlib::io, | | 11 | + stdlib::_io, | 12 | 12 | }; | 13 | 13 |
| 14 | 14 | // TODO: supply these from <asm-generic/fnctl.h> (please file an issue/PR upstream): | @@ -57,7 +57,7 @@ mod fcntl { | 57 | 57 |
| 58 | 58 | #[pyfunction] | 59 | 59 | fn fcntl( | 60 | | - io::Fildes(fd): io::Fildes, | | 60 | + _io::Fildes(fd): _io::Fildes, | 61 | 61 | cmd: i32, | 62 | 62 | arg: OptionalArg<Either<ArgStrOrBytesLike, PyIntRef>>, | 63 | 63 | vm: &VirtualMachine, | @@ -91,7 +91,7 @@ mod fcntl { | 91 | 91 |
| 92 | 92 | #[pyfunction] | 93 | 93 | fn ioctl( | 94 | | - io::Fildes(fd): io::Fildes, | | 94 | + _io::Fildes(fd): _io::Fildes, | 95 | 95 | request: i64, | 96 | 96 | arg: OptionalArg<Either<Either<ArgMemoryBuffer, ArgStrOrBytesLike>, i32>>, | 97 | 97 | mutate_flag: OptionalArg<bool>, | @@ -149,7 +149,7 @@ mod fcntl { | 149 | 149 | // XXX: at the time of writing, wasi and redox don't have the necessary constants/function | 150 | 150 | #[cfg(not(any(target_os = "wasi", target_os = "redox")))] | 151 | 151 | #[pyfunction] | 152 | | - fn flock(io::Fildes(fd): io::Fildes, operation: i32, vm: &VirtualMachine) -> PyResult { | | 152 | + fn flock(_io::Fildes(fd): _io::Fildes, operation: i32, vm: &VirtualMachine) -> PyResult { | 153 | 153 | let ret = unsafe { libc::flock(fd, operation) }; | 154 | 154 | // TODO: add support for platforms that don't have a builtin `flock` syscall | 155 | 155 | if ret < 0 { | @@ -162,7 +162,7 @@ mod fcntl { | 162 | 162 | #[cfg(not(any(target_os = "wasi", target_os = "redox")))] | 163 | 163 | #[pyfunction] | 164 | 164 | fn lockf( | 165 | | - io::Fildes(fd): io::Fildes, | | 165 | + _io::Fildes(fd): _io::Fildes, | 166 | 166 | cmd: i32, | 167 | 167 | len: OptionalArg<PyIntRef>, | 168 | 168 | start: OptionalArg<PyIntRef>, | |
Collapse file Copy file name to clipboardExpand all lines: crates/stdlib/src/select.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -337,7 +337,7 @@ mod decl { | 337 | 337 | common::lock::PyMutex, | 338 | 338 | convert::{IntoPyException, ToPyObject}, | 339 | 339 | function::OptionalArg, | 340 | | - stdlib::io::Fildes, | | 340 | + stdlib::_io::Fildes, | 341 | 341 | }; | 342 | 342 | use core::{convert::TryFrom, time::Duration}; | 343 | 343 | use libc::pollfd; | @@ -554,7 +554,7 @@ mod decl { | 554 | 554 | common::lock::{PyRwLock, PyRwLockReadGuard}, | 555 | 555 | convert::{IntoPyException, ToPyObject}, | 556 | 556 | function::OptionalArg, | 557 | | - stdlib::io::Fildes, | | 557 | + stdlib::_io::Fildes, | 558 | 558 | types::Constructor, | 559 | 559 | }; | 560 | 560 | use core::ops::Deref; | |
Collapse file Copy file name to clipboardExpand all lines: crates/stdlib/src/ssl.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,7 +48,7 @@ mod _ssl { | 48 | 48 | function::{ | 49 | 49 | ArgBytesLike, ArgMemoryBuffer, Either, FuncArgs, OptionalArg, PyComparisonValue, | 50 | 50 | }, | 51 | | - stdlib::warnings, | | 51 | + stdlib::_warnings, | 52 | 52 | types::{Comparable, Constructor, Hashable, PyComparisonOp, Representable}, | 53 | 53 | }, | 54 | 54 | }; | @@ -976,7 +976,7 @@ mod _ssl { | 976 | 976 |
| 977 | 977 | // Warn if any deprecated options are being newly set | 978 | 978 | if (set & opt_no) != 0 { | 979 | | - warnings::warn( | | 979 | + _warnings::warn( | 980 | 980 | vm.ctx.exceptions.deprecation_warning, | 981 | 981 | "ssl.OP_NO_SSL*/ssl.OP_NO_TLS* options are deprecated".to_owned(), | 982 | 982 | 2, // stack_level = 2 | |
Collapse file Copy file name to clipboardExpand all lines: crates/vm/src/builtins/complex.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ use crate::{ | 7 | 7 | convert::{IntoPyException, ToPyObject, ToPyResult}, | 8 | 8 | function::{FuncArgs, OptionalArg, PyComparisonValue}, | 9 | 9 | protocol::PyNumberMethods, | 10 | | - stdlib::warnings, | | 10 | + stdlib::_warnings, | 11 | 11 | types::{AsNumber, Comparable, Constructor, Hashable, PyComparisonOp, Representable}, | 12 | 12 | }; | 13 | 13 | use core::cell::Cell; | @@ -95,7 +95,7 @@ impl PyObjectRef { | 95 | 95 |
| 96 | 96 | let ret_class = result.class().to_owned(); | 97 | 97 | if let Some(ret) = result.downcast_ref::<PyComplex>() { | 98 | | - warnings::warn( | | 98 | + _warnings::warn( | 99 | 99 | vm.ctx.exceptions.deprecation_warning, | 100 | 100 | format!( | 101 | 101 | "__complex__ returned non-complex (type {ret_class}). \ | |
Collapse file Copy file name to clipboardExpand all lines: crates/vm/src/builtins/genericalias.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -735,7 +735,7 @@ pub fn subscript_generic(type_params: PyObjectRef, vm: &VirtualMachine) -> PyRes | 735 | 735 | PyTuple::new_ref(vec![type_params], &vm.ctx) | 736 | 736 | }; | 737 | 737 |
| 738 | | - let args = crate::stdlib::typing::unpack_typevartuples(¶ms, vm)?; | | 738 | + let args = crate::stdlib::_typing::unpack_typevartuples(¶ms, vm)?; | 739 | 739 |
| 740 | 740 | generic_alias_class.call((generic_type, args.to_pyobject(vm)), vm) | 741 | 741 | } | |
Collapse file Copy file name to clipboardExpand all lines: crates/vm/src/builtins/union.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ use crate::{ | 9 | 9 | convert::ToPyObject, | 10 | 10 | function::PyComparisonValue, | 11 | 11 | protocol::{PyMappingMethods, PyNumberMethods}, | 12 | | - stdlib::typing::{TypeAliasType, call_typing_func_object}, | | 12 | + stdlib::_typing::{TypeAliasType, call_typing_func_object}, | 13 | 13 | types::{AsMapping, AsNumber, Comparable, GetAttr, Hashable, PyComparisonOp, Representable}, | 14 | 14 | }; | 15 | 15 | use alloc::fmt; | |
Collapse file Copy file name to clipboardExpand all lines: crates/vm/src/frame.rs +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,7 +29,7 @@ use crate::{ | 29 | 29 | protocol::{PyIter, PyIterReturn}, | 30 | 30 | scope::Scope, | 31 | 31 | sliceable::SliceableSequenceOp, | 32 | | - stdlib::{builtins, sys::monitoring, typing}, | | 32 | + stdlib::{_typing, builtins, sys::monitoring}, | 33 | 33 | types::{PyComparisonOp, PyTypeFlags}, | 34 | 34 | vm::{Context, PyMethod}, | 35 | 35 | }; | @@ -9134,19 +9134,19 @@ impl ExecutingFrame<'_> { | 9134 | 9134 | } | 9135 | 9135 | bytecode::IntrinsicFunction1::TypeVar => { | 9136 | 9136 | let type_var: PyObjectRef = | 9137 | | - typing::TypeVar::new(vm, arg.clone(), vm.ctx.none(), vm.ctx.none()) | | 9137 | + _typing::TypeVar::new(vm, arg.clone(), vm.ctx.none(), vm.ctx.none()) | 9138 | 9138 | .into_ref(&vm.ctx) | 9139 | 9139 | .into(); | 9140 | 9140 | Ok(type_var) | 9141 | 9141 | } | 9142 | 9142 | bytecode::IntrinsicFunction1::ParamSpec => { | 9143 | | - let param_spec: PyObjectRef = typing::ParamSpec::new(arg.clone(), vm) | | 9143 | + let param_spec: PyObjectRef = _typing::ParamSpec::new(arg.clone(), vm) | 9144 | 9144 | .into_ref(&vm.ctx) | 9145 | 9145 | .into(); | 9146 | 9146 | Ok(param_spec) | 9147 | 9147 | } | 9148 | 9148 | bytecode::IntrinsicFunction1::TypeVarTuple => { | 9149 | | - let type_var_tuple: PyObjectRef = typing::TypeVarTuple::new(arg.clone(), vm) | | 9149 | + let type_var_tuple: PyObjectRef = _typing::TypeVarTuple::new(arg.clone(), vm) | 9150 | 9150 | .into_ref(&vm.ctx) | 9151 | 9151 | .into(); | 9152 | 9152 | Ok(type_var_tuple) | @@ -9179,7 +9179,7 @@ impl ExecutingFrame<'_> { | 9179 | 9179 | let name = name | 9180 | 9180 | .downcast::<crate::builtins::PyStr>() | 9181 | 9181 | .map_err(|_| vm.new_type_error("TypeAliasType name must be a string"))?; | 9182 | | - let type_alias = typing::TypeAliasType::new(name, type_params, compute_value); | | 9182 | + let type_alias = _typing::TypeAliasType::new(name, type_params, compute_value); | 9183 | 9183 | Ok(type_alias.into_ref(&vm.ctx).into()) | 9184 | 9184 | } | 9185 | 9185 | bytecode::IntrinsicFunction1::ListToTuple => { | @@ -9225,7 +9225,7 @@ impl ExecutingFrame<'_> { | 9225 | 9225 | ) -> PyResult { | 9226 | 9226 | match func { | 9227 | 9227 | bytecode::IntrinsicFunction2::SetTypeparamDefault => { | 9228 | | - crate::stdlib::typing::set_typeparam_default(arg1, arg2, vm) | | 9228 | + crate::stdlib::_typing::set_typeparam_default(arg1, arg2, vm) | 9229 | 9229 | } | 9230 | 9230 | bytecode::IntrinsicFunction2::SetFunctionTypeParams => { | 9231 | 9231 | // arg1 is the function, arg2 is the type params tuple | @@ -9235,14 +9235,14 @@ impl ExecutingFrame<'_> { | 9235 | 9235 | } | 9236 | 9236 | bytecode::IntrinsicFunction2::TypeVarWithBound => { | 9237 | 9237 | let type_var: PyObjectRef = | 9238 | | - typing::TypeVar::new(vm, arg1.clone(), arg2, vm.ctx.none()) | | 9238 | + _typing::TypeVar::new(vm, arg1.clone(), arg2, vm.ctx.none()) | 9239 | 9239 | .into_ref(&vm.ctx) | 9240 | 9240 | .into(); | 9241 | 9241 | Ok(type_var) | 9242 | 9242 | } | 9243 | 9243 | bytecode::IntrinsicFunction2::TypeVarWithConstraint => { | 9244 | 9244 | let type_var: PyObjectRef = | 9245 | | - typing::TypeVar::new(vm, arg1.clone(), vm.ctx.none(), arg2) | | 9245 | + _typing::TypeVar::new(vm, arg1.clone(), vm.ctx.none(), arg2) | 9246 | 9246 | .into_ref(&vm.ctx) | 9247 | 9247 | .into(); | 9248 | 9248 | Ok(type_var) | |
Collapse file Copy file name to clipboardExpand all lines: crates/vm/src/ospath.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -86,7 +86,7 @@ impl PathConverter { | 86 | 86 | .class() | 87 | 87 | .is(crate::builtins::bool_::PyBool::static_type()) | 88 | 88 | { | 89 | | - crate::stdlib::warnings::warn( | | 89 | + crate::stdlib::_warnings::warn( | 90 | 90 | vm.ctx.exceptions.runtime_warning, | 91 | 91 | "bool is used as a file descriptor".to_owned(), | 92 | 92 | 1, | |
|