diff options
author | Eugene Kliuchnikov <eustas.ru@gmail.com> | 2021-08-31 14:07:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 14:07:17 +0200 |
commit | 0e42caf3591d09d156c2b35462bc91a04e903b39 (patch) | |
tree | ab1c59f14b2fd82bfd9765ce99784bad903a6755 /scripts/dictionary | |
parent | 68f1b90ad0d204907beb58304d0bd06391001a4d (diff) | |
download | brotli-0e42caf3591d09d156c2b35462bc91a04e903b39.zip brotli-0e42caf3591d09d156c2b35462bc91a04e903b39.tar.gz brotli-0e42caf3591d09d156c2b35462bc91a04e903b39.tar.bz2 |
Migrate to github actions (#920)
Not all combinations are migrated to the initial configuration; corresponding TODOs added.
Drive-by: additional combinations uncovered minor portability problems -> fixed
Drive-by: remove no-longer used "script" files.
Co-authored-by: Eugene Kliuchnikov <eustas@chromium.org>
Diffstat (limited to 'scripts/dictionary')
-rw-r--r-- | scripts/dictionary/step-01-download-rfc.py | 2 | ||||
-rw-r--r-- | scripts/dictionary/step-02-rfc-to-bin.py | 2 | ||||
-rw-r--r-- | scripts/dictionary/step-03-validate-bin.py | 13 | ||||
-rw-r--r-- | scripts/dictionary/step-04-generate-java-literals.py | 11 |
4 files changed, 13 insertions, 15 deletions
diff --git a/scripts/dictionary/step-01-download-rfc.py b/scripts/dictionary/step-01-download-rfc.py index 14f65cc..04f9ccc 100644 --- a/scripts/dictionary/step-01-download-rfc.py +++ b/scripts/dictionary/step-01-download-rfc.py @@ -5,7 +5,7 @@ import urllib2 -response = urllib2.urlopen('https://tools.ietf.org/rfc/rfc7932.txt') +response = urllib2.urlopen("https://tools.ietf.org/rfc/rfc7932.txt") text = response.read() path = "rfc7932.txt" diff --git a/scripts/dictionary/step-02-rfc-to-bin.py b/scripts/dictionary/step-02-rfc-to-bin.py index 27737c5..ddf255a 100644 --- a/scripts/dictionary/step-02-rfc-to-bin.py +++ b/scripts/dictionary/step-02-rfc-to-bin.py @@ -19,7 +19,7 @@ for line in lines: if re_data_line.match(line) is not None: data = line.strip() for i in range(32): - dictionary.append(int(data[2 * i : 2 * i + 2], 16)) + dictionary.append(int(data[2 * i:2 * i + 2], 16)) if len(dictionary) == 122784: break else: diff --git a/scripts/dictionary/step-03-validate-bin.py b/scripts/dictionary/step-03-validate-bin.py index 171cc9b..b52e614 100644 --- a/scripts/dictionary/step-03-validate-bin.py +++ b/scripts/dictionary/step-03-validate-bin.py @@ -10,6 +10,7 @@ bin_path = "dictionary.bin" with open(bin_path, "rb") as raw: data = raw.read() + def check_digest(name, expected, actual): if expected == actual: print("[OK] " + name) @@ -22,15 +23,11 @@ check_digest( "0x5136cb04", hex(zlib.crc32(data))) -check_digest( - "MD5", - "96cecd2ee7a666d5aa3627d74735b32a", - hashlib.md5(data).hexdigest()) +check_digest("MD5", "96cecd2ee7a666d5aa3627d74735b32a", + hashlib.md5(data).hexdigest()) -check_digest( - "SHA1", - "72b41051cb61a9281ba3c4414c289da50d9a7640", - hashlib.sha1(data).hexdigest()) +check_digest("SHA1", "72b41051cb61a9281ba3c4414c289da50d9a7640", + hashlib.sha1(data).hexdigest()) check_digest( "SHA256", diff --git a/scripts/dictionary/step-04-generate-java-literals.py b/scripts/dictionary/step-04-generate-java-literals.py index c235f25..d864542 100644 --- a/scripts/dictionary/step-04-generate-java-literals.py +++ b/scripts/dictionary/step-04-generate-java-literals.py @@ -1,6 +1,6 @@ # Step 04 - generate Java literals. # -# Java byte-code has ridiculous restrictions. There is no such thing as +# Java byte-code has severe restrictions. There is no such thing as # "array literal" - those are implemented as series of data[x] = y; # as a consequence N-byte array will use 7N bytes in class, plus N bytes # in instantiated variable. Also no literal could be longer than 64KiB. @@ -17,7 +17,7 @@ try: unichr # Python 2 -except NameError +except NameError: unichr = chr # Python 3 bin_path = "dictionary.bin" @@ -49,8 +49,9 @@ for b in data: cntr = skip_flip_offset + 1 hi.append(unichr(cntr)) -low0 = low[0 : len(low) // 2] -low1 = low[len(low) // 2 : len(low)] +low0 = low[0:len(low) // 2] +low1 = low[len(low) // 2:len(low)] + def escape(chars): result = [] @@ -68,7 +69,7 @@ def escape(chars): elif ord(c) < 32 or ord(c) >= 127: result.append("\\u%04X" % ord(c)) else: - result.append(c); + result.append(c) return result |