lyz-code / autoimport

Autoimport automatically fixes wrong import statements.
https://lyz-code.github.io/autoimport
GNU General Public License v3.0
97 stars 24 forks source link

Stdout of unmodified script should be returned even if autoimport fails to resolve libraries #220

Closed ghost closed 2 years ago

ghost commented 2 years ago

Description

I think autoimport should output the entire script even if it cannot resolve missing libraries. From what I can see, it doesn't output anything despite #131.

Steps to reproduce

  1. Use the following example:
    
    #! /usr/bin/env python

plt.style.use('ggplot')

2. Run `cat example.py | autoimport -`
3. No response.

## Current behavior
It doesn't return the unmodified script.

## Desired behavior
I believe it should return the unmodified script.
## Environment

╰─ → $ python -c "import autoimport.version; print(autoimport.version.version_info())"
       autoimport version: 1.2.2
           python version: 3.9.12 (main, Jun  1 2022, 11:38:51)  [GCC 7.5.0]
                 platform: Linux-5.18.3-051803-generic-x86_64-with-glibc2.35
lyz-code commented 2 years ago

Hi @rsmith31415, thanks for taking the time to open the issue. I agree with you that this is something that needs to be fixed. I'll work on it as soon as I can, if you want to jump ahead and implement the fix yourself, be my guest :).

I don't expect the implementation to be complicated

ghost commented 2 years ago

221 was a very simple change, but one test is failing. Should I use double quotes instead? Is that what the linter is complaining about?

UPDATE

Yes, that was the issue.

lyz-code commented 2 years ago

Thanks for the fix ^^, it's been released under 1.2.3