This sorts imports into sections: * From standard library * From other libraries * From the current project Each section is sorted alphabetically.
16 lines
330 B
Python
16 lines
330 B
Python
import re
|
|
from binascii import unhexlify
|
|
from struct import unpack
|
|
|
|
|
|
def assert_status(b):
|
|
s, = unpack('<H', b[:2])
|
|
if s != 0:
|
|
if s == 0x44f:
|
|
raise Exception('Signature validation failed: %04x' % s)
|
|
|
|
raise Exception('Failed: %04x' % s)
|
|
|
|
|
|
def unhex(x):
|
|
return unhexlify(re.sub('\W', '', x))
|