MCPcopy Index your code
hub / github.com/python/cpython / _is_subnet_of

Method _is_subnet_of

Lib/ipaddress.py:1028–1037  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

1026
1027 @staticmethod
1028 def _is_subnet_of(a, b):
1029 try:
1030 # Always false if one is v4 and the other is v6.
1031 if a.version != b.version:
1032 raise TypeError(f"{a} and {b} are not of the same version")
1033 return (b.network_address <= a.network_address and
1034 b.broadcast_address >= a.broadcast_address)
1035 except AttributeError:
1036 raise TypeError(f"Unable to test subnet containment "
1037 f"between {a} and {b}")
1038
1039 def subnet_of(self, other):
1040 """Return True if this network is a subnet of other."""

Callers 2

subnet_ofMethod · 0.95
supernet_ofMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected