MCPcopy Index your code
hub / github.com/qiyeboy/IPProxyPool / getAddr

Method getAddr

util/IPAddress.py:42–65  ·  view source on GitHub ↗
(self, offset, ip=0)

Source from the content-addressed store, hash-verified

40 return self.getString(offset)
41
42 def getAddr(self, offset, ip=0):
43 self.ipdb.seek(offset + 4)
44 countryAddr = text_("")
45 areaAddr = text_("")
46 str = self.ipdb.read(1)
47 (byte,) = struct.unpack('B', str)
48 if byte == 0x01:
49 countryOffset = self.getLong3()
50 self.ipdb.seek(countryOffset)
51 str = self.ipdb.read(1)
52 (b,) = struct.unpack('B', str)
53 if b == 0x02:
54 countryAddr = self.getString(self.getLong3())
55 self.ipdb.seek(countryOffset + 4)
56 else:
57 countryAddr = self.getString(countryOffset)
58 areaAddr = self.getAreaAddr()
59 elif byte == 0x02:
60 countryAddr = self.getString(self.getLong3())
61 areaAddr = self.getAreaAddr(offset + 8)
62 else:
63 countryAddr = self.getString(offset + 4)
64 areaAddr = self.getAreaAddr()
65 return countryAddr + text_(" ") + areaAddr
66
67 def dump(self, first, last):
68 if last > self.indexCount:

Callers 2

dumpMethod · 0.95
getIpAddrMethod · 0.95

Calls 4

getLong3Method · 0.95
getStringMethod · 0.95
getAreaAddrMethod · 0.95
text_Function · 0.90

Tested by

no test coverage detected