Move {AnyNodeRef, AstNode} to ruff_python_ast crate root (#8030)

This is a do-over of https://github.com/astral-sh/ruff/pull/8011, which
I accidentally merged into a non-`main` branch. Sorry!
This commit is contained in:
Charlie Marsh 2023-10-17 20:01:18 -04:00 committed by GitHub
parent d85950ce5a
commit d685107638
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 76 additions and 75 deletions

View file

@ -1,5 +1,5 @@
use ruff_formatter::{write, FormatRuleWithOptions};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Constant, Expr, ExprAttribute, ExprConstant};
use ruff_python_trivia::{find_only_token_in_range, SimpleTokenKind};
use ruff_text_size::{Ranged, TextRange};

View file

@ -1,5 +1,5 @@
use ruff_formatter::write;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprAwait;
use crate::expression::maybe_parenthesize_expression;

View file

@ -1,4 +1,4 @@
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Expr, ExprBinOp};
use crate::comments::SourceComment;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{FormatOwnedWithRule, FormatRefWithRule};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{BoolOp, ExprBoolOp};
use crate::expression::binary_like::BinaryLike;

View file

@ -1,5 +1,5 @@
use ruff_formatter::FormatRuleWithOptions;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Expr, ExprCall};
use crate::comments::{dangling_comments, SourceComment};

View file

@ -1,5 +1,5 @@
use ruff_formatter::{FormatOwnedWithRule, FormatRefWithRule};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{CmpOp, Expr, ExprCompare};
use crate::comments::SourceComment;

View file

@ -1,5 +1,5 @@
use ruff_formatter::FormatRuleWithOptions;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Constant, ExprConstant};
use ruff_text_size::{Ranged, TextLen, TextRange};

View file

@ -1,5 +1,5 @@
use ruff_formatter::{format_args, write};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Expr, ExprDict};
use ruff_text_size::{Ranged, TextRange};

View file

@ -1,5 +1,5 @@
use ruff_formatter::write;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprDictComp;
use ruff_text_size::Ranged;

View file

@ -2,7 +2,7 @@ use memchr::memchr2;
use crate::comments::SourceComment;
use ruff_formatter::FormatResult;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprFString;
use crate::expression::parentheses::{NeedsParentheses, OptionalParentheses};

View file

@ -1,4 +1,4 @@
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprFormattedValue;
use crate::expression::parentheses::{NeedsParentheses, OptionalParentheses};

View file

@ -1,5 +1,5 @@
use ruff_formatter::{format_args, write, FormatRuleWithOptions};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprGeneratorExp;
use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer};
use ruff_text_size::{Ranged, TextRange};

View file

@ -1,5 +1,5 @@
use ruff_formatter::{write, FormatRuleWithOptions};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Expr, ExprIfExp};
use crate::comments::leading_comments;

View file

@ -1,5 +1,5 @@
use ruff_formatter::write;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprLambda;
use ruff_text_size::Ranged;

View file

@ -1,5 +1,5 @@
use ruff_formatter::prelude::format_with;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprList;
use ruff_text_size::Ranged;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{format_args, write, FormatResult};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprListComp;
use crate::comments::SourceComment;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{write, FormatContext};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprName;
use crate::comments::SourceComment;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{format_args, write};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprNamedExpr;
use crate::comments::{dangling_comments, SourceComment};

View file

@ -1,4 +1,4 @@
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprSet;
use ruff_text_size::Ranged;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{format_args, write, Buffer, FormatResult};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprSetComp;
use crate::comments::SourceComment;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{write, FormatError};
use ruff_python_ast::node::{AnyNodeRef, AstNode};
use ruff_python_ast::{AnyNodeRef, AstNode};
use ruff_python_ast::{Expr, ExprSlice, ExprUnaryOp, UnaryOp};
use ruff_python_trivia::{SimpleToken, SimpleTokenKind, SimpleTokenizer};
use ruff_text_size::{Ranged, TextRange};

View file

@ -1,5 +1,5 @@
use ruff_formatter::write;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprStarred;
use crate::comments::{dangling_comments, SourceComment};

View file

@ -1,5 +1,5 @@
use ruff_formatter::{write, FormatRuleWithOptions};
use ruff_python_ast::node::{AnyNodeRef, AstNode};
use ruff_python_ast::{AnyNodeRef, AstNode};
use ruff_python_ast::{Expr, ExprSubscript};
use crate::comments::SourceComment;

View file

@ -1,5 +1,5 @@
use ruff_formatter::{format_args, write, FormatRuleWithOptions};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprTuple;
use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer};
use ruff_text_size::{Ranged, TextRange};

View file

@ -1,4 +1,4 @@
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprUnaryOp;
use ruff_python_ast::UnaryOp;

View file

@ -1,5 +1,5 @@
use ruff_formatter::write;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Expr, ExprYield, ExprYieldFrom};
use ruff_text_size::{Ranged, TextRange};

View file

@ -1,4 +1,4 @@
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExprYieldFrom;
use crate::expression::expr_yield::AnyExpressionYield;

View file

@ -6,8 +6,8 @@ use ruff_formatter::{
write, FormatOwnedWithRule, FormatRefWithRule, FormatRule, FormatRuleWithOptions,
};
use ruff_python_ast as ast;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::visitor::preorder::{walk_expr, PreorderVisitor};
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{Constant, Expr, ExpressionRef, Operator};
use ruff_python_trivia::CommentRanges;

View file

@ -1,6 +1,6 @@
use ruff_formatter::prelude::tag::Condition;
use ruff_formatter::{format_args, write, Argument, Arguments};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::ExpressionRef;
use ruff_python_trivia::CommentRanges;
use ruff_python_trivia::{

View file

@ -3,7 +3,7 @@ use std::borrow::Cow;
use bitflags::bitflags;
use ruff_formatter::{format_args, write, FormatError};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::AnyNodeRef;
use ruff_python_ast::{self as ast, Constant, ExprConstant, ExprFString, ExpressionRef};
use ruff_python_parser::lexer::{lex_starts_at, LexicalError, LexicalErrorType};
use ruff_python_parser::{Mode, Tok};