コード例 #1
0
ファイル: Rerequester.py プロジェクト: kaulie/BitTornado
 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
ファイル: Announce.py プロジェクト: dontnod/bittornado
 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
ファイル: Rerequester.py プロジェクト: kaulie/BitTornado
 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)