[Mesa-dev] [PATCH 12/41] glapi: have only one statement per line in python files.

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 1 00:04:29 UTC 2016


One line if statements (if foo: break) are pretty uncommon, and are not
nearly as readable as their counterparts in other languages.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 src/mapi/glapi/gen/glX_XML.py        |  3 ++-
 src/mapi/glapi/gen/glX_proto_send.py |  9 ++++++---
 src/mapi/glapi/gen/glX_proto_size.py | 16 ++++++++++------
 src/mapi/glapi/gen/gl_XML.py         |  3 ++-
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py
index 580a241..a36d6ea 100644
--- a/src/mapi/glapi/gen/glX_XML.py
+++ b/src/mapi/glapi/gen/glX_XML.py
@@ -267,7 +267,8 @@ class glx_function(gl_XML.gl_function):
 
         temp = [[], [], []]
         for param in self.parameters:
-            if param.is_output: continue
+            if param.is_output:
+                continue
 
             if param.is_variable_length():
                 temp[2].append(param)
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index d2166d2..5ca0130 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -316,7 +316,8 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
         generated_stubs = []
 
         for func in api.functionIterateGlx():
-            if func.client_handcode: continue
+            if func.client_handcode:
+                continue
 
             # If the function is a pixel function with a certain
             # GLX protocol signature, create a fake stub function
@@ -834,7 +835,8 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
 
             print '}'
 
-        if trailer: print trailer
+        if trailer:
+            print trailer
 
     def printRenderFunction(self, f):
         # There is a class of GL functions that take a single pointer
@@ -887,7 +889,8 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
             print '__indirect_glFinish();'
             print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name)
 
-        if trailer: print trailer
+        if trailer:
+            print trailer
 
 
 class PrintGlxProtoInit_c(gl_XML.gl_print_base):
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index 9ece1e1..c73aaf4 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -455,10 +455,12 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
         enum_sigs = {}
 
         for func in api.functionIterateGlx():
-            if not func.has_variable_size_request(): continue
+            if not func.has_variable_size_request():
+                continue
 
             ef = glx_server_enum_function(func, api.enums_by_name)
-            if len(ef.enums) == 0: continue
+            if len(ef.enums) == 0:
+                continue
 
             sig = ef.signature()
 
@@ -476,8 +478,8 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
             # probably wouldn't need to be handcoded in the first
             # place!
 
-            if func.server_handcode: continue
-            if not func.has_variable_size_request(): continue
+            if func.server_handcode or not func.has_variable_size_request():
+                continue
 
             if enum_functions.has_key(func.name):
                 sig = enum_functions[func.name]
@@ -492,7 +494,8 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
                 self.printPixelFunction(func)
             elif func.has_variable_size_request():
                 a = self.printCountedFunction(func)
-                if a: aliases.append(a)
+                if a:
+                    aliases.append(a)
 
         for [alias_name, real_name] in aliases:
             print 'ALIAS( %s, %s )' % (alias_name, real_name)
@@ -581,7 +584,8 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
                 params.append(p)
             elif p.counter:
                 s = p.size()
-                if s == 0: s = 1
+                if s == 0:
+                    s = 1
 
                 sig += "(%u,%u)" % (f.offset_of(p.counter), s)
                 size += '%s%s' % (plus, p.size_string())
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index 74b5e5a..3a029cb 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -307,7 +307,8 @@ def create_parameter_string(parameters, include_names):
         else:
             list.append(p.type_string())
 
-    if len(list) == 0: list = ["void"]
+    if not list:
+        list = ["void"]
 
     return ', '.join(list)
 
-- 
2.8.0



More information about the mesa-dev mailing list