Menu

#1142 auto import "quick fix" puts imports before the docstring

open
nobody
None
5
2010-06-18
2010-05-05
No

The "Auto Import" quick fix puts its imports before the module docstring, but in order to be valid, the docstring must be the first thing in the module, before everything including imports.

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2010-06-14

    Strange, I've tested it here and it seems to work for me. Can you attache a sample code where this happens?

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2010-06-14
    • status: open --> pending
     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2010-06-18

    It has to do with the number of lines preceding the docstring. The magic number seems to be 3: if you have 3 lines preceding the start of the docstring in an otherwise empty file, the quick fix works as expected. But, if you have *4* lines, it puts the import at the top of the file.

    This tends to affect projects with large copyright-statement mastheads in comments which go before the docstring.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2010-06-18
    • status: pending --> open
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.