From b5fa5054c9ea71c05dc9bc8380d4b66effa5933e Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Mon, 20 May 2024 14:10:30 +0300 Subject: [PATCH] Fix pylint errors (false positives) The errors were ************* Module linkcheck.ansicolor linkcheck/ansicolor.py:190:21: E0606: Possibly using variable 'WinColor' before assignment (possibly-used-before-assignment) ************* Module linkcheck.plugins.locationinfo linkcheck/plugins/locationinfo.py:107:12: E0606: Possibly using variable 'geoip_error' before assignment (possibly-used-before-assignment) and while it's true that the variables (WinColor, geoip_error) are assigned conditionally, their use is protected (indirectly) by the same conditionals. --- linkcheck/ansicolor.py | 4 ++++ linkcheck/plugins/locationinfo.py | 1 + 2 files changed, 5 insertions(+) diff --git a/linkcheck/ansicolor.py b/linkcheck/ansicolor.py index beb1c840..6913702c 100644 --- a/linkcheck/ansicolor.py +++ b/linkcheck/ansicolor.py @@ -159,6 +159,10 @@ if os.name == 'nt': Cyan: colorama.CYAN, White: colorama.GREY, } +else: + WinColor = { + None: None, + } # pc speaker beep escape code Beep = "\007" diff --git a/linkcheck/plugins/locationinfo.py b/linkcheck/plugins/locationinfo.py index 8b835bb3..9b3b32a8 100644 --- a/linkcheck/plugins/locationinfo.py +++ b/linkcheck/plugins/locationinfo.py @@ -69,6 +69,7 @@ def get_geoip_dat(): # try importing both the C-library GeoIP and the pure-python pygeoip geoip_dat = get_geoip_dat() geoip = None +geoip_error = None if geoip_dat: try: import GeoIP