From b1028484c4932b517ac76905126d932bda715db6 Mon Sep 17 00:00:00 2001 From: ivy <119665497+lvlvllvlvllvlvl@users.noreply.github.com> Date: Fri, 15 Dec 2023 18:20:41 +0700 Subject: [PATCH] fix error --- PyPoE/cli/exporter/wiki/handler.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/PyPoE/cli/exporter/wiki/handler.py b/PyPoE/cli/exporter/wiki/handler.py index 34dfe081..18648b48 100644 --- a/PyPoE/cli/exporter/wiki/handler.py +++ b/PyPoE/cli/exporter/wiki/handler.py @@ -37,6 +37,7 @@ # Python from difflib import unified_diff +from itertools import islice from queue import Empty, SimpleQueue from threading import Lock @@ -229,12 +230,15 @@ def handle_page(self, *a, row=None, rownum=None): if ("[DNT]" in text or "[UNUSED]" in text) and new: console("Found text marked as Do Not Translate. Skipping.") return - revisions = page.exists and [ - r["content"].splitlines() - for r in page.revisions(limit=2, prop="content|comment") - if not r["comment"].startswith("PyPoE/ExporterBot/") - ] - if revisions and new_lines in revisions: + rev1, rev2 = ( + islice(page.revisions(limit=2, prop="content|comment"), 2) + if page.exists + else [None, None] + ) + previous_revision = ( + page.exists and not rev1["comment"].startswith("PyPoE/ExporterBot/") and rev2["*"] + ) + if previous_revision == new_lines: console( f"Update to {pdata['page']} would be a manual revert, skipping this row.", msg=Msg.warning,