Move Token, TokenKind and Tokens to ruff-python-ast (#21760)

This commit is contained in:
Micha Reiser
2025-12-02 20:10:46 +01:00
committed by GitHub
parent 508c0a0861
commit 515de2d062
80 changed files with 1484 additions and 1492 deletions

View File

@@ -14,7 +14,6 @@ license = { workspace = true }
ruff_diagnostics = { workspace = true }
ruff_python_ast = { workspace = true }
ruff_python_codegen = { workspace = true }
ruff_python_parser = { workspace = true }
ruff_python_trivia = { workspace = true }
ruff_source_file = { workspace = true, features = ["serde"] }
ruff_text_size = { workspace = true }
@@ -22,6 +21,8 @@ ruff_text_size = { workspace = true }
anyhow = { workspace = true }
[dev-dependencies]
ruff_python_parser = { workspace = true }
insta = { workspace = true }
[features]

View File

@@ -5,8 +5,8 @@ use std::ops::Add;
use ruff_diagnostics::Edit;
use ruff_python_ast::Stmt;
use ruff_python_ast::helpers::is_docstring_stmt;
use ruff_python_ast::token::{TokenKind, Tokens};
use ruff_python_codegen::Stylist;
use ruff_python_parser::{TokenKind, Tokens};
use ruff_python_trivia::is_python_whitespace;
use ruff_python_trivia::{PythonWhitespace, textwrap::indent};
use ruff_source_file::{LineRanges, UniversalNewlineIterator};
@@ -194,7 +194,7 @@ impl<'a> Insertion<'a> {
tokens
.before(at)
.last()
.map(ruff_python_parser::Token::kind),
.map(ruff_python_ast::token::Token::kind),
Some(TokenKind::Import)
) {
return None;