Skip to content
Snippets Groups Projects
Unverified Commit 91c8760e authored by Jakob Haufe's avatar Jakob Haufe
Browse files

Fix code style

parent 3ab773d8
Branches
No related tags found
No related merge requests found
Pipeline #3990 passed
...@@ -3,21 +3,26 @@ import sys ...@@ -3,21 +3,26 @@ import sys
try: try:
import crc16 import crc16
crcfun = crc16.crc16xmodem crcfun = crc16.crc16xmodem
except ImportError: except ImportError:
try: try:
import crcmod import crcmod
crcfun = crcmod.predefined.mkCrcFun('xmodem')
crcfun = crcmod.predefined.mkCrcFun("xmodem")
except ImportError: except ImportError:
try: try:
import crcelk import crcelk
crcfun = crcelk.CRC_XMODEM.calc_bytes crcfun = crcelk.CRC_XMODEM.calc_bytes
except ImportError: except ImportError:
raise Exception('Could not find a CRC implementation. Tried: crc16, crcmod, crcelk.') raise Exception(
"Could not find a CRC implementation. Tried: crc16, crcmod, crcelk."
)
def main(): def main():
data = open(sys.argv[1], 'rb').read() data = open(sys.argv[1], "rb").read()
crc = crcfun(data) crc = crcfun(data)
# print(crc) # print(crc)
...@@ -26,7 +31,7 @@ def main(): ...@@ -26,7 +31,7 @@ def main():
crc = crcfun(padded) crc = crcfun(padded)
# print(crc) # print(crc)
open(sys.argv[1], 'wb').write(padded) open(sys.argv[1], "wb").write(padded)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment