[ovs-dev,09/55] python: Fix several pep8 whitespace errors.
diff mbox

Message ID 1450730875-18083-10-git-send-email-russell@ovn.org
State Deferred
Headers show

Commit Message

Russell Bryant Dec. 21, 2015, 8:47 p.m. UTC
Fix the following pep8 errors:

  E201 whitespace after '('
  E203 whitespace before ','
  E226 missing whitespace around arithmetic operator
  E231 missing whitespace after ':'
  E241 multiple spaces after ':'
  E251 unexpected spaces around keyword / parameter equals
  E261 at least two spaces before inline comment
  E262 inline comment should start with '# '
  E265 block comment should start with '# '
  E271 multiple spaces after keyword

Signed-off-by: Russell Bryant <russell@ovn.org>
---
 python/ovs/daemon.py   |  2 --
 python/ovs/db/idl.py   |  2 +-
 python/ovs/json.py     |  2 +-
 python/ovs/jsonrpc.py  |  6 +++---
 python/ovs/stream.py   |  4 ++--
 python/ovs/vlog.py     |  2 +-
 python/ovstest/udp.py  |  2 +-
 python/ovstest/util.py | 12 ++++++------
 python/tox.ini         |  2 +-
 9 files changed, 16 insertions(+), 18 deletions(-)

Patch
diff mbox

diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py
index 1e84dd2..8847238 100644
--- a/python/ovs/daemon.py
+++ b/python/ovs/daemon.py
@@ -22,7 +22,6 @@  import time
 
 import ovs.dirs
 import ovs.fatal_signal
-#import ovs.lockfile
 import ovs.process
 import ovs.socket_util
 import ovs.timeval
@@ -254,7 +253,6 @@  def _fork_and_wait_for_startup():
         # Running in parent process.
         os.close(rfd)
         ovs.timeval.postfork()
-        #ovs.lockfile.postfork()
 
         global _daemonize_fd
         _daemonize_fd = wfd
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 3e4ca41..c50766c 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1090,7 +1090,7 @@  class Transaction(object):
         self._inc_column = column
 
     def _fetch(self, row, column_name):
-        self._fetch_requests.append({"row":row, "column_name":column_name})
+        self._fetch_requests.append({"row": row, "column_name": column_name})
 
     def _write(self, row, column, datum):
         assert row._changes is not None
diff --git a/python/ovs/json.py b/python/ovs/json.py
index c71c640..4e87726 100644
--- a/python/ovs/json.py
+++ b/python/ovs/json.py
@@ -153,7 +153,7 @@  def from_string(s):
 
 
 class Parser(object):
-    ## Maximum height of parsing stack. ##
+    # Maximum height of parsing stack. #
     MAX_HEIGHT = 1000
 
     def __init__(self, check_trailer=False):
diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py
index f2873a4..99aa27c 100644
--- a/python/ovs/jsonrpc.py
+++ b/python/ovs/jsonrpc.py
@@ -92,9 +92,9 @@  class Message(object):
             return "\"params\" must be JSON array"
 
         pattern = {Message.T_REQUEST: 0x11001,
-                   Message.T_NOTIFY:  0x11000,
-                   Message.T_REPLY:   0x00101,
-                   Message.T_ERROR:   0x00011}.get(self.type)
+                   Message.T_NOTIFY: 0x11000,
+                   Message.T_REPLY: 0x00101,
+                   Message.T_ERROR: 0x00011}.get(self.type)
         if pattern is None:
             return "invalid JSON-RPC message type %s" % self.type
 
diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index 1af9253..42bc4cc 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -352,8 +352,8 @@  class UnixStream(Stream):
     @staticmethod
     def _open(suffix, dscp):
         connect_path = suffix
-        return  ovs.socket_util.make_unix_socket(socket.SOCK_STREAM,
-                                                 True, None, connect_path)
+        return ovs.socket_util.make_unix_socket(socket.SOCK_STREAM,
+                                                True, None, connect_path)
 Stream.register_method("unix", UnixStream)
 
 
diff --git a/python/ovs/vlog.py b/python/ovs/vlog.py
index d5741a6..70d0738 100644
--- a/python/ovs/vlog.py
+++ b/python/ovs/vlog.py
@@ -130,7 +130,7 @@  class Vlog:
         matches = formatting.match(match)
         # Do we need to apply padding?
         if not matches.group(1) and replace != "":
-            replace = replace.center(len(replace)+2)
+            replace = replace.center(len(replace) + 2)
         # Does the field have a minimum width
         if matches.group(2):
             min_width = int(matches.group(2))
diff --git a/python/ovstest/udp.py b/python/ovstest/udp.py
index fa03e74..d6e6162 100644
--- a/python/ovstest/udp.py
+++ b/python/ovstest/udp.py
@@ -60,7 +60,7 @@  class UdpSender(DatagramProtocol):
     def startProtocol(self):
         self.looper = LoopingCall(self.sendData)
         period = self.duration / float(self.count)
-        self.looper.start(period , now = False)
+        self.looper.start(period, now=False)
 
     def stopProtocol(self):
         if (self.looper is not None):
diff --git a/python/ovstest/util.py b/python/ovstest/util.py
index d61e4ba..16c012e 100644
--- a/python/ovstest/util.py
+++ b/python/ovstest/util.py
@@ -43,7 +43,7 @@  def get_interface_mtu(iface):
     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     indata = iface + ('\0' * (32 - len(iface)))
     try:
-        outdata = fcntl.ioctl(s.fileno(), 0x8921, indata) #  socket.SIOCGIFMTU
+        outdata = fcntl.ioctl(s.fileno(), 0x8921, indata)  # socket.SIOCGIFMTU
         mtu = struct.unpack("16si12x", outdata)[1]
     except:
         return 0
@@ -60,7 +60,7 @@  def get_interface(address):
     names = array.array('B', '\0' * bytes)
     outbytes = struct.unpack('iL', fcntl.ioctl(
         s.fileno(),
-        0x8912, # SIOCGIFCONF
+        0x8912,  # SIOCGIFCONF
         struct.pack('iL', bytes, names.buffer_info()[0])
     ))[0]
     namestr = names.tostring()
@@ -80,9 +80,9 @@  def uname():
 def start_process(args):
     try:
         p = subprocess.Popen(args,
-            stdin = subprocess.PIPE,
-            stdout = subprocess.PIPE,
-            stderr = subprocess.PIPE)
+                             stdin=subprocess.PIPE,
+                             stdout=subprocess.PIPE,
+                             stderr=subprocess.PIPE)
         out, err = p.communicate()
         return (p.returncode, out, err)
     except exceptions.OSError:
@@ -186,7 +186,7 @@  def start_local_server(port):
     p = subprocess.Popen(["ovs-test", "-s", str(port)],
                          stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                          preexec_fn=sigint_intercept)
-    fcntl.fcntl( p.stdout.fileno(),fcntl.F_SETFL,
+    fcntl.fcntl(p.stdout.fileno(), fcntl.F_SETFL,
         fcntl.fcntl(p.stdout.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
 
     while p.poll() is None:
diff --git a/python/tox.ini b/python/tox.ini
index 625dd12..392870c 100644
--- a/python/tox.ini
+++ b/python/tox.ini
@@ -16,5 +16,5 @@  deps = -r{toxinidir}/requirements.txt
 commands = flake8
 
 [flake8]
-ignore=E111,E113,E126,E127,E128,E129,E131,E201,E203,E226,E231,E241,E251,E261,E262,E265,E271
+ignore=E111,E113,E126,E127,E128,E129,E131
 exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build