jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1096363?usp=email )

Change subject: IMPR: Do not redefine local variable within loop
......................................................................

IMPR: Do not redefine local variable within loop

Change-Id: I48a017a86556a0f115c033c69e03b149789e4486
---
M pywikibot/site/_siteinfo.py
M pywikibot/userinterfaces/terminal_interface_base.py
M scripts/coordinate_import.py
M scripts/protect.py
M scripts/weblinkchecker.py
5 files changed, 18 insertions(+), 18 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_siteinfo.py b/pywikibot/site/_siteinfo.py
index 5471959..b720aab 100644
--- a/pywikibot/site/_siteinfo.py
+++ b/pywikibot/site/_siteinfo.py
@@ -142,15 +142,15 @@
                               "one property is unknown: '{}'"
                               .format("', '".join(props)))
                 results = {}
-                for prop in props:
-                    results.update(self._get_siteinfo(prop, expiry))
+                for p in props:
+                    results.update(self._get_siteinfo(p, expiry))
                 return results
             raise

         result = {}
         if invalid_properties:
-            for prop in invalid_properties:
-                result[prop] = (EMPTY_DEFAULT, False)
+            for invalid_prop in invalid_properties:
+                result[invalid_prop] = (EMPTY_DEFAULT, False)
             pywikibot.log("Unable to get siprop(s) '{}'"
                           .format("', '".join(invalid_properties)))

diff --git a/pywikibot/userinterfaces/terminal_interface_base.py 
b/pywikibot/userinterfaces/terminal_interface_base.py
index 4f68dfe..b123ff8 100644
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -213,8 +213,8 @@
         # match.split() includes every regex group; for each matched color
         # fg_col:b_col, fg_col and bg_col are added to the resulting list.
         len_text_parts = len(text_parts[::4])
-        for index, (text, next_color) in enumerate(zip(text_parts[::4],
-                                                       text_parts[1::4])):
+        for index, (txt, next_color) in enumerate(zip(text_parts[::4],
+                                                      text_parts[1::4])):
             current_color = color_stack[-1]
             if next_color == 'previous':
                 if len(color_stack) > 1:  # keep the last element in the stack
@@ -226,15 +226,15 @@
             if current_color != next_color:
                 colored_line = True
             if colored_line and not colorized:
-                if '\n' in text:  # Normal end of line
-                    text = text.replace('\n', ' ***\n', 1)
+                if '\n' in txt:  # Normal end of line
+                    txt = txt.replace('\n', ' ***\n', 1)
                     colored_line = False
                 elif index == len_text_parts - 1:  # Or end of text
-                    text += ' ***'
+                    txt += ' ***'
                     colored_line = False

             # print the text up to the tag.
-            self._write(text, target_stream)
+            self._write(txt, target_stream)

             if current_color != next_color and colorized:
                 # set the new color, but only if they change
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index 3886ce6..a0cdba8 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -113,9 +113,9 @@
             return
         if page is None:
             # running over items, search in linked pages
-            for page in item.iterlinks():
-                if page.site.has_extension('GeoData') \
-                   and self.try_import_coordinates_from_page(page, item):
+            for p in item.iterlinks():
+                if p.site.has_extension('GeoData') \
+                   and self.try_import_coordinates_from_page(p, item):
                     break
             return

diff --git a/scripts/protect.py b/scripts/protect.py
index a6681af..8150148 100755
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -128,15 +128,15 @@
     first_char = []
     default_char = None
     num = 1
-    for level in levels:
-        for c in level:
+    for lev in levels:
+        for c in lev:
             if c not in first_char:
                 first_char.append(c)
                 break
         else:
             first_char.append(str(num))
             num += 1
-        if level == default:
+        if lev == default:
             default_char = first_char[-1]

     choice = pywikibot.input_choice(
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index c5c4842..14174b8 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -369,10 +369,10 @@
             error_report = f'* {url} ([{archive_url} archive])\n'
         else:
             error_report = f'* {url}\n'
-        for (page_title, date, error) in self.history_dict[url]:
+        for (page_title, date, err) in self.history_dict[url]:
             # ISO 8601 formulation
             iso_date = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(date))
-            error_report += f'** In [[{page_title}]] on {iso_date}, {error}\n'
+            error_report += f'** In [[{page_title}]] on {iso_date}, {err}\n'
         pywikibot.info('** Logging link for deletion.')
         txtfilename = pywikibot.config.datafilepath(
             'deadlinks',

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1096363?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I48a017a86556a0f115c033c69e03b149789e4486
Gerrit-Change-Number: 1096363
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to