Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
be9c1b13
Kaydet (Commit)
be9c1b13
authored
Eki 22, 2013
tarafından
Peter Moody
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#17400: fix documentation, add cache to is_global and correctly handle 100.64.0.0/10
üst
a4df90ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
ipaddress.rst
Doc/library/ipaddress.rst
+1
-1
ipaddress.py
Lib/ipaddress.py
+5
-3
test_ipaddress.py
Lib/test/test_ipaddress.py
+1
-0
No files found.
Doc/library/ipaddress.rst
Dosyayı görüntüle @
be9c1b13
...
...
@@ -160,7 +160,7 @@ write code that handles both IP versions correctly.
.. attribute:: is_global
``True`` if the address is allocated for p
rivate
networks. See
``True`` if the address is allocated for p
ublic
networks. See
iana-ipv4-special-registry (for IPv4) or iana-ipv6-special-registry
(for IPv6).
...
...
Lib/ipaddress.py
Dosyayı görüntüle @
be9c1b13
...
...
@@ -984,7 +984,7 @@ class _BaseNetwork(_IPAddressBase):
@property
def
is_global
(
self
):
"""Test if this address is allocated for p
rivate
networks.
"""Test if this address is allocated for p
ublic
networks.
Returns:
A boolean, True if the address is not reserved per
...
...
@@ -1233,6 +1233,7 @@ class IPv4Address(_BaseV4, _BaseAddress):
return
self
in
reserved_network
@property
@functools.lru_cache
()
def
is_private
(
self
):
"""Test if this address is allocated for private networks.
...
...
@@ -1259,14 +1260,14 @@ class IPv4Address(_BaseV4, _BaseAddress):
@property
def
is_global
(
self
):
"""Test if this address is allocated for p
rivate
networks.
"""Test if this address is allocated for p
ublic
networks.
Returns:
A boolean, True if the address is not reserved per
iana-ipv4-special-registry.
"""
return
not
self
.
is_private
return
self
in
IPv4Network
(
'100.64.0.0/10'
)
or
not
self
.
is_private
@property
...
...
@@ -1856,6 +1857,7 @@ class IPv6Address(_BaseV6, _BaseAddress):
return
self
in
sitelocal_network
@property
@functools.lru_cache
()
def
is_private
(
self
):
"""Test if this address is allocated for private networks.
...
...
Lib/test/test_ipaddress.py
Dosyayı görüntüle @
be9c1b13
...
...
@@ -1320,6 +1320,7 @@ class IpaddrUnitTest(unittest.TestCase):
'127.42.0.0/16'
)
.
is_loopback
)
self
.
assertEqual
(
False
,
ipaddress
.
ip_network
(
'128.0.0.0'
)
.
is_loopback
)
self
.
assertEqual
(
True
,
ipaddress
.
ip_network
(
'100.64.0.0/10'
)
.
is_private
)
self
.
assertEqual
(
False
,
ipaddress
.
ip_network
(
'100.64.0.0/10'
)
.
is_global
)
self
.
assertEqual
(
True
,
ipaddress
.
ip_network
(
'192.0.2.128/25'
)
.
is_private
)
self
.
assertEqual
(
True
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment