Fix all major pylint warnings in ml/main.py
Fix all major pylint warnings in ml/main.py

The `redefined-outer-name` warning is not addressed in this commit.
`redefined-outer-name` will be fixed in a subsequent commit which will
separate the helper functions from the main execution of the script.

googleinterns/amaranth,googleinterns/amaranth