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,7 +1,7 @@
|
|||
use crate::{AsFormat, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, Format, FormatResult};
|
||||
use rustpython_parser::ast::Alias;
|
||||
use rustpython_ast::Alias;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatAlias;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::write;
|
||||
use rustpython_parser::ast::Arg;
|
||||
use rustpython_ast::Arg;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatArg;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ruff_formatter::write;
|
||||
use rustpython_parser::ast::ArgWithDefault;
|
||||
use rustpython_ast::ArgWithDefault;
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::usize;
|
||||
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
use rustpython_parser::ast::{Arguments, Ranged};
|
||||
use rustpython_ast::{Arguments, Ranged};
|
||||
|
||||
use ruff_formatter::{format_args, write, FormatRuleWithOptions};
|
||||
use ruff_python_ast::node::{AnyNodeRef, AstNode};
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::prelude::*;
|
|||
use crate::AsFormat;
|
||||
use crate::{FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{format_args, write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::{Comprehension, Expr, Ranged};
|
||||
use rustpython_ast::{Comprehension, Expr, Ranged};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatComprehension;
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::expression::parentheses::Parenthesize;
|
|||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::write;
|
||||
use rustpython_parser::ast::Decorator;
|
||||
use rustpython_ast::Decorator;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatDecorator;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::statement::stmt_if::format_elif_else_clause;
|
||||
use crate::{FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::FormatResult;
|
||||
use rustpython_parser::ast::ElifElseClause;
|
||||
use rustpython_ast::ElifElseClause;
|
||||
|
||||
/// Note that this implementation misses the leading newlines before the leading comments because
|
||||
/// it does not have access to the last node of the previous branch. The `StmtIf` therefore doesn't
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{FormatNodeRule, PyFormatter};
|
|||
use ruff_formatter::FormatRuleWithOptions;
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AstNode;
|
||||
use rustpython_parser::ast::ExceptHandlerExceptHandler;
|
||||
use rustpython_ast::ExceptHandlerExceptHandler;
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
pub enum ExceptHandlerKind {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
use crate::AsFormat;
|
||||
use ruff_formatter::{FormatOwnedWithRule, FormatRefWithRule};
|
||||
use rustpython_parser::ast::{Identifier, Ranged};
|
||||
use rustpython_ast::{Identifier, Ranged};
|
||||
|
||||
pub struct FormatIdentifier;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::write;
|
||||
use rustpython_parser::ast::Keyword;
|
||||
use rustpython_ast::Keyword;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatKeyword;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::MatchCase;
|
||||
use rustpython_ast::MatchCase;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatMatchCase;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::TypeIgnoreTypeIgnore;
|
||||
use rustpython_ast::TypeIgnoreTypeIgnore;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatTypeIgnoreTypeIgnore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_parser::ast::WithItem;
|
||||
use rustpython_ast::WithItem;
|
||||
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue