mlx icon indicating copy to clipboard operation
mlx copied to clipboard

Remove unused import

Open chunyang-wen opened this issue 8 months ago • 6 comments

Proposed changes

Remove unused import.

Checklist

Put an x in the boxes that apply.

  • [x] I have read the CONTRIBUTING document
  • [x] I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] I have updated the necessary documentation (if needed)

chunyang-wen avatar Mar 21 '25 13:03 chunyang-wen

I'm not following exactly what the purpose of this diff is. If you import the subpackage members without putting them in __all__ then you get a warning?

awni avatar Mar 21 '25 15:03 awni

__all__ controls what will be imported when you use from a import *.

chunyang-wen avatar Mar 22 '25 07:03 chunyang-wen

all controls what will be imported when you use from a import *.

Indeed I get what __all__ does. What I don't get is why you added a bunch of stuff to it. Can you explain that part?

As far as I can tell this doesn't change the behavior of e.g. from mlx.nn import * since by default all of the names that don't start with _ are included.

awni avatar Mar 22 '25 13:03 awni

Oh, sorry for not making myself clear. I'd like to remove the all warning that the variables are imported but not used.

chunyang-wen avatar Mar 23 '25 11:03 chunyang-wen

What about this instead (from Google search):

# pyright: reportUnusedVariable=false

awni avatar Mar 23 '25 13:03 awni

Ok. I will just delete the unused import. Leave other stuff unchanged.

chunyang-wen avatar Mar 24 '25 23:03 chunyang-wen