mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:09 +00:00
Add basic Constant formatting (#4954)
This commit is contained in:
parent
83cf6d6e2f
commit
c1cc6f3be1
47 changed files with 549 additions and 624 deletions
|
@ -191,16 +191,16 @@ no_leading_newline = 30
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&printed,
|
&printed,
|
||||||
r#"a = 0x42
|
r#"a = 10
|
||||||
|
|
||||||
|
|
||||||
three_leading_newlines = 0x42
|
three_leading_newlines = 80
|
||||||
|
|
||||||
|
|
||||||
two_leading_newlines = 0x42
|
two_leading_newlines = 20
|
||||||
|
|
||||||
one_leading_newline = 0x42
|
one_leading_newline = 10
|
||||||
no_leading_newline = 0x42"#
|
no_leading_newline = 30"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,14 +211,14 @@ no_leading_newline = 0x42"#
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&printed,
|
&printed,
|
||||||
r#"a = 0x42
|
r#"a = 10
|
||||||
|
|
||||||
three_leading_newlines = 0x42
|
three_leading_newlines = 80
|
||||||
|
|
||||||
two_leading_newlines = 0x42
|
two_leading_newlines = 20
|
||||||
|
|
||||||
one_leading_newline = 0x42
|
one_leading_newline = 10
|
||||||
no_leading_newline = 0x42"#
|
no_leading_newline = 30"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,11 +229,11 @@ no_leading_newline = 0x42"#
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&printed,
|
&printed,
|
||||||
r#"a = 0x42
|
r#"a = 10
|
||||||
three_leading_newlines = 0x42
|
three_leading_newlines = 80
|
||||||
two_leading_newlines = 0x42
|
two_leading_newlines = 20
|
||||||
one_leading_newline = 0x42
|
one_leading_newline = 10
|
||||||
no_leading_newline = 0x42"#
|
no_leading_newline = 30"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,38 @@
|
||||||
use crate::expression::parentheses::{
|
use crate::expression::parentheses::{
|
||||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||||
};
|
};
|
||||||
use crate::{not_yet_implemented_custom_text, AsFormat, FormatNodeRule, PyFormatter};
|
use crate::prelude::*;
|
||||||
use ruff_formatter::prelude::text;
|
use crate::{not_yet_implemented_custom_text, FormatNodeRule};
|
||||||
use ruff_formatter::{write, Buffer, FormatResult};
|
use ruff_formatter::write;
|
||||||
use rustpython_parser::ast::ExprAttribute;
|
use rustpython_parser::ast::{Constant, Expr, ExprAttribute, ExprConstant};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct FormatExprAttribute;
|
pub struct FormatExprAttribute;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprAttribute> for FormatExprAttribute {
|
impl FormatNodeRule<ExprAttribute> for FormatExprAttribute {
|
||||||
fn fmt_fields(&self, item: &ExprAttribute, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, item: &ExprAttribute, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
// We need to write the value - which is also a dummy - already because power op spacing
|
let ExprAttribute {
|
||||||
// depends on it
|
value,
|
||||||
|
range: _,
|
||||||
|
attr: _,
|
||||||
|
ctx: _,
|
||||||
|
} = item;
|
||||||
|
|
||||||
|
let requires_space = matches!(
|
||||||
|
value.as_ref(),
|
||||||
|
Expr::Constant(ExprConstant {
|
||||||
|
value: Constant::Int(_) | Constant::Float(_),
|
||||||
|
..
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[
|
[
|
||||||
item.value.format(),
|
item.value.format(),
|
||||||
|
requires_space.then_some(space()),
|
||||||
text("."),
|
text("."),
|
||||||
not_yet_implemented_custom_text(item, "NOT_IMPLEMENTED_attr")
|
not_yet_implemented_custom_text("NOT_IMPLEMENTED_attr")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,10 @@ use rustpython_parser::ast::ExprBoolOp;
|
||||||
pub struct FormatExprBoolOp;
|
pub struct FormatExprBoolOp;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprBoolOp> for FormatExprBoolOp {
|
impl FormatNodeRule<ExprBoolOp> for FormatExprBoolOp {
|
||||||
fn fmt_fields(&self, item: &ExprBoolOp, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprBoolOp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2"
|
"NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,13 +9,10 @@ use rustpython_parser::ast::ExprCall;
|
||||||
pub struct FormatExprCall;
|
pub struct FormatExprCall;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprCall> for FormatExprCall {
|
impl FormatNodeRule<ExprCall> for FormatExprCall {
|
||||||
fn fmt_fields(&self, item: &ExprCall, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprCall, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text("NOT_IMPLEMENTED_call()")]
|
||||||
item,
|
|
||||||
"NOT_IMPLEMENTED_call()"
|
|
||||||
)]
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,10 @@ use rustpython_parser::ast::ExprCompare;
|
||||||
pub struct FormatExprCompare;
|
pub struct FormatExprCompare;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprCompare> for FormatExprCompare {
|
impl FormatNodeRule<ExprCompare> for FormatExprCompare {
|
||||||
fn fmt_fields(&self, item: &ExprCompare, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprCompare, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right"
|
"NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,16 +1,42 @@
|
||||||
use crate::expression::parentheses::{
|
use crate::expression::parentheses::{
|
||||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||||
};
|
};
|
||||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
use crate::prelude::*;
|
||||||
use ruff_formatter::{write, Buffer, FormatResult};
|
use crate::{not_yet_implemented_custom_text, verbatim_text, FormatNodeRule};
|
||||||
use rustpython_parser::ast::ExprConstant;
|
use ruff_formatter::write;
|
||||||
|
use rustpython_parser::ast::{Constant, ExprConstant};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct FormatExprConstant;
|
pub struct FormatExprConstant;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprConstant> for FormatExprConstant {
|
impl FormatNodeRule<ExprConstant> for FormatExprConstant {
|
||||||
fn fmt_fields(&self, item: &ExprConstant, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, item: &ExprConstant, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(f, [not_yet_implemented_custom_text(item, "0x42")])
|
let ExprConstant {
|
||||||
|
range: _,
|
||||||
|
value,
|
||||||
|
kind: _,
|
||||||
|
} = item;
|
||||||
|
|
||||||
|
match value {
|
||||||
|
Constant::Ellipsis => text("...").fmt(f),
|
||||||
|
Constant::None => text("None").fmt(f),
|
||||||
|
Constant::Bool(value) => match value {
|
||||||
|
true => text("True").fmt(f),
|
||||||
|
false => text("False").fmt(f),
|
||||||
|
},
|
||||||
|
Constant::Int(_) | Constant::Float(_) | Constant::Complex { .. } => {
|
||||||
|
write!(f, [verbatim_text(item)])
|
||||||
|
}
|
||||||
|
Constant::Str(_) => {
|
||||||
|
not_yet_implemented_custom_text(r#""NOT_YET_IMPLEMENTED_STRING""#).fmt(f)
|
||||||
|
}
|
||||||
|
Constant::Bytes(_) => {
|
||||||
|
not_yet_implemented_custom_text(r#"b"NOT_YET_IMPLEMENTED_BYTE_STRING""#).fmt(f)
|
||||||
|
}
|
||||||
|
Constant::Tuple(_) => {
|
||||||
|
not_yet_implemented_custom_text("(NOT_YET_IMPLEMENTED_TUPLE,)").fmt(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,10 @@ use rustpython_parser::ast::ExprDict;
|
||||||
pub struct FormatExprDict;
|
pub struct FormatExprDict;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprDict> for FormatExprDict {
|
impl FormatNodeRule<ExprDict> for FormatExprDict {
|
||||||
fn fmt_fields(&self, item: &ExprDict, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprDict, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}"
|
"{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,11 +9,10 @@ use rustpython_parser::ast::ExprDictComp;
|
||||||
pub struct FormatExprDictComp;
|
pub struct FormatExprDictComp;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprDictComp> for FormatExprDictComp {
|
impl FormatNodeRule<ExprDictComp> for FormatExprDictComp {
|
||||||
fn fmt_fields(&self, item: &ExprDictComp, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprDictComp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"{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}"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,11 +9,8 @@ use rustpython_parser::ast::ExprGeneratorExp;
|
||||||
pub struct FormatExprGeneratorExp;
|
pub struct FormatExprGeneratorExp;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprGeneratorExp> for FormatExprGeneratorExp {
|
impl FormatNodeRule<ExprGeneratorExp> for FormatExprGeneratorExp {
|
||||||
fn fmt_fields(&self, item: &ExprGeneratorExp, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprGeneratorExp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(f, [not_yet_implemented_custom_text("(i for i in [])")])
|
||||||
f,
|
|
||||||
[not_yet_implemented_custom_text(item, "(i for i in [])")]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,10 @@ use rustpython_parser::ast::ExprIfExp;
|
||||||
pub struct FormatExprIfExp;
|
pub struct FormatExprIfExp;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprIfExp> for FormatExprIfExp {
|
impl FormatNodeRule<ExprIfExp> for FormatExprIfExp {
|
||||||
fn fmt_fields(&self, item: &ExprIfExp, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprIfExp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false"
|
"NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,8 +9,8 @@ use rustpython_parser::ast::ExprLambda;
|
||||||
pub struct FormatExprLambda;
|
pub struct FormatExprLambda;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
||||||
fn fmt_fields(&self, item: &ExprLambda, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprLambda, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(f, [not_yet_implemented_custom_text(item, "lambda x: True")])
|
write!(f, [not_yet_implemented_custom_text("lambda x: True")])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,8 @@ use rustpython_parser::ast::ExprListComp;
|
||||||
pub struct FormatExprListComp;
|
pub struct FormatExprListComp;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprListComp> for FormatExprListComp {
|
impl FormatNodeRule<ExprListComp> for FormatExprListComp {
|
||||||
fn fmt_fields(&self, item: &ExprListComp, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprListComp, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(f, [not_yet_implemented_custom_text("[i for i in []]")])
|
||||||
f,
|
|
||||||
[not_yet_implemented_custom_text(item, "[i for i in []]")]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,10 @@ use rustpython_parser::ast::ExprSlice;
|
||||||
pub struct FormatExprSlice;
|
pub struct FormatExprSlice;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprSlice> for FormatExprSlice {
|
impl FormatNodeRule<ExprSlice> for FormatExprSlice {
|
||||||
fn fmt_fields(&self, item: &ExprSlice, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprSlice, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"NOT_IMPLEMENTED_start:NOT_IMPLEMENTED_end"
|
"NOT_IMPLEMENTED_start:NOT_IMPLEMENTED_end"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,11 +10,10 @@ use rustpython_parser::ast::ExprSubscript;
|
||||||
pub struct FormatExprSubscript;
|
pub struct FormatExprSubscript;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprSubscript> for FormatExprSubscript {
|
impl FormatNodeRule<ExprSubscript> for FormatExprSubscript {
|
||||||
fn fmt_fields(&self, item: &ExprSubscript, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprSubscript, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
[not_yet_implemented_custom_text(
|
[not_yet_implemented_custom_text(
|
||||||
item,
|
|
||||||
"NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]"
|
"NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]"
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,8 +9,8 @@ use rustpython_parser::ast::ExprTuple;
|
||||||
pub struct FormatExprTuple;
|
pub struct FormatExprTuple;
|
||||||
|
|
||||||
impl FormatNodeRule<ExprTuple> for FormatExprTuple {
|
impl FormatNodeRule<ExprTuple> for FormatExprTuple {
|
||||||
fn fmt_fields(&self, item: &ExprTuple, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_fields(&self, _item: &ExprTuple, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(f, [not_yet_implemented_custom_text(item, "(1, 2)")])
|
write!(f, [not_yet_implemented_custom_text("(1, 2)")])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,19 +39,17 @@ where
|
||||||
N: AstNode,
|
N: AstNode,
|
||||||
{
|
{
|
||||||
fn fmt(&self, node: &N, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt(&self, node: &N, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
write!(f, [source_position(node.start())])?;
|
|
||||||
self.fmt_leading_comments(node, f)?;
|
self.fmt_leading_comments(node, f)?;
|
||||||
self.fmt_node(node, f)?;
|
self.fmt_node(node, f)?;
|
||||||
self.fmt_dangling_comments(node, f)?;
|
self.fmt_dangling_comments(node, f)?;
|
||||||
self.fmt_trailing_comments(node, f)?;
|
self.fmt_trailing_comments(node, f)
|
||||||
write!(f, [source_position(node.end())])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Formats the node without comments. Ignores any suppression comments.
|
/// Formats the node without comments. Ignores any suppression comments.
|
||||||
fn fmt_node(&self, node: &N, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt_node(&self, node: &N, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
|
write!(f, [source_position(node.start())])?;
|
||||||
self.fmt_fields(node, f)?;
|
self.fmt_fields(node, f)?;
|
||||||
|
write!(f, [source_position(node.end())])
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Formats the node's fields.
|
/// Formats the node's fields.
|
||||||
|
@ -164,33 +162,26 @@ impl Format<PyFormatContext<'_>> for NotYetImplemented {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct NotYetImplementedCustomText(NodeKind, String);
|
pub(crate) struct NotYetImplementedCustomText(&'static str);
|
||||||
|
|
||||||
/// Formats a placeholder for nodes that have not yet been implemented
|
/// Formats a placeholder for nodes that have not yet been implemented
|
||||||
pub(crate) fn not_yet_implemented_custom_text<'a, T>(
|
pub(crate) const fn not_yet_implemented_custom_text(
|
||||||
node: T,
|
text: &'static str,
|
||||||
text: impl AsRef<str>,
|
) -> NotYetImplementedCustomText {
|
||||||
) -> NotYetImplementedCustomText
|
NotYetImplementedCustomText(text)
|
||||||
where
|
|
||||||
T: Into<AnyNodeRef<'a>>,
|
|
||||||
{
|
|
||||||
NotYetImplementedCustomText(node.into().kind(), text.as_ref().to_string())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Format<PyFormatContext<'_>> for NotYetImplementedCustomText {
|
impl Format<PyFormatContext<'_>> for NotYetImplementedCustomText {
|
||||||
fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> {
|
fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> {
|
||||||
f.write_element(FormatElement::Tag(Tag::StartVerbatim(
|
f.write_element(FormatElement::Tag(Tag::StartVerbatim(
|
||||||
tag::VerbatimKind::Verbatim {
|
tag::VerbatimKind::Verbatim {
|
||||||
length: self.1.text_len(),
|
length: self.0.text_len(),
|
||||||
},
|
},
|
||||||
)))?;
|
)))?;
|
||||||
|
|
||||||
f.write_element(FormatElement::DynamicText {
|
text(self.0).fmt(f)?;
|
||||||
text: Box::from(self.1.clone()),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
f.write_element(FormatElement::Tag(Tag::EndVerbatim))?;
|
f.write_element(FormatElement::Tag(Tag::EndVerbatim))
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,12 +408,11 @@ Formatted twice:
|
||||||
#[ignore]
|
#[ignore]
|
||||||
#[test]
|
#[test]
|
||||||
fn quick_test() {
|
fn quick_test() {
|
||||||
let src = r#"AAAAAAAAAAAAA = AAAAAAAAAAAAA # type: ignore
|
let src = r#"
|
||||||
|
def test(): ...
|
||||||
|
|
||||||
call_to_some_function_asdf(
|
# Comment
|
||||||
foo,
|
def with_leading_comment(): ...
|
||||||
[AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBB], # type: ignore
|
|
||||||
)
|
|
||||||
"#;
|
"#;
|
||||||
// Tokenize once
|
// Tokenize once
|
||||||
let mut tokens = Vec::new();
|
let mut tokens = Vec::new();
|
||||||
|
|
|
@ -55,17 +55,17 @@ y = 100(no)
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
+x = 1. .NOT_IMPLEMENTED_attr
|
||||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
+x = 1E+1 .NOT_IMPLEMENTED_attr
|
||||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
+x = 1E-1 .NOT_IMPLEMENTED_attr
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
+x = 123456789.123456789E123456789 .NOT_IMPLEMENTED_attr
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
+x = 123456789J.NOT_IMPLEMENTED_attr
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = 0x42.NOT_IMPLEMENTED_attr
|
+x = 0O777 .NOT_IMPLEMENTED_attr
|
||||||
+x = NOT_IMPLEMENTED_call()
|
+x = NOT_IMPLEMENTED_call()
|
||||||
+x = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
+x = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
|
|
||||||
|
@ -85,17 +85,17 @@ y = 100(no)
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = 0x42.NOT_IMPLEMENTED_attr
|
x = 1. .NOT_IMPLEMENTED_attr
|
||||||
x = 0x42.NOT_IMPLEMENTED_attr
|
x = 1E+1 .NOT_IMPLEMENTED_attr
|
||||||
x = 0x42.NOT_IMPLEMENTED_attr
|
x = 1E-1 .NOT_IMPLEMENTED_attr
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = 0x42.NOT_IMPLEMENTED_attr
|
x = 123456789.123456789E123456789 .NOT_IMPLEMENTED_attr
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = 0x42.NOT_IMPLEMENTED_attr
|
x = 123456789J.NOT_IMPLEMENTED_attr
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = 0x42.NOT_IMPLEMENTED_attr
|
x = 0O777 .NOT_IMPLEMENTED_attr
|
||||||
x = NOT_IMPLEMENTED_call()
|
x = NOT_IMPLEMENTED_call()
|
||||||
x = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
x = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ if True:
|
||||||
```diff
|
```diff
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,99 +1,40 @@
|
@@ -1,99 +1,46 @@
|
||||||
-import core, time, a
|
-import core, time, a
|
||||||
+NOT_YET_IMPLEMENTED_StmtImport
|
+NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
|
||||||
|
@ -115,7 +115,8 @@ if True:
|
||||||
- 2,
|
- 2,
|
||||||
- 3,
|
- 3,
|
||||||
-}
|
-}
|
||||||
-b = {1, 2, 3}
|
+a = {1, 2, 3}
|
||||||
|
b = {1, 2, 3}
|
||||||
-c = {
|
-c = {
|
||||||
- 1,
|
- 1,
|
||||||
- 2,
|
- 2,
|
||||||
|
@ -128,13 +129,23 @@ if True:
|
||||||
- (4, 5, 6),
|
- (4, 5, 6),
|
||||||
-}
|
-}
|
||||||
-nested_no_trailing_comma = {(1, 2, 3), (4, 5, 6)}
|
-nested_no_trailing_comma = {(1, 2, 3), (4, 5, 6)}
|
||||||
-nested_long_lines = [
|
+c = {1, 2, 3}
|
||||||
|
+x = (1, 2)
|
||||||
|
+y = (1, 2)
|
||||||
|
+nested = {(1, 2), (1, 2)}
|
||||||
|
+nested_no_trailing_comma = {(1, 2), (1, 2)}
|
||||||
|
nested_long_lines = [
|
||||||
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
- "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
- "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||||
- "cccccccccccccccccccccccccccccccccccccccc",
|
- "cccccccccccccccccccccccccccccccccccccccc",
|
||||||
- (1, 2, 3),
|
- (1, 2, 3),
|
||||||
- "dddddddddddddddddddddddddddddddddddddddd",
|
- "dddddddddddddddddddddddddddddddddddddddd",
|
||||||
-]
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ (1, 2),
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
]
|
||||||
-{
|
-{
|
||||||
- "oneple": (1,),
|
- "oneple": (1,),
|
||||||
-}
|
-}
|
||||||
|
@ -148,17 +159,9 @@ if True:
|
||||||
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa wraps %s"
|
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa wraps %s"
|
||||||
- % bar
|
- % bar
|
||||||
-)
|
-)
|
||||||
+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}
|
||||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
+[0x42, 0x42 % (1, 2)]
|
+["NOT_YET_IMPLEMENTED_STRING", "NOT_YET_IMPLEMENTED_STRING" % (1, 2)]
|
||||||
+x = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
+x = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
+y = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
+y = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
@ -176,7 +179,7 @@ if True:
|
||||||
- 2,
|
- 2,
|
||||||
- 3,
|
- 3,
|
||||||
-]
|
-]
|
||||||
+[0x42, 0x42, 0x42]
|
+[1, 2, 3]
|
||||||
|
|
||||||
-division_result_tuple = (6 / 2,)
|
-division_result_tuple = (6 / 2,)
|
||||||
-print("foo %r", (foo.bar,))
|
-print("foo %r", (foo.bar,))
|
||||||
|
@ -228,17 +231,23 @@ NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||||
# `as` works as well
|
# `as` works as well
|
||||||
NOT_YET_IMPLEMENTED_StmtImportFrom
|
NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||||
|
|
||||||
a = {0x42, 0x42, 0x42}
|
a = {1, 2, 3}
|
||||||
b = {0x42, 0x42, 0x42}
|
b = {1, 2, 3}
|
||||||
c = {0x42, 0x42, 0x42}
|
c = {1, 2, 3}
|
||||||
x = (1, 2)
|
x = (1, 2)
|
||||||
y = (1, 2)
|
y = (1, 2)
|
||||||
nested = {(1, 2), (1, 2)}
|
nested = {(1, 2), (1, 2)}
|
||||||
nested_no_trailing_comma = {(1, 2), (1, 2)}
|
nested_no_trailing_comma = {(1, 2), (1, 2)}
|
||||||
nested_long_lines = [0x42, 0x42, 0x42, (1, 2), 0x42]
|
nested_long_lines = [
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
(1, 2),
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
]
|
||||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
{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 % (1, 2)]
|
["NOT_YET_IMPLEMENTED_STRING", "NOT_YET_IMPLEMENTED_STRING" % (1, 2)]
|
||||||
x = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
x = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
y = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
y = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
NOT_YET_IMPLEMENTED_StmtAssert
|
NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
@ -247,7 +256,7 @@ NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
NOT_YET_IMPLEMENTED_StmtFor
|
NOT_YET_IMPLEMENTED_StmtFor
|
||||||
NOT_YET_IMPLEMENTED_StmtFor
|
NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
|
||||||
[0x42, 0x42, 0x42]
|
[1, 2, 3]
|
||||||
|
|
||||||
division_result_tuple = (1, 2)
|
division_result_tuple = (1, 2)
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
|
|
|
@ -178,7 +178,7 @@ instruction()#comment with bad spacing
|
||||||
```diff
|
```diff
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,173 +1,68 @@
|
@@ -1,31 +1,27 @@
|
||||||
-from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
|
-from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
|
||||||
- MyLovelyCompanyTeamProjectComponent, # NOT DRY
|
- MyLovelyCompanyTeamProjectComponent, # NOT DRY
|
||||||
-)
|
-)
|
||||||
|
@ -195,16 +195,16 @@ instruction()#comment with bad spacing
|
||||||
- "Any",
|
- "Any",
|
||||||
- "Callable",
|
- "Callable",
|
||||||
- "ClassVar",
|
- "ClassVar",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
# ABCs (from collections.abc).
|
# ABCs (from collections.abc).
|
||||||
- "AbstractSet", # collections.abc.Set.
|
- "AbstractSet", # collections.abc.Set.
|
||||||
- "ByteString",
|
- "ByteString",
|
||||||
- "Container",
|
- "Container",
|
||||||
+ 0x42, # collections.abc.Set.
|
+ "NOT_YET_IMPLEMENTED_STRING", # collections.abc.Set.
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
# Concrete collection types.
|
# Concrete collection types.
|
||||||
- "Counter",
|
- "Counter",
|
||||||
- "Deque",
|
- "Deque",
|
||||||
|
@ -215,39 +215,30 @@ instruction()#comment with bad spacing
|
||||||
- "FrozenSet",
|
- "FrozenSet",
|
||||||
- "NamedTuple", # Not really a type.
|
- "NamedTuple", # Not really a type.
|
||||||
- "Generator",
|
- "Generator",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42, # Not really a type.
|
+ "NOT_YET_IMPLEMENTED_STRING", # Not really a type.
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
]
|
]
|
||||||
|
|
||||||
not_shareables = [
|
not_shareables = [
|
||||||
# singletons
|
@@ -37,129 +33,28 @@
|
||||||
- True,
|
|
||||||
- False,
|
|
||||||
+ 0x42,
|
|
||||||
+ 0x42,
|
|
||||||
NotImplemented,
|
|
||||||
- ...,
|
|
||||||
+ 0x42,
|
|
||||||
# builtin types and objects
|
# builtin types and objects
|
||||||
type,
|
type,
|
||||||
object,
|
object,
|
||||||
- object(),
|
- object(),
|
||||||
- Exception(),
|
- Exception(),
|
||||||
- 42,
|
+ NOT_IMPLEMENTED_call(),
|
||||||
- 100.0,
|
+ NOT_IMPLEMENTED_call(),
|
||||||
|
42,
|
||||||
|
100.0,
|
||||||
- "spam",
|
- "spam",
|
||||||
+ NOT_IMPLEMENTED_call(),
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ NOT_IMPLEMENTED_call(),
|
|
||||||
+ 0x42,
|
|
||||||
+ 0x42,
|
|
||||||
+ 0x42,
|
|
||||||
# user-defined types and objects
|
# user-defined types and objects
|
||||||
Cheese,
|
Cheese,
|
||||||
- Cheese("Wensleydale"),
|
- Cheese("Wensleydale"),
|
||||||
|
@ -308,10 +299,9 @@ instruction()#comment with bad spacing
|
||||||
-""",
|
-""",
|
||||||
- arg3=True,
|
- arg3=True,
|
||||||
- )
|
- )
|
||||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
-
|
||||||
|
|
||||||
- ############################################################################
|
- ############################################################################
|
||||||
|
-
|
||||||
- call2(
|
- call2(
|
||||||
- # short
|
- # short
|
||||||
- arg1,
|
- arg1,
|
||||||
|
@ -346,17 +336,16 @@ instruction()#comment with bad spacing
|
||||||
- while True:
|
- while True:
|
||||||
- if False:
|
- if False:
|
||||||
- continue
|
- continue
|
||||||
+CONFIG_FILES = [CONFIG_FILE] + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final
|
-
|
||||||
|
|
||||||
- # and round and round we go
|
- # and round and round we go
|
||||||
- # and round and round we go
|
- # and round and round we go
|
||||||
|
-
|
||||||
- # let's return
|
- # let's return
|
||||||
- return Node(
|
- return Node(
|
||||||
- syms.simple_stmt,
|
- syms.simple_stmt,
|
||||||
- [Node(statement, result), Leaf(token.NEWLINE, "\n")], # FIXME: \r\n?
|
- [Node(statement, result), Leaf(token.NEWLINE, "\n")], # FIXME: \r\n?
|
||||||
- )
|
- )
|
||||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
|
|
||||||
|
|
||||||
-CONFIG_FILES = (
|
-CONFIG_FILES = (
|
||||||
|
@ -366,16 +355,18 @@ instruction()#comment with bad spacing
|
||||||
- + SHARED_CONFIG_FILES
|
- + SHARED_CONFIG_FILES
|
||||||
- + USER_CONFIG_FILES
|
- + USER_CONFIG_FILES
|
||||||
-) # type: Final
|
-) # type: Final
|
||||||
-
|
+CONFIG_FILES = [CONFIG_FILE] + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final
|
||||||
-
|
|
||||||
|
|
||||||
-class Test:
|
-class Test:
|
||||||
- def _init_host(self, parsed) -> None:
|
- def _init_host(self, parsed) -> None:
|
||||||
- if parsed.hostname is None or not parsed.hostname.strip(): # type: ignore
|
- if parsed.hostname is None or not parsed.hostname.strip(): # type: ignore
|
||||||
- pass
|
- pass
|
||||||
-
|
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||||
-
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
### SECTION COMMENT ###
|
@@ -167,7 +62,7 @@
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,39 +387,39 @@ NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Super-special typing primitives.
|
# Super-special typing primitives.
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
# ABCs (from collections.abc).
|
# ABCs (from collections.abc).
|
||||||
0x42, # collections.abc.Set.
|
"NOT_YET_IMPLEMENTED_STRING", # collections.abc.Set.
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
# Concrete collection types.
|
# Concrete collection types.
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42, # Not really a type.
|
"NOT_YET_IMPLEMENTED_STRING", # Not really a type.
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
]
|
]
|
||||||
|
|
||||||
not_shareables = [
|
not_shareables = [
|
||||||
# singletons
|
# singletons
|
||||||
0x42,
|
True,
|
||||||
0x42,
|
False,
|
||||||
NotImplemented,
|
NotImplemented,
|
||||||
0x42,
|
...,
|
||||||
# builtin types and objects
|
# builtin types and objects
|
||||||
type,
|
type,
|
||||||
object,
|
object,
|
||||||
NOT_IMPLEMENTED_call(),
|
NOT_IMPLEMENTED_call(),
|
||||||
NOT_IMPLEMENTED_call(),
|
NOT_IMPLEMENTED_call(),
|
||||||
0x42,
|
42,
|
||||||
0x42,
|
100.0,
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
# user-defined types and objects
|
# user-defined types and objects
|
||||||
Cheese,
|
Cheese,
|
||||||
NOT_IMPLEMENTED_call(),
|
NOT_IMPLEMENTED_call(),
|
||||||
|
|
|
@ -87,40 +87,39 @@ if __name__ == "__main__":
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,61 +1,33 @@
|
@@ -1,61 +1,33 @@
|
||||||
-while True:
|
while True:
|
||||||
- if something.changed:
|
- if something.changed:
|
||||||
- do.stuff() # trailing comment
|
- do.stuff() # trailing comment
|
||||||
- # Comment belongs to the `if` block.
|
- # Comment belongs to the `if` block.
|
||||||
+while 0x42:
|
|
||||||
+ NOT_YET_IMPLEMENTED_StmtIf
|
+ NOT_YET_IMPLEMENTED_StmtIf
|
||||||
# This one belongs to the `while` block.
|
# This one belongs to the `while` block.
|
||||||
|
|
||||||
# Should this one, too? I guess so.
|
# Should this one, too? I guess so.
|
||||||
|
|
||||||
# This one is properly standalone now.
|
# This one is properly standalone now.
|
||||||
|
-
|
||||||
-for i in range(100):
|
-for i in range(100):
|
||||||
- # first we do this
|
- # first we do this
|
||||||
- if i % 33 == 0:
|
- if i % 33 == 0:
|
||||||
- break
|
- break
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
-
|
||||||
|
|
||||||
- # then we do this
|
- # then we do this
|
||||||
- print(i)
|
- print(i)
|
||||||
- # and finally we loop around
|
- # and finally we loop around
|
||||||
+NOT_YET_IMPLEMENTED_StmtWith
|
|
||||||
|
|
||||||
-with open(some_temp_file) as f:
|
-with open(some_temp_file) as f:
|
||||||
- data = f.read()
|
- data = f.read()
|
||||||
-
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
|
||||||
-try:
|
-try:
|
||||||
- with open(some_other_file) as w:
|
- with open(some_other_file) as w:
|
||||||
- w.write(data)
|
- w.write(data)
|
||||||
+NOT_YET_IMPLEMENTED_StmtTry
|
+NOT_YET_IMPLEMENTED_StmtWith
|
||||||
|
|
||||||
-except OSError:
|
-except OSError:
|
||||||
- print("problems")
|
- print("problems")
|
||||||
-
|
+NOT_YET_IMPLEMENTED_StmtTry
|
||||||
|
|
||||||
-import sys
|
-import sys
|
||||||
+NOT_YET_IMPLEMENTED_StmtImport
|
+NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
|
||||||
|
@ -174,7 +173,7 @@ if __name__ == "__main__":
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
while 0x42:
|
while True:
|
||||||
NOT_YET_IMPLEMENTED_StmtIf
|
NOT_YET_IMPLEMENTED_StmtIf
|
||||||
# This one belongs to the `while` block.
|
# This one belongs to the `while` block.
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*ite
|
||||||
- "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa" # type: ignore
|
- "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa" # type: ignore
|
||||||
- )
|
- )
|
||||||
|
|
||||||
+result = 0x42 # aaa
|
+result = "NOT_YET_IMPLEMENTED_STRING" # aaa
|
||||||
|
|
||||||
-result = ( # aaa
|
-result = ( # aaa
|
||||||
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
@ -301,7 +301,7 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
|
|
||||||
|
|
||||||
result = 0x42 # aaa
|
result = "NOT_YET_IMPLEMENTED_STRING" # aaa
|
||||||
|
|
||||||
AAAAAAAAAAAAA = (
|
AAAAAAAAAAAAA = (
|
||||||
[AAAAAAAAAAAAA]
|
[AAAAAAAAAAAAA]
|
||||||
|
|
|
@ -41,16 +41,13 @@ def function(a:int=42):
|
||||||
-)
|
-)
|
||||||
+NOT_YET_IMPLEMENTED_StmtImportFrom
|
+NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||||
|
|
||||||
-result = 1 # A simple comment
|
result = 1 # A simple comment
|
||||||
-result = (1,) # Another one
|
-result = (1,) # Another one
|
||||||
+result = 0x42 # A simple comment
|
|
||||||
+result = (1, 2) # Another one
|
+result = (1, 2) # Another one
|
||||||
|
|
||||||
-result = 1 # type: ignore
|
result = 1 # type: ignore
|
||||||
-result = 1 # This comment is talking about type: ignore
|
result = 1 # This comment is talking about type: ignore
|
||||||
-square = Square(4) # type: Optional[Square]
|
-square = Square(4) # type: Optional[Square]
|
||||||
+result = 0x42 # type: ignore
|
|
||||||
+result = 0x42 # This comment is talking about type: ignore
|
|
||||||
+square = NOT_IMPLEMENTED_call() # type: Optional[Square]
|
+square = NOT_IMPLEMENTED_call() # type: Optional[Square]
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,11 +67,11 @@ def function(a:int=42):
|
||||||
```py
|
```py
|
||||||
NOT_YET_IMPLEMENTED_StmtImportFrom
|
NOT_YET_IMPLEMENTED_StmtImportFrom
|
||||||
|
|
||||||
result = 0x42 # A simple comment
|
result = 1 # A simple comment
|
||||||
result = (1, 2) # Another one
|
result = (1, 2) # Another one
|
||||||
|
|
||||||
result = 0x42 # type: ignore
|
result = 1 # type: ignore
|
||||||
result = 0x42 # This comment is talking about type: ignore
|
result = 1 # This comment is talking about type: ignore
|
||||||
square = NOT_IMPLEMENTED_call() # type: Optional[Square]
|
square = NOT_IMPLEMENTED_call() # type: Optional[Square]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,51 +114,50 @@ async def wat():
|
||||||
# Has many lines. Many, many lines.
|
# Has many lines. Many, many lines.
|
||||||
# Many, many, many lines.
|
# Many, many, many lines.
|
||||||
-"""Module docstring.
|
-"""Module docstring.
|
||||||
+0x42
|
-
|
||||||
|
|
||||||
-Possibly also many, many lines.
|
-Possibly also many, many lines.
|
||||||
-"""
|
-"""
|
||||||
+NOT_YET_IMPLEMENTED_StmtImport
|
-
|
||||||
+NOT_YET_IMPLEMENTED_StmtImport
|
|
||||||
|
|
||||||
-import os.path
|
-import os.path
|
||||||
-import sys
|
-import sys
|
||||||
-
|
-
|
||||||
-import a
|
-import a
|
||||||
-from b.c import X # some noqa comment
|
-from b.c import X # some noqa comment
|
||||||
+NOT_YET_IMPLEMENTED_StmtImport
|
+"NOT_YET_IMPLEMENTED_STRING"
|
||||||
+NOT_YET_IMPLEMENTED_StmtImportFrom # some noqa comment
|
|
||||||
|
|
||||||
-try:
|
-try:
|
||||||
- import fast
|
- import fast
|
||||||
-except ImportError:
|
-except ImportError:
|
||||||
- import slow as fast
|
- import slow as fast
|
||||||
-
|
+NOT_YET_IMPLEMENTED_StmtImport
|
||||||
-
|
+NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtImportFrom # some noqa comment
|
||||||
|
|
||||||
-# Some comment before a function.
|
-# Some comment before a function.
|
||||||
-y = 1
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtTry
|
+NOT_YET_IMPLEMENTED_StmtTry
|
||||||
+y = 0x42
|
y = 1
|
||||||
(
|
(
|
||||||
# some strings
|
# some strings
|
||||||
y # type: ignore
|
y # type: ignore
|
||||||
)
|
)
|
||||||
-
|
-
|
||||||
|
-
|
||||||
-def function(default=None):
|
-def function(default=None):
|
||||||
- """Docstring comes first.
|
- """Docstring comes first.
|
||||||
|
-
|
||||||
- Possibly many lines.
|
- Possibly many lines.
|
||||||
- """
|
- """
|
||||||
- # FIXME: Some comment about why this function is crap but still in production.
|
- # FIXME: Some comment about why this function is crap but still in production.
|
||||||
- import inner_imports
|
- import inner_imports
|
||||||
-
|
|
||||||
- if inner_imports.are_evil():
|
- if inner_imports.are_evil():
|
||||||
- # Explains why we have this if.
|
- # Explains why we have this if.
|
||||||
- # In great detail indeed.
|
- # In great detail indeed.
|
||||||
- x = X()
|
- x = X()
|
||||||
- return x.method1() # type: ignore
|
- return x.method1() # type: ignore
|
||||||
-
|
|
||||||
- # This return is also commented for some reason.
|
- # This return is also commented for some reason.
|
||||||
- return default
|
- return default
|
||||||
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
+NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
|
@ -171,11 +170,11 @@ async def wat():
|
||||||
|
|
||||||
# Another comment!
|
# Another comment!
|
||||||
# This time two lines.
|
# This time two lines.
|
||||||
-
|
|
||||||
|
|
||||||
-class Foo:
|
-class Foo:
|
||||||
- """Docstring for class Foo. Example from Sphinx docs."""
|
- """Docstring for class Foo. Example from Sphinx docs."""
|
||||||
|
-
|
||||||
- #: Doc comment for class attribute Foo.bar.
|
- #: Doc comment for class attribute Foo.bar.
|
||||||
- #: It can have multiple lines.
|
- #: It can have multiple lines.
|
||||||
- bar = 1
|
- bar = 1
|
||||||
|
@ -188,12 +187,12 @@ async def wat():
|
||||||
- def __init__(self):
|
- def __init__(self):
|
||||||
- #: Doc comment for instance attribute qux.
|
- #: Doc comment for instance attribute qux.
|
||||||
- self.qux = 3
|
- self.qux = 3
|
||||||
-
|
|
||||||
- self.spam = 4
|
|
||||||
- """Docstring for instance attribute spam."""
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtClassDef
|
+NOT_YET_IMPLEMENTED_StmtClassDef
|
||||||
|
|
||||||
|
- self.spam = 4
|
||||||
|
- """Docstring for instance attribute spam."""
|
||||||
|
|
||||||
|
-
|
||||||
#' <h1>This is pweave!</h1>
|
#' <h1>This is pweave!</h1>
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +226,7 @@ async def wat():
|
||||||
#
|
#
|
||||||
# Has many lines. Many, many lines.
|
# Has many lines. Many, many lines.
|
||||||
# Many, many, many lines.
|
# Many, many, many lines.
|
||||||
0x42
|
"NOT_YET_IMPLEMENTED_STRING"
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtImport
|
NOT_YET_IMPLEMENTED_StmtImport
|
||||||
NOT_YET_IMPLEMENTED_StmtImport
|
NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
@ -236,7 +235,7 @@ NOT_YET_IMPLEMENTED_StmtImport
|
||||||
NOT_YET_IMPLEMENTED_StmtImportFrom # some noqa comment
|
NOT_YET_IMPLEMENTED_StmtImportFrom # some noqa comment
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtTry
|
NOT_YET_IMPLEMENTED_StmtTry
|
||||||
y = 0x42
|
y = 1
|
||||||
(
|
(
|
||||||
# some strings
|
# some strings
|
||||||
y # type: ignore
|
y # type: ignore
|
||||||
|
|
|
@ -107,7 +107,7 @@ def g():
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,89 +1,12 @@
|
@@ -1,89 +1,12 @@
|
||||||
-"""Docstring."""
|
-"""Docstring."""
|
||||||
+0x42
|
+"NOT_YET_IMPLEMENTED_STRING"
|
||||||
|
|
||||||
|
|
||||||
# leading comment
|
# leading comment
|
||||||
|
@ -203,7 +203,7 @@ def g():
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
0x42
|
"NOT_YET_IMPLEMENTED_STRING"
|
||||||
|
|
||||||
|
|
||||||
# leading comment
|
# leading comment
|
||||||
|
|
|
@ -267,19 +267,19 @@ last_call()
|
||||||
```diff
|
```diff
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,352 +1,247 @@
|
@@ -1,5 +1,6 @@
|
||||||
-"some_string"
|
-"some_string"
|
||||||
-b"\\xa3"
|
-b"\\xa3"
|
||||||
+0x42
|
+...
|
||||||
+0x42
|
+"NOT_YET_IMPLEMENTED_STRING"
|
||||||
+0x42
|
+b"NOT_YET_IMPLEMENTED_BYTE_STRING"
|
||||||
Name
|
Name
|
||||||
-None
|
None
|
||||||
-True
|
True
|
||||||
-False
|
@@ -7,346 +8,240 @@
|
||||||
-1
|
1
|
||||||
-1.0
|
1.0
|
||||||
-1j
|
1j
|
||||||
-True or False
|
-True or False
|
||||||
-True or False or None
|
-True or False or None
|
||||||
-True and False
|
-True and False
|
||||||
|
@ -292,11 +292,23 @@ last_call()
|
||||||
-Name1 and Name2 or Name3 and Name4
|
-Name1 and Name2 or Name3 and Name4
|
||||||
-Name1 or (Name2 and Name3) or Name4
|
-Name1 or (Name2 and Name3) or Name4
|
||||||
-Name1 or Name2 and Name3 or Name4
|
-Name1 or Name2 and Name3 or Name4
|
||||||
-v1 << 2
|
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
-1 >> v2
|
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
-1 % finished
|
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
-1 + v2 - v3 * 4 ^ 5**v6 / 7 // 8
|
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
-((1 + v2) - (v3 * 4)) ^ (((5**v6) / 7) // 8)
|
+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 << 2
|
||||||
|
1 >> v2
|
||||||
|
1 % finished
|
||||||
|
1 + v2 - v3 * 4 ^ 5**v6 / 7 // 8
|
||||||
|
((1 + v2) - (v3 * 4)) ^ (((5**v6) / 7) // 8)
|
||||||
-not great
|
-not great
|
||||||
-~great
|
-~great
|
||||||
-+value
|
-+value
|
||||||
|
@ -332,29 +344,6 @@ last_call()
|
||||||
-({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
|
-({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
|
||||||
-()
|
-()
|
||||||
-(1,)
|
-(1,)
|
||||||
+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_ExprUnaryOp
|
+NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
|
@ -380,11 +369,11 @@ last_call()
|
||||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
+{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,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ (NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false),
|
+ (NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false),
|
||||||
+}
|
+}
|
||||||
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
+NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
|
@ -396,39 +385,34 @@ last_call()
|
||||||
[]
|
[]
|
||||||
-[1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
|
-[1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
|
||||||
[
|
[
|
||||||
- 1,
|
1,
|
||||||
- 2,
|
2,
|
||||||
- 3,
|
3,
|
||||||
+ 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]
|
-[*a]
|
||||||
-[*range(10)]
|
-[*range(10)]
|
||||||
-[
|
-[
|
||||||
- *a,
|
- *a,
|
||||||
- 4,
|
4,
|
||||||
- 5,
|
5,
|
||||||
-]
|
+ 6,
|
||||||
|
+ 7,
|
||||||
|
+ 8,
|
||||||
|
+ 9,
|
||||||
|
+ (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),
|
||||||
|
]
|
||||||
-[
|
-[
|
||||||
- 4,
|
- 4,
|
||||||
- *a,
|
- *a,
|
||||||
- 5,
|
- 5,
|
||||||
-]
|
-]
|
||||||
+[0x42, 0x42, 0x42]
|
+[1, 2, 3]
|
||||||
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||||
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
+[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||||
+[NOT_YET_IMPLEMENTED_ExprStarred, 0x42, 0x42]
|
+[NOT_YET_IMPLEMENTED_ExprStarred, 4, 5]
|
||||||
+[0x42, NOT_YET_IMPLEMENTED_ExprStarred, 0x42]
|
+[4, NOT_YET_IMPLEMENTED_ExprStarred, 5]
|
||||||
[
|
[
|
||||||
this_is_a_very_long_variable_which_will_force_a_delimiter_split,
|
this_is_a_very_long_variable_which_will_force_a_delimiter_split,
|
||||||
element,
|
element,
|
||||||
|
@ -475,9 +459,9 @@ last_call()
|
||||||
+NOT_IMPLEMENTED_call()
|
+NOT_IMPLEMENTED_call()
|
||||||
+lukasz.NOT_IMPLEMENTED_attr.NOT_IMPLEMENTED_attr
|
+lukasz.NOT_IMPLEMENTED_attr.NOT_IMPLEMENTED_attr
|
||||||
+NOT_IMPLEMENTED_call()
|
+NOT_IMPLEMENTED_call()
|
||||||
+0x42.NOT_IMPLEMENTED_attr
|
+1 .NOT_IMPLEMENTED_attr
|
||||||
+0x42.NOT_IMPLEMENTED_attr
|
+1.0 .NOT_IMPLEMENTED_attr
|
||||||
+0x42.NOT_IMPLEMENTED_attr
|
+....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_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
|
@ -518,11 +502,11 @@ last_call()
|
||||||
{
|
{
|
||||||
- k: v
|
- k: v
|
||||||
- for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
|
- for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ 0x42,
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+ NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false,
|
+ NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false,
|
||||||
}
|
}
|
||||||
-Python3 > Python2 > COBOL
|
-Python3 > Python2 > COBOL
|
||||||
|
@ -558,15 +542,15 @@ last_call()
|
||||||
- float,
|
- float,
|
||||||
- dict[str, int],
|
- dict[str, int],
|
||||||
+[
|
+[
|
||||||
+ 0x42,
|
+ 1,
|
||||||
+ 0x42,
|
+ 2,
|
||||||
+ 0x42,
|
+ 3,
|
||||||
+ 0x42,
|
+ 4,
|
||||||
+ 0x42,
|
+ 5,
|
||||||
+ 0x42,
|
+ 6,
|
||||||
+ 0x42,
|
+ 7,
|
||||||
+ 0x42,
|
+ 8,
|
||||||
+ 0x42,
|
+ 9,
|
||||||
+ 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,
|
||||||
|
@ -632,24 +616,6 @@ last_call()
|
||||||
-}
|
-}
|
||||||
-a = (1,)
|
-a = (1,)
|
||||||
-b = (1,)
|
-b = (1,)
|
||||||
-c = 1
|
|
||||||
-d = (1,) + a + (2,)
|
|
||||||
-e = (1,).count(1)
|
|
||||||
-f = 1, *range(10)
|
|
||||||
-g = 1, *"ten"
|
|
||||||
-what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
|
|
||||||
- vars_to_remove
|
|
||||||
-)
|
|
||||||
-what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
|
|
||||||
- vars_to_remove
|
|
||||||
-)
|
|
||||||
-result = (
|
|
||||||
- session.query(models.Customer.id)
|
|
||||||
- .filter(
|
|
||||||
- models.Customer.account_id == account_id, models.Customer.email == email_address
|
|
||||||
- )
|
|
||||||
- .order_by(models.Customer.id.asc())
|
|
||||||
- .all()
|
|
||||||
+(1, 2)
|
+(1, 2)
|
||||||
+(i for i in [])
|
+(i for i in [])
|
||||||
+(i for i in [])
|
+(i for i in [])
|
||||||
|
@ -659,7 +625,13 @@ last_call()
|
||||||
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
+a = (1, 2)
|
+a = (1, 2)
|
||||||
+b = (1, 2)
|
+b = (1, 2)
|
||||||
+c = 0x42
|
c = 1
|
||||||
|
-d = (1,) + a + (2,)
|
||||||
|
-e = (1,).count(1)
|
||||||
|
-f = 1, *range(10)
|
||||||
|
-g = 1, *"ten"
|
||||||
|
-what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
|
||||||
|
- vars_to_remove
|
||||||
+d = (1, 2) + a + (1, 2)
|
+d = (1, 2) + a + (1, 2)
|
||||||
+e = NOT_IMPLEMENTED_call()
|
+e = NOT_IMPLEMENTED_call()
|
||||||
+f = (1, 2)
|
+f = (1, 2)
|
||||||
|
@ -668,6 +640,20 @@ last_call()
|
||||||
+ (coord_names + NOT_IMPLEMENTED_call())
|
+ (coord_names + NOT_IMPLEMENTED_call())
|
||||||
+ + NOT_IMPLEMENTED_call()
|
+ + NOT_IMPLEMENTED_call()
|
||||||
)
|
)
|
||||||
|
-what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
|
||||||
|
- vars_to_remove
|
||||||
|
+what_is_up_with_those_new_coord_names = (
|
||||||
|
+ (coord_names | NOT_IMPLEMENTED_call())
|
||||||
|
+ - NOT_IMPLEMENTED_call()
|
||||||
|
)
|
||||||
|
-result = (
|
||||||
|
- session.query(models.Customer.id)
|
||||||
|
- .filter(
|
||||||
|
- models.Customer.account_id == account_id, models.Customer.email == email_address
|
||||||
|
- )
|
||||||
|
- .order_by(models.Customer.id.asc())
|
||||||
|
- .all()
|
||||||
|
-)
|
||||||
-result = (
|
-result = (
|
||||||
- session.query(models.Customer.id)
|
- session.query(models.Customer.id)
|
||||||
- .filter(
|
- .filter(
|
||||||
|
@ -677,10 +663,7 @@ last_call()
|
||||||
- models.Customer.id.asc(),
|
- models.Customer.id.asc(),
|
||||||
- )
|
- )
|
||||||
- .all()
|
- .all()
|
||||||
+what_is_up_with_those_new_coord_names = (
|
-)
|
||||||
+ (coord_names | NOT_IMPLEMENTED_call())
|
|
||||||
+ - NOT_IMPLEMENTED_call()
|
|
||||||
)
|
|
||||||
-Ø = set()
|
-Ø = set()
|
||||||
-authors.łukasz.say_thanks()
|
-authors.łukasz.say_thanks()
|
||||||
-mapping = {
|
-mapping = {
|
||||||
|
@ -728,7 +711,19 @@ last_call()
|
||||||
-for j in 1 + (2 + 3):
|
-for j in 1 + (2 + 3):
|
||||||
- ...
|
- ...
|
||||||
-while this and that:
|
-while this and that:
|
||||||
- ...
|
+NOT_IMPLEMENTED_call()
|
||||||
|
+NOT_IMPLEMENTED_call()
|
||||||
|
+NOT_IMPLEMENTED_call()
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
|
+while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2:
|
||||||
|
...
|
||||||
-for (
|
-for (
|
||||||
- addr_family,
|
- addr_family,
|
||||||
- addr_type,
|
- addr_type,
|
||||||
|
@ -810,19 +805,6 @@ last_call()
|
||||||
- >> aaaaaaaaaaaaaaaa.l**aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
|
- >> aaaaaaaaaaaaaaaa.l**aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
|
||||||
-):
|
-):
|
||||||
- return True
|
- return True
|
||||||
+NOT_IMPLEMENTED_call()
|
|
||||||
+NOT_IMPLEMENTED_call()
|
|
||||||
+NOT_IMPLEMENTED_call()
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
|
||||||
+while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2:
|
|
||||||
+ 0x42
|
|
||||||
+NOT_YET_IMPLEMENTED_StmtFor
|
+NOT_YET_IMPLEMENTED_StmtFor
|
||||||
+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
|
||||||
|
@ -858,16 +840,16 @@ last_call()
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
0x42
|
...
|
||||||
0x42
|
"NOT_YET_IMPLEMENTED_STRING"
|
||||||
0x42
|
b"NOT_YET_IMPLEMENTED_BYTE_STRING"
|
||||||
Name
|
Name
|
||||||
0x42
|
None
|
||||||
0x42
|
True
|
||||||
0x42
|
False
|
||||||
0x42
|
1
|
||||||
0x42
|
1.0
|
||||||
0x42
|
1j
|
||||||
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
|
||||||
|
@ -880,11 +862,11 @@ 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
|
v1 << 2
|
||||||
0x42 >> v2
|
1 >> v2
|
||||||
0x42 % finished
|
1 % finished
|
||||||
0x42 + v2 - v3 * 0x42 ^ 0x42**v6 / 0x42 // 0x42
|
1 + v2 - v3 * 4 ^ 5**v6 / 7 // 8
|
||||||
((0x42 + v2) - (v3 * 0x42)) ^ (((0x42**v6) / 0x42) // 0x42)
|
((1 + v2) - (v3 * 4)) ^ (((5**v6) / 7) // 8)
|
||||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
|
@ -910,11 +892,11 @@ 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}
|
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
{
|
{
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
(NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false),
|
(NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false),
|
||||||
}
|
}
|
||||||
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
|
@ -924,24 +906,24 @@ NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2
|
||||||
(1, 2)
|
(1, 2)
|
||||||
[]
|
[]
|
||||||
[
|
[
|
||||||
0x42,
|
1,
|
||||||
0x42,
|
2,
|
||||||
0x42,
|
3,
|
||||||
0x42,
|
4,
|
||||||
0x42,
|
5,
|
||||||
0x42,
|
6,
|
||||||
0x42,
|
7,
|
||||||
0x42,
|
8,
|
||||||
0x42,
|
9,
|
||||||
(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),
|
||||||
]
|
]
|
||||||
[0x42, 0x42, 0x42]
|
[1, 2, 3]
|
||||||
[NOT_YET_IMPLEMENTED_ExprStarred]
|
[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||||
[NOT_YET_IMPLEMENTED_ExprStarred]
|
[NOT_YET_IMPLEMENTED_ExprStarred]
|
||||||
[NOT_YET_IMPLEMENTED_ExprStarred, 0x42, 0x42]
|
[NOT_YET_IMPLEMENTED_ExprStarred, 4, 5]
|
||||||
[0x42, NOT_YET_IMPLEMENTED_ExprStarred, 0x42]
|
[4, NOT_YET_IMPLEMENTED_ExprStarred, 5]
|
||||||
[
|
[
|
||||||
this_is_a_very_long_variable_which_will_force_a_delimiter_split,
|
this_is_a_very_long_variable_which_will_force_a_delimiter_split,
|
||||||
element,
|
element,
|
||||||
|
@ -975,9 +957,9 @@ NOT_IMPLEMENTED_call()
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
lukasz.NOT_IMPLEMENTED_attr.NOT_IMPLEMENTED_attr
|
lukasz.NOT_IMPLEMENTED_attr.NOT_IMPLEMENTED_attr
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
0x42.NOT_IMPLEMENTED_attr
|
1 .NOT_IMPLEMENTED_attr
|
||||||
0x42.NOT_IMPLEMENTED_attr
|
1.0 .NOT_IMPLEMENTED_attr
|
||||||
0x42.NOT_IMPLEMENTED_attr
|
....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_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
|
@ -1016,23 +998,23 @@ NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
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}
|
||||||
{
|
{
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
0x42,
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false,
|
NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false,
|
||||||
}
|
}
|
||||||
[
|
[
|
||||||
0x42,
|
1,
|
||||||
0x42,
|
2,
|
||||||
0x42,
|
3,
|
||||||
0x42,
|
4,
|
||||||
0x42,
|
5,
|
||||||
0x42,
|
6,
|
||||||
0x42,
|
7,
|
||||||
0x42,
|
8,
|
||||||
0x42,
|
9,
|
||||||
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,
|
||||||
|
@ -1048,7 +1030,7 @@ SomeName
|
||||||
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
a = (1, 2)
|
a = (1, 2)
|
||||||
b = (1, 2)
|
b = (1, 2)
|
||||||
c = 0x42
|
c = 1
|
||||||
d = (1, 2) + a + (1, 2)
|
d = (1, 2) + a + (1, 2)
|
||||||
e = NOT_IMPLEMENTED_call()
|
e = NOT_IMPLEMENTED_call()
|
||||||
f = (1, 2)
|
f = (1, 2)
|
||||||
|
@ -1086,7 +1068,7 @@ NOT_YET_IMPLEMENTED_StmtFor
|
||||||
NOT_YET_IMPLEMENTED_StmtFor
|
NOT_YET_IMPLEMENTED_StmtFor
|
||||||
NOT_YET_IMPLEMENTED_StmtFor
|
NOT_YET_IMPLEMENTED_StmtFor
|
||||||
while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2:
|
while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2:
|
||||||
0x42
|
...
|
||||||
NOT_YET_IMPLEMENTED_StmtFor
|
NOT_YET_IMPLEMENTED_StmtFor
|
||||||
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
|
||||||
|
|
|
@ -57,12 +57,10 @@ def test_calculate_fades():
|
||||||
-import pytest
|
-import pytest
|
||||||
+NOT_YET_IMPLEMENTED_StmtImport
|
+NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
|
||||||
-TmSt = 1
|
TmSt = 1
|
||||||
-TmEx = 2
|
TmEx = 2
|
||||||
+TmSt = 0x42
|
|
||||||
+TmEx = 0x42
|
|
||||||
+
|
|
||||||
|
|
||||||
|
+
|
||||||
# fmt: off
|
# fmt: off
|
||||||
|
|
||||||
# Test data:
|
# Test data:
|
||||||
|
@ -112,8 +110,8 @@ def test_calculate_fades():
|
||||||
```py
|
```py
|
||||||
NOT_YET_IMPLEMENTED_StmtImport
|
NOT_YET_IMPLEMENTED_StmtImport
|
||||||
|
|
||||||
TmSt = 0x42
|
TmSt = 1
|
||||||
TmEx = 0x42
|
TmEx = 2
|
||||||
|
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
|
|
|
@ -36,7 +36,7 @@ x = [
|
||||||
- 1, 2,
|
- 1, 2,
|
||||||
- 3, 4,
|
- 3, 4,
|
||||||
-]
|
-]
|
||||||
+x = [0x42, 0x42, 0x42, 0x42]
|
+x = [1, 2, 3, 4]
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
|
@ -44,25 +44,24 @@ x = [
|
||||||
- 1, 2,
|
- 1, 2,
|
||||||
- 3, 4,
|
- 3, 4,
|
||||||
-]
|
-]
|
||||||
+x = [0x42, 0x42, 0x42, 0x42]
|
+x = [1, 2, 3, 4]
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
-x = [1, 2, 3, 4]
|
x = [1, 2, 3, 4]
|
||||||
+x = [0x42, 0x42, 0x42, 0x42]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
# fmt: off
|
# fmt: off
|
||||||
x = [0x42, 0x42, 0x42, 0x42]
|
x = [1, 2, 3, 4]
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
x = [0x42, 0x42, 0x42, 0x42]
|
x = [1, 2, 3, 4]
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
x = [0x42, 0x42, 0x42, 0x42]
|
x = [1, 2, 3, 4]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -454,7 +454,7 @@ d={'a':1,
|
||||||
-l=[1,2,3]
|
-l=[1,2,3]
|
||||||
-d={'a':1,
|
-d={'a':1,
|
||||||
- 'b':2}
|
- 'b':2}
|
||||||
+l = [0x42, 0x42, 0x42]
|
+l = [1, 2, 3]
|
||||||
+d = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
+d = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ NOT_IMPLEMENTED_call()
|
||||||
# fmt: off
|
# fmt: off
|
||||||
NOT_YET_IMPLEMENTED_ExprYield
|
NOT_YET_IMPLEMENTED_ExprYield
|
||||||
# No formatting to the end of the file
|
# No formatting to the end of the file
|
||||||
l = [0x42, 0x42, 0x42]
|
l = [1, 2, 3]
|
||||||
d = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
d = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -16,29 +16,49 @@ l3 = ["I have", "trailing comma", "so I should be braked",]
|
||||||
```diff
|
```diff
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,11 +1,3 @@
|
@@ -1,11 +1,15 @@
|
||||||
-l1 = [
|
l1 = [
|
||||||
- "This list should be broken up",
|
- "This list should be broken up",
|
||||||
- "into multiple lines",
|
- "into multiple lines",
|
||||||
- "because it is way too long",
|
- "because it is way too long",
|
||||||
-]
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
]
|
||||||
-l2 = ["But this list shouldn't", "even though it also has", "way too many characters in it"] # fmt: skip
|
-l2 = ["But this list shouldn't", "even though it also has", "way too many characters in it"] # fmt: skip
|
||||||
-l3 = [
|
+l2 = [
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
+] # fmt: skip
|
||||||
|
l3 = [
|
||||||
- "I have",
|
- "I have",
|
||||||
- "trailing comma",
|
- "trailing comma",
|
||||||
- "so I should be braked",
|
- "so I should be braked",
|
||||||
-]
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+l1 = [0x42, 0x42, 0x42]
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+l2 = [0x42, 0x42, 0x42] # fmt: skip
|
+ "NOT_YET_IMPLEMENTED_STRING",
|
||||||
+l3 = [0x42, 0x42, 0x42]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
l1 = [0x42, 0x42, 0x42]
|
l1 = [
|
||||||
l2 = [0x42, 0x42, 0x42] # fmt: skip
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
l3 = [0x42, 0x42, 0x42]
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
]
|
||||||
|
l2 = [
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
] # fmt: skip
|
||||||
|
l3 = [
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
"NOT_YET_IMPLEMENTED_STRING",
|
||||||
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -21,33 +21,31 @@ f = ["This is a very long line that should be formatted into a clearer line ", "
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,10 +1,7 @@
|
@@ -1,10 +1,7 @@
|
||||||
-a = 3
|
a = 3
|
||||||
+a = 0x42
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
-b, c = 1, 2
|
-b, c = 1, 2
|
||||||
-d = 6 # fmt: skip
|
-d = 6 # fmt: skip
|
||||||
-e = 5
|
|
||||||
+(1, 2) = (1, 2)
|
+(1, 2) = (1, 2)
|
||||||
+d = 0x42 # fmt: skip
|
+d = 6 # fmt: skip
|
||||||
+e = 0x42
|
e = 5
|
||||||
# fmt: on
|
# fmt: on
|
||||||
-f = [
|
-f = [
|
||||||
- "This is a very long line that should be formatted into a clearer line ",
|
- "This is a very long line that should be formatted into a clearer line ",
|
||||||
- "by rearranging.",
|
- "by rearranging.",
|
||||||
-]
|
-]
|
||||||
+f = [0x42, 0x42]
|
+f = ["NOT_YET_IMPLEMENTED_STRING", "NOT_YET_IMPLEMENTED_STRING"]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
a = 0x42
|
a = 3
|
||||||
# fmt: off
|
# fmt: off
|
||||||
(1, 2) = (1, 2)
|
(1, 2) = (1, 2)
|
||||||
d = 0x42 # fmt: skip
|
d = 6 # fmt: skip
|
||||||
e = 0x42
|
e = 5
|
||||||
# fmt: on
|
# fmt: on
|
||||||
f = [0x42, 0x42]
|
f = ["NOT_YET_IMPLEMENTED_STRING", "NOT_YET_IMPLEMENTED_STRING"]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -17,23 +17,22 @@ l = [1, 2, 3,]
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,7 +1,3 @@
|
@@ -1,7 +1,3 @@
|
||||||
-a = 2
|
a = 2
|
||||||
+a = 0x42
|
|
||||||
# fmt: skip
|
# fmt: skip
|
||||||
-l = [
|
-l = [
|
||||||
- 1,
|
- 1,
|
||||||
- 2,
|
- 2,
|
||||||
- 3,
|
- 3,
|
||||||
-]
|
-]
|
||||||
+l = [0x42, 0x42, 0x42]
|
+l = [1, 2, 3]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
a = 0x42
|
a = 2
|
||||||
# fmt: skip
|
# fmt: skip
|
||||||
l = [0x42, 0x42, 0x42]
|
l = [1, 2, 3]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -20,21 +20,20 @@ d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasu
|
||||||
@@ -1,4 +1,4 @@
|
@@ -1,4 +1,4 @@
|
||||||
-a = "this is some code"
|
-a = "this is some code"
|
||||||
-b = 5 # fmt:skip
|
-b = 5 # fmt:skip
|
||||||
-c = 9 # fmt: skip
|
+a = "NOT_YET_IMPLEMENTED_STRING"
|
||||||
|
+b = 5 # fmt:skip
|
||||||
|
c = 9 # fmt: skip
|
||||||
-d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasuperlongstring" # fmt:skip
|
-d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasuperlongstring" # fmt:skip
|
||||||
+a = 0x42
|
+d = "NOT_YET_IMPLEMENTED_STRING" # fmt:skip
|
||||||
+b = 0x42 # fmt:skip
|
|
||||||
+c = 0x42 # fmt: skip
|
|
||||||
+d = 0x42 # fmt:skip
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
a = 0x42
|
a = "NOT_YET_IMPLEMENTED_STRING"
|
||||||
b = 0x42 # fmt:skip
|
b = 5 # fmt:skip
|
||||||
c = 0x42 # fmt: skip
|
c = 9 # fmt: skip
|
||||||
d = 0x42 # fmt:skip
|
d = "NOT_YET_IMPLEMENTED_STRING" # fmt:skip
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -19,18 +19,17 @@ d = 5
|
||||||
@@ -1,3 +1,3 @@
|
@@ -1,3 +1,3 @@
|
||||||
-a, b = 1, 2
|
-a, b = 1, 2
|
||||||
-c = 6 # fmt: skip
|
-c = 6 # fmt: skip
|
||||||
-d = 5
|
|
||||||
+(1, 2) = (1, 2)
|
+(1, 2) = (1, 2)
|
||||||
+c = 0x42 # fmt: skip
|
+c = 6 # fmt: skip
|
||||||
+d = 0x42
|
d = 5
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
(1, 2) = (1, 2)
|
(1, 2) = (1, 2)
|
||||||
c = 0x42 # fmt: skip
|
c = 6 # fmt: skip
|
||||||
d = 0x42
|
d = 5
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -64,7 +64,7 @@ __all__ = (
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,64 +1,42 @@
|
@@ -1,64 +1,42 @@
|
||||||
-"""The asyncio package, tracking PEP 3156."""
|
-"""The asyncio package, tracking PEP 3156."""
|
||||||
+0x42
|
+"NOT_YET_IMPLEMENTED_STRING"
|
||||||
|
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ __all__ = (
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
0x42
|
"NOT_YET_IMPLEMENTED_STRING"
|
||||||
|
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ list_of_types = [tuple[int,],]
|
||||||
-list_of_types = [
|
-list_of_types = [
|
||||||
- tuple[int,],
|
- tuple[int,],
|
||||||
-]
|
-]
|
||||||
+small_list = [0x42]
|
+small_list = [1]
|
||||||
+list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
+list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||||
d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
|
|
||||||
# Magic commas still work as expected for non-subscripts.
|
# Magic commas still work as expected for non-subscripts.
|
||||||
small_list = [0x42]
|
small_list = [1]
|
||||||
list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -110,16 +110,16 @@ return np.divide(
|
||||||
-o = settings(max_examples=10**6)
|
-o = settings(max_examples=10**6)
|
||||||
-p = {(k, k**2): v**2 for k, v in pairs}
|
-p = {(k, k**2): v**2 for k, v in pairs}
|
||||||
-q = [10**i for i in range(6)]
|
-q = [10**i for i in range(6)]
|
||||||
+a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
+a = 5**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
+b = 0x42 ** NOT_IMPLEMENTED_call()
|
+b = 5 ** NOT_IMPLEMENTED_call()
|
||||||
+c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
+c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
+d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
+d = 5 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
+e = NOT_IMPLEMENTED_call()
|
+e = NOT_IMPLEMENTED_call()
|
||||||
+f = NOT_IMPLEMENTED_call() ** 0x42
|
+f = NOT_IMPLEMENTED_call() ** 5
|
||||||
+g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
+g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||||
+h = 0x42 ** NOT_IMPLEMENTED_call()
|
+h = 5 ** NOT_IMPLEMENTED_call()
|
||||||
+i = NOT_IMPLEMENTED_call() ** 0x42
|
+i = NOT_IMPLEMENTED_call() ** 5
|
||||||
+j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
+j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 5
|
||||||
+k = [i for i in []]
|
+k = [i for i in []]
|
||||||
+l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
+l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||||
+m = [(1, 2)]
|
+m = [(1, 2)]
|
||||||
|
@ -146,16 +146,16 @@ return np.divide(
|
||||||
-o = settings(max_examples=10**6.0)
|
-o = settings(max_examples=10**6.0)
|
||||||
-p = {(k, k**2): v**2.0 for k, v in pairs}
|
-p = {(k, k**2): v**2.0 for k, v in pairs}
|
||||||
-q = [10.5**i for i in range(6)]
|
-q = [10.5**i for i in range(6)]
|
||||||
+a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
+a = 5.0**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
+b = 0x42 ** NOT_IMPLEMENTED_call()
|
+b = 5.0 ** NOT_IMPLEMENTED_call()
|
||||||
+c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
+c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
+d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
+d = 5.0 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
+e = NOT_IMPLEMENTED_call()
|
+e = NOT_IMPLEMENTED_call()
|
||||||
+f = NOT_IMPLEMENTED_call() ** 0x42
|
+f = NOT_IMPLEMENTED_call() ** 5.0
|
||||||
+g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
+g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||||
+h = 0x42 ** NOT_IMPLEMENTED_call()
|
+h = 5.0 ** NOT_IMPLEMENTED_call()
|
||||||
+i = NOT_IMPLEMENTED_call() ** 0x42
|
+i = NOT_IMPLEMENTED_call() ** 5.0
|
||||||
+j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
+j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 5.0
|
||||||
+k = [i for i in []]
|
+k = [i for i in []]
|
||||||
+l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
+l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||||
+m = [(1, 2)]
|
+m = [(1, 2)]
|
||||||
|
@ -193,16 +193,16 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
|
|
||||||
|
|
||||||
a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
a = 5**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
b = 0x42 ** NOT_IMPLEMENTED_call()
|
b = 5 ** NOT_IMPLEMENTED_call()
|
||||||
c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
d = 5 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
e = NOT_IMPLEMENTED_call()
|
e = NOT_IMPLEMENTED_call()
|
||||||
f = NOT_IMPLEMENTED_call() ** 0x42
|
f = NOT_IMPLEMENTED_call() ** 5
|
||||||
g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||||
h = 0x42 ** NOT_IMPLEMENTED_call()
|
h = 5 ** NOT_IMPLEMENTED_call()
|
||||||
i = NOT_IMPLEMENTED_call() ** 0x42
|
i = NOT_IMPLEMENTED_call() ** 5
|
||||||
j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 5
|
||||||
k = [i for i in []]
|
k = [i for i in []]
|
||||||
l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||||
m = [(1, 2)]
|
m = [(1, 2)]
|
||||||
|
@ -212,16 +212,16 @@ p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_
|
||||||
q = [i for i in []]
|
q = [i for i in []]
|
||||||
r = x**y
|
r = x**y
|
||||||
|
|
||||||
a = 0x42**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
a = 5.0**NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
b = 0x42 ** NOT_IMPLEMENTED_call()
|
b = 5.0 ** NOT_IMPLEMENTED_call()
|
||||||
c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
c = NOT_YET_IMPLEMENTED_ExprUnaryOp
|
||||||
d = 0x42 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
d = 5.0 ** NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
e = NOT_IMPLEMENTED_call()
|
e = NOT_IMPLEMENTED_call()
|
||||||
f = NOT_IMPLEMENTED_call() ** 0x42
|
f = NOT_IMPLEMENTED_call() ** 5.0
|
||||||
g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
g = a.NOT_IMPLEMENTED_attr**c.NOT_IMPLEMENTED_attr
|
||||||
h = 0x42 ** NOT_IMPLEMENTED_call()
|
h = 5.0 ** NOT_IMPLEMENTED_call()
|
||||||
i = NOT_IMPLEMENTED_call() ** 0x42
|
i = NOT_IMPLEMENTED_call() ** 5.0
|
||||||
j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 0x42
|
j = NOT_IMPLEMENTED_call().NOT_IMPLEMENTED_attr ** 5.0
|
||||||
k = [i for i in []]
|
k = [i for i in []]
|
||||||
l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
l = NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right
|
||||||
m = [(1, 2)]
|
m = [(1, 2)]
|
||||||
|
|
|
@ -47,7 +47,7 @@ xxxxxxxxx_yyy_zzzzzzzz[xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxx
|
||||||
-xxxxxxxxx_yyy_zzzzzzzz[
|
-xxxxxxxxx_yyy_zzzzzzzz[
|
||||||
- xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
- xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||||
-] = 1
|
-] = 1
|
||||||
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key] = 0x42
|
+NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key] = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
@ -61,7 +61,7 @@ xxxxxxxxx_yyy_zzzzzzzz[xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxx
|
||||||
|
|
||||||
# Make when when the left side of assignment plus the opening paren "... = (" is
|
# 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.
|
# exactly line length limit + 1, it won't be split like that.
|
||||||
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key] = 0x42
|
NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key] = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Black Output
|
## Black Output
|
||||||
|
|
|
@ -170,13 +170,13 @@ with open("/path/to/file.txt", mode="r") as read_file:
|
||||||
-for i in range(5):
|
-for i in range(5):
|
||||||
- for j in range(7):
|
- for j in range(7):
|
||||||
- print(f"{i}) The lines above me should be removed!")
|
- print(f"{i}) The lines above me should be removed!")
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-if random.randint(0, 3) == 0:
|
||||||
|
- print("The new line above me is about to be removed!")
|
||||||
+NOT_YET_IMPLEMENTED_StmtIf
|
+NOT_YET_IMPLEMENTED_StmtIf
|
||||||
|
|
||||||
|
|
||||||
-if random.randint(0, 3) == 0:
|
|
||||||
- print("The new line above me is about to be removed!")
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-if random.randint(0, 3) == 0:
|
-if random.randint(0, 3) == 0:
|
||||||
- print("The new lines above me is about to be removed!")
|
- print("The new lines above me is about to be removed!")
|
||||||
+NOT_YET_IMPLEMENTED_StmtIf
|
+NOT_YET_IMPLEMENTED_StmtIf
|
||||||
|
@ -188,23 +188,19 @@ with open("/path/to/file.txt", mode="r") as read_file:
|
||||||
+NOT_YET_IMPLEMENTED_StmtIf
|
+NOT_YET_IMPLEMENTED_StmtIf
|
||||||
|
|
||||||
|
|
||||||
-while True:
|
while True:
|
||||||
- print("The newline above me should be deleted!")
|
- print("The newline above me should be deleted!")
|
||||||
+while 0x42:
|
|
||||||
+ NOT_IMPLEMENTED_call()
|
+ NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
||||||
-while True:
|
while True:
|
||||||
- print("The newlines above me should be deleted!")
|
- print("The newlines above me should be deleted!")
|
||||||
+while 0x42:
|
|
||||||
+ NOT_IMPLEMENTED_call()
|
+ NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
||||||
-while True:
|
while True:
|
||||||
- while False:
|
while False:
|
||||||
- print("The newlines above me should be deleted!")
|
- print("The newlines above me should be deleted!")
|
||||||
+while 0x42:
|
|
||||||
+ while 0x42:
|
|
||||||
+ NOT_IMPLEMENTED_call()
|
+ NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,16 +259,16 @@ NOT_YET_IMPLEMENTED_StmtIf
|
||||||
NOT_YET_IMPLEMENTED_StmtIf
|
NOT_YET_IMPLEMENTED_StmtIf
|
||||||
|
|
||||||
|
|
||||||
while 0x42:
|
while True:
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
||||||
while 0x42:
|
while True:
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
||||||
while 0x42:
|
while True:
|
||||||
while 0x42:
|
while False:
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,8 @@ def example8():
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,85 +1,37 @@
|
@@ -1,85 +1,37 @@
|
||||||
-x = 1
|
x = 1
|
||||||
-x = 1.2
|
x = 1.2
|
||||||
+x = 0x42
|
|
||||||
+x = 0x42
|
|
||||||
|
|
||||||
-data = (
|
-data = (
|
||||||
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
@ -173,8 +171,8 @@ def example8():
|
||||||
## Ruff Output
|
## Ruff Output
|
||||||
|
|
||||||
```py
|
```py
|
||||||
x = 0x42
|
x = 1
|
||||||
x = 0x42
|
x = 1.2
|
||||||
|
|
||||||
data = NOT_IMPLEMENTED_call()
|
data = NOT_IMPLEMENTED_call()
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,11 @@ func(
|
||||||
+d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
+d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
|
|
||||||
# Remove commas for non-subscripts.
|
# Remove commas for non-subscripts.
|
||||||
-small_list = [1]
|
small_list = [1]
|
||||||
-list_of_types = [tuple[int,]]
|
-list_of_types = [tuple[int,]]
|
||||||
-small_set = {1}
|
|
||||||
-set_of_types = {tuple[int,]}
|
|
||||||
+small_list = [0x42]
|
|
||||||
+list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
+list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||||
+small_set = {0x42}
|
small_set = {1}
|
||||||
|
-set_of_types = {tuple[int,]}
|
||||||
+set_of_types = {NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]}
|
+set_of_types = {NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]}
|
||||||
|
|
||||||
# Except single element tuples
|
# Except single element tuples
|
||||||
|
@ -113,9 +111,9 @@ NOT_YET_IMPLEMENTED_StmtAnnAssign
|
||||||
d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
d = NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]
|
||||||
|
|
||||||
# Remove commas for non-subscripts.
|
# Remove commas for non-subscripts.
|
||||||
small_list = [0x42]
|
small_list = [1]
|
||||||
list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
list_of_types = [NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]]
|
||||||
small_set = {0x42}
|
small_set = {1}
|
||||||
set_of_types = {NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]}
|
set_of_types = {NOT_IMPLEMENTED_value[NOT_IMPLEMENTED_key]}
|
||||||
|
|
||||||
# Except single element tuples
|
# Except single element tuples
|
||||||
|
|
|
@ -41,7 +41,7 @@ def docstring_multiline():
|
||||||
-(b"", b"")
|
-(b"", b"")
|
||||||
-("", "")
|
-("", "")
|
||||||
-(r"", R"")
|
-(r"", R"")
|
||||||
+name = 0x42
|
+name = "NOT_YET_IMPLEMENTED_STRING"
|
||||||
+(1, 2)
|
+(1, 2)
|
||||||
+(1, 2)
|
+(1, 2)
|
||||||
+(1, 2)
|
+(1, 2)
|
||||||
|
@ -70,7 +70,7 @@ def docstring_multiline():
|
||||||
```py
|
```py
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
name = 0x42
|
name = "NOT_YET_IMPLEMENTED_STRING"
|
||||||
(1, 2)
|
(1, 2)
|
||||||
(1, 2)
|
(1, 2)
|
||||||
(1, 2)
|
(1, 2)
|
||||||
|
|
|
@ -42,14 +42,15 @@ assert (
|
||||||
```diff
|
```diff
|
||||||
--- Black
|
--- Black
|
||||||
+++ Ruff
|
+++ Ruff
|
||||||
@@ -1,58 +1,17 @@
|
@@ -1,58 +1,21 @@
|
||||||
importA
|
importA
|
||||||
-(
|
(
|
||||||
- ()
|
- ()
|
||||||
- << 0
|
+ (1, 2)
|
||||||
|
<< 0
|
||||||
- ** 101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
- ** 101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||||
-) #
|
+ **101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||||
+(1, 2) << 0x42**0x42 #
|
) #
|
||||||
|
|
||||||
-assert sort_by_dependency(
|
-assert sort_by_dependency(
|
||||||
- {
|
- {
|
||||||
|
@ -65,10 +66,8 @@ assert (
|
||||||
+NOT_YET_IMPLEMENTED_StmtAssert
|
+NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
|
||||||
importA
|
importA
|
||||||
-0
|
0
|
||||||
-0 ^ 0 #
|
0 ^ 0 #
|
||||||
+0x42
|
|
||||||
+0x42 ^ 0x42 #
|
|
||||||
|
|
||||||
|
|
||||||
-class A:
|
-class A:
|
||||||
|
@ -114,13 +113,17 @@ assert (
|
||||||
|
|
||||||
```py
|
```py
|
||||||
importA
|
importA
|
||||||
(1, 2) << 0x42**0x42 #
|
(
|
||||||
|
(1, 2)
|
||||||
|
<< 0
|
||||||
|
**101234234242352525425252352352525234890264906820496920680926538059059209922523523525
|
||||||
|
) #
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtAssert
|
NOT_YET_IMPLEMENTED_StmtAssert
|
||||||
|
|
||||||
importA
|
importA
|
||||||
0x42
|
0
|
||||||
0x42 ^ 0x42 #
|
0 ^ 0 #
|
||||||
|
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff_python_formatter/src/lib.rs
|
|
||||||
expression: snapshot
|
|
||||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/tricky_unicode_symbols.py
|
|
||||||
---
|
|
||||||
## Input
|
|
||||||
|
|
||||||
```py
|
|
||||||
ä = 1
|
|
||||||
µ = 2
|
|
||||||
蟒 = 3
|
|
||||||
x󠄀 = 4
|
|
||||||
មុ = 1
|
|
||||||
Q̇_per_meter = 4
|
|
||||||
|
|
||||||
A᧚ = 3
|
|
||||||
A፩ = 8
|
|
||||||
```
|
|
||||||
|
|
||||||
## Black Differences
|
|
||||||
|
|
||||||
```diff
|
|
||||||
--- Black
|
|
||||||
+++ Ruff
|
|
||||||
@@ -1,9 +1,9 @@
|
|
||||||
-ä = 1
|
|
||||||
-µ = 2
|
|
||||||
-蟒 = 3
|
|
||||||
-x󠄀 = 4
|
|
||||||
-មុ = 1
|
|
||||||
-Q̇_per_meter = 4
|
|
||||||
+ä = 0x42
|
|
||||||
+µ = 0x42
|
|
||||||
+蟒 = 0x42
|
|
||||||
+x󠄀 = 0x42
|
|
||||||
+មុ = 0x42
|
|
||||||
+Q̇_per_meter = 0x42
|
|
||||||
|
|
||||||
-A᧚ = 3
|
|
||||||
-A፩ = 8
|
|
||||||
+A᧚ = 0x42
|
|
||||||
+A፩ = 0x42
|
|
||||||
```
|
|
||||||
|
|
||||||
## Ruff Output
|
|
||||||
|
|
||||||
```py
|
|
||||||
ä = 0x42
|
|
||||||
µ = 0x42
|
|
||||||
蟒 = 0x42
|
|
||||||
x󠄀 = 0x42
|
|
||||||
មុ = 0x42
|
|
||||||
Q̇_per_meter = 0x42
|
|
||||||
|
|
||||||
A᧚ = 0x42
|
|
||||||
A፩ = 0x42
|
|
||||||
```
|
|
||||||
|
|
||||||
## Black Output
|
|
||||||
|
|
||||||
```py
|
|
||||||
ä = 1
|
|
||||||
µ = 2
|
|
||||||
蟒 = 3
|
|
||||||
x󠄀 = 4
|
|
||||||
មុ = 1
|
|
||||||
Q̇_per_meter = 4
|
|
||||||
|
|
||||||
A᧚ = 3
|
|
||||||
A፩ = 8
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,15 @@ a = asdf = fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakj
|
||||||
```py
|
```py
|
||||||
# break left hand side
|
# break left hand side
|
||||||
a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = cakjdshflkjahdslkfjlasfdahjlfds = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = (
|
a1akjdshflkjahdslkfjlasfdahjlfds = bakjdshflkjahdslkfjlasfdahjlfds = cakjdshflkjahdslkfjlasfdahjlfds = kjaödkjaföjfahlfdalfhaöfaöfhaöfha = fkjaödkjaföjfahlfdalfhaöfaöfhaöfha = g = (
|
||||||
0x42
|
3
|
||||||
)
|
)
|
||||||
|
|
||||||
# join left hand side
|
# join left hand side
|
||||||
a2 = (b2) = 0x42
|
a2 = (b2) = 2
|
||||||
|
|
||||||
# Break the last element
|
# Break the last element
|
||||||
a = asdf = fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal = (
|
a = asdf = fjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfalflaflapamsakjsdhflakjdslfjhalsdljfal = (
|
||||||
0x42
|
1
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ while (
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
```py
|
```py
|
||||||
while 0x42: # trailing test comment
|
while 34: # trailing test comment
|
||||||
NOT_YET_IMPLEMENTED_StmtPass # trailing last statement comment
|
NOT_YET_IMPLEMENTED_StmtPass # trailing last statement comment
|
||||||
|
|
||||||
# trailing while body comment
|
# trailing while body comment
|
||||||
|
@ -59,7 +59,7 @@ while (
|
||||||
NOT_YET_IMPLEMENTED_StmtPass
|
NOT_YET_IMPLEMENTED_StmtPass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
0x42
|
...
|
||||||
|
|
||||||
while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2: # comment
|
while NOT_IMPLEMENTED_bool_op1 and NOT_IMPLEMENTED_bool_op2: # comment
|
||||||
NOT_IMPLEMENTED_call()
|
NOT_IMPLEMENTED_call()
|
||||||
|
|
|
@ -44,11 +44,11 @@ e = 50 # one empty line before
|
||||||
```py
|
```py
|
||||||
# Removes the line above
|
# Removes the line above
|
||||||
|
|
||||||
a = 0x42 # Keeps the line above
|
a = 10 # Keeps the line above
|
||||||
|
|
||||||
# Separated by one line from `a` and `b`
|
# Separated by one line from `a` and `b`
|
||||||
|
|
||||||
b = 0x42
|
b = 20
|
||||||
|
|
||||||
|
|
||||||
# Adds two lines after `b`
|
# Adds two lines after `b`
|
||||||
|
@ -57,22 +57,22 @@ NOT_YET_IMPLEMENTED_StmtClassDef
|
||||||
|
|
||||||
# two lines before, one line after
|
# two lines before, one line after
|
||||||
|
|
||||||
c = 0x42
|
c = 30
|
||||||
|
|
||||||
while NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right:
|
while NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right:
|
||||||
0x42
|
...
|
||||||
|
|
||||||
# trailing comment with one line before
|
# trailing comment with one line before
|
||||||
|
|
||||||
# one line before this leading comment
|
# one line before this leading comment
|
||||||
|
|
||||||
d = 0x42
|
d = 40
|
||||||
|
|
||||||
while NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right:
|
while NOT_IMPLEMENTED_left < NOT_IMPLEMENTED_right:
|
||||||
0x42
|
...
|
||||||
# no empty line before
|
# no empty line before
|
||||||
|
|
||||||
e = 0x42 # one empty line before
|
e = 50 # one empty line before
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -234,22 +234,22 @@ def trailing_func():
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
formatted,
|
formatted,
|
||||||
r#"a = 0x42
|
r#"a = 10
|
||||||
|
|
||||||
|
|
||||||
three_leading_newlines = 0x42
|
three_leading_newlines = 80
|
||||||
|
|
||||||
|
|
||||||
two_leading_newlines = 0x42
|
two_leading_newlines = 20
|
||||||
|
|
||||||
one_leading_newline = 0x42
|
one_leading_newline = 10
|
||||||
no_leading_newline = 0x42
|
no_leading_newline = 30
|
||||||
|
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||||
|
|
||||||
|
|
||||||
trailing_statement = 0x42
|
trailing_statement = 1
|
||||||
|
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
|
@ -265,18 +265,18 @@ NOT_YET_IMPLEMENTED_StmtFunctionDef"#
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
formatted,
|
formatted,
|
||||||
r#"a = 0x42
|
r#"a = 10
|
||||||
|
|
||||||
three_leading_newlines = 0x42
|
three_leading_newlines = 80
|
||||||
|
|
||||||
two_leading_newlines = 0x42
|
two_leading_newlines = 20
|
||||||
|
|
||||||
one_leading_newline = 0x42
|
one_leading_newline = 10
|
||||||
no_leading_newline = 0x42
|
no_leading_newline = 30
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtClassDef
|
NOT_YET_IMPLEMENTED_StmtClassDef
|
||||||
|
|
||||||
trailing_statement = 0x42
|
trailing_statement = 1
|
||||||
|
|
||||||
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
NOT_YET_IMPLEMENTED_StmtFunctionDef
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue