File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ write code that handles both IP versions correctly.
160160
161161 .. attribute :: is_global
162162
163- ``True `` if the address is allocated for private networks. See
163+ ``True `` if the address is allocated for public networks. See
164164 iana-ipv4-special-registry (for IPv4) or iana-ipv6-special-registry
165165 (for IPv6).
166166
Original file line number Diff line number Diff line change @@ -984,7 +984,7 @@ def is_private(self):
984984
985985 @property
986986 def is_global (self ):
987- """Test if this address is allocated for private networks.
987+ """Test if this address is allocated for public networks.
988988
989989 Returns:
990990 A boolean, True if the address is not reserved per
@@ -1233,6 +1233,7 @@ def is_reserved(self):
12331233 return self in reserved_network
12341234
12351235 @property
1236+ @functools .lru_cache ()
12361237 def is_private (self ):
12371238 """Test if this address is allocated for private networks.
12381239
@@ -1259,14 +1260,14 @@ def is_private(self):
12591260
12601261 @property
12611262 def is_global (self ):
1262- """Test if this address is allocated for private networks.
1263+ """Test if this address is allocated for public networks.
12631264
12641265 Returns:
12651266 A boolean, True if the address is not reserved per
12661267 iana-ipv4-special-registry.
12671268
12681269 """
1269- return not self .is_private
1270+ return self in IPv4Network ( '100.64.0.0/10' ) or not self .is_private
12701271
12711272
12721273 @property
@@ -1856,6 +1857,7 @@ def is_site_local(self):
18561857 return self in sitelocal_network
18571858
18581859 @property
1860+ @functools .lru_cache ()
18591861 def is_private (self ):
18601862 """Test if this address is allocated for private networks.
18611863
Original file line number Diff line number Diff line change @@ -1320,6 +1320,7 @@ def testReservedIpv4(self):
13201320 '127.42.0.0/16' ).is_loopback )
13211321 self .assertEqual (False , ipaddress .ip_network ('128.0.0.0' ).is_loopback )
13221322 self .assertEqual (True , ipaddress .ip_network ('100.64.0.0/10' ).is_private )
1323+ self .assertEqual (False , ipaddress .ip_network ('100.64.0.0/10' ).is_global )
13231324 self .assertEqual (True ,
13241325 ipaddress .ip_network ('192.0.2.128/25' ).is_private )
13251326 self .assertEqual (True ,
You can’t perform that action at this time.
0 commit comments