Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reapply ruff code
  • Loading branch information
ShaharNaveh committed Oct 22, 2025
commit e92c3d4eb04855d0226b3713bd59db9e819bf053
25 changes: 25 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ rustpython-wtf8 = { path = "wtf8", version = "0.4.0" }
rustpython-doc = { git = "https://github.com/RustPython/__doc__", tag = "0.3.0", version = "0.3.0" }

ruff_python_parser = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_python_codegen = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_python_ast = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_text_size = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_source_file = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
Expand Down
14 changes: 5 additions & 9 deletions compiler/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,12 @@ enum ComprehensionType {
}

fn unparse_expr(expr: &Expr) -> String {
// Hack, because we can't do `ruff_python_codegen::Indentation::default()`
// https://github.com/astral-sh/ruff/pull/20216
let indentation = {
let contents = r"x = 1";
let module = ruff_python_parser::parse_module(contents).unwrap();
let stylist = ruff_python_codegen::Stylist::from_tokens(module.tokens(), contents);
stylist.indentation().clone()
};
use ruff_python_ast::str::Quote;
use ruff_python_codegen::{Generator, Indentation};

ruff_python_codegen::Generator::new(&indentation, LineEnding::default()).expr(expr)
Generator::new(&Indentation::default(), LineEnding::default())
.with_preferred_quote(Some(Quote::Single))
.expr(expr)
}

fn validate_duplicate_params(params: &Parameters) -> Result<(), CodegenErrorType> {
Expand Down