openairplay / airplay2-receiver

AirPlay 2 Receiver - Python implementation
2.15k stars 134 forks source link

Remove unused imports #65

Closed m3brown closed 2 years ago

m3brown commented 2 years ago

I noticed there were some unused imports in the python code, so I used the tool pycln to find and remove them.

Side note:

I'm a big fan of the pre-commit static code analysis tool for automatically running linters such as pycln, black, isort, etc. using git's built in hooks system. The purpose is to ensure the code is clean and consistently formatted. If you're interested, I'm happy to put together a PR that introduces that tooling to this repo.

Here's an example from a personal project of mine: https://github.com/m3brown/plz/blob/master/.pre-commit-config.yaml

systemcrash commented 2 years ago

I would welcome a PR for some automated checks like these. I run black in my IDE so any new code I commit at least adheres to such rigor. Some 'unused' imports here are the effect of this largely being a developers playground for AP2: some commented or removed sections which sometimes or once upon a time require(d) an import. Still, removing imports is a decent step.

Edit: one particular example is tempfile. For those who want to save coverart, there is commented code. So uncommenting it also requires an import, which is often only discovered missing at runtime.

Some pass statements are stopgaps for when something else in a code-block is temporarily commented out.

m3brown commented 2 years ago

Thanks for the insight, @systemcrash, and good call on the commented code.

I think I found all the cases -- you mentioned most of them -- but it's certainly possible I missed something. As such, no pressure from my end to merge this PR, but is has been updated for your consideration.

systemcrash commented 2 years ago

OK. thanks for the contribution :)