python: Resolve pep8 blank line errors.
authorRussell Bryant <russell@ovn.org>
Sat, 12 Dec 2015 03:28:31 +0000 (22:28 -0500)
committerRussell Bryant <russell@ovn.org>
Tue, 5 Jan 2016 23:13:47 +0000 (18:13 -0500)
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>
16 files changed:
Makefile.am
ofproto/ipfix-gen-entities
python/build/nroff.py
python/ovs/poller.py
python/ovs/timeval.py
python/ovs/unixctl/__init__.py
python/ovs/unixctl/server.py
python/ovstest/args.py
python/ovstest/tests.py
python/ovstest/vswitch.py
tests/MockXenAPI.py
tests/test-unix-socket.py
tests/test-unixctl.py
utilities/ovs-pcap.in
vtep/ovs-vtep
xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync

index d224a39..030021c 100644 (file)
@@ -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,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,E501,E502,E703,E711,E713,E721,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
 endif
 
 include $(srcdir)/manpages.mk
index 7cd0b03..6fd76b1 100755 (executable)
@@ -13,6 +13,7 @@ import sys
 import xml.sax
 import xml.sax.handler
 
+
 class IpfixEntityHandler(xml.sax.handler.ContentHandler):
 
     RECORD_FIELDS = ['name', 'dataType', 'elementId', 'status']
@@ -90,9 +91,11 @@ class IpfixEntityHandler(xml.sax.handler.ContentHandler):
         if self.current_field_name is not None:
             self.current_field_value.append(content)
 
+
 def print_ipfix_entity_macros(xml_file):
     xml.sax.parse(xml_file, IpfixEntityHandler())
 
+
 def usage(name):
     print """\
 %(name)s: IPFIX entity definition generator
index 674fdfe..58c006c 100644 (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:
index b67cfc5..f616126 100644 (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.
index a16bf60..9a0cf67 100644 (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
index 715f2db..c6484c4 100644 (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)
 
index 18e1cf2..c750fe9 100644 (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)
index e90db2a..4344979 100644 (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.
index 5d5a85f..26befef 100644 (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
index be66a2e..1c6726e 100644 (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
index cca1571..b8de4ee 100644 (file)
@@ -14,6 +14,7 @@
 
 import re
 
+
 def xapi_local():
     return Session()
 
@@ -97,6 +98,7 @@ class Pool(Table):
     def __init__(self):
         Table.__init__(self, Pool.__records)
 
+
 class VIF(Table):
     __records = ({"uuid": "6ab1b260-398e-49ba-827b-c7696108964c",
                   "other_config":
@@ -105,6 +107,7 @@ class VIF(Table):
     def __init__(self):
         Table.__init__(self, VIF.__records)
 
+
 class VM(Table):
     __records = ({"uuid": "fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8",
                   "other_config":
index f55f6c3..ebfa054 100644 (file)
@@ -20,6 +20,7 @@ import sys
 
 import ovs.socket_util
 
+
 def main(argv):
     if len(argv) not in (2, 3):
         sys.stderr.write("usage: %s SOCKETNAME1 [SOCKETNAME2]", argv[0])
@@ -52,5 +53,6 @@ def main(argv):
                                                       os.strerror(error)))
         sys.exit(1)
 
+
 if __name__ == '__main__':
     main(sys.argv)
index ab03479..49a3b61 100644 (file)
@@ -22,6 +22,7 @@ import ovs.unixctl.server
 vlog = ovs.vlog.Vlog("test-unixctl")
 exiting = False
 
+
 def unixctl_exit(conn, unused_argv, aux):
     assert aux == "aux_exit"
     global exiting
index 5306480..5253c31 100755 (executable)
@@ -19,9 +19,11 @@ import getopt
 import struct
 import sys
 
+
 class PcapException(Exception):
     pass
 
+
 class PcapReader(object):
     def __init__(self, file_name):
         self.file = open(file_name, "rb")
@@ -53,6 +55,7 @@ class PcapReader(object):
         return packet
 argv0 = sys.argv[0]
 
+
 def usage():
     print """\
 %(argv0)s: print pcap file packet data as hex
index 9b6799e..1811e29 100755 (executable)
@@ -49,6 +49,7 @@ tun_id = 0
 bfd_bridge = "vtep_bfd"
 bfd_ref = {}
 
+
 def call_prog(prog, args_list):
     cmd = [prog, "-vconsole:off"] + args_list
     output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
@@ -58,12 +59,15 @@ def call_prog(prog, args_list):
         output = output[0].strip()
     return output
 
+
 def ovs_vsctl(args):
     return call_prog("ovs-vsctl", shlex.split(args))
 
+
 def ovs_ofctl(args):
     return call_prog("ovs-ofctl", shlex.split(args))
 
+
 def vtep_ctl(args):
     return call_prog("vtep-ctl", shlex.split(args))
 
@@ -325,6 +329,7 @@ class Logical_Switch(object):
         self.update_remote_macs()
         self.update_stats()
 
+
 def get_vtep_tunnel(remote_ip):
     # Get the physical_locator record for the local tunnel end point.
     column = vtep_ctl("--columns=_uuid find physical_locator "
@@ -346,6 +351,7 @@ def get_vtep_tunnel(remote_ip):
 
     return (local, remote, tunnel)
 
+
 def create_vtep_tunnel(remote_ip):
     local, remote, tunnel = get_vtep_tunnel(remote_ip)
     if not local or not remote:
@@ -359,6 +365,7 @@ def create_vtep_tunnel(remote_ip):
                           %(ps_name, local, remote))
     return tunnel
 
+
 def destroy_vtep_tunnel(remote_ip):
     local, remote, tunnel = get_vtep_tunnel(remote_ip)
     if tunnel:
@@ -368,6 +375,7 @@ def destroy_vtep_tunnel(remote_ip):
                  "-- --if-exists destroy tunnel %s"
                  % (ps_name, tunnel, tunnel))
 
+
 def add_bfd(remote_ip):
     # The VTEP emulator creates one OVS bridge for every logical switch.
     # Multiple logical switches can have multiple OVS tunnels to the
@@ -397,6 +405,7 @@ def add_bfd(remote_ip):
     # conditions, pass the responsibility of creating a 'tunnel' record
     # to run_bfd() which runs more often.
 
+
 def del_bfd(remote_ip):
     if remote_ip in bfd_ref:
         if bfd_ref[remote_ip] == 1:
@@ -408,6 +417,7 @@ def del_bfd(remote_ip):
         else:
             bfd_ref[remote_ip] -= 1
 
+
 def run_bfd():
     bfd_ports = ovs_vsctl("list-ports %s" % bfd_bridge).split()
     for port in bfd_ports:
@@ -475,6 +485,7 @@ def run_bfd():
                   bfd_lconf_default['bfd_config_local:bfd_dst_mac'],
                   bfd_dst_mac))
 
+
 def add_binding(binding, ls):
     vlog.info("adding binding %s" % binding)
 
@@ -516,6 +527,7 @@ def add_binding(binding, ls):
     ls.add_lbinding(lbinding)
     Bindings[binding] = ls.name
 
+
 def del_binding(binding, ls):
     vlog.info("removing binding %s" % binding)
 
@@ -545,6 +557,7 @@ def del_binding(binding, ls):
 
     del Bindings[binding]
 
+
 def handle_physical():
     # Gather physical ports except the patch ports we created
     ovs_ports = ovs_vsctl("list-ports %s" % ps_name).split()
@@ -582,7 +595,6 @@ def handle_physical():
 
             add_binding(binding, ls)
 
-
     dead_bindings = set(Bindings.keys()).difference(new_bindings)
     for binding in dead_bindings:
         ls_name = Bindings[binding]
@@ -596,6 +608,7 @@ def handle_physical():
             vtep_ctl("clear-local-macs %s" % Lswitches[ls_name].name)
             del Lswitches[ls_name]
 
+
 def setup():
     br_list = ovs_vsctl("list-br").split()
     if (ps_name not in br_list):
index cb1f175..583356c 100755 (executable)
@@ -87,6 +87,7 @@ def get_network_by_bridge(br_name):
 
     return None
 
+
 # There are possibilities when multiple xs-network-uuids are set for a bridge.
 # In cases like that, we should choose the bridge-id associated with the bridge
 # name.
@@ -101,6 +102,7 @@ def get_single_bridge_id(bridge_ids, br_name, default=None):
     xapi_down = True
     return default
 
+
 # By default, the "bridge-id" external id in the Bridge table is the
 # same as "xs-network-uuids".  This may be overridden by defining a
 # "nicira-bridge-id" key in the "other_config" field of the network