In Python 3, the `hex' builtin function converts its operand to an
integer (using the new `__index__' special method) and then converts
that to hex, rather than calling a special method directly. The new
`bytes' type offers a `hex' method for conversion to hex, so we do the
same here.
def fromhex(x):
return ByteString(_unhexify(x))
fromhex = staticmethod(fromhex)
- def __hex__(me):
- return _hexify(me)
+ def hex(me): return _hexify(me)
+ __hex__ = hex
def __repr__(me):
- return 'bytes(%r)' % hex(me)
+ return 'bytes(%r)' % me.hex()
_augment(ByteString, _tmp)
ByteString.__hash__ = str.__hash__
bytes = ByteString.fromhex
pix = "pixie-py%d.%d%s" % (SYS.version_info[0],
SYS.version_info[1],
T.DEBUGP and "dbg" or "")
- me.token = hex(C.rand.block(8))
+ me.token = C.rand.block(8).hex()
try: OS.mkdir(OS.path.join("build", pix), int("700", 8))
except OSError:
if SYS.exc_info()[1].errno == E.EEXIST: pass