mirror of
https://github.com/bazel-contrib/bazel-lib
synced 2024-12-01 07:15:24 +00:00
27 lines
490 B
Python
27 lines
490 B
Python
|
# python utility to seed the starlark constants in base64.bzl
|
||
|
|
||
|
print("")
|
||
|
print("CHAR_TO_INT = {")
|
||
|
for i in range(256):
|
||
|
print(" \"\{o}\": {i},".format(
|
||
|
o = oct(i)[2:],
|
||
|
i = i,
|
||
|
))
|
||
|
print("}")
|
||
|
|
||
|
print("")
|
||
|
print("INT_TO_CHAR = [")
|
||
|
for i in range(256):
|
||
|
print(" \"\{o}\",".format(
|
||
|
o = oct(i)[2:],
|
||
|
))
|
||
|
print("]")
|
||
|
|
||
|
print("")
|
||
|
print("INT_TO_BINARY = [")
|
||
|
for i in range(256):
|
||
|
print(" \"{b}\",".format(
|
||
|
b = "{:0>8}".format(bin(i)[2:])
|
||
|
))
|
||
|
print("]")
|