Pull in RustPython parser (#6099)

This commit is contained in:
Micha Reiser 2023-07-27 11:29:11 +02:00 committed by GitHub
parent 86539c1fc5
commit 40f54375cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
779 changed files with 108400 additions and 2078 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_ast::Alias;
use ruff_python_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_ast::Arg;
use ruff_python_ast::Arg;
#[derive(Default)]
pub struct FormatArg;

View file

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

View file

@ -1,7 +1,7 @@
use std::usize;
use ruff_python_ast::{Arguments, Ranged};
use ruff_text_size::{TextRange, TextSize};
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_ast::{Comprehension, Expr, Ranged};
use ruff_python_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_ast::Decorator;
use ruff_python_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_ast::ElifElseClause;
use ruff_python_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

@ -5,7 +5,7 @@ use crate::prelude::*;
use crate::{FormatNodeRule, PyFormatter};
use ruff_formatter::FormatRuleWithOptions;
use ruff_formatter::{write, Buffer, FormatResult};
use rustpython_ast::ExceptHandlerExceptHandler;
use ruff_python_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_ast::{Identifier, Ranged};
use ruff_python_ast::{Identifier, Ranged};
pub struct FormatIdentifier;

View file

@ -1,7 +1,7 @@
use crate::prelude::*;
use crate::FormatNodeRule;
use ruff_formatter::write;
use rustpython_ast::Keyword;
use ruff_python_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_ast::MatchCase;
use ruff_python_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_ast::TypeIgnoreTypeIgnore;
use ruff_python_ast::TypeIgnoreTypeIgnore;
#[derive(Default)]
pub struct FormatTypeIgnoreTypeIgnore;

View file

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