mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Remove parser dependency from ruff-python-ast (#6096)
This commit is contained in:
parent
99127243f4
commit
2cf00fee96
658 changed files with 1714 additions and 1546 deletions
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::{Constant, Expr, ExprAttribute, ExprConstant};
|
||||
use rustpython_ast::{Constant, Expr, ExprAttribute, ExprConstant};
|
||||
|
||||
use ruff_formatter::write;
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::ExprAwait;
|
||||
use rustpython_ast::ExprAwait;
|
||||
|
||||
use ruff_formatter::write;
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::iter;
|
||||
|
||||
use rustpython_parser::ast::{
|
||||
use rustpython_ast::{
|
||||
Constant, Expr, ExprAttribute, ExprBinOp, ExprConstant, ExprUnaryOp, Operator, UnaryOp,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::expression::parentheses::{
|
|||
use crate::prelude::*;
|
||||
use ruff_formatter::{write, FormatOwnedWithRule, FormatRefWithRule, FormatRuleWithOptions};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::{BoolOp, ExprBoolOp};
|
||||
use rustpython_ast::{BoolOp, ExprBoolOp};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprBoolOp {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ruff_text_size::{TextRange, TextSize};
|
||||
use rustpython_parser::ast::{Expr, ExprCall, Ranged};
|
||||
use rustpython_ast::{Expr, ExprCall, Ranged};
|
||||
|
||||
use crate::builders::empty_parenthesized_with_dangling_comments;
|
||||
use ruff_formatter::write;
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::prelude::*;
|
|||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::{write, FormatOwnedWithRule, FormatRefWithRule, FormatRuleWithOptions};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::{CmpOp, ExprCompare};
|
||||
use rustpython_ast::{CmpOp, ExprCompare};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprCompare {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ruff_text_size::{TextLen, TextRange};
|
||||
use rustpython_parser::ast::{Constant, ExprConstant, Ranged};
|
||||
use rustpython_ast::{Constant, ExprConstant, Ranged};
|
||||
|
||||
use ruff_formatter::FormatRuleWithOptions;
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
|
@ -6,8 +6,8 @@ use crate::FormatNodeRule;
|
|||
use ruff_formatter::{format_args, write};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use ruff_text_size::TextRange;
|
||||
use rustpython_parser::ast::Ranged;
|
||||
use rustpython_parser::ast::{Expr, ExprDict};
|
||||
use rustpython_ast::Ranged;
|
||||
use rustpython_ast::{Expr, ExprDict};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprDict;
|
||||
|
|
|
@ -7,7 +7,7 @@ use ruff_formatter::prelude::{
|
|||
};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprDictComp;
|
||||
use rustpython_ast::ExprDictComp;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprDictComp;
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::expression::parentheses::{NeedsParentheses, OptionalParentheses};
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprFormattedValue;
|
||||
use rustpython_ast::ExprFormattedValue;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprFormattedValue;
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::AsFormat;
|
|||
use crate::{FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{format_args, write, Buffer, FormatResult, FormatRuleWithOptions};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprGeneratorExp;
|
||||
use rustpython_ast::ExprGeneratorExp;
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Default)]
|
||||
pub enum GeneratorExpParentheses {
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::prelude::*;
|
|||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::{format_args, write};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprIfExp;
|
||||
use rustpython_ast::ExprIfExp;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprIfExp;
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::expression::parentheses::{NeedsParentheses, OptionalParentheses};
|
|||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprJoinedStr;
|
||||
use rustpython_ast::ExprJoinedStr;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprJoinedStr;
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{FormatNodeRule, PyFormatter};
|
|||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprLambda;
|
||||
use rustpython_ast::ExprLambda;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprLambda;
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::expression::parentheses::{parenthesized, NeedsParentheses, OptionalPa
|
|||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::{ExprList, Ranged};
|
||||
use rustpython_ast::{ExprList, Ranged};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprList;
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::AsFormat;
|
|||
use crate::{FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{format_args, write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprListComp;
|
||||
use rustpython_ast::ExprListComp;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprListComp;
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::prelude::*;
|
|||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::{write, FormatContext};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprName;
|
||||
use rustpython_ast::ExprName;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprName;
|
||||
|
@ -37,7 +37,7 @@ impl NeedsParentheses for ExprName {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
use rustpython_parser::ast::{ModModule, Ranged};
|
||||
use rustpython_ast::{ModModule, Ranged};
|
||||
use rustpython_parser::Parse;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{AsFormat, FormatNodeRule, PyFormatter};
|
|||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprNamedExpr;
|
||||
use rustpython_ast::ExprNamedExpr;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprNamedExpr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::{ExprSet, Ranged};
|
||||
use rustpython_ast::{ExprSet, Ranged};
|
||||
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::AsFormat;
|
|||
use crate::{FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{format_args, write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprSetComp;
|
||||
use rustpython_ast::ExprSetComp;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprSetComp;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ruff_text_size::TextRange;
|
||||
use rustpython_parser::ast::{Expr, ExprSlice, ExprUnaryOp, Ranged, UnaryOp};
|
||||
use rustpython_ast::{Expr, ExprSlice, ExprUnaryOp, Ranged, UnaryOp};
|
||||
|
||||
use ruff_formatter::prelude::{hard_line_break, line_suffix_boundary, space, text};
|
||||
use ruff_formatter::{write, Buffer, Format, FormatError, FormatResult};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::ExprStarred;
|
||||
use rustpython_ast::ExprStarred;
|
||||
|
||||
use ruff_formatter::write;
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::{Expr, ExprSubscript};
|
||||
use rustpython_ast::{Expr, ExprSubscript};
|
||||
|
||||
use ruff_formatter::{format_args, write};
|
||||
use ruff_python_ast::node::{AnyNodeRef, AstNode};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use ruff_text_size::TextRange;
|
||||
use rustpython_parser::ast::ExprTuple;
|
||||
use rustpython_parser::ast::{Expr, Ranged};
|
||||
use rustpython_ast::ExprTuple;
|
||||
use rustpython_ast::{Expr, Ranged};
|
||||
|
||||
use ruff_formatter::{format_args, write, FormatRuleWithOptions};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use ruff_text_size::{TextLen, TextRange};
|
||||
use rustpython_parser::ast::UnaryOp;
|
||||
use rustpython_parser::ast::{ExprUnaryOp, Ranged};
|
||||
use rustpython_ast::UnaryOp;
|
||||
use rustpython_ast::{ExprUnaryOp, Ranged};
|
||||
|
||||
use ruff_formatter::prelude::{hard_line_break, space, text};
|
||||
use ruff_formatter::{Format, FormatContext, FormatResult};
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::{FormatNodeRule, PyFormatter};
|
|||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprYield;
|
||||
use rustpython_ast::ExprYield;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprYield;
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::{FormatNodeRule, PyFormatter};
|
|||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprYieldFrom;
|
||||
use rustpython_ast::ExprYieldFrom;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatExprYieldFrom;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::cmp::Ordering;
|
||||
|
||||
use rustpython_ast::{Expr, Operator};
|
||||
use rustpython_parser::ast;
|
||||
use rustpython_parser::ast::{Expr, Operator};
|
||||
|
||||
use ruff_formatter::{FormatOwnedWithRule, FormatRefWithRule, FormatRule, FormatRuleWithOptions};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use ruff_text_size::TextSize;
|
||||
use rustpython_parser::ast::{ExprConstant, Ranged};
|
||||
use rustpython_ast::{ExprConstant, Ranged};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::Ranged;
|
||||
use rustpython_ast::Ranged;
|
||||
|
||||
use ruff_formatter::prelude::tag::Condition;
|
||||
use ruff_formatter::{format_args, write, Argument, Arguments};
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
|||
|
||||
use bitflags::bitflags;
|
||||
use ruff_text_size::{TextLen, TextRange, TextSize};
|
||||
use rustpython_parser::ast::{ExprConstant, Ranged};
|
||||
use rustpython_ast::{ExprConstant, Ranged};
|
||||
use rustpython_parser::lexer::{lex_starts_at, LexicalError, LexicalErrorType};
|
||||
use rustpython_parser::{Mode, Tok};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue