mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
A basic StmtAssign formatter and better dummies for expressions (#4938)
* A basic StmtAssign formatter and better dummies for expressions The goal of this PR was formatting StmtAssign since many nodes in the black tests (and in python in general) are after an assignment. This caused unstable formatting: The spacing of power op spacing depends on the type of the two involved expressions, but each expression was formatted as dummy string and re-parsed as a ExprName, so in the second round the different rules of ExprName were applied, causing unstable formatting. This PR does not necessarily bring us closer to black's style, but it unlocks a good porting of black's test suite and is a basis for implementing the Expr nodes. * fmt * Review
This commit is contained in:
parent
651d89794c
commit
23abad0bd5
62 changed files with 1291 additions and 1023 deletions
10
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/stmt_assign.py
vendored
Normal file
10
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/stmt_assign.py
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# break left hand side
|
||||
a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = cakjdshflkjahdslkfjlasfdahjlfds = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = 3
|
||||
|
||||
# join left hand side
|
||||
a2 = (
|
||||
b2
|
||||
) = 2
|
||||
|
||||
# Break the last element
|
||||
a = asdf = fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal = 1
|
|
@ -191,16 +191,16 @@ no_leading_newline = 30
|
|||
|
||||
assert_eq!(
|
||||
&printed,
|
||||
r#"NOT_YET_IMPLEMENTED_StmtAssign
|
||||
r#"a = 0x42
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
three_leading_newlines = 0x42
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
two_leading_newlines = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign"#
|
||||
one_leading_newline = 0x42
|
||||
no_leading_newline = 0x42"#
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -211,14 +211,14 @@ NOT_YET_IMPLEMENTED_StmtAssign"#
|
|||
|
||||
assert_eq!(
|
||||
&printed,
|
||||
r#"NOT_YET_IMPLEMENTED_StmtAssign
|
||||
r#"a = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
three_leading_newlines = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
two_leading_newlines = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign"#
|
||||
one_leading_newline = 0x42
|
||||
no_leading_newline = 0x42"#
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -229,11 +229,11 @@ NOT_YET_IMPLEMENTED_StmtAssign"#
|
|||
|
||||
assert_eq!(
|
||||
&printed,
|
||||
r#"NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign"#
|
||||
r#"a = 0x42
|
||||
three_leading_newlines = 0x42
|
||||
two_leading_newlines = 0x42
|
||||
one_leading_newline = 0x42
|
||||
no_leading_newline = 0x42"#
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, AsFormat, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::prelude::text;
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprAttribute;
|
||||
|
||||
|
@ -10,7 +11,16 @@ pub struct FormatExprAttribute;
|
|||
|
||||
impl FormatNodeRule<ExprAttribute> for FormatExprAttribute {
|
||||
fn fmt_fields(&self, item: &ExprAttribute, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
// We need to write the value - which is also a dummy - already because power op spacing
|
||||
// depends on it
|
||||
write!(
|
||||
f,
|
||||
[
|
||||
item.value.format(),
|
||||
text("."),
|
||||
not_yet_implemented_custom_text(item, "NOT_IMPLEMENTED_attr")
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{AsFormat, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprAwait;
|
||||
|
||||
|
@ -10,7 +11,8 @@ pub struct FormatExprAwait;
|
|||
|
||||
impl FormatNodeRule<ExprAwait> for FormatExprAwait {
|
||||
fn fmt_fields(&self, item: &ExprAwait, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
let ExprAwait { range: _, value } = item;
|
||||
write!(f, [text("await"), space(), value.format()])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprBoolOp;
|
||||
|
||||
|
@ -10,7 +10,13 @@ pub struct FormatExprBoolOp;
|
|||
|
||||
impl FormatNodeRule<ExprBoolOp> for FormatExprBoolOp {
|
||||
fn fmt_fields(&self, item: &ExprBoolOp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprCall;
|
||||
|
||||
|
@ -10,7 +10,13 @@ pub struct FormatExprCall;
|
|||
|
||||
impl FormatNodeRule<ExprCall> for FormatExprCall {
|
||||
fn fmt_fields(&self, item: &ExprCall, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"NOT_IMPLEMENTED_call()"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprCompare;
|
||||
|
||||
|
@ -10,7 +11,13 @@ pub struct FormatExprCompare;
|
|||
|
||||
impl FormatNodeRule<ExprCompare> for FormatExprCompare {
|
||||
fn fmt_fields(&self, item: &ExprCompare, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprConstant;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub struct FormatExprConstant;
|
|||
|
||||
impl FormatNodeRule<ExprConstant> for FormatExprConstant {
|
||||
fn fmt_fields(&self, item: &ExprConstant, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(f, [not_yet_implemented_custom_text(item, "0x42")])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprDict;
|
||||
|
||||
|
@ -10,7 +10,13 @@ pub struct FormatExprDict;
|
|||
|
||||
impl FormatNodeRule<ExprDict> for FormatExprDict {
|
||||
fn fmt_fields(&self, item: &ExprDict, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprDictComp;
|
||||
|
||||
|
@ -10,7 +10,13 @@ pub struct FormatExprDictComp;
|
|||
|
||||
impl FormatNodeRule<ExprDictComp> for FormatExprDictComp {
|
||||
fn fmt_fields(&self, item: &ExprDictComp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprGeneratorExp;
|
||||
|
||||
|
@ -10,7 +10,10 @@ pub struct FormatExprGeneratorExp;
|
|||
|
||||
impl FormatNodeRule<ExprGeneratorExp> for FormatExprGeneratorExp {
|
||||
fn fmt_fields(&self, item: &ExprGeneratorExp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(item, "(i for i in [])")]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprIfExp;
|
||||
|
||||
|
@ -10,7 +10,13 @@ pub struct FormatExprIfExp;
|
|||
|
||||
impl FormatNodeRule<ExprIfExp> for FormatExprIfExp {
|
||||
fn fmt_fields(&self, item: &ExprIfExp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprLambda;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub struct FormatExprLambda;
|
|||
|
||||
impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
||||
fn fmt_fields(&self, item: &ExprLambda, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(f, [not_yet_implemented_custom_text(item, "lambda x: True")])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprListComp;
|
||||
|
||||
|
@ -10,7 +10,10 @@ pub struct FormatExprListComp;
|
|||
|
||||
impl FormatNodeRule<ExprListComp> for FormatExprListComp {
|
||||
fn fmt_fields(&self, item: &ExprListComp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(item, "[i for i in []]")]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use crate::{FormatNodeRule, FormattedIterExt, PyFormatter};
|
||||
use ruff_formatter::prelude::{
|
||||
format_with, group, if_group_breaks, soft_block_indent, soft_line_break_or_space, text,
|
||||
};
|
||||
use ruff_formatter::{format_args, write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprSet;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -10,7 +13,23 @@ pub struct FormatExprSet;
|
|||
|
||||
impl FormatNodeRule<ExprSet> for FormatExprSet {
|
||||
fn fmt_fields(&self, item: &ExprSet, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
let ExprSet { range: _, elts } = item;
|
||||
// That would be a dict expression
|
||||
assert!(!elts.is_empty());
|
||||
// Avoid second mutable borrow of f
|
||||
let joined = format_with(|f| {
|
||||
f.join_with(format_args!(text(","), soft_line_break_or_space()))
|
||||
.entries(elts.iter().formatted())
|
||||
.finish()
|
||||
});
|
||||
write!(
|
||||
f,
|
||||
[group(&format_args![
|
||||
text("{"),
|
||||
soft_block_indent(&format_args![joined, if_group_breaks(&text(",")),]),
|
||||
text("}")
|
||||
])]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprSlice;
|
||||
|
||||
|
@ -10,7 +11,13 @@ pub struct FormatExprSlice;
|
|||
|
||||
impl FormatNodeRule<ExprSlice> for FormatExprSlice {
|
||||
fn fmt_fields(&self, item: &ExprSlice, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"NOT_IMPLEMENTED_start:NOT_IMPLEMENTED_end"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprSubscript;
|
||||
|
||||
|
@ -10,7 +11,13 @@ pub struct FormatExprSubscript;
|
|||
|
||||
impl FormatNodeRule<ExprSubscript> for FormatExprSubscript {
|
||||
fn fmt_fields(&self, item: &ExprSubscript, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(
|
||||
f,
|
||||
[not_yet_implemented_custom_text(
|
||||
item,
|
||||
"NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]"
|
||||
)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use rustpython_parser::ast::ExprTuple;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub struct FormatExprTuple;
|
|||
|
||||
impl FormatNodeRule<ExprTuple> for FormatExprTuple {
|
||||
fn fmt_fields(&self, item: &ExprTuple, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
write!(f, [not_yet_implemented_custom_text(item, "(1, 2)")])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,36 @@ impl Format<PyFormatContext<'_>> for NotYetImplemented {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) struct NotYetImplementedCustomText(NodeKind, String);
|
||||
|
||||
/// Formats a placeholder for nodes that have not yet been implemented
|
||||
pub(crate) fn not_yet_implemented_custom_text<'a, T>(
|
||||
node: T,
|
||||
text: impl AsRef<str>,
|
||||
) -> NotYetImplementedCustomText
|
||||
where
|
||||
T: Into<AnyNodeRef<'a>>,
|
||||
{
|
||||
NotYetImplementedCustomText(node.into().kind(), text.as_ref().to_string())
|
||||
}
|
||||
|
||||
impl Format<PyFormatContext<'_>> for NotYetImplementedCustomText {
|
||||
fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
f.write_element(FormatElement::Tag(Tag::StartVerbatim(
|
||||
tag::VerbatimKind::Verbatim {
|
||||
length: self.1.text_len(),
|
||||
},
|
||||
)))?;
|
||||
|
||||
f.write_element(FormatElement::DynamicText {
|
||||
text: Box::from(self.1.clone()),
|
||||
})?;
|
||||
|
||||
f.write_element(FormatElement::Tag(Tag::EndVerbatim))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct VerbatimText(TextRange);
|
||||
|
||||
#[allow(unused)]
|
||||
|
@ -250,11 +280,15 @@ NOT_YET_IMPLEMENTED_StmtIf
|
|||
|
||||
let formatted_code = printed.as_code();
|
||||
|
||||
let reformatted = format_module(formatted_code).unwrap_or_else(|err| {
|
||||
panic!(
|
||||
"Formatted code resulted introduced a syntax error {err:#?}. Code:\n{formatted_code}"
|
||||
)
|
||||
});
|
||||
let reformatted = match format_module(formatted_code) {
|
||||
Ok(reformatted) => reformatted,
|
||||
Err(err) => {
|
||||
panic!(
|
||||
"Expected formatted code to be valid syntax: {err}:\
|
||||
\n---\n{formatted_code}---\n",
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if reformatted.as_code() != formatted_code {
|
||||
let diff = TextDiff::from_lines(formatted_code, reformatted.as_code())
|
||||
|
@ -263,13 +297,16 @@ NOT_YET_IMPLEMENTED_StmtIf
|
|||
.to_string();
|
||||
panic!(
|
||||
r#"Reformatting the formatted code a second time resulted in formatting changes.
|
||||
{diff}
|
||||
---
|
||||
{diff}---
|
||||
|
||||
Formatted once:
|
||||
{formatted_code}
|
||||
---
|
||||
{formatted_code}---
|
||||
|
||||
Formatted twice:
|
||||
{}"#,
|
||||
---
|
||||
{}---"#,
|
||||
reformatted.as_code()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -52,22 +52,22 @@ y = 100(no)
|
|||
-x = 0o777.real
|
||||
-x = (0.000000006).hex()
|
||||
-x = -100.0000j
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
||||
+x = NOT_IMPLEMENTED_call()
|
||||
+x = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
|
||||
-if (10).real:
|
||||
- ...
|
||||
|
@ -75,34 +75,34 @@ y = 100(no)
|
|||
|
||||
-y = 100[no]
|
||||
-y = 100(no)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+y = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+y = NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = 0x42.NOT_IMPLEMENTED_attr
|
||||
x = 0x42.NOT_IMPLEMENTED_attr
|
||||
x = 0x42.NOT_IMPLEMENTED_attr
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = 0x42.NOT_IMPLEMENTED_attr
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = 0x42.NOT_IMPLEMENTED_attr
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = 0x42.NOT_IMPLEMENTED_attr
|
||||
x = NOT_IMPLEMENTED_call()
|
||||
x = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
y = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
y = NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -22,13 +22,13 @@ print("hello, world")
|
|||
+++ Ruff
|
||||
@@ -1 +1 @@
|
||||
-print("hello, world")
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -25,16 +25,16 @@ lambda x=lambda y={1: 3}: y['x':lambda y: {1: 2}]: x
|
|||
-pem_spam = lambda l, spam={"x": 3}: not spam.get(l.strip())
|
||||
-lambda x=lambda y={1: 3}: y["x" : lambda y: {1: 2}]: x
|
||||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_ExprLambda
|
||||
+pem_spam = lambda x: True
|
||||
+lambda x: True
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_ExprLambda
|
||||
pem_spam = lambda x: True
|
||||
lambda x: True
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -84,7 +84,7 @@ if True:
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,99 +1,48 @@
|
||||
@@ -1,99 +1,40 @@
|
||||
-import core, time, a
|
||||
+NOT_YET_IMPLEMENTED_StmtImport
|
||||
|
||||
|
@ -134,21 +134,7 @@ if True:
|
|||
- "cccccccccccccccccccccccccccccccccccccccc",
|
||||
- (1, 2, 3),
|
||||
- "dddddddddddddddddddddddddddddddddddddddd",
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+[
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ % NOT_YET_IMPLEMENTED_ExprTuple,
|
||||
]
|
||||
-]
|
||||
-{
|
||||
- "oneple": (1,),
|
||||
-}
|
||||
|
@ -162,8 +148,19 @@ if True:
|
|||
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa wraps %s"
|
||||
- % bar
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+a = {0x42, 0x42, 0x42}
|
||||
+b = {0x42, 0x42, 0x42}
|
||||
+c = {0x42, 0x42, 0x42}
|
||||
+x = (1, 2)
|
||||
+y = (1, 2)
|
||||
+nested = {(1, 2), (1, 2)}
|
||||
+nested_no_trailing_comma = {(1, 2), (1, 2)}
|
||||
+nested_long_lines = [0x42, 0x42, 0x42, (1, 2), 0x42]
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+[0x42, 0x42 % (1, 2)]
|
||||
+x = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+y = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||
|
||||
# looping over a 1-tuple should also not get wrapped
|
||||
|
@ -174,19 +171,17 @@ if True:
|
|||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
|
||||
[
|
||||
-[
|
||||
- 1,
|
||||
- 2,
|
||||
- 3,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
]
|
||||
-]
|
||||
+[0x42, 0x42, 0x42]
|
||||
|
||||
-division_result_tuple = (6 / 2,)
|
||||
-print("foo %r", (foo.bar,))
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+division_result_tuple = (1, 2)
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
-if True:
|
||||
- IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING = (
|
||||
|
@ -233,37 +228,29 @@ NOT_YET_IMPLEMENTED_StmtImportFrom
|
|||
# `as` works as well
|
||||
NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
% NOT_YET_IMPLEMENTED_ExprTuple,
|
||||
]
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
a = {0x42, 0x42, 0x42}
|
||||
b = {0x42, 0x42, 0x42}
|
||||
c = {0x42, 0x42, 0x42}
|
||||
x = (1, 2)
|
||||
y = (1, 2)
|
||||
nested = {(1, 2), (1, 2)}
|
||||
nested_no_trailing_comma = {(1, 2), (1, 2)}
|
||||
nested_long_lines = [0x42, 0x42, 0x42, (1, 2), 0x42]
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
[0x42, 0x42 % (1, 2)]
|
||||
x = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
y = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
NOT_YET_IMPLEMENTED_StmtAssert
|
||||
|
||||
# looping over a 1-tuple should also not get wrapped
|
||||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
]
|
||||
[0x42, 0x42, 0x42]
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
division_result_tuple = (1, 2)
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ instruction()#comment with bad spacing
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,165 +1,23 @@
|
||||
@@ -1,173 +1,68 @@
|
||||
-from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
|
||||
- MyLovelyCompanyTeamProjectComponent, # NOT DRY
|
||||
-)
|
||||
|
@ -190,16 +190,22 @@ instruction()#comment with bad spacing
|
|||
|
||||
# Please keep __all__ alphabetized within each category.
|
||||
|
||||
-__all__ = [
|
||||
- # Super-special typing primitives.
|
||||
__all__ = [
|
||||
# Super-special typing primitives.
|
||||
- "Any",
|
||||
- "Callable",
|
||||
- "ClassVar",
|
||||
- # ABCs (from collections.abc).
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
# ABCs (from collections.abc).
|
||||
- "AbstractSet", # collections.abc.Set.
|
||||
- "ByteString",
|
||||
- "Container",
|
||||
- # Concrete collection types.
|
||||
+ 0x42, # collections.abc.Set.
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
# Concrete collection types.
|
||||
- "Counter",
|
||||
- "Deque",
|
||||
- "Dict",
|
||||
|
@ -209,29 +215,46 @@ instruction()#comment with bad spacing
|
|||
- "FrozenSet",
|
||||
- "NamedTuple", # Not really a type.
|
||||
- "Generator",
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42, # Not really a type.
|
||||
+ 0x42,
|
||||
]
|
||||
|
||||
-not_shareables = [
|
||||
- # singletons
|
||||
not_shareables = [
|
||||
# singletons
|
||||
- True,
|
||||
- False,
|
||||
- NotImplemented,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
NotImplemented,
|
||||
- ...,
|
||||
- # builtin types and objects
|
||||
- type,
|
||||
- object,
|
||||
+ 0x42,
|
||||
# builtin types and objects
|
||||
type,
|
||||
object,
|
||||
- object(),
|
||||
- Exception(),
|
||||
- 42,
|
||||
- 100.0,
|
||||
- "spam",
|
||||
- # user-defined types and objects
|
||||
- Cheese,
|
||||
+ NOT_IMPLEMENTED_call(),
|
||||
+ NOT_IMPLEMENTED_call(),
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
# user-defined types and objects
|
||||
Cheese,
|
||||
- Cheese("Wensleydale"),
|
||||
- SubBytes(b"spam"),
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+ NOT_IMPLEMENTED_call(),
|
||||
+ NOT_IMPLEMENTED_call(),
|
||||
]
|
||||
|
||||
-if "PYTHON" in os.environ:
|
||||
- add_compiler(compiler_from_env())
|
||||
|
@ -275,8 +298,7 @@ instruction()#comment with bad spacing
|
|||
- # two
|
||||
- 2,
|
||||
- ]
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
-
|
||||
- # no newline after
|
||||
- call(
|
||||
- arg1,
|
||||
|
@ -286,9 +308,10 @@ instruction()#comment with bad spacing
|
|||
-""",
|
||||
- arg3=True,
|
||||
- )
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
- ############################################################################
|
||||
-
|
||||
|
||||
- call2(
|
||||
- # short
|
||||
- arg1,
|
||||
|
@ -323,7 +346,7 @@ instruction()#comment with bad spacing
|
|||
- while True:
|
||||
- if False:
|
||||
- continue
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # type: Final
|
||||
+CONFIG_FILES = [CONFIG_FILE] + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final
|
||||
|
||||
- # and round and round we go
|
||||
- # and round and round we go
|
||||
|
@ -333,8 +356,9 @@ instruction()#comment with bad spacing
|
|||
- syms.simple_stmt,
|
||||
- [Node(statement, result), Leaf(token.NEWLINE, "\n")], # FIXME: \r\n?
|
||||
- )
|
||||
-
|
||||
-
|
||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
-CONFIG_FILES = (
|
||||
- [
|
||||
- CONFIG_FILE,
|
||||
|
@ -348,16 +372,15 @@ instruction()#comment with bad spacing
|
|||
- def _init_host(self, parsed) -> None:
|
||||
- if parsed.hostname is None or not parsed.hostname.strip(): # type: ignore
|
||||
- pass
|
||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
-
|
||||
-
|
||||
#######################
|
||||
@@ -167,7 +25,7 @@
|
||||
### SECTION COMMENT ###
|
||||
#######################
|
||||
|
||||
|
||||
-instruction() # comment with bad spacing
|
||||
+NOT_YET_IMPLEMENTED_ExprCall # comment with bad spacing
|
||||
+NOT_IMPLEMENTED_call() # comment with bad spacing
|
||||
|
||||
# END COMMENTS
|
||||
# MORE END COMMENTS
|
||||
|
@ -371,9 +394,46 @@ NOT_YET_IMPLEMENTED_StmtImportFrom
|
|||
|
||||
# Please keep __all__ alphabetized within each category.
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
__all__ = [
|
||||
# Super-special typing primitives.
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
# ABCs (from collections.abc).
|
||||
0x42, # collections.abc.Set.
|
||||
0x42,
|
||||
0x42,
|
||||
# Concrete collection types.
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42, # Not really a type.
|
||||
0x42,
|
||||
]
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
not_shareables = [
|
||||
# singletons
|
||||
0x42,
|
||||
0x42,
|
||||
NotImplemented,
|
||||
0x42,
|
||||
# builtin types and objects
|
||||
type,
|
||||
object,
|
||||
NOT_IMPLEMENTED_call(),
|
||||
NOT_IMPLEMENTED_call(),
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
# user-defined types and objects
|
||||
Cheese,
|
||||
NOT_IMPLEMENTED_call(),
|
||||
NOT_IMPLEMENTED_call(),
|
||||
]
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
|
||||
|
@ -382,7 +442,7 @@ NOT_YET_IMPLEMENTED_StmtIf
|
|||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # type: Final
|
||||
CONFIG_FILES = [CONFIG_FILE] + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
@ -393,7 +453,7 @@ NOT_YET_IMPLEMENTED_StmtClassDef
|
|||
#######################
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall # comment with bad spacing
|
||||
NOT_IMPLEMENTED_call() # comment with bad spacing
|
||||
|
||||
# END COMMENTS
|
||||
# MORE END COMMENTS
|
||||
|
|
|
@ -91,7 +91,7 @@ if __name__ == "__main__":
|
|||
- if something.changed:
|
||||
- do.stuff() # trailing comment
|
||||
- # Comment belongs to the `if` block.
|
||||
+while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
+while 0x42:
|
||||
+ NOT_YET_IMPLEMENTED_StmtIf
|
||||
# This one belongs to the `while` block.
|
||||
|
||||
|
@ -174,7 +174,7 @@ if __name__ == "__main__":
|
|||
## Ruff Output
|
||||
|
||||
```py
|
||||
while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
while 0x42:
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
# This one belongs to the `while` block.
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,118 +1,35 @@
|
||||
@@ -1,118 +1,40 @@
|
||||
-from typing import Any, Tuple
|
||||
+NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
|
||||
|
@ -147,8 +147,9 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
-def f(a, b, c, d, e, f, g, h, i):
|
||||
- # type: (int, int, int, int, int, int, int, int, int) -> None
|
||||
- pass
|
||||
-
|
||||
-
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-def f(
|
||||
- a, # type: int
|
||||
- b, # type: int
|
||||
|
@ -162,8 +163,9 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
-):
|
||||
- # type: (...) -> None
|
||||
- pass
|
||||
-
|
||||
-
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-def f(
|
||||
- arg, # type: int
|
||||
- *args, # type: *Any
|
||||
|
@ -182,8 +184,7 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
- d, # type: int
|
||||
-):
|
||||
- # type: (...) -> None
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
-
|
||||
- element = 0 # type: int
|
||||
- another_element = 1 # type: float
|
||||
- another_element_with_long_name = 2 # type: int
|
||||
|
@ -191,12 +192,12 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
- 3
|
||||
- ) # type: int
|
||||
- an_element_with_a_long_value = calls() or more_calls() and more() # type: bool
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
- tup = (
|
||||
- another_element,
|
||||
- another_really_really_long_element_with_a_unnecessarily_long_name_to_describe_what_it_does_enterprise_style,
|
||||
- ) # type: Tuple[int, int]
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
- a = (
|
||||
- element
|
||||
|
@ -206,25 +207,24 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
- + another_element
|
||||
- + another_element_with_long_name
|
||||
- ) # type: int
|
||||
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-def f(
|
||||
- x, # not a type comment
|
||||
- y, # type: int
|
||||
-):
|
||||
- # type: (...) -> None
|
||||
- pass
|
||||
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
-
|
||||
-
|
||||
-def f(
|
||||
- x, # not a type comment
|
||||
-): # type: (int) -> None
|
||||
- pass
|
||||
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-def func(
|
||||
- a=some_list[0], # type: int
|
||||
-): # type: () -> int
|
||||
|
@ -240,29 +240,34 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
|||
- 0.0789,
|
||||
- a[-1], # type: ignore
|
||||
- )
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
- c = call(
|
||||
- "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa" # type: ignore
|
||||
- )
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
+result = 0x42 # aaa
|
||||
|
||||
-result = ( # aaa
|
||||
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+AAAAAAAAAAAAA = (
|
||||
+ [AAAAAAAAAAAAA]
|
||||
+ + SHARED_AAAAAAAAAAAAA
|
||||
+ + USER_AAAAAAAAAAAAA
|
||||
+ + AAAAAAAAAAAAA
|
||||
+) # type: ignore
|
||||
|
||||
-AAAAAAAAAAAAA = [AAAAAAAAAAAAA] + SHARED_AAAAAAAAAAAAA + USER_AAAAAAAAAAAAA + AAAAAAAAAAAAA # type: ignore
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # type: ignore
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
-call_to_some_function_asdf(
|
||||
- foo,
|
||||
- [AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBB], # type: ignore
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
|
||||
-
|
||||
-aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*items))) # type: ignore[arg-type]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # type: ignore[arg-type]
|
||||
+(1, 2) = NOT_IMPLEMENTED_call() # type: ignore[arg-type]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
@ -296,13 +301,18 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
result = 0x42 # aaa
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # type: ignore
|
||||
AAAAAAAAAAAAA = (
|
||||
[AAAAAAAAAAAAA]
|
||||
+ SHARED_AAAAAAAAAAAAA
|
||||
+ USER_AAAAAAAAAAAAA
|
||||
+ AAAAAAAAAAAAA
|
||||
) # type: ignore
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # type: ignore[arg-type]
|
||||
(1, 2) = NOT_IMPLEMENTED_call() # type: ignore[arg-type]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -152,11 +152,7 @@ def bar():
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,161 +1,90 @@
|
||||
# Test for https://github.com/psf/black/issues/246.
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
|
||||
# This comment should be split from the statement above by two lines.
|
||||
|
@ -165,10 +161,8 @@ def bar():
|
|||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
|
||||
|
||||
some = statement
|
||||
@@ -14,148 +13,78 @@
|
||||
# This multiline comments section
|
||||
# should be split from the statement
|
||||
# above by two lines.
|
||||
|
@ -177,8 +171,7 @@ def bar():
|
|||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This comment should be split from the statement above by two lines.
|
||||
|
@ -187,20 +180,18 @@ def bar():
|
|||
+NOT_YET_IMPLEMENTED_StmtAsyncFunctionDef
|
||||
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This comment should be split from the statement above by two lines.
|
||||
-class MyClass:
|
||||
- pass
|
||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
+
|
||||
+
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
|
||||
|
||||
-some = statement
|
||||
some = statement
|
||||
+
|
||||
+
|
||||
# This should be stick to the statement above
|
||||
|
||||
-
|
||||
|
@ -221,8 +212,7 @@ def bar():
|
|||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# leading 1
|
||||
|
@ -238,8 +228,7 @@ def bar():
|
|||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# leading 1
|
||||
|
@ -255,8 +244,7 @@ def bar():
|
|||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
-some = statement
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# leading 1
|
||||
|
@ -270,18 +258,18 @@ def bar():
|
|||
-def decorated_with_split_leading_comments():
|
||||
- pass
|
||||
-
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
-
|
||||
-def main():
|
||||
- if a:
|
||||
- # Leading comment before inline function
|
||||
- def inline():
|
||||
- pass
|
||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
- # Another leading comment
|
||||
- def another_inline():
|
||||
- pass
|
||||
-
|
||||
|
||||
- else:
|
||||
- # More leading comments
|
||||
- def inline_after_else():
|
||||
|
@ -303,16 +291,16 @@ def bar():
|
|||
- # More leading comments
|
||||
- def top_level_quote_inline_after_else():
|
||||
- pass
|
||||
-
|
||||
-
|
||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
-class MyClass:
|
||||
- # First method has no empty lines between bare class def.
|
||||
- # More comments.
|
||||
- def first_method(self):
|
||||
- pass
|
||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
-
|
||||
-
|
||||
# Regression test for https://github.com/psf/black/issues/3454.
|
||||
-def foo():
|
||||
- pass
|
||||
|
@ -348,14 +336,14 @@ def bar():
|
|||
```py
|
||||
# Test for https://github.com/psf/black/issues/246.
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This comment should be split from the statement above by two lines.
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This multiline comments section
|
||||
|
@ -364,21 +352,21 @@ NOT_YET_IMPLEMENTED_StmtAssign
|
|||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This comment should be split from the statement above by two lines.
|
||||
NOT_YET_IMPLEMENTED_StmtAsyncFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This comment should be split from the statement above by two lines.
|
||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# This should be stick to the statement above
|
||||
|
@ -394,21 +382,21 @@ NOT_YET_IMPLEMENTED_StmtClassDef
|
|||
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# leading 1
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# leading 1
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
some = statement
|
||||
|
||||
|
||||
# leading 1
|
||||
|
|
|
@ -43,15 +43,15 @@ def function(a:int=42):
|
|||
|
||||
-result = 1 # A simple comment
|
||||
-result = (1,) # Another one
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # A simple comment
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # Another one
|
||||
+result = 0x42 # A simple comment
|
||||
+result = (1, 2) # Another one
|
||||
|
||||
-result = 1 # type: ignore
|
||||
-result = 1 # This comment is talking about type: ignore
|
||||
-square = Square(4) # type: Optional[Square]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # type: ignore
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # This comment is talking about type: ignore
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # type: Optional[Square]
|
||||
+result = 0x42 # type: ignore
|
||||
+result = 0x42 # This comment is talking about type: ignore
|
||||
+square = NOT_IMPLEMENTED_call() # type: Optional[Square]
|
||||
|
||||
|
||||
-def function(a: int = 42):
|
||||
|
@ -70,12 +70,12 @@ def function(a:int=42):
|
|||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # A simple comment
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # Another one
|
||||
result = 0x42 # A simple comment
|
||||
result = (1, 2) # Another one
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # type: ignore
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # This comment is talking about type: ignore
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # type: Optional[Square]
|
||||
result = 0x42 # type: ignore
|
||||
result = 0x42 # This comment is talking about type: ignore
|
||||
square = NOT_IMPLEMENTED_call() # type: Optional[Square]
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
|
|
@ -114,7 +114,7 @@ async def wat():
|
|||
# Has many lines. Many, many lines.
|
||||
# Many, many, many lines.
|
||||
-"""Module docstring.
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+0x42
|
||||
|
||||
-Possibly also many, many lines.
|
||||
-"""
|
||||
|
@ -138,7 +138,7 @@ async def wat():
|
|||
-# Some comment before a function.
|
||||
-y = 1
|
||||
+NOT_YET_IMPLEMENTED_StmtTry
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+y = 0x42
|
||||
(
|
||||
# some strings
|
||||
y # type: ignore
|
||||
|
@ -166,7 +166,7 @@ async def wat():
|
|||
|
||||
# Explains why we use global state.
|
||||
-GLOBAL_STATE = {"a": a(1), "b": a(2), "c": a(3)}
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+GLOBAL_STATE = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
|
||||
|
||||
# Another comment!
|
||||
|
@ -227,7 +227,7 @@ async def wat():
|
|||
#
|
||||
# Has many lines. Many, many lines.
|
||||
# Many, many, many lines.
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtImport
|
||||
NOT_YET_IMPLEMENTED_StmtImport
|
||||
|
@ -236,7 +236,7 @@ NOT_YET_IMPLEMENTED_StmtImport
|
|||
NOT_YET_IMPLEMENTED_StmtImportFrom # some noqa comment
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtTry
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
y = 0x42
|
||||
(
|
||||
# some strings
|
||||
y # type: ignore
|
||||
|
@ -247,7 +247,7 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
|
||||
|
||||
# Explains why we use global state.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
GLOBAL_STATE = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
|
||||
|
||||
# Another comment!
|
||||
|
|
|
@ -107,7 +107,7 @@ def g():
|
|||
+++ Ruff
|
||||
@@ -1,89 +1,12 @@
|
||||
-"""Docstring."""
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+0x42
|
||||
|
||||
|
||||
# leading comment
|
||||
|
@ -203,7 +203,7 @@ def g():
|
|||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
0x42
|
||||
|
||||
|
||||
# leading comment
|
||||
|
|
|
@ -267,12 +267,12 @@ last_call()
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,352 +1,253 @@
|
||||
@@ -1,352 +1,247 @@
|
||||
-"some_string"
|
||||
-b"\\xa3"
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+0x42
|
||||
+0x42
|
||||
+0x42
|
||||
Name
|
||||
-None
|
||||
-True
|
||||
|
@ -320,39 +320,11 @@ last_call()
|
|||
-(str or None) if True else (str or bytes or None)
|
||||
-str or None if (1 if True else 2) else str or bytes or None
|
||||
-(str or None) if (1 if True else 2) else (str or bytes or None)
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+v1 << NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant >> v2
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant % finished
|
||||
(
|
||||
-(
|
||||
- (super_long_variable_name or None)
|
||||
- if (1 if super_long_test_name else 2)
|
||||
- else (str or bytes or None)
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ + v2
|
||||
+ - v3 * NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ ^ NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ **v6
|
||||
+ / NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ // NOT_YET_IMPLEMENTED_ExprConstant
|
||||
)
|
||||
-)
|
||||
-{"2.7": dead, "3.7": (long_live or die_hard)}
|
||||
-{"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
|
||||
-{**a, **b, **c}
|
||||
|
@ -360,89 +332,103 @@ last_call()
|
|||
-({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
|
||||
-()
|
||||
-(1,)
|
||||
-(1, 2)
|
||||
+0x42
|
||||
+0x42
|
||||
+0x42
|
||||
+0x42
|
||||
+0x42
|
||||
+0x42
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+v1 << 0x42
|
||||
+0x42 >> v2
|
||||
+0x42 % finished
|
||||
+0x42 + v2 - v3 * 0x42 ^ 0x42**v6 / 0x42 // 0x42
|
||||
+((0x42 + v2) - (v3 * 0x42)) ^ (((0x42**v6) / 0x42) // 0x42)
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+lambda x: True
|
||||
+lambda x: True
|
||||
+lambda x: True
|
||||
+lambda x: True
|
||||
+lambda x: True
|
||||
+manylambdas = lambda x: True
|
||||
+foo = lambda x: True
|
||||
+NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
+NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
+NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
+NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
+NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
+(NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false)
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+{
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ (NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false),
|
||||
+}
|
||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
(1, 2)
|
||||
-(1, 2, 3)
|
||||
+(
|
||||
+ ((NOT_YET_IMPLEMENTED_ExprConstant + v2) - (v3 * NOT_YET_IMPLEMENTED_ExprConstant))
|
||||
+ ^ (
|
||||
+ ((NOT_YET_IMPLEMENTED_ExprConstant**v6) / NOT_YET_IMPLEMENTED_ExprConstant)
|
||||
+ // NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ )
|
||||
+)
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprLambda
|
||||
+NOT_YET_IMPLEMENTED_ExprLambda
|
||||
+NOT_YET_IMPLEMENTED_ExprLambda
|
||||
+NOT_YET_IMPLEMENTED_ExprLambda
|
||||
+NOT_YET_IMPLEMENTED_ExprLambda
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
+NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
+NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
+NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
+NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
+(NOT_YET_IMPLEMENTED_ExprIfExp)
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+NOT_YET_IMPLEMENTED_ExprSet
|
||||
+NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
[]
|
||||
-[1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
|
||||
[
|
||||
- 1,
|
||||
- 2,
|
||||
- 3,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ (NOT_YET_IMPLEMENTED_ExprBoolOp),
|
||||
+ (NOT_YET_IMPLEMENTED_ExprBoolOp),
|
||||
+ (NOT_YET_IMPLEMENTED_ExprBoolOp),
|
||||
+]
|
||||
+[
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ (NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2),
|
||||
+ (NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2),
|
||||
+ (NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2),
|
||||
]
|
||||
-[*a]
|
||||
-[*range(10)]
|
||||
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||
[
|
||||
-[
|
||||
- *a,
|
||||
- 4,
|
||||
- 5,
|
||||
+ NOT_YET_IMPLEMENTED_ExprStarred,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
]
|
||||
[
|
||||
-]
|
||||
-[
|
||||
- 4,
|
||||
- *a,
|
||||
- 5,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprStarred,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
]
|
||||
-]
|
||||
+[0x42, 0x42, 0x42]
|
||||
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||
+[NOT_YET_IMPLEMENTED_ExprStarred, 0x42, 0x42]
|
||||
+[0x42, NOT_YET_IMPLEMENTED_ExprStarred, 0x42]
|
||||
[
|
||||
this_is_a_very_long_variable_which_will_force_a_delimiter_split,
|
||||
element,
|
||||
|
@ -462,10 +448,83 @@ last_call()
|
|||
-{i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
|
||||
-{a: b * 2 for a, b in dictionary.items()}
|
||||
-{a: b * -2 for a, b in dictionary.items()}
|
||||
-{
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+[i for i in []]
|
||||
+[i for i in []]
|
||||
+[i for i in []]
|
||||
+[i for i in []]
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call() # note: no trailing comma pre-3.6
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+lukasz.NOT_IMPLEMENTED_attr.NOT_IMPLEMENTED_attr
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+0x42.NOT_IMPLEMENTED_attr
|
||||
+0x42.NOT_IMPLEMENTED_attr
|
||||
+0x42.NOT_IMPLEMENTED_attr
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign # type: ignore
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
{
|
||||
- k: v
|
||||
- for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
|
||||
-}
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false,
|
||||
}
|
||||
-Python3 > Python2 > COBOL
|
||||
-Life is Life
|
||||
-call()
|
||||
|
@ -498,87 +557,19 @@ last_call()
|
|||
- int,
|
||||
- float,
|
||||
- dict[str, int],
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
+NOT_YET_IMPLEMENTED_ExprListComp
|
||||
+NOT_YET_IMPLEMENTED_ExprListComp
|
||||
+NOT_YET_IMPLEMENTED_ExprListComp
|
||||
+NOT_YET_IMPLEMENTED_ExprListComp
|
||||
+NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
+NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
+NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
+NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
+NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
+NOT_YET_IMPLEMENTED_ExprCompare
|
||||
+NOT_YET_IMPLEMENTED_ExprCompare
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall # note: no trailing comma pre-3.6
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
+NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
+NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign # type: ignore
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+NOT_YET_IMPLEMENTED_ExprSet
|
||||
+[
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
+ NOT_YET_IMPLEMENTED_ExprBoolOp,
|
||||
+ NOT_YET_IMPLEMENTED_ExprBoolOp,
|
||||
+ NOT_YET_IMPLEMENTED_ExprBoolOp,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ 0x42,
|
||||
+ NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2,
|
||||
+ NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2,
|
||||
+ NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2,
|
||||
]
|
||||
-very_long_variable_name_filters: t.List[
|
||||
- t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
|
||||
|
@ -659,7 +650,24 @@ last_call()
|
|||
- )
|
||||
- .order_by(models.Customer.id.asc())
|
||||
- .all()
|
||||
-)
|
||||
+(1, 2)
|
||||
+(i for i in [])
|
||||
+(i for i in [])
|
||||
+(i for i in [])
|
||||
+(i for i in [])
|
||||
+(1, 2)
|
||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
+a = (1, 2)
|
||||
+b = (1, 2)
|
||||
+c = 0x42
|
||||
+d = (1, 2) + a + (1, 2)
|
||||
+e = NOT_IMPLEMENTED_call()
|
||||
+f = (1, 2)
|
||||
+g = (1, 2)
|
||||
+what_is_up_with_those_new_coord_names = (
|
||||
+ (coord_names + NOT_IMPLEMENTED_call())
|
||||
+ + NOT_IMPLEMENTED_call()
|
||||
)
|
||||
-result = (
|
||||
- session.query(models.Customer.id)
|
||||
- .filter(
|
||||
|
@ -669,7 +677,10 @@ last_call()
|
|||
- models.Customer.id.asc(),
|
||||
- )
|
||||
- .all()
|
||||
-)
|
||||
+what_is_up_with_those_new_coord_names = (
|
||||
+ (coord_names | NOT_IMPLEMENTED_call())
|
||||
+ - NOT_IMPLEMENTED_call()
|
||||
)
|
||||
-Ø = set()
|
||||
-authors.łukasz.say_thanks()
|
||||
-mapping = {
|
||||
|
@ -678,27 +689,11 @@ last_call()
|
|||
- C: 0.1 * (10.0 / 12),
|
||||
- D: 0.1 * (10.0 / 12),
|
||||
-}
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
+NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
+NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
+NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprDict
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+result = NOT_IMPLEMENTED_call()
|
||||
+result = NOT_IMPLEMENTED_call()
|
||||
+Ø = NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+mapping = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
|
||||
|
||||
-def gen():
|
||||
|
@ -815,9 +810,9 @@ last_call()
|
|||
- >> aaaaaaaaaaaaaaaa.l**aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
|
||||
-):
|
||||
- return True
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_IMPLEMENTED_call()
|
||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||
|
@ -826,13 +821,13 @@ last_call()
|
|||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
+while NOT_YET_IMPLEMENTED_ExprBoolOp:
|
||||
+ NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2:
|
||||
+ 0x42
|
||||
+NOT_YET_IMPLEMENTED_StmtFor
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+NOT_YET_IMPLEMENTED_StmtIf
|
||||
+NOT_YET_IMPLEMENTED_StmtIf
|
||||
+NOT_YET_IMPLEMENTED_StmtIf
|
||||
|
@ -846,126 +841,107 @@ last_call()
|
|||
(
|
||||
aaaaaaaaaaaaaaaa
|
||||
+ aaaaaaaaaaaaaaaa
|
||||
@@ -363,8 +264,9 @@
|
||||
@@ -363,8 +258,9 @@
|
||||
bbbb >> bbbb * bbbb
|
||||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
- ^ bbbb.a & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
+ ^ NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
+ ^ bbbb.NOT_IMPLEMENTED_attr
|
||||
+ & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
-last_call()
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
# standalone comment at ENDMARKER
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
0x42
|
||||
0x42
|
||||
0x42
|
||||
Name
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
v1 << NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant >> v2
|
||||
NOT_YET_IMPLEMENTED_ExprConstant % finished
|
||||
(
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+ v2
|
||||
- v3 * NOT_YET_IMPLEMENTED_ExprConstant
|
||||
^ NOT_YET_IMPLEMENTED_ExprConstant
|
||||
**v6
|
||||
/ NOT_YET_IMPLEMENTED_ExprConstant
|
||||
// NOT_YET_IMPLEMENTED_ExprConstant
|
||||
)
|
||||
(
|
||||
((NOT_YET_IMPLEMENTED_ExprConstant + v2) - (v3 * NOT_YET_IMPLEMENTED_ExprConstant))
|
||||
^ (
|
||||
((NOT_YET_IMPLEMENTED_ExprConstant**v6) / NOT_YET_IMPLEMENTED_ExprConstant)
|
||||
// NOT_YET_IMPLEMENTED_ExprConstant
|
||||
)
|
||||
)
|
||||
0x42
|
||||
0x42
|
||||
0x42
|
||||
0x42
|
||||
0x42
|
||||
0x42
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
v1 << 0x42
|
||||
0x42 >> v2
|
||||
0x42 % finished
|
||||
0x42 + v2 - v3 * 0x42 ^ 0x42**v6 / 0x42 // 0x42
|
||||
((0x42 + v2) - (v3 * 0x42)) ^ (((0x42**v6) / 0x42) // 0x42)
|
||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprLambda
|
||||
NOT_YET_IMPLEMENTED_ExprLambda
|
||||
NOT_YET_IMPLEMENTED_ExprLambda
|
||||
NOT_YET_IMPLEMENTED_ExprLambda
|
||||
NOT_YET_IMPLEMENTED_ExprLambda
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
(NOT_YET_IMPLEMENTED_ExprIfExp)
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
NOT_YET_IMPLEMENTED_ExprSet
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
lambda x: True
|
||||
lambda x: True
|
||||
lambda x: True
|
||||
lambda x: True
|
||||
lambda x: True
|
||||
manylambdas = lambda x: True
|
||||
foo = lambda x: True
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
(NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false)
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
{
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
(NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false),
|
||||
}
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
[]
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
(NOT_YET_IMPLEMENTED_ExprBoolOp),
|
||||
(NOT_YET_IMPLEMENTED_ExprBoolOp),
|
||||
(NOT_YET_IMPLEMENTED_ExprBoolOp),
|
||||
]
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
(NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2),
|
||||
(NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2),
|
||||
(NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2),
|
||||
]
|
||||
[0x42, 0x42, 0x42]
|
||||
[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||
[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprStarred,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
]
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprStarred,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
]
|
||||
[NOT_YET_IMPLEMENTED_ExprStarred, 0x42, 0x42]
|
||||
[0x42, NOT_YET_IMPLEMENTED_ExprStarred, 0x42]
|
||||
[
|
||||
this_is_a_very_long_variable_which_will_force_a_delimiter_split,
|
||||
element,
|
||||
|
@ -976,107 +952,120 @@ NOT_YET_IMPLEMENTED_ExprSetComp
|
|||
NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
NOT_YET_IMPLEMENTED_ExprListComp
|
||||
NOT_YET_IMPLEMENTED_ExprListComp
|
||||
NOT_YET_IMPLEMENTED_ExprListComp
|
||||
NOT_YET_IMPLEMENTED_ExprListComp
|
||||
NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
NOT_YET_IMPLEMENTED_ExprDictComp
|
||||
NOT_YET_IMPLEMENTED_ExprCompare
|
||||
NOT_YET_IMPLEMENTED_ExprCompare
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall # note: no trailing comma pre-3.6
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
[i for i in []]
|
||||
[i for i in []]
|
||||
[i for i in []]
|
||||
[i for i in []]
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call() # note: no trailing comma pre-3.6
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
lukasz.NOT_IMPLEMENTED_attr.NOT_IMPLEMENTED_attr
|
||||
NOT_IMPLEMENTED_call()
|
||||
0x42.NOT_IMPLEMENTED_attr
|
||||
0x42.NOT_IMPLEMENTED_attr
|
||||
0x42.NOT_IMPLEMENTED_attr
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign # type: ignore
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprIfExp
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
NOT_YET_IMPLEMENTED_ExprSet
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
{
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false,
|
||||
}
|
||||
[
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprConstant,
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp,
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp,
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
0x42,
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2,
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2,
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2,
|
||||
]
|
||||
(SomeName)
|
||||
SomeName
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprDict
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2)
|
||||
(i for i in [])
|
||||
(i for i in [])
|
||||
(i for i in [])
|
||||
(i for i in [])
|
||||
(1, 2)
|
||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
a = (1, 2)
|
||||
b = (1, 2)
|
||||
c = 0x42
|
||||
d = (1, 2) + a + (1, 2)
|
||||
e = NOT_IMPLEMENTED_call()
|
||||
f = (1, 2)
|
||||
g = (1, 2)
|
||||
what_is_up_with_those_new_coord_names = (
|
||||
(coord_names + NOT_IMPLEMENTED_call())
|
||||
+ NOT_IMPLEMENTED_call()
|
||||
)
|
||||
what_is_up_with_those_new_coord_names = (
|
||||
(coord_names | NOT_IMPLEMENTED_call())
|
||||
- NOT_IMPLEMENTED_call()
|
||||
)
|
||||
result = NOT_IMPLEMENTED_call()
|
||||
result = NOT_IMPLEMENTED_call()
|
||||
Ø = NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
mapping = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
@ -1085,9 +1074,9 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
NOT_YET_IMPLEMENTED_StmtAsyncFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_IMPLEMENTED_call()
|
||||
NOT_YET_IMPLEMENTED_StmtAssert
|
||||
NOT_YET_IMPLEMENTED_StmtAssert
|
||||
NOT_YET_IMPLEMENTED_StmtAssert
|
||||
|
@ -1096,13 +1085,13 @@ NOT_YET_IMPLEMENTED_StmtFor
|
|||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
while NOT_YET_IMPLEMENTED_ExprBoolOp:
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2:
|
||||
0x42
|
||||
NOT_YET_IMPLEMENTED_StmtFor
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
a = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
|
@ -1129,11 +1118,11 @@ aaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaa
|
|||
bbbb >> bbbb * bbbb
|
||||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
^ NOT_YET_IMPLEMENTED_ExprAttribute
|
||||
^ bbbb.NOT_IMPLEMENTED_attr
|
||||
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
# standalone comment at ENDMARKER
|
||||
```
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ def test_calculate_fades():
|
|||
|
||||
-TmSt = 1
|
||||
-TmEx = 2
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+TmSt = 0x42
|
||||
+TmEx = 0x42
|
||||
+
|
||||
|
||||
# fmt: off
|
||||
|
@ -112,8 +112,8 @@ def test_calculate_fades():
|
|||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtImport
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
TmSt = 0x42
|
||||
TmEx = 0x42
|
||||
|
||||
|
||||
# fmt: off
|
||||
|
|
|
@ -36,7 +36,7 @@ x = [
|
|||
- 1, 2,
|
||||
- 3, 4,
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+x = [0x42, 0x42, 0x42, 0x42]
|
||||
# fmt: on
|
||||
|
||||
# fmt: off
|
||||
|
@ -44,25 +44,25 @@ x = [
|
|||
- 1, 2,
|
||||
- 3, 4,
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+x = [0x42, 0x42, 0x42, 0x42]
|
||||
# fmt: on
|
||||
|
||||
-x = [1, 2, 3, 4]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+x = [0x42, 0x42, 0x42, 0x42]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
# fmt: off
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
x = [0x42, 0x42, 0x42, 0x42]
|
||||
# fmt: on
|
||||
|
||||
# fmt: off
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
x = [0x42, 0x42, 0x42, 0x42]
|
||||
# fmt: on
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
x = [0x42, 0x42, 0x42, 0x42]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -109,7 +109,7 @@ elif unformatted:
|
|||
- ] # Includes an formatted indentation.
|
||||
- },
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
# Regression test for https://github.com/psf/black/issues/2015.
|
||||
|
@ -123,7 +123,7 @@ elif unformatted:
|
|||
- + path,
|
||||
- check=True,
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
# Regression test for https://github.com/psf/black/issues/3026.
|
||||
|
@ -199,11 +199,11 @@ elif unformatted:
|
|||
|
||||
```py
|
||||
# Regression test for https://github.com/psf/black/issues/3129.
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
# Regression test for https://github.com/psf/black/issues/2015.
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
# Regression test for https://github.com/psf/black/issues/3026.
|
||||
|
|
|
@ -308,7 +308,7 @@ d={'a':1,
|
|||
- a , b = *hello
|
||||
- 'unformatted'
|
||||
- # fmt: on
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+something = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
|
||||
|
||||
-def yield_expr():
|
||||
|
@ -446,7 +446,7 @@ d={'a':1,
|
|||
- # fmt: on
|
||||
- xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5,
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
# fmt: off
|
||||
-yield 'hello'
|
||||
+NOT_YET_IMPLEMENTED_ExprYield
|
||||
|
@ -454,8 +454,8 @@ d={'a':1,
|
|||
-l=[1,2,3]
|
||||
-d={'a':1,
|
||||
- 'b':2}
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+l = [0x42, 0x42, 0x42]
|
||||
+d = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
@ -498,7 +498,7 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
something = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
@ -528,12 +528,12 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
# fmt: off
|
||||
NOT_YET_IMPLEMENTED_ExprYield
|
||||
# No formatting to the end of the file
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
l = [0x42, 0x42, 0x42]
|
||||
d = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -28,17 +28,17 @@ l3 = ["I have", "trailing comma", "so I should be braked",]
|
|||
- "trailing comma",
|
||||
- "so I should be braked",
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+l1 = [0x42, 0x42, 0x42]
|
||||
+l2 = [0x42, 0x42, 0x42] # fmt: skip
|
||||
+l3 = [0x42, 0x42, 0x42]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
l1 = [0x42, 0x42, 0x42]
|
||||
l2 = [0x42, 0x42, 0x42] # fmt: skip
|
||||
l3 = [0x42, 0x42, 0x42]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -22,32 +22,32 @@ f = ["This is a very long line that should be formatted into a clearer line ", "
|
|||
+++ Ruff
|
||||
@@ -1,10 +1,7 @@
|
||||
-a = 3
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+a = 0x42
|
||||
# fmt: off
|
||||
-b, c = 1, 2
|
||||
-d = 6 # fmt: skip
|
||||
-e = 5
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = (1, 2)
|
||||
+d = 0x42 # fmt: skip
|
||||
+e = 0x42
|
||||
# fmt: on
|
||||
-f = [
|
||||
- "This is a very long line that should be formatted into a clearer line ",
|
||||
- "by rearranging.",
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+f = [0x42, 0x42]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
a = 0x42
|
||||
# fmt: off
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = (1, 2)
|
||||
d = 0x42 # fmt: skip
|
||||
e = 0x42
|
||||
# fmt: on
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
f = [0x42, 0x42]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -18,22 +18,22 @@ l = [1, 2, 3,]
|
|||
+++ Ruff
|
||||
@@ -1,7 +1,3 @@
|
||||
-a = 2
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+a = 0x42
|
||||
# fmt: skip
|
||||
-l = [
|
||||
- 1,
|
||||
- 2,
|
||||
- 3,
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+l = [0x42, 0x42, 0x42]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
a = 0x42
|
||||
# fmt: skip
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
l = [0x42, 0x42, 0x42]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -32,14 +32,14 @@ else:
|
|||
- print("I'm good!")
|
||||
-else:
|
||||
- print("I'm bad")
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = (1, 2)
|
||||
+NOT_YET_IMPLEMENTED_StmtIf
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = (1, 2)
|
||||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
```
|
||||
|
||||
|
|
|
@ -22,19 +22,19 @@ d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasu
|
|||
-b = 5 # fmt:skip
|
||||
-c = 9 # fmt: skip
|
||||
-d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasuperlongstring" # fmt:skip
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # fmt:skip
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # fmt:skip
|
||||
+a = 0x42
|
||||
+b = 0x42 # fmt:skip
|
||||
+c = 0x42 # fmt: skip
|
||||
+d = 0x42 # fmt:skip
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # fmt:skip
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # fmt:skip
|
||||
a = 0x42
|
||||
b = 0x42 # fmt:skip
|
||||
c = 0x42 # fmt: skip
|
||||
d = 0x42 # fmt:skip
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -116,8 +116,8 @@ async def test_async_with():
|
|||
|
||||
-while some_condition( unformatted, args ): # fmt: skip
|
||||
- print("Do something")
|
||||
+while NOT_YET_IMPLEMENTED_ExprCall: # fmt: skip
|
||||
+ NOT_YET_IMPLEMENTED_ExprCall
|
||||
+while NOT_IMPLEMENTED_call(): # fmt: skip
|
||||
+ NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
-for i in some_iter( unformatted, args ): # fmt: skip
|
||||
|
@ -170,8 +170,8 @@ NOT_YET_IMPLEMENTED_StmtClassDef
|
|||
NOT_YET_IMPLEMENTED_StmtIf # fmt: skip
|
||||
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprCall: # fmt: skip
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
while NOT_IMPLEMENTED_call(): # fmt: skip
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFor # fmt: skip
|
||||
|
|
|
@ -20,17 +20,17 @@ d = 5
|
|||
-a, b = 1, 2
|
||||
-c = 6 # fmt: skip
|
||||
-d = 5
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = (1, 2)
|
||||
+c = 0x42 # fmt: skip
|
||||
+d = 0x42
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # fmt: skip
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = (1, 2)
|
||||
c = 0x42 # fmt: skip
|
||||
d = 0x42
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -185,7 +185,7 @@ some_module.some_function(
|
|||
-some_module.some_function(
|
||||
- argument1, (one_element_tuple,), argument4, argument5, argument6
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
# Inner trailing comma causes outer to explode
|
||||
-some_module.some_function(
|
||||
|
@ -198,7 +198,7 @@ some_module.some_function(
|
|||
- argument5,
|
||||
- argument6,
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
@ -231,10 +231,10 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
|
||||
|
||||
# Make sure inner one-element tuple won't explode
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
# Inner trailing comma causes outer to explode
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -62,9 +62,9 @@ __all__ = (
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,64 +1,31 @@
|
||||
@@ -1,64 +1,42 @@
|
||||
-"""The asyncio package, tracking PEP 3156."""
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+0x42
|
||||
|
||||
# flake8: noqa
|
||||
|
||||
|
@ -135,7 +135,7 @@ __all__ = (
|
|||
+NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
+NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
|
||||
-__all__ = (
|
||||
__all__ = (
|
||||
- base_events.__all__
|
||||
- + coroutines.__all__
|
||||
- + events.__all__
|
||||
|
@ -146,14 +146,23 @@ __all__ = (
|
|||
- + queues.__all__
|
||||
- + streams.__all__
|
||||
- + tasks.__all__
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+ base_events.NOT_IMPLEMENTED_attr
|
||||
+ + coroutines.NOT_IMPLEMENTED_attr
|
||||
+ + events.NOT_IMPLEMENTED_attr
|
||||
+ + futures.NOT_IMPLEMENTED_attr
|
||||
+ + locks.NOT_IMPLEMENTED_attr
|
||||
+ + protocols.NOT_IMPLEMENTED_attr
|
||||
+ + runners.NOT_IMPLEMENTED_attr
|
||||
+ + queues.NOT_IMPLEMENTED_attr
|
||||
+ + streams.NOT_IMPLEMENTED_attr
|
||||
+ + tasks.NOT_IMPLEMENTED_attr
|
||||
)
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
0x42
|
||||
|
||||
# flake8: noqa
|
||||
|
||||
|
@ -183,7 +192,18 @@ NOT_YET_IMPLEMENTED_StmtImportFrom
|
|||
NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
__all__ = (
|
||||
base_events.NOT_IMPLEMENTED_attr
|
||||
+ coroutines.NOT_IMPLEMENTED_attr
|
||||
+ events.NOT_IMPLEMENTED_attr
|
||||
+ futures.NOT_IMPLEMENTED_attr
|
||||
+ locks.NOT_IMPLEMENTED_attr
|
||||
+ protocols.NOT_IMPLEMENTED_attr
|
||||
+ runners.NOT_IMPLEMENTED_attr
|
||||
+ queues.NOT_IMPLEMENTED_attr
|
||||
+ streams.NOT_IMPLEMENTED_attr
|
||||
+ tasks.NOT_IMPLEMENTED_attr
|
||||
)
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -31,7 +31,7 @@ list_of_types = [tuple[int,],]
|
|||
-a: tuple[int,]
|
||||
-b = tuple[int,]
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+b = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# The magic comma still applies to multi-element subscripts.
|
||||
-c: tuple[
|
||||
|
@ -43,7 +43,7 @@ list_of_types = [tuple[int,],]
|
|||
- int,
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# Magic commas still work as expected for non-subscripts.
|
||||
-small_list = [
|
||||
|
@ -52,8 +52,8 @@ list_of_types = [tuple[int,],]
|
|||
-list_of_types = [
|
||||
- tuple[int,],
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+small_list = [0x42]
|
||||
+list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
@ -62,15 +62,15 @@ list_of_types = [tuple[int,],]
|
|||
# We should not treat the trailing comma
|
||||
# in a single-element subscript.
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
b = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# The magic comma still applies to multi-element subscripts.
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# Magic commas still work as expected for non-subscripts.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
small_list = [0x42]
|
||||
list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -110,25 +110,24 @@ return np.divide(
|
|||
-o = settings(max_examples=10**6)
|
||||
-p = {(k, k**2): v**2 for k, v in pairs}
|
||||
-q = [10**i for i in range(6)]
|
||||
-r = x**y
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+b = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
+c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+e = NOT_IMPLEMENTED_call()
|
||||
+f = NOT_IMPLEMENTED_call() ** 0x42
|
||||
+g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||
+h = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
+i = NOT_IMPLEMENTED_call() ** 0x42
|
||||
+j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
||||
+k = [i for i in []]
|
||||
+l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+m = [(1, 2)]
|
||||
+n = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+o = NOT_IMPLEMENTED_call()
|
||||
+p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+q = [i for i in []]
|
||||
r = x**y
|
||||
|
||||
-a = 5.0**~4.0
|
||||
-b = 5.0 ** f()
|
||||
|
@ -147,23 +146,23 @@ return np.divide(
|
|||
-o = settings(max_examples=10**6.0)
|
||||
-p = {(k, k**2): v**2.0 for k, v in pairs}
|
||||
-q = [10.5**i for i in range(6)]
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+b = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
+c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
+d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+e = NOT_IMPLEMENTED_call()
|
||||
+f = NOT_IMPLEMENTED_call() ** 0x42
|
||||
+g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||
+h = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
+i = NOT_IMPLEMENTED_call() ** 0x42
|
||||
+j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
||||
+k = [i for i in []]
|
||||
+l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+m = [(1, 2)]
|
||||
+n = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
+o = NOT_IMPLEMENTED_call()
|
||||
+p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
+q = [i for i in []]
|
||||
|
||||
|
||||
# WE SHOULD DEFINITELY NOT EAT THESE COMMENTS (https://github.com/psf/black/issues/2873)
|
||||
|
@ -194,42 +193,42 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
|||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
b = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
e = NOT_IMPLEMENTED_call()
|
||||
f = NOT_IMPLEMENTED_call() ** 0x42
|
||||
g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||
h = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
i = NOT_IMPLEMENTED_call() ** 0x42
|
||||
j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
||||
k = [i for i in []]
|
||||
l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
m = [(1, 2)]
|
||||
n = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
o = NOT_IMPLEMENTED_call()
|
||||
p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
q = [i for i in []]
|
||||
r = x**y
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
b = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
e = NOT_IMPLEMENTED_call()
|
||||
f = NOT_IMPLEMENTED_call() ** 0x42
|
||||
g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||
h = 0x42 ** NOT_IMPLEMENTED_call()
|
||||
i = NOT_IMPLEMENTED_call() ** 0x42
|
||||
j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
||||
k = [i for i in []]
|
||||
l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
m = [(1, 2)]
|
||||
n = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||
o = NOT_IMPLEMENTED_call()
|
||||
p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
|
||||
q = [i for i in []]
|
||||
|
||||
|
||||
# WE SHOULD DEFINITELY NOT EAT THESE COMMENTS (https://github.com/psf/black/issues/2873)
|
||||
|
|
|
@ -40,14 +40,14 @@ xxxxxxxxx_yyy_zzzzzzzz[xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxx
|
|||
- arg1,
|
||||
- arg2,
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = NOT_IMPLEMENTED_call()
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
-xxxxxxxxx_yyy_zzzzzzzz[
|
||||
- xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
-] = 1
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key] = 0x42
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
@ -57,11 +57,11 @@ xxxxxxxxx_yyy_zzzzzzzz[xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxx
|
|||
|
||||
# Left hand side fits in a single line but will still be exploded by the
|
||||
# magic trailing comma.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = NOT_IMPLEMENTED_call()
|
||||
|
||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
||||
# exactly line length limit + 1, it won't be split like that.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key] = 0x42
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -190,22 +190,22 @@ with open("/path/to/file.txt", mode="r") as read_file:
|
|||
|
||||
-while True:
|
||||
- print("The newline above me should be deleted!")
|
||||
+while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
+ NOT_YET_IMPLEMENTED_ExprCall
|
||||
+while 0x42:
|
||||
+ NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
-while True:
|
||||
- print("The newlines above me should be deleted!")
|
||||
+while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
+ NOT_YET_IMPLEMENTED_ExprCall
|
||||
+while 0x42:
|
||||
+ NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
-while True:
|
||||
- while False:
|
||||
- print("The newlines above me should be deleted!")
|
||||
+while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
+ while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
+ NOT_YET_IMPLEMENTED_ExprCall
|
||||
+while 0x42:
|
||||
+ while 0x42:
|
||||
+ NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
-with open("/path/to/file.txt", mode="w") as file:
|
||||
|
@ -263,17 +263,17 @@ NOT_YET_IMPLEMENTED_StmtIf
|
|||
NOT_YET_IMPLEMENTED_StmtIf
|
||||
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
while 0x42:
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
while 0x42:
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
while NOT_YET_IMPLEMENTED_ExprConstant:
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
while 0x42:
|
||||
while 0x42:
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtWith
|
||||
|
|
|
@ -71,13 +71,13 @@ def example8():
|
|||
@@ -1,85 +1,37 @@
|
||||
-x = 1
|
||||
-x = 1.2
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+x = 0x42
|
||||
+x = 0x42
|
||||
|
||||
-data = (
|
||||
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
-).encode()
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+data = NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
-async def show_status():
|
||||
|
@ -173,10 +173,10 @@ def example8():
|
|||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
x = 0x42
|
||||
x = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
data = NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAsyncFunctionDef
|
||||
|
|
|
@ -65,40 +65,40 @@ func(
|
|||
-a: tuple[int,]
|
||||
-b = tuple[int,]
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+b = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# But commas in multiple element subscripts should be removed.
|
||||
-c: tuple[int, int]
|
||||
-d = tuple[int, int]
|
||||
+NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# Remove commas for non-subscripts.
|
||||
-small_list = [1]
|
||||
-list_of_types = [tuple[int,]]
|
||||
-small_set = {1}
|
||||
-set_of_types = {tuple[int,]}
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+small_list = [0x42]
|
||||
+list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||
+small_set = {0x42}
|
||||
+set_of_types = {NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]}
|
||||
|
||||
# Except single element tuples
|
||||
-small_tuple = (1,)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+small_tuple = (1, 2)
|
||||
|
||||
# Trailing commas in multiple chained non-nested parens.
|
||||
-zero(one).two(three).four(five)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
-func1(arg1).func2(arg2).func3(arg3).func4(arg4).func5(arg5)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
-(a, b, c, d) = func1(arg1) and func2(arg2)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
|
||||
-func(argument1, (one, two), argument4, argument5, argument6)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
@ -106,29 +106,29 @@ func(
|
|||
```py
|
||||
# We should not remove the trailing comma in a single-element subscript.
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
b = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# But commas in multiple element subscripts should be removed.
|
||||
NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
# Remove commas for non-subscripts.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
small_list = [0x42]
|
||||
list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||
small_set = {0x42}
|
||||
set_of_types = {NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]}
|
||||
|
||||
# Except single element tuples
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
small_tuple = (1, 2)
|
||||
|
||||
# Trailing commas in multiple chained non-nested parens.
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -96,25 +96,25 @@ x[
|
|||
-slice[not so_simple : 1 < val <= 10]
|
||||
-slice[(1 for i in range(42)) : x]
|
||||
-slice[:: [i for i in range(42)]]
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
|
||||
-async def f():
|
||||
|
@ -125,13 +125,13 @@ x[
|
|||
# These are from PEP-8:
|
||||
-ham[1:9], ham[1:9:3], ham[:9:3], ham[1::3], ham[1:9:]
|
||||
-ham[lower:upper], ham[lower:upper:], ham[lower::step]
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
# ham[lower+offset : upper+offset]
|
||||
-ham[: upper_fn(x) : step_fn(x)], ham[:: step_fn(x)]
|
||||
-ham[lower + offset : upper + offset]
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+(1, 2)
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
-slice[::, ::]
|
||||
-slice[
|
||||
|
@ -149,9 +149,9 @@ x[
|
|||
- # C
|
||||
- 3
|
||||
-]
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
-slice[
|
||||
- # A
|
||||
|
@ -163,50 +163,50 @@ x[
|
|||
- 4
|
||||
-]
|
||||
-x[1:2:3] # A # B # C
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAsyncFunctionDef
|
||||
|
||||
|
||||
# These are from PEP-8:
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
# ham[lower+offset : upper+offset]
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
(1, 2)
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_YET_IMPLEMENTED_ExprSubscript
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -41,16 +41,16 @@ def docstring_multiline():
|
|||
-(b"", b"")
|
||||
-("", "")
|
||||
-(r"", R"")
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+name = 0x42
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
|
||||
-(rf"", rf"", Rf"", Rf"", rf"", rf"", Rf"", Rf"")
|
||||
-(rb"", rb"", Rb"", Rb"", rb"", rb"", Rb"", Rb"")
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+(1, 2)
|
||||
+(1, 2)
|
||||
|
||||
|
||||
-def docstring_singleline():
|
||||
|
@ -70,14 +70,14 @@ def docstring_multiline():
|
|||
```py
|
||||
#!/usr/bin/env python3
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
name = 0x42
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
(1, 2)
|
||||
(1, 2)
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
|
|
@ -42,15 +42,14 @@ assert (
|
|||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -1,58 +1,20 @@
|
||||
@@ -1,58 +1,17 @@
|
||||
importA
|
||||
(
|
||||
-(
|
||||
- ()
|
||||
- << 0
|
||||
- ** 101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||
+ NOT_YET_IMPLEMENTED_ExprTuple
|
||||
+ << NOT_YET_IMPLEMENTED_ExprConstant**NOT_YET_IMPLEMENTED_ExprConstant
|
||||
) #
|
||||
-) #
|
||||
+(1, 2) << 0x42**0x42 #
|
||||
|
||||
-assert sort_by_dependency(
|
||||
- {
|
||||
|
@ -68,8 +67,8 @@ assert (
|
|||
importA
|
||||
-0
|
||||
-0 ^ 0 #
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant
|
||||
+NOT_YET_IMPLEMENTED_ExprConstant ^ NOT_YET_IMPLEMENTED_ExprConstant #
|
||||
+0x42
|
||||
+0x42 ^ 0x42 #
|
||||
|
||||
|
||||
-class A:
|
||||
|
@ -115,16 +114,13 @@ assert (
|
|||
|
||||
```py
|
||||
importA
|
||||
(
|
||||
NOT_YET_IMPLEMENTED_ExprTuple
|
||||
<< NOT_YET_IMPLEMENTED_ExprConstant**NOT_YET_IMPLEMENTED_ExprConstant
|
||||
) #
|
||||
(1, 2) << 0x42**0x42 #
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssert
|
||||
|
||||
importA
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
NOT_YET_IMPLEMENTED_ExprConstant ^ NOT_YET_IMPLEMENTED_ExprConstant #
|
||||
0x42
|
||||
0x42 ^ 0x42 #
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
|
|
@ -54,18 +54,18 @@ assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
|
|||
-).four(
|
||||
- five,
|
||||
-)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
-func1(arg1).func2(
|
||||
- arg2,
|
||||
-).func3(arg3).func4(
|
||||
- arg4,
|
||||
-).func5(arg5)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
# Inner one-element tuple shouldn't explode
|
||||
-func1(arg1).func2(arg1, (one_tuple,)).func3(arg3)
|
||||
+NOT_YET_IMPLEMENTED_ExprCall
|
||||
+NOT_IMPLEMENTED_call()
|
||||
|
||||
-(
|
||||
- a,
|
||||
|
@ -75,7 +75,7 @@ assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
|
|||
-) = func1(
|
||||
- arg1
|
||||
-) and func2(arg2)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
|
||||
|
||||
# Example from https://github.com/psf/black/issues/3229
|
||||
|
@ -109,14 +109,14 @@ assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
|
|||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
# Inner one-element tuple shouldn't explode
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||
|
||||
|
||||
# Example from https://github.com/psf/black/issues/3229
|
||||
|
|
|
@ -29,31 +29,31 @@ A፩ = 8
|
|||
-x󠄀 = 4
|
||||
-មុ = 1
|
||||
-Q̇_per_meter = 4
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+ä = 0x42
|
||||
+µ = 0x42
|
||||
+蟒 = 0x42
|
||||
+x󠄀 = 0x42
|
||||
+មុ = 0x42
|
||||
+Q̇_per_meter = 0x42
|
||||
|
||||
-A᧚ = 3
|
||||
-A፩ = 8
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+A᧚ = 0x42
|
||||
+A፩ = 0x42
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
ä = 0x42
|
||||
µ = 0x42
|
||||
蟒 = 0x42
|
||||
x󠄀 = 0x42
|
||||
មុ = 0x42
|
||||
Q̇_per_meter = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
A᧚ = 0x42
|
||||
A፩ = 0x42
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -28,26 +28,26 @@ this_will_be_wrapped_in_parens, = struct.unpack(b"12345678901234567890")
|
|||
- sdfsdjfklsdfjlksdljkf,
|
||||
- sdsfsdfjskdflsfsdf,
|
||||
-) = (1, 2, 3)
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = (1, 2)
|
||||
|
||||
# This is as well.
|
||||
-(this_will_be_wrapped_in_parens,) = struct.unpack(b"12345678901234567890")
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = NOT_IMPLEMENTED_call()
|
||||
|
||||
-(a,) = call()
|
||||
+NOT_YET_IMPLEMENTED_StmtAssign
|
||||
+(1, 2) = NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Ruff Output
|
||||
|
||||
```py
|
||||
# This is a standalone comment.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = (1, 2)
|
||||
|
||||
# This is as well.
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = NOT_IMPLEMENTED_call()
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
(1, 2) = NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
## Black Output
|
||||
|
|
|
@ -68,18 +68,23 @@ not (aaaaaaaaaaaaaa + {a for x in bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
|||
|
||||
|
||||
# Black breaks the right side first for the following expressions:
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprCall
|
||||
aaaaaaaaaaaaaa + NOT_IMPLEMENTED_call()
|
||||
aaaaaaaaaaaaaa + [
|
||||
bbbbbbbbbbbbbbbbbbbbbb,
|
||||
ccccccccccccccccccccc,
|
||||
dddddddddddddddd,
|
||||
eeeeeee,
|
||||
]
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprTuple
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprDict
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprSet
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprListComp
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprGeneratorExp
|
||||
aaaaaaaaaaaaaa + (1, 2)
|
||||
aaaaaaaaaaaaaa + {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||
aaaaaaaaaaaaaa + {
|
||||
bbbbbbbbbbbbbbbbbbbbbb,
|
||||
ccccccccccccccccccccc,
|
||||
dddddddddddddddd,
|
||||
eeeeeee,
|
||||
}
|
||||
aaaaaaaaaaaaaa + [i for i in []]
|
||||
aaaaaaaaaaaaaa + (i for i in [])
|
||||
aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprSetComp
|
||||
|
||||
# Wraps it in parentheses if it needs to break both left and right
|
||||
|
@ -91,7 +96,7 @@ aaaaaaaaaaaaaa + NOT_YET_IMPLEMENTED_ExprSetComp
|
|||
|
||||
# But only for expressions that have a statement parent.
|
||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||
[NOT_YET_IMPLEMENTED_ExprCompare]
|
||||
[NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right]
|
||||
|
||||
|
||||
# leading comment
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/src/lib.rs
|
||||
expression: snapshot
|
||||
---
|
||||
## Input
|
||||
```py
|
||||
# break left hand side
|
||||
a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = cakjdshflkjahdslkfjlasfdahjlfds = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = 3
|
||||
|
||||
# join left hand side
|
||||
a2 = (
|
||||
b2
|
||||
) = 2
|
||||
|
||||
# Break the last element
|
||||
a = asdf = fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal = 1
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Output
|
||||
```py
|
||||
# break left hand side
|
||||
a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = cakjdshflkjahdslkfjlasfdahjlfds = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = (
|
||||
0x42
|
||||
)
|
||||
|
||||
# join left hand side
|
||||
a2 = (b2) = 0x42
|
||||
|
||||
# Break the last element
|
||||
a = asdf = fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal = (
|
||||
0x42
|
||||
)
|
||||
```
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ while (
|
|||
|
||||
## Output
|
||||
```py
|
||||
while NOT_YET_IMPLEMENTED_ExprConstant: # trailing test comment
|
||||
while 0x42: # trailing test comment
|
||||
NOT_YET_IMPLEMENTED_StmtPass # trailing last statement comment
|
||||
|
||||
# trailing while body comment
|
||||
|
@ -59,16 +59,16 @@ while (
|
|||
NOT_YET_IMPLEMENTED_StmtPass
|
||||
|
||||
else:
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
0x42
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprBoolOp: # comment
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2: # comment
|
||||
NOT_IMPLEMENTED_call()
|
||||
|
||||
|
||||
while (
|
||||
NOT_YET_IMPLEMENTED_ExprBoolOp # trailing third condition
|
||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2 # trailing third condition
|
||||
): # comment
|
||||
NOT_YET_IMPLEMENTED_ExprCall
|
||||
NOT_IMPLEMENTED_call()
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@ e = 50 # one empty line before
|
|||
```py
|
||||
# Removes the line above
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # Keeps the line above
|
||||
a = 0x42 # Keeps the line above
|
||||
|
||||
# Separated by one line from `a` and `b`
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
b = 0x42
|
||||
|
||||
|
||||
# Adds two lines after `b`
|
||||
|
@ -57,22 +57,22 @@ NOT_YET_IMPLEMENTED_StmtClassDef
|
|||
|
||||
# two lines before, one line after
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
c = 0x42
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprCompare:
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
while NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right:
|
||||
0x42
|
||||
|
||||
# trailing comment with one line before
|
||||
|
||||
# one line before this leading comment
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
d = 0x42
|
||||
|
||||
while NOT_YET_IMPLEMENTED_ExprCompare:
|
||||
NOT_YET_IMPLEMENTED_ExprConstant
|
||||
while NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right:
|
||||
0x42
|
||||
# no empty line before
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign # one empty line before
|
||||
e = 0x42 # one empty line before
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,54 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use crate::context::PyFormatContext;
|
||||
use crate::expression::parentheses::Parenthesize;
|
||||
use crate::{AsFormat, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::formatter::Formatter;
|
||||
use ruff_formatter::prelude::{space, text};
|
||||
use ruff_formatter::{write, Buffer, Format, FormatResult};
|
||||
use ruff_python_ast::prelude::Expr;
|
||||
use rustpython_parser::ast::StmtAssign;
|
||||
|
||||
//
|
||||
// Note: This currently does wrap but not the black way so the types below likely need to be
|
||||
// replaced entirely
|
||||
//
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatStmtAssign;
|
||||
|
||||
impl FormatNodeRule<StmtAssign> for FormatStmtAssign {
|
||||
fn fmt_fields(&self, item: &StmtAssign, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
let StmtAssign {
|
||||
range: _,
|
||||
targets,
|
||||
value,
|
||||
type_comment: _,
|
||||
} = item;
|
||||
write!(
|
||||
f,
|
||||
[
|
||||
LhsAssignList::new(targets),
|
||||
value.format().with_options(Parenthesize::IfBreaks)
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct LhsAssignList<'a> {
|
||||
lhs_assign_list: &'a [Expr],
|
||||
}
|
||||
|
||||
impl<'a> LhsAssignList<'a> {
|
||||
const fn new(lhs_assign_list: &'a [Expr]) -> Self {
|
||||
Self { lhs_assign_list }
|
||||
}
|
||||
}
|
||||
|
||||
impl Format<PyFormatContext<'_>> for LhsAssignList<'_> {
|
||||
fn fmt(&self, f: &mut Formatter<PyFormatContext<'_>>) -> FormatResult<()> {
|
||||
for element in self.lhs_assign_list {
|
||||
write!(f, [&element.format(), space(), text("="), space(),])?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,22 +234,22 @@ def trailing_func():
|
|||
|
||||
assert_eq!(
|
||||
formatted,
|
||||
r#"NOT_YET_IMPLEMENTED_StmtAssign
|
||||
r#"a = 0x42
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
three_leading_newlines = 0x42
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
two_leading_newlines = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
one_leading_newline = 0x42
|
||||
no_leading_newline = 0x42
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
trailing_statement = 0x42
|
||||
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
@ -265,18 +265,18 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef"#
|
|||
|
||||
assert_eq!(
|
||||
formatted,
|
||||
r#"NOT_YET_IMPLEMENTED_StmtAssign
|
||||
r#"a = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
three_leading_newlines = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
two_leading_newlines = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
one_leading_newline = 0x42
|
||||
no_leading_newline = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtAssign
|
||||
trailing_statement = 0x42
|
||||
|
||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue