From 524b377e9e750417d20c87670273d28c97d04a05 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 24 Sep 2019 13:10:46 +0100 Subject: [PATCH] python: fix use of undeclared variables in python scripts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit docs/apibuild.py:2436:65: F821 undefined name 'first_letter' chunks.append(["chunk%s" % (chunk - 1), first_letter, letter]) ^ src/hyperv/hyperv_wmi_generator.py:415:57: F821 undefined name 'number' report_error("line %d: invalid block header" % (number)) ^ Signed-off-by: Daniel P. Berrangé --- build-aux/syntax-check.mk | 2 -- docs/apibuild.py | 1 + src/hyperv/hyperv_wmi_generator.py | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 492cc79b72..221c581a31 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -888,7 +888,6 @@ FLAKE8_WHITESPACE = E211,E221,E222,E225,E226,E231,E261 FLAKE8_BLANK_LINES = E301,E302,E303,E305 FLAKE8_LINE_LENGTH = E501 FLAKE8_STATEMENTS = E722,E741 -FLAKE8_ERRORS = F821 FLAKE8_WARNINGS = W504,W605 FLAKE8_IGNORE = $(FLAKE8_INDENTATION),$\ @@ -896,7 +895,6 @@ FLAKE8_IGNORE = $(FLAKE8_INDENTATION),$\ $(FLAKE8_BLANK_LINES),$\ $(FLAKE8_LINE_LENGTH),$\ $(FLAKE8_STATEMENTS),$\ - $(FLAKE8_ERRORS),$\ $(FLAKE8_WARNINGS) \ $(NULL) diff --git a/docs/apibuild.py b/docs/apibuild.py index 26bdb7e890..20ce926ae8 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -2401,6 +2401,7 @@ class docBuilder: count = 0 chunk = 0 chunks = [] + first_letter = None for id in typ: if len(index[id]) > 30: continue diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py index c3cd39cc76..fe0ba66759 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -407,7 +407,7 @@ def report_error(message): -def parse_class(block): +def parse_class(block, number): # expected format: class header_items = block[0][1].split() @@ -488,7 +488,7 @@ def main(): if block is not None: if line == "end": if block[0][1].startswith("class"): - parse_class(block) + parse_class(block, number) block = None else: -- 2.39.5