本文整理汇总了Python中netaddr.IPNetwork.__contains__方法的典型用法代码示例。如果您正苦于以下问题:Python IPNetwork.__contains__方法的具体用法?Python IPNetwork.__contains__怎么用?Python IPNetwork.__contains__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netaddr.IPNetwork
的用法示例。
在下文中一共展示了IPNetwork.__contains__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scanIPclosed
# 需要导入模块: from netaddr import IPNetwork [as 别名]
# 或者: from netaddr.IPNetwork import __contains__ [as 别名]
def scanIPclosed(self,result):
if result[0]:
# scan subnet outside ipv4.address/24
if result[1] == "address":
print "[Networkbrowser] got IP:",result[0]
self.setStatus('update')
net = IPNetwork('%s/24' % result[0])
localnet = IPNetwork('%s/%s' % (self._ipv4.address, self._ipv4.netmask))
if localnet.__contains__(net):
self._startScan(self.iface, net.cidr)
else:
for host in net.iter_hosts():
self._nrthreads += 1
reactor.callInThread(self.getNetworkIPs, str(host))
# add offline host
elif result[1] == "nfs":
self.networklist.append(NetworkItemHost(result[0], result[0], ['nfs']))
write_cache(self.cache_file, self.networklist)
self.updateNetworkList()