summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRussell Bryant <russell@ovn.org>2015-12-11 22:28:31 -0500
committerRussell Bryant <russell@ovn.org>2016-01-05 18:13:47 -0500
commitbdca6c4b56b9951b95c02f1fc13cbc78b16eee28 (patch)
treecd1397a6b6a48e4dfac56e999d8a09d0e35578c4 /python
parente8049bc5e807bc7065462f60b703469915f8b4d5 (diff)
downloadopenvswitch-bdca6c4b56b9951b95c02f1fc13cbc78b16eee28.tar.gz
python: Resolve pep8 blank line errors.
Resolve pep8 errors E302 and E303: E302 expected 2 blank lines, found 1 E303 too many blank lines (3) Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'python')
-rw-r--r--python/build/nroff.py6
-rw-r--r--python/ovs/poller.py1
-rw-r--r--python/ovs/timeval.py3
-rw-r--r--python/ovs/unixctl/__init__.py1
-rw-r--r--python/ovs/unixctl/server.py1
-rw-r--r--python/ovstest/args.py2
-rw-r--r--python/ovstest/tests.py1
-rw-r--r--python/ovstest/vswitch.py1
8 files changed, 15 insertions, 1 deletions
diff --git a/python/build/nroff.py b/python/build/nroff.py
index 674fdfea3..58c006c1f 100644
--- a/python/build/nroff.py
+++ b/python/build/nroff.py
@@ -17,6 +17,7 @@ import sys
from ovs.db import error
+
def text_to_nroff(s, font=r'\fR'):
def escape(match):
c = match.group(0)
@@ -56,9 +57,11 @@ def text_to_nroff(s, font=r'\fR'):
s = re.sub('(-[0-9]|--|[-"\'\\\\.])', escape, s)
return s
+
def escape_nroff_literal(s, font=r'\fB'):
return font + r'%s\fR' % text_to_nroff(s, font)
+
def inline_xml_to_nroff(node, font, to_upper=False, newline='\n'):
if node.nodeType == node.TEXT_NODE:
if to_upper:
@@ -99,6 +102,7 @@ def inline_xml_to_nroff(node, font, to_upper=False, newline='\n'):
else:
raise error.Error("unknown node %s in inline xml" % node)
+
def pre_to_nroff(nodes, para, font):
# This puts 'font' at the beginning of each line so that leading and
# trailing whitespace stripping later doesn't removed leading spaces
@@ -168,6 +172,7 @@ def diagram_header_to_nroff(header_node):
text_s += "\n"
return pic_s, text_s
+
def diagram_to_nroff(nodes, para):
pic_s = ''
text_s = ''
@@ -210,6 +215,7 @@ fillval = .2
.RE
\\}"""
+
def block_xml_to_nroff(nodes, para='.PP'):
s = ''
for node in nodes:
diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index b67cfc578..f6161267d 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -35,6 +35,7 @@ POLLERR = 0x008
POLLHUP = 0x010
POLLNVAL = 0x020
+
# eventlet/gevent doesn't support select.poll. If select.poll is used,
# python interpreter is blocked as a whole instead of switching from the
# current thread that is about to block to other runnable thread.
diff --git a/python/ovs/timeval.py b/python/ovs/timeval.py
index a16bf60d4..9a0cf6762 100644
--- a/python/ovs/timeval.py
+++ b/python/ovs/timeval.py
@@ -52,6 +52,7 @@ except:
# Librt shared library could not be loaded
librt = None
+
def monotonic():
if not librt:
return time.time()
@@ -62,10 +63,12 @@ def monotonic():
# Kernel does not support CLOCK_MONOTONIC
return time.time()
+
# Use time.monotonic() if Python version >= 3.3
if not hasattr(time, 'monotonic'):
time.monotonic = monotonic
+
def msec():
""" Returns the system's monotonic time if possible, otherwise returns the
current time as the amount of time since the epoch, in milliseconds, as a
diff --git a/python/ovs/unixctl/__init__.py b/python/ovs/unixctl/__init__.py
index 715f2db5f..c6484c446 100644
--- a/python/ovs/unixctl/__init__.py
+++ b/python/ovs/unixctl/__init__.py
@@ -67,6 +67,7 @@ def command_register(name, usage, min_args, max_args, callback, aux):
commands[name] = _UnixctlCommand(usage, min_args, max_args, callback,
aux)
+
def socket_name_from_target(target):
assert isinstance(target, strtypes)
diff --git a/python/ovs/unixctl/server.py b/python/ovs/unixctl/server.py
index 18e1cf20b..c750fe920 100644
--- a/python/ovs/unixctl/server.py
+++ b/python/ovs/unixctl/server.py
@@ -135,6 +135,7 @@ def _unixctl_version(conn, unused_argv, version):
version = "%s (Open vSwitch) %s" % (ovs.util.PROGRAM_NAME, version)
conn.reply(version)
+
class UnixctlServer(object):
def __init__(self, listener):
assert isinstance(listener, ovs.stream.PassiveStream)
diff --git a/python/ovstest/args.py b/python/ovstest/args.py
index e90db2a53..434497974 100644
--- a/python/ovstest/args.py
+++ b/python/ovstest/args.py
@@ -24,6 +24,7 @@ import sys
CONTROL_PORT = 15531
DATA_PORT = 15532
+
def ip_address(string):
"""Verifies if string is a valid IP address"""
try:
@@ -246,6 +247,7 @@ def ovs_initialize_args():
'OuterIP.')
return parser.parse_args()
+
def l3_initialize_args():
"""
Initialize argument parsing for ovs-l3ping utility.
diff --git a/python/ovstest/tests.py b/python/ovstest/tests.py
index 5d5a85f28..26befef4e 100644
--- a/python/ovstest/tests.py
+++ b/python/ovstest/tests.py
@@ -139,7 +139,6 @@ def do_l3_tests(node1, node2, bandwidth, duration, ps, type):
server.del_bridge(DEFAULT_TEST_BRIDGE)
-
def do_vlan_tests(node1, node2, bandwidth, duration, ps, tag):
"""
Do VLAN tests between node1 and node2. Each node is given
diff --git a/python/ovstest/vswitch.py b/python/ovstest/vswitch.py
index be66a2ebd..1c6726ea0 100644
--- a/python/ovstest/vswitch.py
+++ b/python/ovstest/vswitch.py
@@ -33,6 +33,7 @@ def ovs_vsctl_del_bridge(bridge):
ret, _out, _err = util.start_process(["ovs-vsctl", "del-br", bridge])
return ret
+
def ovs_vsctl_del_pbridge(bridge, iface):
"""
This function deletes the OVS bridge and assigns the bridge IP address