[PyQt] Add 2 blank lines between import & classes in pyuic5 output
Addison Elliott
addison.elliott at gmail.com
Wed Jan 2 04:04:37 GMT 2019
Hello everyone,
I want to start by stating this is a minor issue that I don't *believe* has
a fix without changes to the source code. With that in mind, I think it's
worthwhile and simple to fix.
When generating Python files from .ui files using *pyuic5, *the Python file
only includes one space between the imports & beginning of classes. For
example:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(837, 727)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
...
I use *flake8 *in my project to automatically lint and detect whitespace
issues in my project. These auto-generated files are giving the following
error:
*E0302 - Expected 2 blank lines, found 1*
Here is the PEP8 reference that explains that there should be two spaces
between the import statements and class definition:
https://www.python.org/dev/peps/pep-0008/#blank-lines
Thanks,
Addison
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190101/665b502e/attachment.html>
More information about the PyQt
mailing list