Apply the following pylint messages:
- use-list-literal - use-dict-literal - consider-using-in - consider-using-from-import
This commit is contained in:
parent
05769e4ff2
commit
9ec4dbd088
8 changed files with 40 additions and 35 deletions
|
@ -160,6 +160,14 @@ enable=F, # Fatal
|
||||||
wildcard-import,
|
wildcard-import,
|
||||||
# Specific refactoring checks:
|
# Specific refactoring checks:
|
||||||
use-implicit-booleaness-not-len,
|
use-implicit-booleaness-not-len,
|
||||||
|
useless-object-inheritance,
|
||||||
|
consider-using-from-import,
|
||||||
|
consider-using-in,
|
||||||
|
consider-using-join,
|
||||||
|
use-list-literal,
|
||||||
|
use-dict-literal,
|
||||||
|
useless-object-inheritance,
|
||||||
|
useless-return,
|
||||||
# Specific basic checks:
|
# Specific basic checks:
|
||||||
lost-exception,
|
lost-exception,
|
||||||
assert-on-tuple,
|
assert-on-tuple,
|
||||||
|
|
21
dataobjs.py
21
dataobjs.py
|
@ -166,7 +166,7 @@ class pesterQuirks:
|
||||||
# Exclude option is checked
|
# Exclude option is checked
|
||||||
if checkstate == 2:
|
if checkstate == 2:
|
||||||
# Check for substring that should be excluded.
|
# Check for substring that should be excluded.
|
||||||
excludes = list()
|
excludes = []
|
||||||
# Check for links, store in list.
|
# Check for links, store in list.
|
||||||
for match in re.finditer(_urlre, string):
|
for match in re.finditer(_urlre, string):
|
||||||
excludes.append(match)
|
excludes.append(match)
|
||||||
|
@ -189,7 +189,7 @@ class pesterQuirks:
|
||||||
if excludes[n].end() > excludes[n + 1].start():
|
if excludes[n].end() > excludes[n + 1].start():
|
||||||
excludes.pop(n)
|
excludes.pop(n)
|
||||||
# Seperate parts to be quirked.
|
# Seperate parts to be quirked.
|
||||||
sendparts = list()
|
sendparts = []
|
||||||
# Add string until start of exclude at index 0.
|
# Add string until start of exclude at index 0.
|
||||||
until = excludes[0].start()
|
until = excludes[0].start()
|
||||||
sendparts.append(string[:until])
|
sendparts.append(string[:until])
|
||||||
|
@ -203,10 +203,10 @@ class pesterQuirks:
|
||||||
sendparts.append(string[after:])
|
sendparts.append(string[after:])
|
||||||
|
|
||||||
# Quirk to-be-quirked parts.
|
# Quirk to-be-quirked parts.
|
||||||
recvparts = list()
|
recvparts = []
|
||||||
for part in sendparts:
|
for part in sendparts:
|
||||||
# No split, apply like normal.
|
# No split, apply like normal.
|
||||||
if q.type == "regexp" or q.type == "random":
|
if q.type in ("regexp", "random"):
|
||||||
recvparts.append(
|
recvparts.append(
|
||||||
q.apply(part, first=(i == 0), last=lastStr)
|
q.apply(part, first=(i == 0), last=lastStr)
|
||||||
)
|
)
|
||||||
|
@ -227,8 +227,8 @@ class pesterQuirks:
|
||||||
string += recvparts[-1]
|
string += recvparts[-1]
|
||||||
else:
|
else:
|
||||||
# No split, apply like normal.
|
# No split, apply like normal.
|
||||||
if q.type != "prefix" and q.type != "suffix":
|
if q.type not in ("prefix", "suffix"):
|
||||||
if q.type == "regexp" or q.type == "random":
|
if q.type in ("regexp", "random"):
|
||||||
string = q.apply(string, first=(i == 0), last=lastStr)
|
string = q.apply(string, first=(i == 0), last=lastStr)
|
||||||
else:
|
else:
|
||||||
string = q.apply(string)
|
string = q.apply(string)
|
||||||
|
@ -238,8 +238,8 @@ class pesterQuirks:
|
||||||
string = q.apply(string)
|
string = q.apply(string)
|
||||||
else:
|
else:
|
||||||
# No split, apply like normal.
|
# No split, apply like normal.
|
||||||
if q.type != "prefix" and q.type != "suffix":
|
if q.type not in ("prefix", "suffix"):
|
||||||
if q.type == "regexp" or q.type == "random":
|
if q.type in ("regexp", "random"):
|
||||||
string = q.apply(string, first=(i == 0), last=lastStr)
|
string = q.apply(string, first=(i == 0), last=lastStr)
|
||||||
else:
|
else:
|
||||||
string = q.apply(string)
|
string = q.apply(string)
|
||||||
|
@ -396,14 +396,13 @@ class PesterProfile:
|
||||||
)
|
)
|
||||||
|
|
||||||
def memoclosemsg(self, syscolor, initials, verb):
|
def memoclosemsg(self, syscolor, initials, verb):
|
||||||
if type(initials) == type(list()):
|
if isinstance(initials, list):
|
||||||
return "<c={}><c={}>{}</c> {}.</c>".format(
|
return "<c={}><c={}>{}</c> {}.</c>".format(
|
||||||
syscolor.name(),
|
syscolor.name(),
|
||||||
self.colorhtml(),
|
self.colorhtml(),
|
||||||
", ".join(initials),
|
", ".join(initials),
|
||||||
verb,
|
verb,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
return "<c={}><c={}>{}{}{}</c> {}.</c>".format(
|
return "<c={}><c={}>{}{}{}</c> {}.</c>".format(
|
||||||
syscolor.name(),
|
syscolor.name(),
|
||||||
self.colorhtml(),
|
self.colorhtml(),
|
||||||
|
@ -439,7 +438,7 @@ class PesterProfile:
|
||||||
|
|
||||||
def memobanmsg(self, opchum, opgrammar, syscolor, initials, reason):
|
def memobanmsg(self, opchum, opgrammar, syscolor, initials, reason):
|
||||||
opinit = opgrammar.pcf + opchum.initials() + opgrammar.number
|
opinit = opgrammar.pcf + opchum.initials() + opgrammar.number
|
||||||
if type(initials) == type(list()):
|
if isinstance(initials, list):
|
||||||
if opchum.handle == reason:
|
if opchum.handle == reason:
|
||||||
return (
|
return (
|
||||||
"<c={}>{}</c> banned <c={}>{}</c> from responding to memo.".format(
|
"<c={}>{}</c> banned <c={}>{}</c> from responding to memo.".format(
|
||||||
|
|
6
memos.py
6
memos.py
|
@ -107,7 +107,7 @@ class TimeGrammar:
|
||||||
self.temporal = temporal
|
self.temporal = temporal
|
||||||
self.pcf = pcf
|
self.pcf = pcf
|
||||||
self.when = when
|
self.when = when
|
||||||
if number == "0" or number == 0:
|
if number in ("0", 0):
|
||||||
self.number = ""
|
self.number = ""
|
||||||
else:
|
else:
|
||||||
self.number = str(number)
|
self.number = str(number)
|
||||||
|
@ -164,7 +164,7 @@ class TimeTracker(list):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# (temporal, pcf, when) = pcfGrammar(mysteryTime())
|
# (temporal, pcf, when) = pcfGrammar(mysteryTime())
|
||||||
pcf = pcfGrammar(mysteryTime())[1]
|
pcf = pcfGrammar(mysteryTime())[1]
|
||||||
if pcf == "C" or pcf == "?":
|
if pcf in ("C", "?"):
|
||||||
return
|
return
|
||||||
if timed in self.timerecord[pcf]:
|
if timed in self.timerecord[pcf]:
|
||||||
return
|
return
|
||||||
|
@ -176,7 +176,7 @@ class TimeTracker(list):
|
||||||
pcf = pcfGrammar(timed - timedelta(0))[1]
|
pcf = pcfGrammar(timed - timedelta(0))[1]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pcf = pcfGrammar(mysteryTime())[1]
|
pcf = pcfGrammar(mysteryTime())[1]
|
||||||
if pcf == "C" or pcf == "?":
|
if pcf in ("C", "?"):
|
||||||
return 0
|
return 0
|
||||||
if len(self.timerecord[pcf]) > 1:
|
if len(self.timerecord[pcf]) > 1:
|
||||||
return self.timerecord[pcf].index(timed) + 1
|
return self.timerecord[pcf].index(timed) + 1
|
||||||
|
|
4
menus.py
4
menus.py
|
@ -37,9 +37,7 @@ class PesterQuirkItem(QtWidgets.QTreeWidgetItem):
|
||||||
"""Sets the order of quirks if auto-sorted by Qt. Obsolete now."""
|
"""Sets the order of quirks if auto-sorted by Qt. Obsolete now."""
|
||||||
if self.quirk.type == "prefix":
|
if self.quirk.type == "prefix":
|
||||||
return True
|
return True
|
||||||
elif (
|
elif self.quirk.type in ("replace", "regexp") and quirkitem.type == "suffix":
|
||||||
self.quirk.type == "replace" or self.quirk.type == "regexp"
|
|
||||||
) and quirkitem.type == "suffix":
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -13,7 +13,7 @@ except ImportError:
|
||||||
import dataobjs
|
import dataobjs
|
||||||
|
|
||||||
# karxi: My own contribution to this - a proper lexer.
|
# karxi: My own contribution to this - a proper lexer.
|
||||||
import pnc.lexercon as lexercon
|
from pnc import lexercon
|
||||||
from generic import mysteryTime
|
from generic import mysteryTime
|
||||||
from quirks import ScriptQuirks
|
from quirks import ScriptQuirks
|
||||||
from pyquirks import PythonQuirks
|
from pyquirks import PythonQuirks
|
||||||
|
|
12
pyinst.py
12
pyinst.py
|
@ -238,10 +238,10 @@ if (_ARGUMENTS.prompts is not False) and (_ARGUMENTS.prompts != "False"):
|
||||||
"This is a script to make building with Pyinstaller a bit more conventient."
|
"This is a script to make building with Pyinstaller a bit more conventient."
|
||||||
)
|
)
|
||||||
|
|
||||||
while (delete_builddist != "y") and (delete_builddist != "n"):
|
while delete_builddist not in ("y", "n"):
|
||||||
delete_builddist = input("Delete build & dist folders? (Y/N): ").lower()
|
delete_builddist = input("Delete build & dist folders? (Y/N): ").lower()
|
||||||
|
|
||||||
while (upx_enabled != "y") and (upx_enabled != "n"):
|
while upx_enabled not in ("y", "n"):
|
||||||
upx_enabled = input("Enable UPX? (Y/N): ").lower()
|
upx_enabled = input("Enable UPX? (Y/N): ").lower()
|
||||||
if upx_enabled == "y":
|
if upx_enabled == "y":
|
||||||
print("If upx is on your path you don't need to include anything here.")
|
print("If upx is on your path you don't need to include anything here.")
|
||||||
|
@ -257,14 +257,14 @@ if (_ARGUMENTS.prompts is not False) and (_ARGUMENTS.prompts != "False"):
|
||||||
elif upx_enabled == "n":
|
elif upx_enabled == "n":
|
||||||
upx_dir = ""
|
upx_dir = ""
|
||||||
|
|
||||||
while (windowed != "y") and (windowed != "n"):
|
while windowed not in ("y", "n"):
|
||||||
windowed = input("Build with '--windowed'? (Y/N): ").lower()
|
windowed = input("Build with '--windowed'? (Y/N): ").lower()
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
print(
|
print(
|
||||||
"(https://pyinstaller.readthedocs.io/en/stable/usage.html?highlight=sdk#windows)"
|
"(https://pyinstaller.readthedocs.io/en/stable/usage.html?highlight=sdk#windows)"
|
||||||
)
|
)
|
||||||
while (package_universal_crt != "y") and (package_universal_crt != "n"):
|
while package_universal_crt not in ("y", "n"):
|
||||||
package_universal_crt = input(
|
package_universal_crt = input(
|
||||||
"Try to include universal CRT? (Y/N): "
|
"Try to include universal CRT? (Y/N): "
|
||||||
).lower()
|
).lower()
|
||||||
|
@ -303,8 +303,8 @@ if (_ARGUMENTS.prompts is not False) and (_ARGUMENTS.prompts != "False"):
|
||||||
)
|
)
|
||||||
print("crt_path = " + crt_path)
|
print("crt_path = " + crt_path)
|
||||||
|
|
||||||
if (sys.platform == "win32") or (sys.platform == "linux"):
|
if sys.platform in ("win32", "linux"):
|
||||||
while (onefile != "y") and (onefile != "n"):
|
while onefile not in ("y", "n"):
|
||||||
onefile = input("Build with '--onefile'? (Y/N): ").lower()
|
onefile = input("Build with '--onefile'? (Y/N): ").lower()
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
4
toast.py
4
toast.py
|
@ -93,7 +93,7 @@ class ToastMachine:
|
||||||
def show(self):
|
def show(self):
|
||||||
if self.machine.on:
|
if self.machine.on:
|
||||||
# Use libnotify's queue if using libnotify
|
# Use libnotify's queue if using libnotify
|
||||||
if self.machine.type == "libnotify" or self.machine.type == "twmn":
|
if self.machine.type in ("libnotify", "twmn"):
|
||||||
self.realShow()
|
self.realShow()
|
||||||
elif self.machine.toasts:
|
elif self.machine.toasts:
|
||||||
self.machine.toasts.append(self)
|
self.machine.toasts.append(self)
|
||||||
|
@ -116,7 +116,7 @@ class ToastMachine:
|
||||||
extras["parent"] = self.machine.parent
|
extras["parent"] = self.machine.parent
|
||||||
if "time" in args:
|
if "time" in args:
|
||||||
extras["time"] = self.time
|
extras["time"] = self.time
|
||||||
if k == "libnotify" or k == "twmn":
|
if k in ("libnotify", "twmn"):
|
||||||
t = v(self.title, self.msg, self.icon, **extras)
|
t = v(self.title, self.msg, self.icon, **extras)
|
||||||
else:
|
else:
|
||||||
t = v(self.machine, self.title, self.msg, self.icon, **extras)
|
t = v(self.machine, self.title, self.msg, self.icon, **extras)
|
||||||
|
|
|
@ -849,7 +849,7 @@ class PesterProfileDB(dict):
|
||||||
|
|
||||||
u = []
|
u = []
|
||||||
for handle, c in chumdict.items():
|
for handle, c in chumdict.items():
|
||||||
options = dict()
|
options = {}
|
||||||
if "group" in c:
|
if "group" in c:
|
||||||
options["group"] = c["group"]
|
options["group"] = c["group"]
|
||||||
if "notes" in c:
|
if "notes" in c:
|
||||||
|
|
Loading…
Reference in a new issue