This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_fmtinner = ('',' ') * 3 + ('','-') + ('',' ') * 3 + ('','') | |
_fmtouter = (' ', ' |', '|') | |
def _mkhex(d, i): | |
try: | |
return '%02x' % (ord(d[i]),) | |
except IndexError: | |
return ' ' | |
def _mkchar(d, i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import ceil | |
# for example, inc=4 gives ln16, or the number of hexadecimal digits | |
# required to represent n. | |
def ln2(n, inc=1): | |
if n<0: | |
raise ValueError('math domain error') | |
i = 0 | |
n = int(ceil(n)) |
NewerOlder