Remove parser dependency from ruff-python-ast (#6096)

This commit is contained in:
Micha Reiser 2023-07-26 17:47:22 +02:00 committed by GitHub
parent 99127243f4
commit 2cf00fee96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
658 changed files with 1714 additions and 1546 deletions

View file

@ -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;

View file

@ -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;

View file

@ -1,5 +1,5 @@
use ruff_formatter::write;
use rustpython_parser::ast::ArgWithDefault;
use rustpython_ast::ArgWithDefault;
use crate::prelude::*;
use crate::FormatNodeRule;

View file

@ -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};

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -1,4 +1,4 @@
use rustpython_parser::ast::WithItem;
use rustpython_ast::WithItem;
use ruff_formatter::{write, Buffer, FormatResult};