|
1 | | -// export through slicable module, not slice. |
| 1 | +// export through sliceable module, not slice. |
2 | 2 | use crate::{ |
3 | 3 | builtins::{int::PyInt, slice::PySlice}, |
4 | 4 | AsObject, PyObject, PyResult, VirtualMachine, |
|
13 | 13 | { |
14 | 14 | type Item: Clone; |
15 | 15 | fn do_set(&mut self, index: usize, value: Self::Item); |
16 | | - fn do_delele(&mut self, index: usize); |
| 16 | + fn do_delete(&mut self, index: usize); |
17 | 17 | /// as CPython, length of range and items could be different, function must act like Vec::splice() |
18 | 18 | fn do_set_range(&mut self, range: Range<usize>, items: &[Self::Item]); |
19 | 19 | fn do_delete_range(&mut self, range: Range<usize>); |
|
34 | 34 | let pos = self |
35 | 35 | .as_ref() |
36 | 36 | .wrap_index(index) |
37 | | - .ok_or_else(|| vm.new_index_error("assigment index out of range".to_owned()))?; |
| 37 | + .ok_or_else(|| vm.new_index_error("assignment index out of range".to_owned()))?; |
38 | 38 | self.do_set(pos, value); |
39 | 39 | Ok(()) |
40 | 40 | } |
|
90 | 90 | let pos = self |
91 | 91 | .as_ref() |
92 | 92 | .wrap_index(index) |
93 | | - .ok_or_else(|| vm.new_index_error("assigment index out of range".to_owned()))?; |
94 | | - self.do_delele(pos); |
| 93 | + .ok_or_else(|| vm.new_index_error("assignment index out of range".to_owned()))?; |
| 94 | + self.do_delete(pos); |
95 | 95 | Ok(()) |
96 | 96 | } |
97 | 97 |
|
@@ -119,7 +119,7 @@ impl<T: Clone> SliceableSequenceMutOp for Vec<T> { |
119 | 119 | self[index] = value; |
120 | 120 | } |
121 | 121 |
|
122 | | - fn do_delele(&mut self, index: usize) { |
| 122 | + fn do_delete(&mut self, index: usize) { |
123 | 123 | self.remove(index); |
124 | 124 | } |
125 | 125 |
|
@@ -276,7 +276,7 @@ impl SequenceIndex { |
276 | 276 | } else if let Some(slice) = obj.payload::<PySlice>() { |
277 | 277 | slice.to_saturated(vm).map(Self::Slice) |
278 | 278 | } else if let Some(i) = vm.to_index_opt(obj.to_owned()) { |
279 | | - // TODO: __index__ for indice is no more supported? |
| 279 | + // TODO: __index__ for indices is no more supported? |
280 | 280 | i?.try_to_primitive(vm) |
281 | 281 | .map_err(|_| { |
282 | 282 | vm.new_index_error("cannot fit 'int' into an index-sized integer".to_owned()) |
@@ -338,7 +338,7 @@ impl SequenceIndexOp for BigInt { |
338 | 338 | } |
339 | 339 |
|
340 | 340 | /// A saturated slice with values ranging in [isize::MIN, isize::MAX]. Used for |
341 | | -/// slicable sequences that require indices in the aforementioned range. |
| 341 | +/// sliceable sequences that require indices in the aforementioned range. |
342 | 342 | /// |
343 | 343 | /// Invokes `__index__` on the PySliceRef during construction so as to separate the |
344 | 344 | /// transformation from PyObject into isize and the adjusting of the slice to a given |
|
0 commit comments