more cspell (#4702)

This commit is contained in:
Jeong YunWon
2023-03-17 14:02:24 +09:00
committed by GitHub
parent 123559478e
commit b35861005e
18 changed files with 134 additions and 54 deletions

View File

@@ -26,11 +26,17 @@
"words": [
// Rust
"ahash",
"bidi",
"biguint",
"bindgen",
"bitflags",
"bstr",
"byteorder",
"chrono",
"consts",
"cstring",
"flate2",
"fract",
"hasher",
"idents",
"indexmap",
@@ -38,38 +44,67 @@
"keccak",
"lalrpop",
"libc",
"libz",
"longlong",
"Manually",
"maplit",
"memmap",
"metas",
"modpow",
"nanos",
"peekable",
"powc",
"powf",
"prepended",
"punct",
"replacen",
"rsplitn",
"rustc",
"rustfmt",
"splitn",
"subsec",
"timsort",
"trai",
"ulonglong",
"unic",
"unistd",
"winapi",
"winsock",
// Python
"abstractmethods",
"aiter",
"anext",
"arrayiterator",
"arraytype",
"asend",
"athrow",
"basicsize",
"cformat",
"classcell",
"closesocket",
"codepoint",
"codepoints",
"cpython",
"decompressor",
"defaultaction",
"descr",
"dictcomp",
"dictitems",
"dictkeys",
"dictview",
"docstring",
"docstrings",
"dunder",
"eventmask",
"fdel",
"fget",
"fileencoding",
"fillchar",
"finallyhandler",
"frombytes",
"fromhex",
"fromunicode",
"fset",
"fspath",
"fstring",
"fstrings",
@@ -79,12 +114,17 @@
"getnewargs",
"getweakrefcount",
"getweakrefs",
"hostnames",
"idiv",
"impls",
"infj",
"instancecheck",
"instanceof",
"isabstractmethod",
"itemiterator",
"itemsize",
"iternext",
"keyiterator",
"kwarg",
"kwargs",
"linearization",
@@ -92,13 +132,20 @@
"listcomp",
"mappingproxy",
"maxsplit",
"MemoryView",
"memoryview",
"memoryviewiterator",
"metaclass",
"metaclasses",
"metatype",
"mro",
"mros",
"nanj",
"ndigits",
"ndim",
"nonbytes",
"origname",
"posixsubprocess",
"pyexpat",
"PYTHONDEBUG",
"PYTHONHOME",
"PYTHONINSPECT",
@@ -108,7 +155,19 @@
"PYTHONVERBOSE",
"PYTHONWARNINGS",
"qualname",
"radd",
"rdiv",
"rdivmod",
"reconstructor",
"reversevalueiterator",
"rfloordiv",
"rlshift",
"rmod",
"rpow",
"rrshift",
"rsub",
"rtruediv",
"scproxy",
"setattro",
"setcomp",
"stacklevel",
@@ -116,6 +175,7 @@
"subclasshook",
"unionable",
"unraisablehook",
"valueiterator",
"vararg",
"varargs",
"varnames",
@@ -165,6 +225,7 @@
"pystruct",
"pystructseq",
"pytrace",
"reducelib",
"richcompare",
"RustPython",
"struc",
@@ -215,6 +276,7 @@
"unparser",
"VARKEYWORDS",
"varkwarg",
"wbits",
"withitem",
"withs"
],

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore typecode tofile tolist fromfile
use rustpython_vm::{PyObjectRef, VirtualMachine};
pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore hexlify unhexlify uuencodes
pub(super) use decl::crc32;
pub(crate) use decl::make_module;
use rustpython_vm::{builtins::PyBaseExceptionRef, convert::ToPyException, VirtualMachine};

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore compresslevel
pub(crate) use _bz2::make_module;
#[pymodule]

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore usedforsecurity HASHXOF
pub(crate) use hashlib::make_module;
#[pymodule]

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore logoption openlog setlogmask upto
pub(crate) use syslog::make_module;
#[pymodule(name = "syslog")]

View File

@@ -1,6 +1,9 @@
/* Access to the unicode database.
See also: https://docs.python.org/3/library/unicodedata.html
*/
// spell-checker:ignore nfkc unistr unidata
use crate::vm::{
builtins::PyStr, convert::TryFromBorrowedObject, PyObject, PyObjectRef, PyPayload, PyResult,
VirtualMachine,

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore compressobj decompressobj zdict chunksize zlibmodule miniz
pub(crate) use zlib::make_module;
#[pymodule]

View File

@@ -194,7 +194,7 @@ pub trait AnyStr {
SW: Fn(&Self, isize, &VirtualMachine) -> Vec<R>,
{
let (sep, maxsplit) = args.get_value(vm)?;
let splited = if let Some(pattern) = sep {
let splits = if let Some(pattern) = sep {
if maxsplit < 0 {
split(self, pattern.as_ref(), vm)
} else {
@@ -203,7 +203,7 @@ pub trait AnyStr {
} else {
splitw(self, maxsplit, vm)
};
Ok(splited)
Ok(splits)
}
fn py_split_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef>
where

View File

@@ -1,3 +1,5 @@
// spell-checker:ignore numer denom
use super::{
try_bigint_to_f64, PyByteArray, PyBytes, PyInt, PyIntRef, PyStr, PyStrRef, PyType, PyTypeRef,
};

View File

@@ -225,9 +225,9 @@ fn make_parameters(args: &PyTupleRef, vm: &VirtualMachine) -> PyTupleRef {
.get_attr(identifier!(vm, __parameters__), vm)
.and_then(|obj| PyTupleRef::try_from_object(vm, obj))
{
for subparam in &subparams {
if !parameters.iter().any(|param| param.is(subparam)) {
parameters.push(subparam.clone());
for sub_param in &subparams {
if !parameters.iter().any(|param| param.is(sub_param)) {
parameters.push(sub_param.clone());
}
}
}

View File

@@ -345,19 +345,19 @@ impl PyRange {
fn getitem(&self, subscript: PyObjectRef, vm: &VirtualMachine) -> PyResult {
match RangeIndex::try_from_object(vm, subscript)? {
RangeIndex::Slice(slice) => {
let (mut substart, mut substop, mut substep) =
let (mut sub_start, mut sub_stop, mut sub_step) =
slice.inner_indices(&self.compute_length(), vm)?;
let range_step = &self.step;
let range_start = &self.start;
substep *= range_step.as_bigint();
substart = (substart * range_step.as_bigint()) + range_start.as_bigint();
substop = (substop * range_step.as_bigint()) + range_start.as_bigint();
sub_step *= range_step.as_bigint();
sub_start = (sub_start * range_step.as_bigint()) + range_start.as_bigint();
sub_stop = (sub_stop * range_step.as_bigint()) + range_start.as_bigint();
Ok(PyRange {
start: vm.new_pyref(substart),
stop: vm.new_pyref(substop),
step: vm.new_pyref(substep),
start: vm.new_pyref(sub_start),
stop: vm.new_pyref(sub_stop),
step: vm.new_pyref(sub_step),
}
.into_ref(vm)
.into())
@@ -582,8 +582,8 @@ impl IterNext for PyLongRangeIterator {
}
}
// When start, stop, step are isizes, we can use a faster more compact representation
// that only operates using isizes to track values.
// When start, stop, step are isize, we can use a faster more compact representation
// that only operates using isize to track values.
#[pyclass(module = false, name = "range_iterator")]
#[derive(Debug)]
pub struct PyRangeIterator {

View File

@@ -1,4 +1,5 @@
// sliceobject.{h,c} in CPython
// spell-checker:ignore sliceobject
use super::{PyTupleRef, PyType, PyTypeRef};
use crate::{
class::PyClassImpl,

View File

@@ -693,9 +693,9 @@ impl PyStr {
/// If the string ends with the suffix string, return string[:len(suffix)]
/// Otherwise, return a copy of the original string.
#[pymethod]
fn removesuffix(&self, suff: PyStrRef) -> String {
fn removesuffix(&self, suffix: PyStrRef) -> String {
self.as_str()
.py_removesuffix(suff.as_str(), suff.byte_len(), |s, p| s.ends_with(p))
.py_removesuffix(suffix.as_str(), suffix.byte_len(), |s, p| s.ends_with(p))
.to_owned()
}
@@ -711,15 +711,15 @@ impl PyStr {
#[pymethod]
fn isdigit(&self) -> bool {
// python's isdigit also checks if exponents are digits, these are the unicodes for exponents
let valid_unicodes: [u16; 10] = [
// python's isdigit also checks if exponents are digits, these are the unicode codepoints for exponents
let valid_codepoints: [u16; 10] = [
0x2070, 0x00B9, 0x00B2, 0x00B3, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079,
];
let s = self.as_str();
!s.is_empty()
&& s.chars()
.filter(|c| !c.is_ascii_digit())
.all(|c| valid_unicodes.contains(&(c as u16)))
.all(|c| valid_codepoints.contains(&(c as u16)))
}
#[pymethod]
@@ -827,12 +827,12 @@ impl PyStr {
fn replace(&self, old: PyStrRef, new: PyStrRef, count: OptionalArg<isize>) -> String {
let s = self.as_str();
match count {
OptionalArg::Present(maxcount) if maxcount >= 0 => {
if maxcount == 0 || s.is_empty() {
OptionalArg::Present(max_count) if max_count >= 0 => {
if max_count == 0 || s.is_empty() {
// nothing to do; return the original bytes
s.into()
} else {
s.replacen(old.as_str(), new.as_str(), maxcount as usize)
s.replacen(old.as_str(), new.as_str(), max_count as usize)
}
}
_ => s.replace(old.as_str(), new.as_str()),
@@ -1692,7 +1692,7 @@ impl AnyStr for str {
F: Fn(&Self) -> PyObjectRef,
{
// CPython split_whitespace
let mut splited = Vec::new();
let mut splits = Vec::new();
let mut last_offset = 0;
let mut count = maxsplit;
for (offset, _) in self.match_indices(|c: char| c.is_ascii_whitespace() || c == '\x0b') {
@@ -1703,14 +1703,14 @@ impl AnyStr for str {
if count == 0 {
break;
}
splited.push(convert(&self[last_offset..offset]));
splits.push(convert(&self[last_offset..offset]));
last_offset = offset + 1;
count -= 1;
}
if last_offset != self.len() {
splited.push(convert(&self[last_offset..]));
splits.push(convert(&self[last_offset..]));
}
splited
splits
}
fn py_rsplit_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef>
@@ -1718,7 +1718,7 @@ impl AnyStr for str {
F: Fn(&Self) -> PyObjectRef,
{
// CPython rsplit_whitespace
let mut splited = Vec::new();
let mut splits = Vec::new();
let mut last_offset = self.len();
let mut count = maxsplit;
for (offset, _) in self.rmatch_indices(|c: char| c.is_ascii_whitespace() || c == '\x0b') {
@@ -1729,14 +1729,14 @@ impl AnyStr for str {
if count == 0 {
break;
}
splited.push(convert(&self[offset + 1..last_offset]));
splits.push(convert(&self[offset + 1..last_offset]));
last_offset = offset;
count -= 1;
}
if last_offset != 0 {
splited.push(convert(&self[..last_offset]));
splits.push(convert(&self[..last_offset]));
}
splited
splits
}
}

View File

@@ -126,10 +126,10 @@ impl PySuper {
#[pymethod(magic)]
fn repr(&self) -> String {
let typname = &self.typ.name();
let name = &self.typ.name();
match self.obj {
Some((_, ref ty)) => format!("<super: <class '{}'>, <{} object>>", typname, ty.name()),
None => format!("<super: <class '{typname}'>, NULL>"),
Some((_, ref ty)) => format!("<super: <class '{}'>, <{} object>>", name, ty.name()),
None => format!("<super: <class '{name}'>, NULL>"),
}
}
}

View File

@@ -56,7 +56,7 @@ impl IntoPyTuple for Vec<PyObjectRef> {
}
}
macro_rules! impl_intopyobj_tuple {
macro_rules! impl_into_pyobj_tuple {
($(($T:ident, $idx:tt)),+) => {
impl<$($T: ToPyObject),*> IntoPyTuple for ($($T,)*) {
fn into_pytuple(self, vm: &VirtualMachine) -> PyTupleRef {
@@ -72,13 +72,13 @@ macro_rules! impl_intopyobj_tuple {
};
}
impl_intopyobj_tuple!((A, 0));
impl_intopyobj_tuple!((A, 0), (B, 1));
impl_intopyobj_tuple!((A, 0), (B, 1), (C, 2));
impl_intopyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3));
impl_intopyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4));
impl_intopyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5));
impl_intopyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6));
impl_into_pyobj_tuple!((A, 0));
impl_into_pyobj_tuple!((A, 0), (B, 1));
impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2));
impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3));
impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4));
impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5));
impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6));
impl PyTuple {
pub(crate) fn fast_getitem(&self, idx: usize) -> PyObjectRef {

View File

@@ -151,14 +151,14 @@ fn make_parameters(args: &PyTupleRef, vm: &VirtualMachine) -> PyTupleRef {
if !parameters.iter().any(|param| param.is(arg)) {
parameters.push(arg.clone());
}
} else if let Ok(subparams) = arg
} else if let Ok(sub_params) = arg
.clone()
.get_attr(identifier!(vm, __parameters__), vm)
.and_then(|obj| PyTupleRef::try_from_object(vm, obj))
{
for subparam in &subparams {
if !parameters.iter().any(|param| param.is(subparam)) {
parameters.push(subparam.clone());
for sub_param in &sub_params {
if !parameters.iter().any(|param| param.is(sub_param)) {
parameters.push(sub_param.clone());
}
}
}

View File

@@ -1044,7 +1044,7 @@ impl AnyStr for [u8] {
where
F: Fn(&Self) -> PyObjectRef,
{
let mut splited = Vec::new();
let mut splits = Vec::new();
let mut count = maxsplit;
let mut haystack = self;
while let Some(offset) = haystack.find_byteset(ASCII_WHITESPACES) {
@@ -1052,22 +1052,22 @@ impl AnyStr for [u8] {
if count == 0 {
break;
}
splited.push(convert(&haystack[..offset]));
splits.push(convert(&haystack[..offset]));
count -= 1;
}
haystack = &haystack[offset + 1..];
}
if !haystack.is_empty() {
splited.push(convert(haystack));
splits.push(convert(haystack));
}
splited
splits
}
fn py_rsplit_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef>
where
F: Fn(&Self) -> PyObjectRef,
{
let mut splited = Vec::new();
let mut splits = Vec::new();
let mut count = maxsplit;
let mut haystack = self;
while let Some(offset) = haystack.rfind_byteset(ASCII_WHITESPACES) {
@@ -1075,15 +1075,15 @@ impl AnyStr for [u8] {
if count == 0 {
break;
}
splited.push(convert(&haystack[offset + 1..]));
splits.push(convert(&haystack[offset + 1..]));
count -= 1;
}
haystack = &haystack[..offset];
}
if !haystack.is_empty() {
splited.push(convert(haystack));
splits.push(convert(haystack));
}
splited
splits
}
}