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

Method dump

util/IPAddress.py:67–78  ·  view source on GitHub ↗
(self, first, last)

Source from the content-addressed store, hash-verified

65 return countryAddr + text_(" ") + areaAddr
66
67 def dump(self, first, last):
68 if last > self.indexCount:
69 last = self.indexCount
70 for index in range(first, last):
71 offset = self.firstIndex + index * 7
72 self.ipdb.seek(offset)
73 buf = self.ipdb.read(7)
74 (ip, of1, of2) = struct.unpack("IHB", buf)
75 address = self.getAddr(of1 + (of2 << 16))
76 # 把GBK转为utf-8
77 address = text_(address, 'gbk').encode("utf-8")
78 logger.info("%d %s %s" % (index, self.ip2str(ip), address))
79
80 def setIpRange(self, index):
81 offset = self.firstIndex + index * 7

Callers

nothing calls this directly

Calls 3

getAddrMethod · 0.95
ip2strMethod · 0.95
text_Function · 0.90

Tested by

no test coverage detected