我目前正在为一个很酷的小 Python 项目做贡献,名为PhotoCollage,维护者要求贡献者flake8
在考虑拉取请求之前通过检查(很公平)。
我的问题是我无法通过这些检查:在我的电脑上,没有投诉。但是在 Travis 上,我总是收到以下错误:
$ flake8 .
./photocollage/gtkgui.py:29:1: I202 Additional newline in a section of imports.
./photocollage/gtkgui.py:32:1: I202 Additional newline in a section of imports.
./photocollage/render.py:25:1: I202 Additional newline in a section of imports.
The command "flake8 ." exited with 1.
但是,我的代码如下所示:
gtkgui.py
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Adrien Vergé
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import copy
import gettext
from io import BytesIO
import math
import os.path
import random
import sys
import cairo
import gi
gi.require_version('Gtk', '3.0') # noqa
from gi.repository import Gtk, Gdk, GObject, GdkPixbuf
from six.moves import urllib # Python 2 backward compatibility
from photocollage import APP_NAME, artwork, collage, render
from photocollage.render import PIL_SUPPORTED_EXTS as EXTS
gettext.textdomain(APP_NAME)
_ = gettext.gettext
_n = gettext.ngettext
(...)
我没有改变进口。以前的提交,所以我怀疑flake8-import-order
以某种方式改变。任何想法?