pyupgrade

Upgrade Python syntax to newer versions automatically

brewmacoslinux
Try with needOr install directly
Source

About

Upgrade syntax for newer versions of Python

Commands

pyupgrade

Examples

Upgrade Python file to Python 3.9 syntax$ pyupgrade --py39-plus myfile.py
Upgrade all Python files in current directory to Python 3.10+$ pyupgrade --py310-plus *.py
Upgrade entire project directory recursively to Python 3.11+$ pyupgrade --py311-plus --recursive .