Mesa (main): u_format: Fix some pep8 in u_format_parse.py.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 3 00:44:43 UTC 2021


Module: Mesa
Branch: main
Commit: a7fdddb133ce676f6d3f5b2a5b0d5bcc47fdcc76
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7fdddb133ce676f6d3f5b2a5b0d5bcc47fdcc76

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 27 15:40:21 2021 -0700

u_format: Fix some pep8 in u_format_parse.py.

My editor likes to enforce pep8, here's some low hanging fruit so I don't
have to do too much add -p.

Acked-by: Adam Jackson <ajax at redhat.com>
Acked-by: Ilia Mirkin <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

---

 src/util/format/u_format_parse.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/util/format/u_format_parse.py b/src/util/format/u_format_parse.py
index b9627055cda..08d6f5eb7e2 100644
--- a/src/util/format/u_format_parse.py
+++ b/src/util/format/u_format_parse.py
@@ -45,7 +45,7 @@ ZS = 'zs'
 
 
 def is_pot(x):
-   return (x & (x - 1)) == 0
+    return (x & (x - 1)) == 0
 
 
 VERY_LARGE = 99999999999999999999999
@@ -53,8 +53,8 @@ VERY_LARGE = 99999999999999999999999
 
 class Channel:
     '''Describe the channel of a color channel.'''
-    
-    def __init__(self, type, norm, pure, size, name = ''):
+
+    def __init__(self, type, norm, pure, size, name=''):
         self.type = type
         self.norm = norm
         self.pure = pure
@@ -93,7 +93,7 @@ class Channel:
         if self.type == SIGNED:
             return (1 << (self.size - 1)) - 1
         assert False
-    
+
     def min(self):
         '''Minimum representable number.'''
         if self.type == FLOAT:
@@ -156,7 +156,7 @@ class Format:
             return None
         ref_channel = self.le_channels[0]
         if ref_channel.type == VOID:
-           ref_channel = self.le_channels[1]
+            ref_channel = self.le_channels[1]
         for channel in self.le_channels:
             if channel.size and (channel.size != ref_channel.size or channel.size % 8):
                 return None
@@ -177,7 +177,7 @@ class Format:
             return False
         ref_channel = self.le_channels[0]
         if ref_channel.type == VOID:
-           ref_channel = self.le_channels[1]
+            ref_channel = self.le_channels[1]
         for channel in self.le_channels[1:]:
             if channel.type != VOID:
                 if channel.type != ref_channel.type:
@@ -244,7 +244,7 @@ class Format:
                  for channel in self.le_channels
                  if channel.type != VOID]
         for x in pures:
-           assert x == pures[0]
+            assert x == pures[0]
         return pures[0]
 
     def channel_type(self):
@@ -252,7 +252,7 @@ class Format:
                  for channel in self.le_channels
                  if channel.type != VOID]
         for x in types:
-           assert x == types[0]
+            assert x == types[0]
         return types[0]
 
     def is_pure_signed(self):
@@ -293,6 +293,7 @@ _swizzle_parse_map = {
     '_': SWIZZLE_NONE,
 }
 
+
 def _parse_channels(fields, layout, colorspace, swizzles):
     if layout == PLAIN:
         names = ['']*4
@@ -341,6 +342,7 @@ def _parse_channels(fields, layout, colorspace, swizzles):
 
     return channels
 
+
 def parse(filename):
     '''Parse the format description in CSV format in terms of the
     Channel and Format classes above.'''
@@ -391,4 +393,3 @@ def parse(filename):
         format = Format(name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
         formats.append(format)
     return formats
-



More information about the mesa-commit mailing list