本文整理匯總了Python中netaddr.IPSet.isdisjoint方法的典型用法代碼示例。如果您正苦於以下問題:Python IPSet.isdisjoint方法的具體用法?Python IPSet.isdisjoint怎麽用?Python IPSet.isdisjoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類netaddr.IPSet
的用法示例。
在下文中一共展示了IPSet.isdisjoint方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_disjointed_ipsets
# 需要導入模塊: from netaddr import IPSet [as 別名]
# 或者: from netaddr.IPSet import isdisjoint [as 別名]
def test_disjointed_ipsets():
s1 = IPSet(['192.0.2.0', '192.0.2.1', '192.0.2.2'])
s2 = IPSet(['192.0.2.2', '192.0.2.3', '192.0.2.4'])
assert s1 & s2 == IPSet(['192.0.2.2/32'])
assert not s1.isdisjoint(s2)
s3 = IPSet(['192.0.2.0', '192.0.2.1'])
s4 = IPSet(['192.0.2.3', '192.0.2.4'])
assert s3 & s4 == IPSet([])
assert s3.isdisjoint(s4)