Skip to content

Comments

Ruff152#239

Merged
inducer merged 2 commits intomainfrom
ruff152
Feb 20, 2026
Merged

Ruff152#239
inducer merged 2 commits intomainfrom
ruff152

Conversation

@inducer
Copy link
Owner

@inducer inducer commented Feb 20, 2026

Closes #238.

Copilot AI review requested due to automatic review settings February 20, 2026 20:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies Ruff linting rule fixes, primarily focused on simplifying code style, improving type annotations, and fixing a critical version check bug. The changes improve code quality and maintainability while preserving functionality.

Changes:

  • Renamed Set imports to AbstractSet throughout the codebase to avoid shadowing the builtin set type
  • Fixed inverted version condition in pymbolic/interop/ast.py for Python 3.14 compatibility
  • Improved type annotations using Never return type for functions that unconditionally raise exceptions
  • Simplified code by removing unnecessary intermediate variables, empty pass statements, and redundant else blocks
  • Standardized imports (e.g., from pytools import obj_array instead of import pytools.obj_array as obj_array)
  • Optimized loops and replaced with comprehensions where appropriate
  • Updated linting configuration to ignore S102 (exec) and TRY004

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/test_pymbolic.py Renamed Set to AbstractSet in imports and type hints
test/test_maxima.py Simplified print("") to print()
pyproject.toml Added S102 and TRY004 to lint ignore list, expanded per-file ignores
pymbolic/rational.py Standardized imports to use from pymbolic import
pymbolic/primitives.py Multiple improvements: import style, re.VERBOSE, removed global declarations, removed pass statements, added noqa comments
pymbolic/mapper/substitutor.py Renamed Set to AbstractSet
pymbolic/mapper/optimize.py Added noqa comment for exec usage
pymbolic/mapper/distributor.py Removed unnecessary intermediate variable
pymbolic/mapper/dependency.py Renamed Set to AbstractSet
pymbolic/mapper/collector.py Renamed Set to AbstractSet, removed intermediate variable
pymbolic/mapper/coefficient.py Improved loop to use items() instead of repeated dict lookups
pymbolic/mapper/init.py Renamed Set to AbstractSet, removed unnecessary else blocks, improved loop efficiency
pymbolic/interop/sympy.py Changed return type to Never for error function
pymbolic/interop/symengine.py Changed return type to Never for error function
pymbolic/interop/common.py Made error function abstract with Never return type, removed unreachable raise statements
pymbolic/interop/ast.py CRITICAL: Fixed inverted version condition for Python 3.14 compatibility
pymbolic/imperative/utils.py Optimized loops to use dict.items(), converted loop to comprehension
pymbolic/imperative/transform.py Converted append loop to extend with comprehension
pymbolic/imperative/statement.py Renamed Set to AbstractSet, removed intermediate variables
pymbolic/geometric_algebra/primitives.py Standardized import of obj_array
pymbolic/geometric_algebra/mapper.py Renamed Set to AbstractSet, standardized obj_array import
pymbolic/geometric_algebra/init.py Improved Protocol type hints using Self, converted loops to comprehensions
pymbolic/cse.py Renamed Set to AbstractSet, removed intermediate variable
pymbolic/algorithm.py Simplified range(0, m) to range(m), added Self import, standardized import
.basedpyright/baseline.json Updated type checker baseline after code changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@inducer inducer merged commit 4b323c4 into main Feb 20, 2026
10 checks passed
@inducer inducer deleted the ruff152 branch February 20, 2026 21:26
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.

1 participant