[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Add 2 blank lines between import & classes in pyuic5 output
From:       Addison Elliott <addison.elliott () gmail ! com>
Date:       2019-01-07 16:53:03
Message-ID: CAM=S0SBrKi1BjSJzqJsgY5+uFHQ6JgVrYuM2GOWOwyy0y1Y8sg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Noticed that *pyuic5* also includes two newlines at the end of the file
that reports an error in flake8.

On Tue, Jan 1, 2019 at 10:04 PM Addison Elliott <addison.elliott@gmail.com>
wrote:

> 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
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>Noticed that <i>pyuic5</i><b style="font-style:italic">  </b>also \
includes two newlines at the end of the file that reports an error in \
flake8.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 1, 2019 at 10:04 \
PM Addison Elliott &lt;<a \
href="mailto:addison.elliott@gmail.com">addison.elliott@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>Hello everyone,</div><div><br></div><div>I want to start by stating \
this is a minor issue that I don&#39;t <b>believe</b>  has a fix without changes to \
the source code. With that in mind, I think it&#39;s worthwhile and simple to \
fix.</div><div><br></div><div>When generating Python files from .ui files using \
<i>pyuic5, </i>the Python file only includes one space between the imports &amp; \
beginning of classes. For example:</div><div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Fira \
Code&quot;,Consolas,&quot;Courier \
New&quot;,monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span \
style="color:rgb(106,153,85)"># -*- coding: utf-8 -*-</span></div><br><div><span \
style="color:rgb(106,153,85)"># Form implementation generated from reading ui file \
&#39;mainWindow.ui&#39;</span></div><div><span \
style="color:rgb(106,153,85)">#</span></div><div><span \
style="color:rgb(106,153,85)"># Created by: PyQt5 UI code generator \
5.9</span></div><div><span style="color:rgb(106,153,85)">#</span></div><div><span \
style="color:rgb(106,153,85)"># WARNING! All changes made in this file will be \
lost!</span></div><br><div><span style="color:rgb(197,134,192)">from</span> PyQt5 \
<span style="color:rgb(197,134,192)">import</span> QtCore, QtGui, \
QtWidgets</div><br><div><span style="color:rgb(86,156,214)">class</span> <span \
style="color:rgb(78,201,176)">Ui_MainWindow</span>(<span \
style="color:rgb(78,201,176)">object</span>):</div><div>    <span \
style="color:rgb(86,156,214)">def</span> <span \
style="color:rgb(220,220,170)">setupUi</span>(<span \
style="color:rgb(156,220,254)">self</span>, <span \
style="color:rgb(156,220,254)">MainWindow</span>):</div><div>        \
MainWindow.setObjectName(<span \
style="color:rgb(206,145,120)">&quot;MainWindow&quot;</span>)</div><div>        \
MainWindow.resize(<span style="color:rgb(181,206,168)">837</span>, <span \
style="color:rgb(181,206,168)">727</span>)</div><div>        <span \
style="color:rgb(86,156,214)">self</span>.centralwidget = \
QtWidgets.QWidget(MainWindow)</div><div>        <span \
style="color:rgb(86,156,214)">self</span>.centralwidget.setObjectName(<span \
style="color:rgb(206,145,120)">&quot;centralwidget&quot;</span>)</div><div>...</div></div></div><div><br></div><div>I \
use <i>flake8 </i>in my project to automatically lint and detect whitespace issues in \
my project. These auto-generated files are giving the following \
error:</div><blockquote style="margin:0px 0px 0px \
40px;border:none;padding:0px"><div><b><i>E0302 - Expected 2 blank lines, found \
1</i></b></div></blockquote><div dir="ltr"><br></div><div>Here is the PEP8 reference \
that explains that there should be two spaces between the import statements and class \
definition: <a href="https://www.python.org/dev/peps/pep-0008/#blank-lines" \
target="_blank">https://www.python.org/dev/peps/pep-0008/#blank-lines</a></div><div><br></div><div>Thanks,</div><div>Addison</div></div>
 </blockquote></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic