Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

more cspell #4702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion 64 .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,85 @@
"words": [
// Rust
"ahash",
"bidi",
"biguint",
"bindgen",
"bitflags",
"bstr",
"byteorder",
"chrono",
"consts",
"cstring",
"flate2",
"fract",
"hasher",
"idents",
"indexmap",
"insta",
"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",
Expand All @@ -79,26 +114,38 @@
"getnewargs",
"getweakrefcount",
"getweakrefs",
"hostnames",
"idiv",
"impls",
"infj",
"instancecheck",
"instanceof",
"isabstractmethod",
"itemiterator",
"itemsize",
"iternext",
"keyiterator",
"kwarg",
"kwargs",
"linearization",
"linearize",
"listcomp",
"mappingproxy",
"maxsplit",
"MemoryView",
"memoryview",
"memoryviewiterator",
"metaclass",
"metaclasses",
"metatype",
"mro",
"mros",
"nanj",
"ndigits",
"ndim",
"nonbytes",
"origname",
"posixsubprocess",
"pyexpat",
"PYTHONDEBUG",
"PYTHONHOME",
"PYTHONINSPECT",
Expand All @@ -108,14 +155,27 @@
"PYTHONVERBOSE",
"PYTHONWARNINGS",
"qualname",
"radd",
"rdiv",
"rdivmod",
"reconstructor",
"reversevalueiterator",
"rfloordiv",
"rlshift",
"rmod",
"rpow",
"rrshift",
"rsub",
"rtruediv",
"scproxy",
"setattro",
"setcomp",
"stacklevel",
"subclasscheck",
"subclasshook",
"unionable",
"unraisablehook",
"valueiterator",
"vararg",
"varargs",
"varnames",
Expand Down Expand Up @@ -165,6 +225,7 @@
"pystruct",
"pystructseq",
"pytrace",
"reducelib",
"richcompare",
"RustPython",
"struc",
Expand Down Expand Up @@ -215,6 +276,7 @@
"unparser",
"VARKEYWORDS",
"varkwarg",
"wbits",
"withitem",
"withs"
],
Expand Down
2 changes: 2 additions & 0 deletions 2 stdlib/src/array.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// spell-checker:ignore typecode tofile tolist fromfile

use rustpython_vm::{PyObjectRef, VirtualMachine};

pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
Expand Down
2 changes: 2 additions & 0 deletions 2 stdlib/src/binascii.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 2 additions & 0 deletions 2 stdlib/src/bz2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// spell-checker:ignore compresslevel

pub(crate) use _bz2::make_module;

#[pymodule]
Expand Down
2 changes: 2 additions & 0 deletions 2 stdlib/src/hashlib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// spell-checker:ignore usedforsecurity HASHXOF

pub(crate) use hashlib::make_module;

#[pymodule]
Expand Down
2 changes: 2 additions & 0 deletions 2 stdlib/src/syslog.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// spell-checker:ignore logoption openlog setlogmask upto

pub(crate) use syslog::make_module;

#[pymodule(name = "syslog")]
Expand Down
3 changes: 3 additions & 0 deletions 3 stdlib/src/unicodedata.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 2 additions & 0 deletions 2 stdlib/src/zlib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// spell-checker:ignore compressobj decompressobj zdict chunksize zlibmodule miniz

pub(crate) use zlib::make_module;

#[pymodule]
Expand Down
4 changes: 2 additions & 2 deletions 4 vm/src/anystr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions 2 vm/src/builtins/float.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// spell-checker:ignore numer denom

use super::{
try_bigint_to_f64, PyByteArray, PyBytes, PyInt, PyIntRef, PyStr, PyStrRef, PyType, PyTypeRef,
};
Expand Down
6 changes: 3 additions & 3 deletions 6 vm/src/builtins/genericalias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions 18 vm/src/builtins/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions 1 vm/src/builtins/slice.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// sliceobject.{h,c} in CPython
// spell-checker:ignore sliceobject
use super::{PyTupleRef, PyType, PyTypeRef};
use crate::{
class::PyClassImpl,
Expand Down
32 changes: 16 additions & 16 deletions 32 vm/src/builtins/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -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]
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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') {
Expand All @@ -1703,22 +1703,22 @@ 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>
where
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') {
Expand All @@ -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
}
}

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.