def __init__(self, arg): if isinstance(arg, bytes): nbytes = self.iptype.bits // 8 arg = { 'ip': self.iptype.from_bytes(arg[:nbytes], 'big'), 'port': int.from_bytes(arg[nbytes:], 'big') } TypedDict.__init__(self, arg)
def __init__(self, arg): """Accept bytes or dict representations""" if isinstance(arg, bytes): nbytes = self.iptype.bits // 8 arg = { 'ip': self.iptype.from_bytes(arg[:nbytes], 'big'), 'port': int.from_bytes(arg[nbytes:], 'big') } TypedDict.__init__(self, arg)
def __init__(self, arg): """Accept bytes or dict representations""" if isinstance(arg, bytes): nbytes = self.iptype.bits // 8 arg = {"ip": self.iptype.from_bytes(arg[:nbytes], "big"), "port": int.from_bytes(arg[nbytes:], "big")} TypedDict.__init__(self, arg)
def __init__(self, arg): if isinstance(arg, bytes): nbytes = self.iptype.bits // 8 arg = {'ip': self.iptype.from_bytes(arg[:nbytes], 'big'), 'port': int.from_bytes(arg[nbytes:], 'big')} TypedDict.__init__(self, arg)