diff options
| author | Damien George <damien.p.george@gmail.com> | 2020-02-27 15:36:53 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2020-02-28 10:33:03 +1100 |
| commit | 69661f3343bedf86e514337cff63d96cc42f8859 (patch) | |
| tree | af5dfb380ffdb75dda84828f63cf9d840d992f0f /tools/make-frozen.py | |
| parent | 3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff) | |
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'tools/make-frozen.py')
| -rwxr-xr-x | tools/make-frozen.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/make-frozen.py b/tools/make-frozen.py index 8809fd0c8..a8706bf78 100755 --- a/tools/make-frozen.py +++ b/tools/make-frozen.py @@ -25,6 +25,7 @@ import os def module_name(f): return f + modules = [] if len(sys.argv) > 1: @@ -35,7 +36,7 @@ if len(sys.argv) > 1: for f in filenames: fullpath = dirpath + "/" + f st = os.stat(fullpath) - modules.append((fullpath[root_len + 1:], st)) + modules.append((fullpath[root_len + 1 :], st)) print("#include <stdint.h>") print("const char mp_frozen_str_names[] = {") @@ -62,8 +63,8 @@ for f, st in modules: # data. We could just encode all characters as hex digits but it's nice # to be able to read the resulting C code as ASCII when possible. - data = bytearray(data) # so Python2 extracts each byte as an integer - esc_dict = {ord('\n'): '\\n', ord('\r'): '\\r', ord('"'): '\\"', ord('\\'): '\\\\'} + data = bytearray(data) # so Python2 extracts each byte as an integer + esc_dict = {ord("\n"): "\\n", ord("\r"): "\\r", ord('"'): '\\"', ord("\\"): "\\\\"} chrs = ['"'] break_str = False for c in data: @@ -76,9 +77,9 @@ for f, st in modules: break_str = False chrs.append(chr(c)) else: - chrs.append('\\x%02x' % c) + chrs.append("\\x%02x" % c) break_str = True chrs.append('\\0"') - print(''.join(chrs)) + print("".join(chrs)) print("};") |
