pub struct NotebookIndex { /* private fields */ }Expand description
Jupyter Notebook indexing table
When we lint a jupyter notebook, we have to translate the row/column based on
ruff_text_size::TextSize to jupyter notebook cell/row/column.
Implementations§
Source§impl NotebookIndex
impl NotebookIndex
Sourcepub fn cell(&self, row: OneIndexed) -> Option<OneIndexed>
pub fn cell(&self, row: OneIndexed) -> Option<OneIndexed>
Returns the (raw) cell number (1-based) for the given row (1-based).
Sourcepub fn cell_row(&self, row: OneIndexed) -> Option<OneIndexed>
pub fn cell_row(&self, row: OneIndexed) -> Option<OneIndexed>
Returns the row number (1-based) in the cell (1-based) for the given row (1-based).
Sourcepub fn iter(&self) -> impl Iterator<Item = CellStart> + '_
pub fn iter(&self) -> impl Iterator<Item = CellStart> + '_
Returns an iterator over the starting rows of each cell (1-based).
This yields one entry per Python cell (skipping over Markdown cell).
Sourcepub fn translate_line_column(&self, source_location: &LineColumn) -> LineColumn
pub fn translate_line_column(&self, source_location: &LineColumn) -> LineColumn
Translates the given LineColumn based on the indexing table.
This will translate the row/column in the concatenated source code to the row/column in the Jupyter Notebook cell.
Sourcepub fn translate_source_location(
&self,
source_location: &SourceLocation,
) -> SourceLocation
pub fn translate_source_location( &self, source_location: &SourceLocation, ) -> SourceLocation
Translates the given SourceLocation based on the indexing table.
This will translate the line/character in the concatenated source code to the line/character in the Jupyter Notebook cell.
Trait Implementations§
Source§impl Clone for NotebookIndex
impl Clone for NotebookIndex
Source§fn clone(&self) -> NotebookIndex
fn clone(&self) -> NotebookIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NotebookIndex
impl Debug for NotebookIndex
Source§impl<'de> Deserialize<'de> for NotebookIndex
impl<'de> Deserialize<'de> for NotebookIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for NotebookIndex
Source§impl PartialEq for NotebookIndex
impl PartialEq for NotebookIndex
Source§impl Serialize for NotebookIndex
impl Serialize for NotebookIndex
impl StructuralPartialEq for NotebookIndex
Auto Trait Implementations§
impl Freeze for NotebookIndex
impl RefUnwindSafe for NotebookIndex
impl Send for NotebookIndex
impl Sync for NotebookIndex
impl Unpin for NotebookIndex
impl UnsafeUnpin for NotebookIndex
impl UnwindSafe for NotebookIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.