File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1017,20 +1017,21 @@ def is_multicast(self):
10171017
10181018 @staticmethod
10191019 def _is_subnet_of (a , b ):
1020- if not isinstance (a , _BaseNetwork ):
1021- raise TypeError (f"{ a } is not a network object" )
1022- if not isinstance (b , _BaseNetwork ):
1023- raise TypeError (f"{ b } is not a network object" )
1020+ # The caller must ensure that 'a' and 'b' are both networks.
10241021 _check_ip_version (a , b )
10251022 return (b .network_address <= a .network_address and
10261023 b .broadcast_address >= a .broadcast_address )
10271024
10281025 def subnet_of (self , other ):
10291026 """Return True if this network is a subnet of other."""
1027+ if not isinstance (other , _BaseNetwork ):
1028+ raise TypeError (f"{ other } is not a network object" )
10301029 return self ._is_subnet_of (self , other )
10311030
10321031 def supernet_of (self , other ):
10331032 """Return True if this network is a supernet of other."""
1033+ if not isinstance (other , _BaseNetwork ):
1034+ raise TypeError (f"{ other } is not a network object" )
10341035 return self ._is_subnet_of (other , self )
10351036
10361037 @property
You can’t perform that action at this time.
0 commit comments