Remove alignments in arguments for format statements

This commit is contained in:
Veronica Berglyd Olsen
2021-06-25 23:20:15 +02:00
parent e1dcfaa1e3
commit 0575f89ae9
11 changed files with 65 additions and 68 deletions
+1 -4
View File
@@ -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
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
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.
@@ -122,6 +122,3 @@ strings. Use formatting instead.
**E241:** multiple spaces after ,
**Reason:** Column alignment.
**E251:** unexpected spaces around keyword / parameter equals
**Reason:** Column alignment.
+3 -3
View File
@@ -149,9 +149,9 @@ def main(sysArgs=None):
" --config= Alternative config file.\n"
" --data= Alternative user data path.\n"
).format(
version = __version__,
copyright = __copyright__,
date = __date__,
version=__version__,
copyright=__copyright__,
date=__date__,
)
# Defaults
+3 -3
View File
@@ -677,9 +677,9 @@ class NWProject():
with open(tempFile, mode="wb") as outFile:
outFile.write(etree.tostring(
nwXML,
pretty_print = True,
encoding = "utf-8",
xml_declaration = True
pretty_print=True,
encoding="utf-8",
xml_declaration=True
))
except Exception as e:
self.makeAlert([
+3 -3
View File
@@ -291,9 +291,9 @@ class ToHtml(Tokenizer):
"</body>\n"
"</html>\n"
).format(
projTitle = self.theProject.projName,
htmlStyle = "\n".join(theStyle),
bodyText = bodyText,
projTitle=self.theProject.projName,
htmlStyle="\n".join(theStyle),
bodyText=bodyText,
)
outFile.write(theHtml)
+3 -3
View File
@@ -450,9 +450,9 @@ class ToOdt(Tokenizer):
with open(savePath, mode="wb") as outFile:
outFile.write(etree.tostring(
self._dFlat,
pretty_print = True,
encoding = "utf-8",
xml_declaration = True
pretty_print=True,
encoding="utf-8",
xml_declaration=True
))
return
+12 -12
View File
@@ -142,31 +142,31 @@ class GuiAbout(QDialog):
"<h3>{title2}</h3>"
"<p>{credits}</p>"
).format(
title1 = self.tr("About novelWriter"),
copy = nw.__copyright__,
link = self.tr("Website: {0}").format(f"<a href='{nw.__url__}'>{nw.__domain__}</a>"),
title2 = self.tr("Credits"),
credits = self._wrapTable([
title1=self.tr("About novelWriter"),
copy=nw.__copyright__,
link=self.tr("Website: {0}").format(f"<a href='{nw.__url__}'>{nw.__domain__}</a>"),
title2=self.tr("Credits"),
credits=self._wrapTable([
(self.tr("Developer"), "Veronica Berglyd Olsen"),
(self.tr("Concept"), "Veronica Berglyd Olsen, Marian Lückhof"),
(self.tr("i18n"), "Bruno Meneguello"),
]),
intro = self.tr(
intro=self.tr(
"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."
),
license1 = self.tr(
license1=self.tr(
"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 "
"Free Software Foundation, either version 3 of the License, or (at your "
"option) any later version."
),
license2 = self.tr(
license2=self.tr(
"novelWriter 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."
),
license3 = self.tr(
license3=self.tr(
"See the Licence tab for the full licence text, or visit the "
"GNU website at {0} for more details."
).format(
@@ -271,9 +271,9 @@ class GuiAbout(QDialog):
" padding-right: 0.8em;"
"}}\n"
).format(
hColR = self.theParent.theTheme.colHead[0],
hColG = self.theParent.theTheme.colHead[1],
hColB = self.theParent.theTheme.colHead[2],
hColR=self.theParent.theTheme.colHead[0],
hColG=self.theParent.theTheme.colHead[1],
hColB=self.theParent.theTheme.colHead[2],
)
self.pageAbout.document().setDefaultStyleSheet(styleSheet)
self.pageNotes.document().setDefaultStyleSheet(styleSheet)
+5 -5
View File
@@ -223,7 +223,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("Font family"),
self.guiFont,
self.tr("Changing this requires restarting novelWriter."),
theButton = self.fontButton
theButton=self.fontButton
)
# Font Size
@@ -236,7 +236,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("Font size"),
self.guiFontSize,
self.tr("Changing this requires restarting novelWriter."),
theUnit = self.tr("pt")
theUnit=self.tr("pt")
)
# GUI Settings
@@ -512,7 +512,7 @@ class GuiPreferencesDocuments(QWidget):
self.tr("Font family"),
self.textFont,
self.tr("Font for the document editor and viewer."),
theButton = self.fontButton
theButton=self.fontButton
)
# Font Size
@@ -525,7 +525,7 @@ class GuiPreferencesDocuments(QWidget):
self.tr("Font size"),
self.textSize,
self.tr("Font size for the document editor and viewer."),
theUnit = self.tr("pt")
theUnit=self.tr("pt")
)
# Text Flow
@@ -788,7 +788,7 @@ class GuiPreferencesEditor(QWidget):
self.tr("Minimum position for Typewriter scrolling"),
self.autoScrollPos,
self.tr("Percentage of the editor height from the top."),
theUnit = "%"
theUnit="%"
)
return
+11 -11
View File
@@ -104,7 +104,7 @@ class NWErrorMessage(QDialog):
"message and traceback shown below.</p>"
"<p>URL: <a href='{issueUrl}'>{issueUrl}</a></p>"
).format(
issueUrl = __issuesurl__,
issueUrl=__issuesurl__,
))
try:
@@ -124,16 +124,16 @@ class NWErrorMessage(QDialog):
"\n"
"Traceback:\n{exTrace}\n"
).format(
nwVersion = __version__,
osType = sys.platform,
osKernel = kernelVersion,
pyVersion = sys.version.split()[0],
pyHexVer = sys.hexversion,
qtVers = QT_VERSION_STR,
pyqtVers = PYQT_VERSION_STR,
exType = exType.__name__,
exMessage = str(exValue),
exTrace = "\n".join(format_tb(exTrace)),
nwVersion=__version__,
osType=sys.platform,
osKernel=kernelVersion,
pyVersion=sys.version.split()[0],
pyHexVer=sys.hexversion,
qtVers=QT_VERSION_STR,
pyqtVers=PYQT_VERSION_STR,
exType=exType.__name__,
exMessage=str(exValue),
exTrace="\n".join(format_tb(exTrace)),
))
except Exception:
self.msgBody.setPlainText("Failed to generate error report ...")
+21 -21
View File
@@ -543,27 +543,27 @@ class GuiDocViewer(QTextBrowser):
" color: rgb({mColR}, {mColG}, {mColB});"
"}}\n"
).format(
tColR = self.theTheme.colText[0],
tColG = self.theTheme.colText[1],
tColB = self.theTheme.colText[2],
hColR = self.theTheme.colHead[0],
hColG = self.theTheme.colHead[1],
hColB = self.theTheme.colHead[2],
aColR = self.theTheme.colVal[0],
aColG = self.theTheme.colVal[1],
aColB = self.theTheme.colVal[2],
eColR = self.theTheme.colEmph[0],
eColG = self.theTheme.colEmph[1],
eColB = self.theTheme.colEmph[2],
kColR = self.theTheme.colKey[0],
kColG = self.theTheme.colKey[1],
kColB = self.theTheme.colKey[2],
cColR = self.theTheme.colHidden[0],
cColG = self.theTheme.colHidden[1],
cColB = self.theTheme.colHidden[2],
mColR = self.theTheme.colMod[0],
mColG = self.theTheme.colMod[1],
mColB = self.theTheme.colMod[2],
tColR=self.theTheme.colText[0],
tColG=self.theTheme.colText[1],
tColB=self.theTheme.colText[2],
hColR=self.theTheme.colHead[0],
hColG=self.theTheme.colHead[1],
hColB=self.theTheme.colHead[2],
aColR=self.theTheme.colVal[0],
aColG=self.theTheme.colVal[1],
aColB=self.theTheme.colVal[2],
eColR=self.theTheme.colEmph[0],
eColG=self.theTheme.colEmph[1],
eColB=self.theTheme.colEmph[2],
kColR=self.theTheme.colKey[0],
kColG=self.theTheme.colKey[1],
kColB=self.theTheme.colKey[2],
cColR=self.theTheme.colHidden[0],
cColG=self.theTheme.colHidden[1],
cColB=self.theTheme.colHidden[2],
mColR=self.theTheme.colMod[0],
mColG=self.theTheme.colMod[1],
mColB=self.theTheme.colMod[2],
)
self._qDocument.setDefaultStyleSheet(styleSheet)
+1 -1
View File
@@ -49,6 +49,6 @@ gui_scripts =
universal = 0
[flake8]
ignore = E221,E226,E228,E241,E251
ignore = E221,E226,E228,E241
max-line-length = 99
exclude = docs/*
+2 -2
View File
@@ -409,8 +409,8 @@ def testCoreToHtml_Complex(dummyGUI, fncDir):
"</body>\n"
"</html>\n"
).format(
htmlStyle = "\n".join(theStyle),
bodyText = "".join(resText).rstrip()
htmlStyle="\n".join(theStyle),
bodyText="".join(resText).rstrip()
)
saveFile = os.path.join(fncDir, "outFile.htm")