mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Merge pull request #3153 from youknowone/use-statement
clean up use statements
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
use crate::{
|
||||
stdlib::{os::PyPathLike, posix},
|
||||
{PyObjectRef, PyResult, PySequence, TryFromObject, VirtualMachine},
|
||||
};
|
||||
use nix::{errno::Errno, unistd};
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
use std::ffi::CStr;
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::{
|
||||
convert::Infallible as Never,
|
||||
ffi::CString,
|
||||
io::{self, prelude::*},
|
||||
};
|
||||
|
||||
pub(crate) use _posixsubprocess::make_module;
|
||||
|
||||
#[pymodule]
|
||||
@@ -28,18 +43,6 @@ mod _posixsubprocess {
|
||||
}
|
||||
}
|
||||
|
||||
use super::os::PyPathLike;
|
||||
use super::posix;
|
||||
use crate::{PyObjectRef, PyResult, PySequence, TryFromObject, VirtualMachine};
|
||||
use nix::{errno::Errno, unistd};
|
||||
use std::convert::Infallible as Never;
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
use std::ffi::CStr;
|
||||
use std::ffi::CString;
|
||||
use std::io::{self, prelude::*};
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
use std::os::unix::io::AsRawFd;
|
||||
|
||||
macro_rules! gen_args {
|
||||
($($field:ident: $t:ty),*$(,)?) => {
|
||||
#[derive(FromArgs)]
|
||||
|
||||
@@ -31,10 +31,10 @@ macro_rules! create_property {
|
||||
|
||||
#[pymodule(name = "pyexpat")]
|
||||
mod _pyexpat {
|
||||
use crate::builtins::{PyStr, PyStrRef, PyTypeRef};
|
||||
use crate::byteslike::ArgBytesLike;
|
||||
use crate::function::{IntoFuncArgs, OptionalArg};
|
||||
use crate::{
|
||||
builtins::{PyStr, PyStrRef, PyTypeRef},
|
||||
byteslike::ArgBytesLike,
|
||||
function::{IntoFuncArgs, OptionalArg},
|
||||
ItemProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject,
|
||||
VirtualMachine,
|
||||
};
|
||||
|
||||
@@ -148,11 +148,10 @@ fn sec_to_timeval(sec: f64) -> timeval {
|
||||
|
||||
#[pymodule(name = "select")]
|
||||
mod decl {
|
||||
use super::super::time;
|
||||
use super::*;
|
||||
use crate::{
|
||||
exceptions::IntoPyException, function::OptionalOption, utils::Either, PyObjectRef,
|
||||
PyResult, VirtualMachine,
|
||||
exceptions::IntoPyException, function::OptionalOption, stdlib::time, utils::Either,
|
||||
PyObjectRef, PyResult, VirtualMachine,
|
||||
};
|
||||
|
||||
#[pyfunction]
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::common::lock::{PyRwLock, PyRwLockWriteGuard};
|
||||
use crate::{
|
||||
builtins::{PyStrRef, PyType, PyTypeRef, PyWeak},
|
||||
byteslike::{ArgBytesLike, ArgMemoryBuffer, ArgStrOrBytesLike},
|
||||
exceptions::{create_exception_type, IntoPyException, PyBaseExceptionRef},
|
||||
exceptions::{self, create_exception_type, IntoPyException, PyBaseExceptionRef},
|
||||
function::{ArgCallable, OptionalArg},
|
||||
slots::SlotConstructor,
|
||||
stdlib::os::PyPathLike,
|
||||
@@ -343,7 +343,7 @@ impl PySslContext {
|
||||
fn set_ciphers(&self, cipherlist: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
let ciphers = cipherlist.as_str();
|
||||
if ciphers.contains('\0') {
|
||||
return Err(crate::exceptions::cstring_error(vm));
|
||||
return Err(exceptions::cstring_error(vm));
|
||||
}
|
||||
self.builder().set_cipher_list(ciphers).map_err(|_| {
|
||||
vm.new_exception_msg(ssl_error(vm), "No cipher can be selected.".to_owned())
|
||||
|
||||
Reference in New Issue
Block a user