From 69afca435b271b42a341730802467bacf88fa444 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 19 Mar 2026 12:00:33 +1100 Subject: Remove unnecessary readlines and make FindCredits same as SciTE. --- scripts/ScintillaData.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'scripts/ScintillaData.py') diff --git a/scripts/ScintillaData.py b/scripts/ScintillaData.py index 55534306b..d57898e5e 100644 --- a/scripts/ScintillaData.py +++ b/scripts/ScintillaData.py @@ -25,19 +25,20 @@ import datetime, pathlib, sys def FindCredits(historyFile, removeLinks=True): + """ Return a list of contributors in a history file. """ credits = [] stage = 0 with historyFile.open(encoding="utf-8") as f: - for line in f.readlines(): - line = line.strip() - if stage == 0 and line == "": + for line in f: + s = line.strip() + if stage == 0 and s == "
": stage = 1 - elif stage == 1 and line == "
": + elif stage == 1 and s == "": stage = 2 - if stage == 1 and line.startswith(""): - credit = line[4:-5] - if removeLinks and ""): + credit = s[4:-5] + if removeLinks and "") name = end.split("<")[0] url = urlplus[1:-1] @@ -57,14 +58,14 @@ class ScintillaData: self.versionCommad = self.versionDotted.replace(".", ", ") + ', 0' with (scintillaRoot / "doc" / "index.html").open() as f: - self.dateModified = [d for d in f.readlines() if "Date.Modified" in d]\ + self.dateModified = [d for d in f if "Date.Modified" in d]\ [0].split('\"')[3] # 20130602 # index.html, SciTE.html dtModified = datetime.datetime.strptime(self.dateModified, "%Y%m%d") self.yearModified = self.dateModified[0:4] monthModified = dtModified.strftime("%B") - dayModified = "%d" % dtModified.day + dayModified = f"{dtModified.day}" self.mdyModified = monthModified + " " + dayModified + " " + self.yearModified # May 22 2013 # index.html, SciTE.html -- cgit v1.2.3