Refactoring Python Code

Overview

  • Before refactoring anything, ensure you have a comprehensive suite of tests to verify that functionality remains unchanged.
  • Only automatically refactor code that doesn’t follow the Pythonic conventions, specially those outlined in the Python instructions at .github/instructions/python.instructions.md if that file is available.
  • Use automated tools like ruff to identify and fix style issues before refactoring.

Performance

  • Follow the performance guidelines at .github/instructions/performance-python.instructions.md if that file is available.