python: Resolve some indentation warnings.
authorRussell Bryant <russell@ovn.org>
Tue, 5 Jan 2016 19:50:40 +0000 (14:50 -0500)
committerRussell Bryant <russell@ovn.org>
Tue, 5 Jan 2016 23:18:21 +0000 (18:18 -0500)
This patch resolves the following warnings from flake8:

 E111 indentation is not a multiple of four
 E112 expected an indented block
 E113 unexpected indentation

It's critical to have correct indentation in Python code, so it seemed
worth enabling these warnings.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Makefile.am
ofproto/ipfix-gen-entities
python/ovs/daemon.py
python/ovs/db/idl.py
python/ovstest/rpcserver.py

index 044806f..b9b8e71 100644 (file)
@@ -342,9 +342,6 @@ endif
 
 if HAVE_FLAKE8
 ALL_LOCAL += flake8-check
-# E111 indentation is not a multiple of four
-# E112 expected an indented block
-# E113 unexpected indentation
 # E123 closing bracket does not match indentation of opening bracket's line
 # E126 continuation line over-indented for hanging indent
 # E127 continuation line over-indented for visual indent
@@ -353,7 +350,7 @@ ALL_LOCAL += flake8-check
 # E131 continuation line unaligned for hanging indent
 # E501 line too long (80 > 79 characters)
 flake8-check: $(FLAKE8_PYFILES)
-       $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E501 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
+       $(AM_V_GEN) if flake8 $^ --ignore=E123,E126,E127,E128,E129,E131,E501 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
 endif
 
 include $(srcdir)/manpages.mk
index 6fd76b1..11d2aaf 100755 (executable)
@@ -111,32 +111,27 @@ The following options are also available:
     sys.exit(0)
 
 if __name__ == '__main__':
-#    try:
-        try:
-            options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
-                                              ['help', 'version'])
-        except getopt.GetoptError, geo:
-            sys.stderr.write('%s: %s\n' % (sys.argv[0], geo.msg))
-            sys.exit(1)
-
-        for key, value in options:
-            if key in ['-h', '--help']:
-                usage()
-            elif key in ['-V', '--version']:
-                print 'ipfix-gen-entities (Open vSwitch)'
-            else:
-                sys.exit(0)
-
-        if len(args) != 1:
-            sys.stderr.write('%s: exactly 1 non-option arguments required '
-                             '(use --help for help)\n' % sys.argv[0])
-            sys.exit(1)
-
-        print_ipfix_entity_macros(args[0])
-
-#    except Exception, e:
-#        sys.stderr.write('%s: %s\n' % (sys.argv[0], e))
-#        sys.exit(1)
+    try:
+        options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
+                                          ['help', 'version'])
+    except getopt.GetoptError, geo:
+        sys.stderr.write('%s: %s\n' % (sys.argv[0], geo.msg))
+        sys.exit(1)
+
+    for key, value in options:
+        if key in ['-h', '--help']:
+            usage()
+        elif key in ['-V', '--version']:
+            print 'ipfix-gen-entities (Open vSwitch)'
+        else:
+            sys.exit(0)
+
+    if len(args) != 1:
+        sys.stderr.write('%s: exactly 1 non-option arguments required '
+                         '(use --help for help)\n' % sys.argv[0])
+        sys.exit(1)
+
+    print_ipfix_entity_macros(args[0])
 
 # Local variables:
 # mode: python
index 61355c4..e5e8858 100644 (file)
@@ -325,7 +325,7 @@ def _monitor_daemon(daemon_pid):
                 vlog.info("%s, exiting" % status_msg)
                 sys.exit(0)
 
-   # Running in new daemon process.
+    # Running in new daemon process.
 
 
 def _close_standard_fds():
index c6e0d38..5145032 100644 (file)
@@ -749,17 +749,26 @@ class Transaction(object):
        of Idl.change_seqno.  (Transaction.commit_block() calls Idl.run().)"""
 
     # Status values that Transaction.commit() can return.
-    UNCOMMITTED = "uncommitted"  # Not yet committed or aborted.
-    UNCHANGED = "unchanged"      # Transaction didn't include any changes.
-    INCOMPLETE = "incomplete"    # Commit in progress, please wait.
-    ABORTED = "aborted"          # ovsdb_idl_txn_abort() called.
-    SUCCESS = "success"          # Commit successful.
-    TRY_AGAIN = "try again"      # Commit failed because a "verify" operation
-                                 # reported an inconsistency, due to a network
-                                 # problem, or other transient failure.  Wait
-                                 # for a change, then try again.
-    NOT_LOCKED = "not locked"    # Server hasn't given us the lock yet.
-    ERROR = "error"              # Commit failed due to a hard error.
+
+    # Not yet committed or aborted.
+    UNCOMMITTED = "uncommitted"
+    # Transaction didn't include any changes.
+    UNCHANGED = "unchanged"
+    # Commit in progress, please wait.
+    INCOMPLETE = "incomplete"
+    # ovsdb_idl_txn_abort() called.
+    ABORTED = "aborted"
+    # Commit successful.
+    SUCCESS = "success"
+    # Commit failed because a "verify" operation
+    # reported an inconsistency, due to a network
+    # problem, or other transient failure.  Wait
+    # for a change, then try again.
+    TRY_AGAIN = "try again"
+    # Server hasn't given us the lock yet.
+    NOT_LOCKED = "not locked"
+    # Commit failed due to a hard error.
+    ERROR = "error"
 
     @staticmethod
     def status_to_string(status):
index 5c92014..80b9c4e 100644 (file)
@@ -359,9 +359,9 @@ def start_rpc_server(port):
     try:
         print "Starting RPC server\n"
         sys.stdout.flush()
-         # If this server was started from ovs-test client then we must flush
-         # STDOUT so that client would know that server is ready to accept
-         # XML RPC connections.
+        # If this server was started from ovs-test client then we must flush
+        # STDOUT so that client would know that server is ready to accept
+        # XML RPC connections.
         reactor.run()
     finally:
         rpc_server.cleanup()