2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

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>
This commit is contained in:
Russell Bryant
2015-12-11 22:28:31 -05:00
parent e8049bc5e8
commit bdca6c4b56
16 changed files with 44 additions and 3 deletions

View File

@@ -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:

View File

@@ -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.

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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.

View File

@@ -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

View File

@@ -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