alecthomas / importmagic

A Python library for finding unresolved symbols in Python code, and the corresponding imports
BSD 2-Clause "Simplified" License
120 stars 20 forks source link

fixed removal of imports that appears after a comment in the imports #7

Closed DamnWidget closed 9 years ago

DamnWidget commented 9 years ago

When there are imports after a comment in the imports block, they get removed so for example:

import re
# some random comment
import sys

def main():
    print(sys.path)
    print(os.uname())

Get translated to

import os

def main():
    print(sys.path)
    print(os.uname())

This commit fixes this behavior but the comment is still gone

birkenfeld commented 9 years ago

Looks good, thanks!