You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/12/12 18:20:48 UTC
[incubator-nuttx-apps] branch master updated: Remove unneeded
semicolons and parentheses from Python files
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new db0b595 Remove unneeded semicolons and parentheses from Python files
db0b595 is described below
commit db0b595b4be5df56f60898664e2d6556b08218d9
Author: John Bampton <jb...@gmail.com>
AuthorDate: Sun Dec 13 02:53:21 2020 +1000
Remove unneeded semicolons and parentheses from Python files
---
examples/serialrx/send.py | 6 +++---
tools/bitmap_converter.py | 22 ++++++++++++----------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/examples/serialrx/send.py b/examples/serialrx/send.py
index 29477dc..a4d08d8 100644
--- a/examples/serialrx/send.py
+++ b/examples/serialrx/send.py
@@ -9,9 +9,9 @@ while len(s) < 11520:
s += "1"
print("Sending to %s" % sys.argv[1])
-while(True):
- f.write(s);
- f.flush();
+while True:
+ f.write(s)
+ f.flush()
#for i in range(len(s)):
# f.write(s[i])
# f.flush()
diff --git a/tools/bitmap_converter.py b/tools/bitmap_converter.py
index f71a0fa..44579e3 100755
--- a/tools/bitmap_converter.py
+++ b/tools/bitmap_converter.py
@@ -19,28 +19,28 @@ def get_palette(img, maxcolors = 255):
def write_palette(outfile, palette):
'''Write the palette (normal and highlight) to the output file.'''
- outfile.write('static const NXWidgets::nxwidget_pixel_t palette[BITMAP_PALETTESIZE] =\n');
+ outfile.write('static const NXWidgets::nxwidget_pixel_t palette[BITMAP_PALETTESIZE] =\n')
outfile.write('{\n')
for i in range(0, len(palette), 4):
- outfile.write(' ');
+ outfile.write(' ')
for r, g, b in palette[i:i+4]:
outfile.write('MKRGB(%3d,%3d,%3d), ' % (r, g, b))
- outfile.write('\n');
+ outfile.write('\n')
outfile.write('};\n\n')
- outfile.write('static const NXWidgets::nxwidget_pixel_t hilight_palette[BITMAP_PALETTESIZE] =\n');
+ outfile.write('static const NXWidgets::nxwidget_pixel_t hilight_palette[BITMAP_PALETTESIZE] =\n')
outfile.write('{\n')
for i in range(0, len(palette), 4):
- outfile.write(' ');
+ outfile.write(' ')
for r, g, b in palette[i:i+4]:
r = min(255, r + 50)
g = min(255, g + 50)
b = min(255, b + 50)
outfile.write('MKRGB(%3d,%3d,%3d), ' % (r, g, b))
- outfile.write('\n');
+ outfile.write('\n')
outfile.write('};\n\n')
@@ -54,7 +54,8 @@ def quantize(color, palette):
def distance(color2):
return sum([(a - b)**2 for a, b in zip(color, color2)])
- return palette.index(min(palette, key = distance));
+ return palette.index(min(palette, key = distance))
+
def encode_row(img, palette, y):
'''RLE-encode one row of image data.'''
@@ -81,8 +82,8 @@ def encode_row(img, palette, y):
def write_image(outfile, img, palette):
'''Write the image contents to the output file.'''
- outfile.write('static const NXWidgets::SRlePaletteBitmapEntry bitmap[] =\n');
- outfile.write('{\n');
+ outfile.write('static const NXWidgets::SRlePaletteBitmapEntry bitmap[] =\n')
+ outfile.write('{\n')
for y in range(0, img.size[1]):
entries = encode_row(img, palette, y)
@@ -97,7 +98,8 @@ def write_image(outfile, img, palette):
row += ' ' * (73 - len(row))
outfile.write(' ' + row + '/* Row %d */\n' % y)
- outfile.write('};\n\n');
+ outfile.write('};\n\n')
+
def write_descriptor(outfile, name):
'''Write the public descriptor structure for the image.'''