Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using try keyword in first line and later extra imports autopep8 generates wrong code #630

Open
cepelinas9000 opened this issue Apr 12, 2022 · 0 comments

Comments

@cepelinas9000
Copy link


I ran into this issue when using "try" block in first line, later in code some imports and between them method calls

Python Code

lets call it code_sample1.py

try:  # try
    import pyximport
    pyximport.install(reload_support=True)
except:
    pass
import random
random.seed(12)
from matplotlib import pyplot as plt
print("42")

Command Line

$ autopep8  code_sample1.py
try:  # try
import random                                        
from matplotlib import pyplot as plt        
import pyximport                                    
pyximport.install(reload_support=True) 
except:
    pass
random.seed(12)
print("42")

Your Environment

  • Python version: 3.9
  • autopep8 version: 1.6 and master from github
  • Platform: linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant