PythonCharmers/python-future

libfuturize.fixes.fix_absolute_import duplicates initial comments

Open

#281 创建于 2017年4月27日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Python (1,172 star) (327 fork)batch import
0.19bughelp wanted

描述

precondition

  • Create thing/{__init__.py,foo.py,bar.py}
  • Fill foo.py with the following:
    #!/usr/bin/env python
    # -*- encoding: utf-8 -*-
    import bar
    
  • run fix_absolute_import on thing

expected

foo.py should have become:

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from . import bar

observed

foo.py has actually become:

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from . import bar

贡献者指南