Skip to content

Commit a3e223d

Browse files
authored
Merge pull request RustPython#4432 from youknowone/cspell
first cspell dict
2 parents fc9e531 + 1848c45 commit a3e223d

File tree

18 files changed

+198
-53
lines changed

18 files changed

+198
-53
lines changed

.cspell.json

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
// See: https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell
2+
{
3+
"version": "0.2",
4+
// language - current active spelling language
5+
"language": "en",
6+
// dictionaries - list of the names of the dictionaries to use
7+
"dictionaries": [
8+
"en_US",
9+
"softwareTerms",
10+
"c",
11+
"cpp",
12+
"python",
13+
"python-custom",
14+
"rust",
15+
"unix",
16+
"posix",
17+
"winapi"
18+
],
19+
// dictionaryDefinitions - this list defines any custom dictionaries to use
20+
"dictionaryDefinitions": [],
21+
"ignorePaths": [
22+
"**/__pycache__/**",
23+
"Lib/**"
24+
],
25+
// words - list of words to be always considered correct
26+
"words": [
27+
// Rust
28+
"ahash",
29+
"bitflags",
30+
"bindgen",
31+
"cstring",
32+
"chrono",
33+
"peekable",
34+
"lalrpop",
35+
"memmap",
36+
"Manually",
37+
"rustc",
38+
"unistd",
39+
"unic",
40+
// Python
41+
"cformat",
42+
"cpython",
43+
"fspath",
44+
"kwarg",
45+
"kwargs",
46+
"vararg",
47+
"varargs",
48+
"metaclass",
49+
"metaclasses",
50+
"fstring",
51+
"fstrings",
52+
"docstring",
53+
"docstrings",
54+
"fileencoding",
55+
"linearization",
56+
"linearize",
57+
"PYTHONDEBUG",
58+
"PYTHONINSPECT",
59+
"PYTHONPATH",
60+
"PYTHONHOME",
61+
"PYTHONPATH",
62+
"PYTHONVERBOSE",
63+
"PYTHONOPTIMIZE",
64+
"PYTHONWARNINGS",
65+
"basicsize",
66+
"itemsize",
67+
"getattro",
68+
"setattro",
69+
"iternext",
70+
"maxsplit",
71+
"fdel",
72+
"subclasscheck",
73+
"qualname",
74+
"eventmask",
75+
"instanceof",
76+
"abstractmethods",
77+
"aiter",
78+
"anext",
79+
"rdiv",
80+
"idiv",
81+
"ndim",
82+
"varnames",
83+
"getweakrefs",
84+
"getweakrefcount",
85+
"stacklevel",
86+
"MemoryView",
87+
"warningregistry",
88+
"defaultaction",
89+
"unraisablehook",
90+
"descr",
91+
"xopts",
92+
"warnopts",
93+
"weakproxy",
94+
"mappingproxy",
95+
// RustPython
96+
"RustPython",
97+
"pyarg",
98+
"pyargs",
99+
"pygetset",
100+
"pyobj",
101+
"pystr",
102+
"pyc",
103+
"pyref",
104+
"pyslot",
105+
"PyFunction",
106+
"PyMethod",
107+
"PyClassMethod",
108+
"PyStaticMethod",
109+
"PyProperty",
110+
"PyClass",
111+
"pyimpl",
112+
"pyarg",
113+
"PyModule",
114+
"PyAttr",
115+
"PyResult",
116+
"PyObject",
117+
"PyException",
118+
"GetSet",
119+
"zelf",
120+
"wasi",
121+
"Bytecode",
122+
"richcompare",
123+
"makeunicodedata",
124+
"unhashable",
125+
"unraisable",
126+
"typealiases",
127+
"Unconstructible",
128+
"posonlyargs",
129+
"kwonlyargs",
130+
"uninit",
131+
"miri"
132+
],
133+
// flagWords - list of words to be always considered incorrect
134+
"flagWords": [
135+
],
136+
"ignoreRegExpList": [
137+
],
138+
// languageSettings - allow for per programming language configuration settings.
139+
"languageSettings": [
140+
{
141+
"languageId": "python",
142+
"locale": "en"
143+
}
144+
]
145+
}

compiler/parser/src/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn validate_arguments(arguments: ast::Arguments) -> Result<ast::Arguments, L
4343
pub fn parse_params(
4444
params: (Vec<ParameterDef>, Vec<ParameterDef>),
4545
) -> Result<ParameterDefs, LexicalError> {
46-
let mut posonly = Vec::with_capacity(params.0.len());
46+
let mut pos_only = Vec::with_capacity(params.0.len());
4747
let mut names = Vec::with_capacity(params.1.len());
4848
let mut defaults = vec![];
4949

@@ -63,15 +63,15 @@ pub fn parse_params(
6363

6464
for (name, default) in params.0 {
6565
try_default(&name, default)?;
66-
posonly.push(name);
66+
pos_only.push(name);
6767
}
6868

6969
for (name, default) in params.1 {
7070
try_default(&name, default)?;
7171
names.push(name);
7272
}
7373

74-
Ok((posonly, names, defaults))
74+
Ok((pos_only, names, defaults))
7575
}
7676

7777
type FunctionArgument = (

derive-impl/src/pymodule.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,19 @@ impl ModuleItem for ClassItem {
401401
let (ident, _) = pyclass_ident_and_attrs(args.item)?;
402402
let (class_name, class_new) = {
403403
let class_attr = &mut args.attrs[self.inner.index];
404-
let noattr = class_attr.try_remove_name("noattr")?;
404+
let no_attr = class_attr.try_remove_name("no_attr")?;
405405
if self.pyattrs.is_empty() {
406-
// check noattr before ClassItemMeta::from_attr
407-
if noattr.is_none() {
406+
// check no_attr before ClassItemMeta::from_attr
407+
if no_attr.is_none() {
408408
bail_span!(
409409
ident,
410410
"#[{name}] requires #[pyattr] to be a module attribute. \
411-
To keep it free type, try #[{name}(noattr)]",
411+
To keep it free type, try #[{name}(no_attr)]",
412412
name = self.attr_name()
413413
)
414414
}
415415
}
416-
let noattr = noattr.is_some();
416+
let no_attr = no_attr.is_some();
417417
let is_use = matches!(&args.item, syn::Item::Use(_));
418418

419419
let class_meta = ClassItemMeta::from_attr(ident.clone(), class_attr)?;
@@ -426,7 +426,7 @@ impl ModuleItem for ClassItem {
426426
})?;
427427
module_name
428428
};
429-
let class_name = if noattr && is_use {
429+
let class_name = if no_attr && is_use {
430430
"<NO ATTR>".to_owned()
431431
} else {
432432
class_meta.class_name()?

stdlib/src/csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod _csv {
152152
reader: csv_core::Reader,
153153
}
154154

155-
#[pyclass(noattr, module = "_csv", name = "reader")]
155+
#[pyclass(no_attr, module = "_csv", name = "reader")]
156156
#[derive(PyPayload)]
157157
pub(super) struct Reader {
158158
iter: PyIter,
@@ -242,7 +242,7 @@ mod _csv {
242242
writer: csv_core::Writer,
243243
}
244244

245-
#[pyclass(noattr, module = "_csv", name = "writer")]
245+
#[pyclass(no_attr, module = "_csv", name = "writer")]
246246
#[derive(PyPayload)]
247247
pub(super) struct Writer {
248248
write: PyObjectRef,

vm/src/builtins/code.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ impl ConstantBag for PyObjBag<'_> {
136136
pub type CodeObject = bytecode::CodeObject<Literal>;
137137

138138
pub trait IntoCodeObject {
139-
fn into_codeobj(self, ctx: &Context) -> CodeObject;
139+
fn into_code_object(self, ctx: &Context) -> CodeObject;
140140
}
141141

142142
impl IntoCodeObject for CodeObject {
143-
fn into_codeobj(self, _ctx: &Context) -> CodeObject {
143+
fn into_code_object(self, _ctx: &Context) -> CodeObject {
144144
self
145145
}
146146
}
147147

148148
impl IntoCodeObject for bytecode::CodeObject {
149-
fn into_codeobj(self, ctx: &Context) -> CodeObject {
149+
fn into_code_object(self, ctx: &Context) -> CodeObject {
150150
self.map_bag(PyObjBag(ctx))
151151
}
152152
}

vm/src/builtins/range.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl PyRange {
169169

170170
pub fn init(context: &Context) {
171171
PyRange::extend_class(context, context.types.range_type);
172-
PyLongRangeIterator::extend_class(context, context.types.longrange_iterator_type);
172+
PyLongRangeIterator::extend_class(context, context.types.long_range_iterator_type);
173173
PyRangeIterator::extend_class(context, context.types.range_iterator_type);
174174
}
175175

@@ -529,7 +529,7 @@ pub struct PyLongRangeIterator {
529529

530530
impl PyPayload for PyLongRangeIterator {
531531
fn class(vm: &VirtualMachine) -> &'static Py<PyType> {
532-
vm.ctx.types.longrange_iterator_type
532+
vm.ctx.types.long_range_iterator_type
533533
}
534534
}
535535

vm/src/stdlib/nt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub(crate) mod module {
4545
}
4646

4747
#[derive(FromArgs)]
48-
pub(super) struct SimlinkArgs {
48+
pub(super) struct SymlinkArgs {
4949
src: PyPathLike,
5050
dst: PyPathLike,
5151
#[pyarg(flatten)]
@@ -55,7 +55,7 @@ pub(crate) mod module {
5555
}
5656

5757
#[pyfunction]
58-
pub(super) fn symlink(args: SimlinkArgs, vm: &VirtualMachine) -> PyResult<()> {
58+
pub(super) fn symlink(args: SymlinkArgs, vm: &VirtualMachine) -> PyResult<()> {
5959
use std::os::windows::fs as win_fs;
6060
let dir = args.target_is_directory.target_is_directory
6161
|| args

vm/src/stdlib/posix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ pub mod module {
306306
}
307307

308308
#[derive(FromArgs)]
309-
pub(super) struct SimlinkArgs {
309+
pub(super) struct SymlinkArgs {
310310
src: PyPathLike,
311311
dst: PyPathLike,
312312
#[pyarg(flatten)]
@@ -316,7 +316,7 @@ pub mod module {
316316
}
317317

318318
#[pyfunction]
319-
pub(super) fn symlink(args: SimlinkArgs, vm: &VirtualMachine) -> PyResult<()> {
319+
pub(super) fn symlink(args: SymlinkArgs, vm: &VirtualMachine) -> PyResult<()> {
320320
let src = args.src.into_cstring(vm)?;
321321
let dst = args.dst.into_cstring(vm)?;
322322
#[cfg(not(target_os = "redox"))]

vm/src/stdlib/posix_compat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) mod module {
2828

2929
#[derive(FromArgs)]
3030
#[allow(unused)]
31-
pub(super) struct SimlinkArgs {
31+
pub(super) struct SymlinkArgs {
3232
src: PyPathLike,
3333
dst: PyPathLike,
3434
#[pyarg(flatten)]
@@ -38,7 +38,7 @@ pub(crate) mod module {
3838
}
3939

4040
#[pyfunction]
41-
pub(super) fn symlink(_args: SimlinkArgs, vm: &VirtualMachine) -> PyResult<()> {
41+
pub(super) fn symlink(_args: SymlinkArgs, vm: &VirtualMachine) -> PyResult<()> {
4242
os_unimpl("os.symlink", vm)
4343
}
4444

vm/src/stdlib/sys.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ mod sys {
651651
/// sys.flags
652652
///
653653
/// Flags provided through command line arguments or environment vars.
654-
#[pyclass(noattr, name = "flags", module = "sys")]
654+
#[pyclass(no_attr, name = "flags", module = "sys")]
655655
#[derive(Debug, PyStructSequence)]
656656
pub(super) struct Flags {
657657
/// -d
@@ -718,7 +718,7 @@ mod sys {
718718
}
719719

720720
#[cfg(feature = "threading")]
721-
#[pyclass(noattr, name = "thread_info")]
721+
#[pyclass(no_attr, name = "thread_info")]
722722
#[derive(PyStructSequence)]
723723
pub(super) struct PyThreadInfo {
724724
name: Option<&'static str>,
@@ -738,7 +738,7 @@ mod sys {
738738
};
739739
}
740740

741-
#[pyclass(noattr, name = "float_info")]
741+
#[pyclass(no_attr, name = "float_info")]
742742
#[derive(PyStructSequence)]
743743
pub(super) struct PyFloatInfo {
744744
max: f64,
@@ -771,7 +771,7 @@ mod sys {
771771
};
772772
}
773773

774-
#[pyclass(noattr, name = "hash_info")]
774+
#[pyclass(no_attr, name = "hash_info")]
775775
#[derive(PyStructSequence)]
776776
pub(super) struct PyHashInfo {
777777
width: usize,
@@ -803,7 +803,7 @@ mod sys {
803803
};
804804
}
805805

806-
#[pyclass(noattr, name = "int_info")]
806+
#[pyclass(no_attr, name = "int_info")]
807807
#[derive(PyStructSequence)]
808808
pub(super) struct PyIntInfo {
809809
bits_per_digit: usize,
@@ -818,7 +818,7 @@ mod sys {
818818
};
819819
}
820820

821-
#[pyclass(noattr, name = "version_info")]
821+
#[pyclass(no_attr, name = "version_info")]
822822
#[derive(Default, Debug, PyStructSequence)]
823823
pub struct VersionInfo {
824824
major: usize,
@@ -848,7 +848,7 @@ mod sys {
848848
}
849849

850850
#[cfg(windows)]
851-
#[pyclass(noattr, name = "getwindowsversion")]
851+
#[pyclass(no_attr, name = "getwindowsversion")]
852852
#[derive(Default, Debug, PyStructSequence)]
853853
pub(super) struct WindowsVersion {
854854
major: u32,
@@ -867,7 +867,7 @@ mod sys {
867867
#[pyclass(with(PyStructSequence))]
868868
impl WindowsVersion {}
869869

870-
#[pyclass(noattr, name = "UnraisableHookArgs")]
870+
#[pyclass(no_attr, name = "UnraisableHookArgs")]
871871
#[derive(Debug, PyStructSequence, TryIntoPyStructSequence)]
872872
pub struct UnraisableHookArgs {
873873
pub exc_type: PyTypeRef,

0 commit comments

Comments
 (0)