Remove alignments in arguments for format statements
This commit is contained in:
+1
-4
@@ -98,7 +98,7 @@ Some `flake8` error codes are ignored for this project for various reasons. The
|
|||||||
camelCase function and variable names. This is the standard for the Qt libraries novelWriter
|
camelCase function and variable names. This is the standard for the Qt libraries novelWriter
|
||||||
integrates with. It also happens to be the author's personal preferences. (Yay!)
|
integrates with. It also happens to be the author's personal preferences. (Yay!)
|
||||||
|
|
||||||
The reason behind the other ignored error codes are listed below. Most of them are due to PEP8 not
|
The reason behind the other ignored error codes are listed below. Two of them are due to PEP8 not
|
||||||
permitting column alignment as opposed to many other coding styles, like for instance for Go. I
|
permitting column alignment as opposed to many other coding styles, like for instance for Go. I
|
||||||
find them useful in regions of bulk value assignments. There's a reason why tables are more
|
find them useful in regions of bulk value assignments. There's a reason why tables are more
|
||||||
readable than lists. They should be used sparingly though.
|
readable than lists. They should be used sparingly though.
|
||||||
@@ -122,6 +122,3 @@ strings. Use formatting instead.
|
|||||||
|
|
||||||
**E241:** multiple spaces after ‘,’
|
**E241:** multiple spaces after ‘,’
|
||||||
**Reason:** Column alignment.
|
**Reason:** Column alignment.
|
||||||
|
|
||||||
**E251:** unexpected spaces around keyword / parameter equals
|
|
||||||
**Reason:** Column alignment.
|
|
||||||
|
|||||||
+3
-3
@@ -149,9 +149,9 @@ def main(sysArgs=None):
|
|||||||
" --config= Alternative config file.\n"
|
" --config= Alternative config file.\n"
|
||||||
" --data= Alternative user data path.\n"
|
" --data= Alternative user data path.\n"
|
||||||
).format(
|
).format(
|
||||||
version = __version__,
|
version=__version__,
|
||||||
copyright = __copyright__,
|
copyright=__copyright__,
|
||||||
date = __date__,
|
date=__date__,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
|
|||||||
+3
-3
@@ -677,9 +677,9 @@ class NWProject():
|
|||||||
with open(tempFile, mode="wb") as outFile:
|
with open(tempFile, mode="wb") as outFile:
|
||||||
outFile.write(etree.tostring(
|
outFile.write(etree.tostring(
|
||||||
nwXML,
|
nwXML,
|
||||||
pretty_print = True,
|
pretty_print=True,
|
||||||
encoding = "utf-8",
|
encoding="utf-8",
|
||||||
xml_declaration = True
|
xml_declaration=True
|
||||||
))
|
))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.makeAlert([
|
self.makeAlert([
|
||||||
|
|||||||
+3
-3
@@ -291,9 +291,9 @@ class ToHtml(Tokenizer):
|
|||||||
"</body>\n"
|
"</body>\n"
|
||||||
"</html>\n"
|
"</html>\n"
|
||||||
).format(
|
).format(
|
||||||
projTitle = self.theProject.projName,
|
projTitle=self.theProject.projName,
|
||||||
htmlStyle = "\n".join(theStyle),
|
htmlStyle="\n".join(theStyle),
|
||||||
bodyText = bodyText,
|
bodyText=bodyText,
|
||||||
)
|
)
|
||||||
outFile.write(theHtml)
|
outFile.write(theHtml)
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -450,9 +450,9 @@ class ToOdt(Tokenizer):
|
|||||||
with open(savePath, mode="wb") as outFile:
|
with open(savePath, mode="wb") as outFile:
|
||||||
outFile.write(etree.tostring(
|
outFile.write(etree.tostring(
|
||||||
self._dFlat,
|
self._dFlat,
|
||||||
pretty_print = True,
|
pretty_print=True,
|
||||||
encoding = "utf-8",
|
encoding="utf-8",
|
||||||
xml_declaration = True
|
xml_declaration=True
|
||||||
))
|
))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -142,31 +142,31 @@ class GuiAbout(QDialog):
|
|||||||
"<h3>{title2}</h3>"
|
"<h3>{title2}</h3>"
|
||||||
"<p>{credits}</p>"
|
"<p>{credits}</p>"
|
||||||
).format(
|
).format(
|
||||||
title1 = self.tr("About novelWriter"),
|
title1=self.tr("About novelWriter"),
|
||||||
copy = nw.__copyright__,
|
copy=nw.__copyright__,
|
||||||
link = self.tr("Website: {0}").format(f"<a href='{nw.__url__}'>{nw.__domain__}</a>"),
|
link=self.tr("Website: {0}").format(f"<a href='{nw.__url__}'>{nw.__domain__}</a>"),
|
||||||
title2 = self.tr("Credits"),
|
title2=self.tr("Credits"),
|
||||||
credits = self._wrapTable([
|
credits=self._wrapTable([
|
||||||
(self.tr("Developer"), "Veronica Berglyd Olsen"),
|
(self.tr("Developer"), "Veronica Berglyd Olsen"),
|
||||||
(self.tr("Concept"), "Veronica Berglyd Olsen, Marian Lückhof"),
|
(self.tr("Concept"), "Veronica Berglyd Olsen, Marian Lückhof"),
|
||||||
(self.tr("i18n"), "Bruno Meneguello"),
|
(self.tr("i18n"), "Bruno Meneguello"),
|
||||||
]),
|
]),
|
||||||
intro = self.tr(
|
intro=self.tr(
|
||||||
"novelWriter is a markdown-like text editor designed for organising and "
|
"novelWriter is a markdown-like text editor designed for organising and "
|
||||||
"writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5."
|
"writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5."
|
||||||
),
|
),
|
||||||
license1 = self.tr(
|
license1=self.tr(
|
||||||
"novelWriter is free software: you can redistribute it and/or modify it "
|
"novelWriter is free software: you can redistribute it and/or modify it "
|
||||||
"under the terms of the GNU General Public License as published by the "
|
"under the terms of the GNU General Public License as published by the "
|
||||||
"Free Software Foundation, either version 3 of the License, or (at your "
|
"Free Software Foundation, either version 3 of the License, or (at your "
|
||||||
"option) any later version."
|
"option) any later version."
|
||||||
),
|
),
|
||||||
license2 = self.tr(
|
license2=self.tr(
|
||||||
"novelWriter is distributed in the hope that it will be useful, but "
|
"novelWriter is distributed in the hope that it will be useful, but "
|
||||||
"WITHOUT ANY WARRANTY; without even the implied warranty of "
|
"WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
),
|
),
|
||||||
license3 = self.tr(
|
license3=self.tr(
|
||||||
"See the Licence tab for the full licence text, or visit the "
|
"See the Licence tab for the full licence text, or visit the "
|
||||||
"GNU website at {0} for more details."
|
"GNU website at {0} for more details."
|
||||||
).format(
|
).format(
|
||||||
@@ -271,9 +271,9 @@ class GuiAbout(QDialog):
|
|||||||
" padding-right: 0.8em;"
|
" padding-right: 0.8em;"
|
||||||
"}}\n"
|
"}}\n"
|
||||||
).format(
|
).format(
|
||||||
hColR = self.theParent.theTheme.colHead[0],
|
hColR=self.theParent.theTheme.colHead[0],
|
||||||
hColG = self.theParent.theTheme.colHead[1],
|
hColG=self.theParent.theTheme.colHead[1],
|
||||||
hColB = self.theParent.theTheme.colHead[2],
|
hColB=self.theParent.theTheme.colHead[2],
|
||||||
)
|
)
|
||||||
self.pageAbout.document().setDefaultStyleSheet(styleSheet)
|
self.pageAbout.document().setDefaultStyleSheet(styleSheet)
|
||||||
self.pageNotes.document().setDefaultStyleSheet(styleSheet)
|
self.pageNotes.document().setDefaultStyleSheet(styleSheet)
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class GuiPreferencesGeneral(QWidget):
|
|||||||
self.tr("Font family"),
|
self.tr("Font family"),
|
||||||
self.guiFont,
|
self.guiFont,
|
||||||
self.tr("Changing this requires restarting novelWriter."),
|
self.tr("Changing this requires restarting novelWriter."),
|
||||||
theButton = self.fontButton
|
theButton=self.fontButton
|
||||||
)
|
)
|
||||||
|
|
||||||
# Font Size
|
# Font Size
|
||||||
@@ -236,7 +236,7 @@ class GuiPreferencesGeneral(QWidget):
|
|||||||
self.tr("Font size"),
|
self.tr("Font size"),
|
||||||
self.guiFontSize,
|
self.guiFontSize,
|
||||||
self.tr("Changing this requires restarting novelWriter."),
|
self.tr("Changing this requires restarting novelWriter."),
|
||||||
theUnit = self.tr("pt")
|
theUnit=self.tr("pt")
|
||||||
)
|
)
|
||||||
|
|
||||||
# GUI Settings
|
# GUI Settings
|
||||||
@@ -512,7 +512,7 @@ class GuiPreferencesDocuments(QWidget):
|
|||||||
self.tr("Font family"),
|
self.tr("Font family"),
|
||||||
self.textFont,
|
self.textFont,
|
||||||
self.tr("Font for the document editor and viewer."),
|
self.tr("Font for the document editor and viewer."),
|
||||||
theButton = self.fontButton
|
theButton=self.fontButton
|
||||||
)
|
)
|
||||||
|
|
||||||
# Font Size
|
# Font Size
|
||||||
@@ -525,7 +525,7 @@ class GuiPreferencesDocuments(QWidget):
|
|||||||
self.tr("Font size"),
|
self.tr("Font size"),
|
||||||
self.textSize,
|
self.textSize,
|
||||||
self.tr("Font size for the document editor and viewer."),
|
self.tr("Font size for the document editor and viewer."),
|
||||||
theUnit = self.tr("pt")
|
theUnit=self.tr("pt")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Text Flow
|
# Text Flow
|
||||||
@@ -788,7 +788,7 @@ class GuiPreferencesEditor(QWidget):
|
|||||||
self.tr("Minimum position for Typewriter scrolling"),
|
self.tr("Minimum position for Typewriter scrolling"),
|
||||||
self.autoScrollPos,
|
self.autoScrollPos,
|
||||||
self.tr("Percentage of the editor height from the top."),
|
self.tr("Percentage of the editor height from the top."),
|
||||||
theUnit = "%"
|
theUnit="%"
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
+11
-11
@@ -104,7 +104,7 @@ class NWErrorMessage(QDialog):
|
|||||||
"message and traceback shown below.</p>"
|
"message and traceback shown below.</p>"
|
||||||
"<p>URL: <a href='{issueUrl}'>{issueUrl}</a></p>"
|
"<p>URL: <a href='{issueUrl}'>{issueUrl}</a></p>"
|
||||||
).format(
|
).format(
|
||||||
issueUrl = __issuesurl__,
|
issueUrl=__issuesurl__,
|
||||||
))
|
))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -124,16 +124,16 @@ class NWErrorMessage(QDialog):
|
|||||||
"\n"
|
"\n"
|
||||||
"Traceback:\n{exTrace}\n"
|
"Traceback:\n{exTrace}\n"
|
||||||
).format(
|
).format(
|
||||||
nwVersion = __version__,
|
nwVersion=__version__,
|
||||||
osType = sys.platform,
|
osType=sys.platform,
|
||||||
osKernel = kernelVersion,
|
osKernel=kernelVersion,
|
||||||
pyVersion = sys.version.split()[0],
|
pyVersion=sys.version.split()[0],
|
||||||
pyHexVer = sys.hexversion,
|
pyHexVer=sys.hexversion,
|
||||||
qtVers = QT_VERSION_STR,
|
qtVers=QT_VERSION_STR,
|
||||||
pyqtVers = PYQT_VERSION_STR,
|
pyqtVers=PYQT_VERSION_STR,
|
||||||
exType = exType.__name__,
|
exType=exType.__name__,
|
||||||
exMessage = str(exValue),
|
exMessage=str(exValue),
|
||||||
exTrace = "\n".join(format_tb(exTrace)),
|
exTrace="\n".join(format_tb(exTrace)),
|
||||||
))
|
))
|
||||||
except Exception:
|
except Exception:
|
||||||
self.msgBody.setPlainText("Failed to generate error report ...")
|
self.msgBody.setPlainText("Failed to generate error report ...")
|
||||||
|
|||||||
+21
-21
@@ -543,27 +543,27 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
" color: rgb({mColR}, {mColG}, {mColB});"
|
" color: rgb({mColR}, {mColG}, {mColB});"
|
||||||
"}}\n"
|
"}}\n"
|
||||||
).format(
|
).format(
|
||||||
tColR = self.theTheme.colText[0],
|
tColR=self.theTheme.colText[0],
|
||||||
tColG = self.theTheme.colText[1],
|
tColG=self.theTheme.colText[1],
|
||||||
tColB = self.theTheme.colText[2],
|
tColB=self.theTheme.colText[2],
|
||||||
hColR = self.theTheme.colHead[0],
|
hColR=self.theTheme.colHead[0],
|
||||||
hColG = self.theTheme.colHead[1],
|
hColG=self.theTheme.colHead[1],
|
||||||
hColB = self.theTheme.colHead[2],
|
hColB=self.theTheme.colHead[2],
|
||||||
aColR = self.theTheme.colVal[0],
|
aColR=self.theTheme.colVal[0],
|
||||||
aColG = self.theTheme.colVal[1],
|
aColG=self.theTheme.colVal[1],
|
||||||
aColB = self.theTheme.colVal[2],
|
aColB=self.theTheme.colVal[2],
|
||||||
eColR = self.theTheme.colEmph[0],
|
eColR=self.theTheme.colEmph[0],
|
||||||
eColG = self.theTheme.colEmph[1],
|
eColG=self.theTheme.colEmph[1],
|
||||||
eColB = self.theTheme.colEmph[2],
|
eColB=self.theTheme.colEmph[2],
|
||||||
kColR = self.theTheme.colKey[0],
|
kColR=self.theTheme.colKey[0],
|
||||||
kColG = self.theTheme.colKey[1],
|
kColG=self.theTheme.colKey[1],
|
||||||
kColB = self.theTheme.colKey[2],
|
kColB=self.theTheme.colKey[2],
|
||||||
cColR = self.theTheme.colHidden[0],
|
cColR=self.theTheme.colHidden[0],
|
||||||
cColG = self.theTheme.colHidden[1],
|
cColG=self.theTheme.colHidden[1],
|
||||||
cColB = self.theTheme.colHidden[2],
|
cColB=self.theTheme.colHidden[2],
|
||||||
mColR = self.theTheme.colMod[0],
|
mColR=self.theTheme.colMod[0],
|
||||||
mColG = self.theTheme.colMod[1],
|
mColG=self.theTheme.colMod[1],
|
||||||
mColB = self.theTheme.colMod[2],
|
mColB=self.theTheme.colMod[2],
|
||||||
)
|
)
|
||||||
self._qDocument.setDefaultStyleSheet(styleSheet)
|
self._qDocument.setDefaultStyleSheet(styleSheet)
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,6 @@ gui_scripts =
|
|||||||
universal = 0
|
universal = 0
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E221,E226,E228,E241,E251
|
ignore = E221,E226,E228,E241
|
||||||
max-line-length = 99
|
max-line-length = 99
|
||||||
exclude = docs/*
|
exclude = docs/*
|
||||||
|
|||||||
@@ -409,8 +409,8 @@ def testCoreToHtml_Complex(dummyGUI, fncDir):
|
|||||||
"</body>\n"
|
"</body>\n"
|
||||||
"</html>\n"
|
"</html>\n"
|
||||||
).format(
|
).format(
|
||||||
htmlStyle = "\n".join(theStyle),
|
htmlStyle="\n".join(theStyle),
|
||||||
bodyText = "".join(resText).rstrip()
|
bodyText="".join(resText).rstrip()
|
||||||
)
|
)
|
||||||
|
|
||||||
saveFile = os.path.join(fncDir, "outFile.htm")
|
saveFile = os.path.join(fncDir, "outFile.htm")
|
||||||
|
|||||||
Reference in New Issue
Block a user