XuNeo commented on PR #16257:
URL: https://github.com/apache/nuttx/pull/16257#issuecomment-2829920535

   ```
   > black --version
   black, 24.8.0 (compiled: yes)
   Python (CPython) 3.10.12
   
   # Then 
   > black tools/splashscreen_converter.py
   ```
   
   After run black to format the file locally from my side, it does report diff.
   ```diff
   diff --git a/tools/splashscreen_converter.py 
b/tools/splashscreen_converter.py
   index cd45f814b56..5d3488e3568 100755
   --- a/tools/splashscreen_converter.py
   +++ b/tools/splashscreen_converter.py
   @@ -27,7 +27,7 @@ def write_palette(outfile, palette, type):
            outfile.write("{\n")
   
            for i in range(0, len(palette), 4):
   -            for r, g, b, a in palette[i:i + 4]:
   +            for r, g, b, a in palette[i : i + 4]:
                    outfile.write("  MKRGB(%d, %d, %d, %d),\n" % (a, r, g, b))
   
            outfile.write("};\n")
   @@ -41,7 +41,7 @@ def write_palette(outfile, palette, type):
            outfile.write("{\n")
   
            for i in range(0, len(palette), 4):
   -            for r, g, b in palette[i:i + 4]:
   +            for r, g, b in palette[i : i + 4]:
                    outfile.write("  MKRGB(%d, %d, %d),\n" % (r, g, b))
   
            outfile.write("};\n")
   @@ -61,7 +61,7 @@ def quantize(color, palette):
        except ValueError:
            # No exact match, search for the closest
            def distance(color2):
   -            return sum([(a - b)**2 for a, b in zip(color, color2)])
   +            return sum([(a - b) ** 2 for a, b in zip(color, color2)])
   
        return palette.index(min(palette, key=distance))
   
   @@ -122,11 +122,23 @@ def write_descriptor(outfile, name):
        outfile.write("  %d," % img.width)
        lw = len(str(img.width))
        lh = len(str(img.height))
   -    outfile.write(("/* width in pixels                                    
*/\n").rjust(77 - lw, " "))
   +    outfile.write(
   +        ("/* width in pixels                                    
*/\n").rjust(
   +            77 - lw, " "
   +        )
   +    )
        outfile.write("  %d," % img.height)
   -    outfile.write(("/* height in pixels                                   
*/\n").rjust(77 - lh, " "))
   -    outfile.write("  palette,             /* Colour palette                 
                    */\n")
   -    outfile.write("  bitmap,              /* Pointer to the start of the 
RLE data               */\n")
   +    outfile.write(
   +        ("/* height in pixels                                   
*/\n").rjust(
   +            77 - lh, " "
   +        )
   +    )
   +    outfile.write(
   +        "  palette,             /* Colour palette                           
          */\n"
   +    )
   +    outfile.write(
   +        "  bitmap,              /* Pointer to the start of the RLE data     
          */\n"
   +    )
        outfile.write("};\n")
   
   
   @@ -153,7 +165,8 @@ if __name__ == "__main__":
        outfile = open(file, "w")
        palette_argb = get_palette(img)
        palette_rgb = get_palette(img.convert("RGB"))
   -    
outfile.write("""/****************************************************************************
   +    outfile.write(
   +        
"""/****************************************************************************
     * %(file)s
     *
     * SPDX-License-Identifier: Apache-2.0
   @@ -194,7 +207,8 @@ if __name__ == "__main__":
     * Private Data
     
****************************************************************************/
   
   -""" % {"file": path + "/" + filename, "src": os.path.relpath(sys.argv[1])}
   +"""
   +        % {"file": path + "/" + filename, "src": 
os.path.relpath(sys.argv[1])}
        )
   
        name = "splscr"
   @@ -207,9 +221,11 @@ if __name__ == "__main__":
        write_image(outfile, img.convert("L"), None, "GREY")
        write_image(outfile, img.convert("1"), None, "MONO")
        write_descriptor(outfile, name)
   -    outfile.write("""
   +    outfile.write(
   +        """
    
/****************************************************************************
     * Private Functions
     
****************************************************************************/
   -""")
   +"""
   +    )
        print("Created %s from %s" % (file, sys.argv[1]))
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to