From f3cacb849b171bb7f647863535e631d0b3062c29 Mon Sep 17 00:00:00 2001 From: Dpeta <69427753+Dpeta@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:52:26 +0100 Subject: [PATCH] Updated black run --- convo.py | 4 +++- dataobjs.py | 2 +- generic.py | 2 +- irc.py | 3 +-- logviewer.py | 4 ++-- menus.py | 10 +++++----- mispeller.py | 4 ++-- parsetools.py | 6 +++--- pesterchum.py | 9 ++++----- pnc/unicolor.py | 1 + profile.py | 10 +++++----- scripts/irc/outgoing.py | 6 ++++-- toast.py | 2 +- 13 files changed, 33 insertions(+), 30 deletions(-) diff --git a/convo.py b/convo.py index eda8da1..67b8236 100644 --- a/convo.py +++ b/convo.py @@ -235,6 +235,7 @@ class PesterTabWindow(QtWidgets.QFrame): i, QtGui.QColor(self.mainwindow.theme["%s/tabs/newmsgcolor" % (self.type)]) ) convo = self.convos[handle] + # Create a function for the icon to use # TODO: Let us disable this. def func(): @@ -286,7 +287,7 @@ class PesterTabWindow(QtWidgets.QFrame): del self.convos[handle] del self.tabIndices[handle] self.tabs.removeTab(i) - for (h, j) in self.tabIndices.items(): + for h, j in self.tabIndices.items(): if j > i: self.tabIndices[h] = j - 1 self.layout.removeWidget(convo) @@ -954,6 +955,7 @@ class PesterConvo(QtWidgets.QFrame): else: self.newmessage = True self.setWindowTitle(title + "*") + # karxi: The order of execution here is a bit unclear...I'm not # entirely sure how much of this directly affects what we see. def func(): diff --git a/dataobjs.py b/dataobjs.py index 80761a6..fdf0e26 100644 --- a/dataobjs.py +++ b/dataobjs.py @@ -146,7 +146,7 @@ class pesterQuirks: # suffix = [q for q in self.quirklist if q.type == "suffix"] newlist = [] - for (i, o) in enumerate(lexed): + for i, o in enumerate(lexed): if type(o) not in [str, str]: if i == 0: string = " " diff --git a/generic.py b/generic.py index 3bf9297..b8c3fd9 100644 --- a/generic.py +++ b/generic.py @@ -119,7 +119,7 @@ class MultiTextDialog(QtWidgets.QDialog): r = self.exec() if r == QtWidgets.QDialog.DialogCode.Accepted: retval = {} - for (name, widget) in self.inputs.items(): + for name, widget in self.inputs.items(): retval[name] = str(widget.text()) return retval else: diff --git a/irc.py b/irc.py index fe272e0..c4039d1 100644 --- a/irc.py +++ b/irc.py @@ -916,8 +916,7 @@ class PesterIRC(QtCore.QThread): modes.append("{}{}".format(cur, l)) PchumLog.debug("handles=%s", handles) PchumLog.debug("enumerate(modes) = " + str(list(enumerate(modes)))) - for (i, m) in enumerate(modes): - + for i, m in enumerate(modes): # Server-set usermodes don't need to be passed. if (handles == [""]) & ( ("x" in m) | ("z" in m) | ("o" in m) | ("x" in m) diff --git a/logviewer.py b/logviewer.py index 803b284..b3eb669 100644 --- a/logviewer.py +++ b/logviewer.py @@ -78,7 +78,7 @@ class PesterLogUserSelect(QtWidgets.QDialog): self.chumsBox.setStyleSheet(self.theme["main/chums/style"]) self.chumsBox.optionsMenu = QtWidgets.QMenu(self) - for (_, t) in enumerate(chumMemoList): + for _, t in enumerate(chumMemoList): item = QtWidgets.QListWidgetItem(t) item.setForeground( QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"])) @@ -244,7 +244,7 @@ class PesterLogViewer(QtWidgets.QDialog): child_1 = None last = ["", ""] # blackbrush = QtGui.QBrush(QtCore.Qt.GlobalColor.black) - for (i, l) in enumerate(self.logList): + for i, l in enumerate(self.logList): my = self.fileToMonthYear(l) if my[0] != last[0]: child_1 = QtWidgets.QTreeWidgetItem(["{} {}".format(my[0], my[1])]) diff --git a/menus.py b/menus.py index dcb880f..ddee212 100644 --- a/menus.py +++ b/menus.py @@ -576,7 +576,7 @@ class PesterQuirkTypes(QtWidgets.QDialog): if quirk: types = ["prefix", "suffix", "replace", "regexp", "random", "spelling"] - for (i, r) in enumerate(self.radios): + for i, r in enumerate(self.radios): if i == types.index(quirk.quirk.type): r.setChecked(True) self.changePage(types.index(quirk.quirk.type) + 1) @@ -648,7 +648,7 @@ class PesterQuirkTypes(QtWidgets.QDialog): return cur = self.pages.currentIndex() if cur == 0: - for (i, r) in enumerate(self.radios): + for i, r in enumerate(self.radios): if r.isChecked(): self.changePage(i + 1) else: @@ -933,7 +933,7 @@ class PesterChooseTheme(QtWidgets.QDialog): avail_themes = config.availableThemes() self.themeBox = QtWidgets.QComboBox(self) - for (i, t) in enumerate(avail_themes): + for i, t in enumerate(avail_themes): self.themeBox.addItem(t) if t == theme.name: self.themeBox.setCurrentIndex(i) @@ -1416,7 +1416,7 @@ class PesterOptions(QtWidgets.QDialog): avail_themes = self.config.availableThemes() self.themeBox = QtWidgets.QComboBox(self) notheme = theme.name not in avail_themes - for (i, t) in enumerate(avail_themes): + for i, t in enumerate(avail_themes): self.themeBox.addItem(t) if (not notheme and t == theme.name) or (notheme and t == "pesterchum"): self.themeBox.setCurrentIndex(i) @@ -1454,7 +1454,7 @@ class PesterOptions(QtWidgets.QDialog): types = self.parent().tm.availableTypes() cur = self.parent().tm.currentType() self.notifyOptions.addItems(types) - for (i, t) in enumerate(types): + for i, t in enumerate(types): if t == cur: self.notifyOptions.setCurrentIndex(i) break diff --git a/mispeller.py b/mispeller.py index 5e38b2f..443ba54 100644 --- a/mispeller.py +++ b/mispeller.py @@ -7,8 +7,8 @@ kbloc = [ [x for x in "zxcvbnm,.>/?"], ] kbdict = {} -for (i, l) in enumerate(kbloc): - for (j, k) in enumerate(l): +for i, l in enumerate(kbloc): + for j, k in enumerate(l): kbdict[k] = (i, j) sounddict = { diff --git a/parsetools.py b/parsetools.py index 746c34f..e09d11d 100644 --- a/parsetools.py +++ b/parsetools.py @@ -64,9 +64,9 @@ def reloadQuirkFunctions(): def lexer(string, objlist): """objlist is a list: [(objecttype, re),...] list is in order of preference""" stringlist = [string] - for (oType, regexp) in objlist: + for oType, regexp in objlist: newstringlist = [] - for (stri, s) in enumerate(stringlist): + for stri, s in enumerate(stringlist): if type(s) not in [str, str]: newstringlist.append(s) continue @@ -339,7 +339,7 @@ def convertTags(lexed, format="html"): lexed = lexMessage(lexed) escaped = "" # firststr = True - for (i, o) in enumerate(lexed): + for i, o in enumerate(lexed): if type(o) in [str, str]: if format == "html": escaped += ( diff --git a/pesterchum.py b/pesterchum.py index ed5dd17..ec835af 100755 --- a/pesterchum.py +++ b/pesterchum.py @@ -2971,7 +2971,7 @@ class PesterWindow(MovingWindow): # Tell everyone we're in a chat with that we just went idle. sysColor = QtGui.QColor(self.theme["convo/systemMsgColor"]) verb = self.theme["convo/text/idle"] - for (h, convo) in self.convos.items(): + for h, convo in self.convos.items(): # karxi: There's an irritating issue here involving a lack of # consideration for case-sensitivity. # This fix is a little sloppy, and I need to look into what it @@ -3051,7 +3051,6 @@ class PesterWindow(MovingWindow): @QtCore.pyqtSlot() def joinSelectedMemo(self): - time = str(self.memochooser.timeinput.text()) secret = self.memochooser.secretChannel.isChecked() invite = self.memochooser.inviteChannel.isChecked() @@ -3246,7 +3245,7 @@ class PesterWindow(MovingWindow): # combine self.createTabWindow() newconvos = {} - for (h, c) in self.convos.items(): + for h, c in self.convos.items(): c.setParent(self.tabconvo) self.tabconvo.addChat(c) self.tabconvo.show() @@ -3276,7 +3275,7 @@ class PesterWindow(MovingWindow): # combine newmemos = {} self.createMemoTabWindow() - for (h, m) in self.memos.items(): + for h, m in self.memos.items(): m.setParent(self.tabmemo) self.tabmemo.addChat(m) self.tabmemo.show() @@ -4293,7 +4292,7 @@ class MainProgram(QtCore.QObject): for k in Mood.moodcats: moodCategories[k] = moodMenu.addMenu(k.upper()) self.moodactions = {} - for (i, m) in enumerate(Mood.moods): + for i, m in enumerate(Mood.moods): maction = QAction(m.upper(), self) mobj = PesterMoodAction(i, self.widget.moods.updateMood) maction.triggered.connect(mobj.updateMood) diff --git a/pnc/unicolor.py b/pnc/unicolor.py index 95dbe80..188652e 100644 --- a/pnc/unicolor.py +++ b/pnc/unicolor.py @@ -27,6 +27,7 @@ class Color: # The threshold at which to consider two colors noticeably different, even # if only barely jnd = 2.3 + # TODO: Either subclass (this is probably best) or add a .native_type; in # the case of the former, just make sure each type is geared towards using # a certain kind of color space as a starting point, e.g. RGB, XYZ, HSV, diff --git a/profile.py b/profile.py index d5502ed..13ce1f4 100644 --- a/profile.py +++ b/profile.py @@ -64,7 +64,7 @@ class PesterLog: if handle not in self.convos: log_time = datetime.now().strftime("%Y-%m-%d.%H.%M") self.convos[handle] = {} - for (format, t) in modes.items(): + for format, t in modes.items(): if not os.path.exists( "{}/{}/{}/{}".format(self.logpath, self.handle, handle, format) ): @@ -81,7 +81,7 @@ class PesterLog: ) self.convos[handle][format] = fp - for (format, t) in modes.items(): + for format, t in modes.items(): f = self.convos[handle][format] f.write(t + "\r\n") # flush + fsync force a write, @@ -737,7 +737,7 @@ class userProfile: def setMentions(self, mentions): i = None try: - for (i, m) in enumerate(mentions): + for i, m in enumerate(mentions): re.compile(m) except re.error as e: PchumLog.error("#{} Not a valid regular expression: {}".format(i, e)) @@ -835,7 +835,7 @@ class PesterProfileDB(dict): json.dump(chumdict, fp) u = [] - for (handle, c) in chumdict.items(): + for handle, c in chumdict.items(): options = dict() if "group" in c: options["group"] = c["group"] @@ -960,7 +960,7 @@ class pesterTheme(dict): return v def pathHook(self, d): - for (k, v) in d.items(): + for k, v in d.items(): if isinstance(v, str): s = Template(v) d[k] = s.safe_substitute(path=self.path) diff --git a/scripts/irc/outgoing.py b/scripts/irc/outgoing.py index b1dff96..93eb75f 100644 --- a/scripts/irc/outgoing.py +++ b/scripts/irc/outgoing.py @@ -102,14 +102,16 @@ class SendIRC: def join(self, channel, key=""): """Send JOIN command to join a channel/memo. - Keys or joining multiple channels is possible in the specification, but unused.""" + Keys or joining multiple channels is possible in the specification, but unused. + """ channel_and_key = " ".join([channel, key]).strip() self.send("JOIN", channel_and_key) def part(self, channel): """Send PART command to leave a channel/memo. - Providing a reason or leaving multiple channels is possible in the specification.""" + Providing a reason or leaving multiple channels is possible in the specification. + """ self.send("PART", channel) def notice(self, target, text): diff --git a/toast.py b/toast.py index 0ac6c7b..2ba80bc 100644 --- a/toast.py +++ b/toast.py @@ -103,7 +103,7 @@ class ToastMachine: def realShow(self): self.machine.displaying = True t = None - for (k, v) in self.machine.types.items(): + for k, v in self.machine.types.items(): if self.machine.type == k: try: args = inspect.getargspec(v.__init__).args