Skip to content

Ruff PR auto-format - #6422

Merged
youknowone merged 2 commits into
RustPython:mainfrom
ShaharNaveh:ensure-ruff-auto-format
Dec 12, 2025
Merged

youknowone merged 2 commits into
RustPython:mainfrom
ShaharNaveh:ensure-ruff-auto-format

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • Chores
    • Reorganized import statements across test files and scripts for improved code consistency and maintainability. All changes are internal refactoring with no impact on user-facing functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The PR systematically reorganizes imports across 50+ files, including reordering import statements, consolidating imports, and adjusting whitespace. Most changes are cosmetic; two files include functional modifications: removal of a deque initialization and loop logic adjustments.

Changes

Cohort / File(s) Summary
Core and test infrastructure
crates/sre_engine/generate_tests.py, crawl_sourcecode.py, extra_tests/custom_text_test_runner.py, extra_tests/jsontests.py, extra_tests/test_snippets.py
Import reordering, consolidation, and removal of duplicate imports; reordering test execution in jsontests (test_importlib moved to front)
Snippet tests — import reorganization
extra_tests/snippets/builtin_all.py, extra_tests/snippets/builtin_any.py, extra_tests/snippets/builtin_bytearray.py, extra_tests/snippets/builtin_exceptions.py, extra_tests/snippets/builtin_pow.py, extra_tests/snippets/builtin_print.py, extra_tests/snippets/builtin_str.py, extra_tests/snippets/dir_module/__init__.py, extra_tests/snippets/forbidden_instantiation.py, extra_tests/snippets/import.py, extra_tests/snippets/protocol_index_bad.py
Reordered imports, added/removed blank lines; expanded imports from types module; granular import refactoring in import.py
Snippet tests — stdlib modules
extra_tests/snippets/stdlib_array.py, extra_tests/snippets/stdlib_binascii.py, extra_tests/snippets/stdlib_collections_deque.py, extra_tests/snippets/stdlib_csv.py, extra_tests/snippets/stdlib_ctypes.py, extra_tests/snippets/stdlib_datetime.py, extra_tests/snippets/stdlib_dir_module.py, extra_tests/snippets/stdlib_functools.py, extra_tests/snippets/stdlib_io.py, extra_tests/snippets/stdlib_itertools.py, extra_tests/snippets/stdlib_json.py, extra_tests/snippets/stdlib_marshal.py, extra_tests/snippets/stdlib_math.py, extra_tests/snippets/stdlib_os.py, extra_tests/snippets/stdlib_select.py, extra_tests/snippets/stdlib_signal.py, extra_tests/snippets/stdlib_socket.py, extra_tests/snippets/stdlib_string.py, extra_tests/snippets/stdlib_struct.py, extra_tests/snippets/stdlib_subprocess.py, extra_tests/snippets/stdlib_sys.py, extra_tests/snippets/stdlib_weakref.py, extra_tests/snippets/stdlib_zlib.py
Reordered imports, added/removed blank lines between import groups; stdlib_ctypes consolidates import blocks; stdlib_datetime expanded and reorganized test utility imports
Snippet test with functional changes
extra_tests/snippets/stdlib_collections.py
Removed deque initialization line (d = deque([0, 1, 2]))
Snippet test with extended logic
extra_tests/snippets/stdlib_pwd.py
Added duplicate assert_raises import; added loop iteration logic (appending "1" to fake_name)
Scripts and utilities
scripts/generate_checklist.py, scripts/make_ssl_data_rs.py
Import reordering; removed blank line before parser initialization
WASM module
wasm/demo/snippets/asyncbrowser.py, wasm/demo/snippets/import_pypi.py, wasm/example/src/main.py, wasm/tests/conftest.py
Reordered imports; Selenium import block reorganization in conftest.py
Root-level utility
whats_left.py
Reorganized and regrouped imports; moved imports between scopes

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~50 minutes

The vast majority of changes are homogeneous (import reordering and formatting), which reduces per-file cognitive load. However, the sheer volume (50+ files) requires systematic verification. Pay special attention to:

  • extra_tests/snippets/stdlib_collections.py: Removal of d = deque([0, 1, 2]) initialization—verify this is intentional and won't cause NameError at runtime
  • extra_tests/snippets/stdlib_pwd.py: Verify the added loop logic (fake_name concatenation) and duplicate import are intentional
  • extra_tests/snippets/forbidden_instantiation.py: Expanded types imports and import reordering—confirm all newly imported types are used
  • extra_tests/snippets/import.py: Granular import refactoring changes namespace sourcing; verify no unintended behavioral differences

Poem

🐰 Imports sorted, line by line,
Rabbit tidy-ups the shrine,
From array to zlib's tail,
Organized without fail!
Code shines clean, imports gleam. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Ruff PR auto-format' accurately describes the main purpose of this pull request, which consists entirely of import reordering and formatting changes across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ShaharNaveh ShaharNaveh changed the title Make intentional formatting violation Test ruff PR auto-format Dec 12, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Code has been automatically formatted

The code in this PR has been formatted using cargo fmt --all.
Please pull the latest changes before pushing again:

git pull origin ensure-ruff-auto-format

@ShaharNaveh ShaharNaveh changed the title Test ruff PR auto-format Ruff PR auto-format Dec 12, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
extra_tests/snippets/stdlib_io.py (1)

2-3: Consider removing unused imports.

The import reordering looks good, but BytesIO and StringIO appear to be unused in this file. Consider removing them to keep imports clean.

Apply this diff to remove unused imports:

-from io import BufferedReader, BytesIO, FileIO, StringIO
+from io import BufferedReader, FileIO

Based on learnings, ruff is used for linting Python code.

extra_tests/snippets/stdlib_ctypes.py (1)

1-32: Remove unused import _FUNCFLAG_PYTHONAPI.

Static analysis confirms that _FUNCFLAG_PYTHONAPI at line 25 is imported but never used in the file. Remove the import statement to clean up the code.

extra_tests/snippets/forbidden_instantiation.py (1)

1-16: Remove unused import Type from typing.

Verified: Type from typing (line 15) is imported but never used in the file. The code uses lowercase typ as a parameter name, not the Type annotation. Ruff F401 check confirms this as a fixable issue.

However, note that per coding guidelines, Python code should not be edited; bug fixes should be made through Rust code modifications only. If this test file needs cleanup, clarify whether test files are exempt from this restriction.

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f80505 and 59d2dac.

📒 Files selected for processing (48)
  • crates/sre_engine/generate_tests.py (1 hunks)
  • crawl_sourcecode.py (1 hunks)
  • extra_tests/custom_text_test_runner.py (1 hunks)
  • extra_tests/jsontests.py (1 hunks)
  • extra_tests/snippets/builtin_all.py (1 hunks)
  • extra_tests/snippets/builtin_any.py (1 hunks)
  • extra_tests/snippets/builtin_bytearray.py (1 hunks)
  • extra_tests/snippets/builtin_exceptions.py (1 hunks)
  • extra_tests/snippets/builtin_pow.py (1 hunks)
  • extra_tests/snippets/builtin_print.py (1 hunks)
  • extra_tests/snippets/builtin_str.py (1 hunks)
  • extra_tests/snippets/dir_module/__init__.py (1 hunks)
  • extra_tests/snippets/forbidden_instantiation.py (1 hunks)
  • extra_tests/snippets/import.py (1 hunks)
  • extra_tests/snippets/protocol_index_bad.py (1 hunks)
  • extra_tests/snippets/stdlib_array.py (1 hunks)
  • extra_tests/snippets/stdlib_binascii.py (1 hunks)
  • extra_tests/snippets/stdlib_collections.py (0 hunks)
  • extra_tests/snippets/stdlib_collections_deque.py (1 hunks)
  • extra_tests/snippets/stdlib_csv.py (1 hunks)
  • extra_tests/snippets/stdlib_ctypes.py (3 hunks)
  • extra_tests/snippets/stdlib_datetime.py (1 hunks)
  • extra_tests/snippets/stdlib_dir_module.py (1 hunks)
  • extra_tests/snippets/stdlib_functools.py (1 hunks)
  • extra_tests/snippets/stdlib_io.py (1 hunks)
  • extra_tests/snippets/stdlib_itertools.py (1 hunks)
  • extra_tests/snippets/stdlib_json.py (1 hunks)
  • extra_tests/snippets/stdlib_marshal.py (1 hunks)
  • extra_tests/snippets/stdlib_math.py (1 hunks)
  • extra_tests/snippets/stdlib_os.py (1 hunks)
  • extra_tests/snippets/stdlib_pwd.py (1 hunks)
  • extra_tests/snippets/stdlib_select.py (1 hunks)
  • extra_tests/snippets/stdlib_signal.py (1 hunks)
  • extra_tests/snippets/stdlib_socket.py (1 hunks)
  • extra_tests/snippets/stdlib_string.py (0 hunks)
  • extra_tests/snippets/stdlib_struct.py (1 hunks)
  • extra_tests/snippets/stdlib_subprocess.py (1 hunks)
  • extra_tests/snippets/stdlib_sys.py (1 hunks)
  • extra_tests/snippets/stdlib_weakref.py (1 hunks)
  • extra_tests/snippets/stdlib_zlib.py (1 hunks)
  • extra_tests/test_snippets.py (1 hunks)
  • scripts/generate_checklist.py (1 hunks)
  • scripts/make_ssl_data_rs.py (0 hunks)
  • wasm/demo/snippets/asyncbrowser.py (1 hunks)
  • wasm/demo/snippets/import_pypi.py (1 hunks)
  • wasm/example/src/main.py (1 hunks)
  • wasm/tests/conftest.py (2 hunks)
  • whats_left.py (2 hunks)
💤 Files with no reviewable changes (3)
  • scripts/make_ssl_data_rs.py
  • extra_tests/snippets/stdlib_collections.py
  • extra_tests/snippets/stdlib_string.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.py: In most cases, Python code should not be edited; bug fixes should be made through Rust code modifications only
Follow PEP 8 style for custom Python code
Use ruff for linting Python code

Files:

  • extra_tests/snippets/stdlib_sys.py
  • extra_tests/snippets/stdlib_weakref.py
  • extra_tests/snippets/stdlib_socket.py
  • extra_tests/snippets/stdlib_os.py
  • crawl_sourcecode.py
  • extra_tests/snippets/stdlib_json.py
  • extra_tests/snippets/builtin_str.py
  • extra_tests/snippets/builtin_exceptions.py
  • extra_tests/snippets/stdlib_zlib.py
  • extra_tests/snippets/stdlib_functools.py
  • extra_tests/snippets/stdlib_math.py
  • extra_tests/snippets/stdlib_itertools.py
  • extra_tests/snippets/stdlib_subprocess.py
  • extra_tests/snippets/dir_module/__init__.py
  • extra_tests/snippets/stdlib_datetime.py
  • extra_tests/snippets/stdlib_ctypes.py
  • extra_tests/custom_text_test_runner.py
  • extra_tests/snippets/builtin_print.py
  • extra_tests/test_snippets.py
  • extra_tests/snippets/protocol_index_bad.py
  • extra_tests/snippets/stdlib_struct.py
  • whats_left.py
  • wasm/example/src/main.py
  • extra_tests/snippets/stdlib_io.py
  • extra_tests/snippets/import.py
  • extra_tests/snippets/builtin_pow.py
  • scripts/generate_checklist.py
  • extra_tests/snippets/stdlib_csv.py
  • extra_tests/snippets/stdlib_marshal.py
  • extra_tests/jsontests.py
  • crates/sre_engine/generate_tests.py
  • extra_tests/snippets/stdlib_array.py
  • extra_tests/snippets/stdlib_binascii.py
  • wasm/demo/snippets/import_pypi.py
  • extra_tests/snippets/builtin_bytearray.py
  • extra_tests/snippets/builtin_all.py
  • wasm/demo/snippets/asyncbrowser.py
  • extra_tests/snippets/stdlib_dir_module.py
  • extra_tests/snippets/stdlib_signal.py
  • extra_tests/snippets/stdlib_select.py
  • extra_tests/snippets/stdlib_pwd.py
  • extra_tests/snippets/forbidden_instantiation.py
  • extra_tests/snippets/stdlib_collections_deque.py
  • extra_tests/snippets/builtin_any.py
  • wasm/tests/conftest.py
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T12:17:28.606Z
Learning: Applies to **/*.py : Use ruff for linting Python code
📚 Learning: 2025-11-29T12:17:28.606Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T12:17:28.606Z
Learning: Applies to Lib/test/**/*.py : NEVER modify test assertions, test logic, or test data in test files

Applied to files:

  • extra_tests/snippets/protocol_index_bad.py
  • extra_tests/snippets/stdlib_struct.py
  • extra_tests/snippets/stdlib_csv.py
  • extra_tests/snippets/stdlib_array.py
  • extra_tests/snippets/builtin_all.py
  • extra_tests/snippets/builtin_any.py
📚 Learning: 2025-11-29T12:17:28.606Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T12:17:28.606Z
Learning: Use `cargo run -- script.py` instead of the standard `python` command to run and test Python code with RustPython

Applied to files:

  • whats_left.py
🧬 Code graph analysis (13)
extra_tests/snippets/stdlib_json.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
extra_tests/snippets/builtin_str.py (1)
extra_tests/snippets/testutils.py (3)
  • AssertRaises (15-32)
  • assert_raises (5-12)
  • skip_if_unsupported (81-95)
extra_tests/snippets/stdlib_datetime.py (1)
extra_tests/snippets/testutils.py (6)
  • assert_equal (59-60)
  • assert_false (67-68)
  • assert_in (77-78)
  • assert_isinstance (71-74)
  • assert_raises (5-12)
  • assert_true (63-64)
extra_tests/snippets/builtin_print.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
extra_tests/snippets/stdlib_struct.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
wasm/example/src/main.py (2)
crates/wasm/Lib/browser.py (1)
  • alert (50-53)
crates/wasm/src/browser_module.rs (1)
  • fetch (59-116)
extra_tests/snippets/builtin_pow.py (1)
extra_tests/snippets/testutils.py (2)
  • assert_equal (59-60)
  • assert_raises (5-12)
extra_tests/snippets/stdlib_csv.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
extra_tests/snippets/stdlib_binascii.py (1)
extra_tests/snippets/testutils.py (2)
  • assert_equal (59-60)
  • assert_raises (5-12)
extra_tests/snippets/builtin_bytearray.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
extra_tests/snippets/stdlib_select.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
extra_tests/snippets/stdlib_pwd.py (1)
extra_tests/snippets/testutils.py (1)
  • assert_raises (5-12)
extra_tests/snippets/builtin_any.py (2)
extra_tests/snippets/testutils.py (2)
  • TestFailingBool (35-37)
  • assert_raises (5-12)
extra_tests/snippets/stdlib_functools.py (1)
  • TestFailingIter (49-51)
🪛 Flake8 (7.3.0)
extra_tests/snippets/dir_module/__init__.py

[error] 2-2: '.relative.value' imported but unused

(F401)

extra_tests/snippets/stdlib_datetime.py

[error] 11-11: 'datetime.MAXYEAR' imported but unused

(F401)


[error] 11-11: 'datetime.MINYEAR' imported but unused

(F401)


[error] 11-11: 'datetime.timezone' imported but unused

(F401)


[error] 12-12: 'operator.eq' imported but unused

(F401)


[error] 12-12: 'operator.floordiv' imported but unused

(F401)


[error] 12-12: 'operator.ge' imported but unused

(F401)


[error] 12-12: 'operator.gt' imported but unused

(F401)


[error] 12-12: 'operator.le' imported but unused

(F401)


[error] 12-12: 'operator.lt' imported but unused

(F401)


[error] 12-12: 'operator.mod' imported but unused

(F401)


[error] 12-12: 'operator.truediv' imported but unused

(F401)

extra_tests/snippets/stdlib_ctypes.py

[error] 24-24: '_ctypes.FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI' imported but unused

(F401)

extra_tests/snippets/stdlib_io.py

[error] 2-2: 'io.BytesIO' imported but unused

(F401)


[error] 2-2: 'io.StringIO' imported but unused

(F401)

extra_tests/snippets/import.py

[error] 4-4: 'from import_star import *' used; unable to detect undefined names

(F403)

extra_tests/snippets/stdlib_dir_module.py

[error] 2-2: 'testutils.assert_equal' imported but unused

(F401)

extra_tests/snippets/forbidden_instantiation.py

[error] 15-15: 'typing.Type' imported but unused

(F401)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: Check the WASM package and demo
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Check Rust code with clippy
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
🔇 Additional comments (35)
extra_tests/snippets/stdlib_sys.py (1)

1-3: Import reorder is safe and ruff-aligned. The new ordering (os, subprocess, sys) is behavior-preserving in this snippet and matches typical ruff/isort sorting.

extra_tests/snippets/stdlib_zlib.py (1)

1-3: Formatting-only change is fine (blank line after import).
This aligns with PEP 8 / ruff formatting conventions and shouldn’t affect runtime behavior.

extra_tests/snippets/protocol_index_bad.py (1)

4-6: Import reordering looks good—ruff-compliant formatting.

The import reorganization follows PEP 8 conventions: standard library imports (array) come first, followed by a blank line, then local imports (testutils). This is consistent with ruff's import-sorting expectations and preserves all test logic and assertions.

extra_tests/snippets/stdlib_functools.py (1)

1-3: Import formatting aligns with PEP 8 and ruff standards.

The addition of a blank line between imports from different modules follows PEP 8 conventions and ruff's auto-formatting rules. This change improves code organization without affecting runtime behavior.

extra_tests/snippets/stdlib_collections_deque.py (1)

4-5: LGTM! Import order now follows PEP 8 guidelines.

The reorganization correctly groups standard library imports (collections, typing) before local imports (testutils), which aligns with PEP 8 and ruff formatting standards. As per coding guidelines, this project uses ruff for linting Python code.

extra_tests/snippets/import.py (1)

2-7: LGTM! Import reorganization aligns with testing objectives.

The import statements have been reformatted and organized. While there are redundant imports (e.g., func and other_func imported multiple times with different aliases), this is intentional for a test file that validates various import mechanisms. The assertions throughout the file (lines 9-20) verify each import style works correctly.

The static analysis warning about the star import (line 4) can be safely ignored—it's deliberately testing star import functionality (validated on line 22 with STAR_IMPORT).

crawl_sourcecode.py (1)

13-14: LGTM! Import reordering aligns with ruff formatting standards.

The imports have been reordered alphabetically, which is consistent with the PR's objective to apply ruff auto-formatting across the codebase.

Based on coding guidelines, this aligns with the project standard to use ruff for linting Python code.

extra_tests/snippets/stdlib_marshal.py (1)

2-2: LGTM! Import ordering follows ruff standards.

The unittest import has been correctly positioned after the marshal import, following alphabetical ordering conventions.

Based on coding guidelines, this change aligns with using ruff for Python code linting.

extra_tests/snippets/builtin_exceptions.py (1)

3-3: LGTM! Import reordering follows ruff conventions.

The platform import has been repositioned to maintain alphabetical ordering of standard library imports.

Based on coding guidelines, this aligns with the project's use of ruff for linting.

extra_tests/snippets/stdlib_socket.py (1)

3-4: LGTM! Import organization follows ruff formatting standards.

The socket import has been correctly positioned after os (alphabetical order), and the blank line properly separates standard library imports from subsequent from-imports, following PEP 8 conventions.

Based on coding guidelines, this aligns with using ruff for Python code linting.

crates/sre_engine/generate_tests.py (1)

1-1: LGTM! Import consolidation and reordering improves code organization.

The json import has been consolidated at the top level (removing duplication), and the Path import has been repositioned, both following alphabetical ordering conventions enforced by ruff.

Based on coding guidelines, this aligns with using ruff for linting Python code.

Also applies to: 5-5

scripts/generate_checklist.py (1)

11-11: LGTM! Import reordering follows ruff standards.

The typing import has been correctly repositioned after warnings to maintain alphabetical ordering of imports.

Based on coding guidelines, this change aligns with using ruff for Python code linting.

extra_tests/snippets/stdlib_itertools.py (1)

2-2: LGTM! Import ordering follows ruff conventions.

The pickle import has been repositioned after itertools to maintain alphabetical ordering of standard library imports.

Based on coding guidelines, this aligns with using ruff for Python code linting.

extra_tests/snippets/stdlib_subprocess.py (1)

1-1: LGTM! Import organization follows ruff formatting standards.

The imports have been reordered alphabetically with signal positioned at the top, followed by subprocess, sys, and time. This ensures the signal module is properly imported before its usage in the Unix-specific assertions (lines 56, 64).

Based on coding guidelines, this aligns with using ruff for linting Python code.

Also applies to: 4-4

extra_tests/snippets/stdlib_struct.py (1)

3-4: Import regrouping is fine (stdlib first, then local testutils).
No behavioral impact; assert_raises remains used.

extra_tests/snippets/stdlib_select.py (1)

3-6: Import order/grouping looks correct; sys usage matches platform checks.

extra_tests/snippets/stdlib_weakref.py (1)

1-2: LGTM: import reorder is behavior-preserving and both symbols are used.

extra_tests/snippets/builtin_str.py (1)

1-1: OK: testutils import reorder is cosmetic and keeps same symbols.

extra_tests/snippets/stdlib_math.py (1)

1-3: Import grouping/spacing looks good; no behavioral change.

extra_tests/snippets/builtin_all.py (1)

1-1: Good consolidation of testutils imports; behavior unchanged.

extra_tests/snippets/stdlib_json.py (1)

2-5: Import reorder/grouping is fine and remains consistent with usage.

extra_tests/jsontests.py (1)

1-3: LGTM!

The import reorganization is appropriate for a ruff auto-format PR. Moving import os to the top and adjusting whitespace aligns with standard Python conventions.

extra_tests/snippets/stdlib_binascii.py (1)

3-3: LGTM!

Alphabetical ordering of imports is consistent with ruff formatting standards.

extra_tests/snippets/builtin_any.py (1)

1-1: LGTM!

Import consolidation is appropriate for ruff auto-formatting. No test logic has been modified.

wasm/demo/snippets/import_pypi.py (1)

16-16: LGTM!

Import reordering has no runtime impact since both imports are completed before usage.

extra_tests/snippets/stdlib_signal.py (1)

3-4: LGTM!

Import reordering and blank line adjustment are appropriate for ruff auto-formatting.

extra_tests/snippets/builtin_bytearray.py (1)

4-5: LGTM!

Properly groups standard library imports before local imports, consistent with PEP 8 and ruff formatting conventions.

extra_tests/custom_text_test_runner.py (1)

28-38: LGTM!

Import reorganization consolidates standard library imports and follows ruff formatting conventions. No functional changes.

wasm/example/src/main.py (1)

1-1: LGTM! Import alphabetization.

The import reordering is consistent with ruff's auto-formatting rules.

whats_left.py (2)

19-25: LGTM! Import organization.

The top-level imports have been alphabetized, which improves consistency.


327-334: LGTM! Function-scoped import organization.

The imports within the compare() function have been alphabetized consistently with the top-level imports.

wasm/tests/conftest.py (2)

1-8: LGTM! Top-level import organization.

The imports have been alphabetized, which is consistent with ruff formatting.


68-73: LGTM! Selenium import organization.

The Selenium-related imports have been reordered while maintaining all necessary symbols (JavascriptException, WebDriverWait, Options).

extra_tests/snippets/stdlib_datetime.py (1)

7-21: LGTM! Import consolidation and alphabetization.

The imports have been reorganized and consolidated. While static analysis flags several imports as unused (MAXYEAR, MINYEAR, timezone, operator functions), these are false positives — all flagged imports are used later in this large test file (e.g., MAXYEAR at line 2801, MINYEAR at line 3204, timezone at line 1826, operator functions at line 2497).

extra_tests/snippets/stdlib_pwd.py (1)

9-14: Unable to verify functional changes; file not found in repository.

The file extra_tests/snippets/stdlib_pwd.py could not be located in the repository to verify whether the assert_raises import and fake_name += "1" loop logic were pre-existing or newly added. Without access to git history for this file, the claim that these modifications go beyond auto-formatting cannot be confirmed or refuted.

Comment on lines 1 to +2
from .dir_module_inner import value2
from .relative import value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix lint blocker (F401): mark re-exported import as intentional (or export via __all__).
Flake8 reports Line 2 as unused; if this is a package re-export, annotate it to avoid CI lint failures.

Based on learnings, use ruff for linting Python code.

 from .dir_module_inner import value2
-from .relative import value
+from .relative import value  # noqa: F401
+
+__all__ = ["value", "value2"]
🧰 Tools
🪛 Flake8 (7.3.0)

[error] 1-1: '.dir_module_inner.value2' imported but unused

(F401)


[error] 2-2: '.relative.value' imported but unused

(F401)

🤖 Prompt for AI Agents
extra_tests/snippets/dir_module/__init__.py lines 1-2: Flake8/ruff flags the
import on line 2 as unused (F401) because it's a package re-export; either mark
the re-export as intentional by appending a noqa for F401 to the import
statement or explicitly export the names via an __all__ list. Fix by choosing
one: 1) add the comment "# noqa: F401" to the import of value to silence the
unused-import lint, or 2) add an __all__ = ["value", "value2"] (and keep the
imports) so the module explicitly exports these symbols for re-export.

from testutils import assert_equal

import dir_module
from testutils import assert_equal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused import.

The assert_equal import is not used anywhere in this file, as correctly identified by Flake8.

Apply this diff to remove the unused import:

-from testutils import assert_equal
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from testutils import assert_equal
🧰 Tools
🪛 Flake8 (7.3.0)

[error] 2-2: 'testutils.assert_equal' imported but unused

(F401)

🤖 Prompt for AI Agents
In extra_tests/snippets/stdlib_dir_module.py around line 2, the file imports
assert_equal from testutils but that symbol is unused; remove the unused import
line so the file no longer imports assert_equal (delete or comment out the "from
testutils import assert_equal" line) to satisfy Flake8.

@youknowone
youknowone merged commit 9ccf4c1 into RustPython:main Dec 12, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants