[ovs-dev] [PATCH v2 03/12] python: Fix invalid varable/function references.
Russell Bryant
russell at ovn.org
Tue Jan 5 19:58:56 UTC 2016
This code referred to "rows" where it meant to refer to "fetched_rows".
The patch resolves flake8 error:
F821 undefined name 'rows'
python/build/nroff.py used a function fatal() that was not defined,
which raised the same type of error.
Signed-off-by: Russell Bryant <russell at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>
---
Makefile.am | 2 +-
python/build/nroff.py | 7 +++++++
python/ovs/db/idl.py | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 50999e5..d224a39 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -343,7 +343,7 @@ endif
if HAVE_FLAKE8
ALL_LOCAL += flake8-check
flake8-check: $(FLAKE8_PYFILES)
- $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,F811,F821,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
+ $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
endif
include $(srcdir)/manpages.mk
diff --git a/python/build/nroff.py b/python/build/nroff.py
index 75461eb..674fdfe 100644
--- a/python/build/nroff.py
+++ b/python/build/nroff.py
@@ -13,6 +13,7 @@
# limitations under the License.
import re
+import sys
from ovs.db import error
@@ -108,6 +109,12 @@ def pre_to_nroff(nodes, para, font):
s += '\n.fi\n'
return s
+
+def fatal(msg):
+ sys.stderr.write('%s\n' % msg)
+ sys.exit(1)
+
+
def diagram_header_to_nroff(header_node):
header_fields = []
i = 0
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index c8990c7..f9fd928 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1221,7 +1221,7 @@ class Transaction(object):
if len(fetched_rows) != 1:
# XXX rate-limit
vlog.warn('"select" reply "rows" has %d elements '
- 'instead of 1' % len(rows))
+ 'instead of 1' % len(fetched_rows))
continue
fetched_row = fetched_rows[0]
if not Transaction.__check_json_type(fetched_row, (dict,),
--
2.5.0
More information about the dev
mailing list