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

importmagic converts multiline imports using parenthesis to slashed #15

Closed whirm closed 9 years ago

whirm commented 9 years ago

It should keep whatever style is in use.

Thanks for your amazing work! :)

birkenfeld commented 9 years ago

Agreed.

whirm commented 9 years ago

@birkenfeld are you planning on working on this anytime soon? If not, I will try to do it when I have some spare time.

birkenfeld commented 9 years ago

Sure, go ahead :)

whirm commented 9 years ago

Is it OK if the default is to group by parentheses when there are neither backslash nor parentheses grouped imports? Thats the proposed way in PEP0328

birkenfeld commented 9 years ago

Hm, this is probably something we want to have an option for. Something like

Imports.set_style(multiline='parenthesis') # or 'backslash' or 'many'

More kwargs could be added (ordering by alphabet or by module name length, handling of newlines between imports, ...)