ni / nimi-python

Python bindings for NI Modular Instrument drivers.
Other
112 stars 84 forks source link

Run pyupgrade to update Python syntax used #2043

Closed ni-jfitzger closed 5 months ago

ni-jfitzger commented 5 months ago

What does this Pull Request accomplish?

Note: No hand-coded changes are included.

Using a script, I ran pyupgrade --py38-plus on files in nimi-python. pyupgrade is a tool used to automatically update the syntax used in Python code to syntaxes available in newer versions.

The script ran on the following folders:

The script ignored folder paths containing:

The script ignored files with the extensions:

The script ignored imported metadata files (the ones that say they were generated) as well as "fancy_fetch_capture_waveform.py.mako" (pyupgrade messed up the indentation) and "_get_error_description.py.mako" (pyupgrade messed up the indentation).

List of automatic changes that I noticed:

I discarded changes to test_converters.py. I believe we're not passing the right arguments for some tuple tests, so I want to handle that separately.

List issues fixed by this Pull Request below, if any.

None

What testing has been done?

ni-jfitzger commented 5 months ago

I considered cleaning up some of the remaining .format() calls, but decided to leave this as only automated changes.

ni-jfitzger commented 5 months ago

pyupgrade can be used as a pre-commit hook, but I don't think that would be a good idea, given that it broke the indentation of some of our templates.