diff options
| author | Neil <nyamatongwe@gmail.com> | 2026-03-19 12:00:33 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2026-03-19 12:00:33 +1100 |
| commit | 69afca435b271b42a341730802467bacf88fa444 (patch) | |
| tree | f1a7c127ab122429256a57a4d1955ae5ee2e7884 /scripts/ScintillaData.py | |
| parent | 7c601c401a26d203d191b198a52e745f6a67c1fe (diff) | |
| download | scintilla-mirror-69afca435b271b42a341730802467bacf88fa444.tar.gz | |
Remove unnecessary readlines and make FindCredits same as SciTE.
Diffstat (limited to 'scripts/ScintillaData.py')
| -rw-r--r-- | scripts/ScintillaData.py | 21 |
1 files changed, 11 insertions, 10 deletions
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 == "<table>": + for line in f: + s = line.strip() + if stage == 0 and s == "<table>": stage = 1 - elif stage == 1 and line == "</table>": + elif stage == 1 and s == "</table>": stage = 2 - if stage == 1 and line.startswith("<td>"): - credit = line[4:-5] - if removeLinks and "<a" in line: - title, _a, rest = credit.partition("<a href=") + if stage == 1 and s.startswith("<td>"): + credit = s[4:-5] + if removeLinks and "<a" in s: + title, _, rest = credit.partition("<a href=") urlplus, _bracket, end = rest.partition(">") 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 |
