Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)