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
b95c6341
Kaydet (Commit)
b95c6341
authored
May 23, 2012
tarafından
Sandro Tosi
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14814: minor improvements as suggested by Hynek Schlawack
üst
876ecad9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
ipaddress.py
Lib/ipaddress.py
+9
-6
No files found.
Lib/ipaddress.py
Dosyayı görüntüle @
b95c6341
#!/usr/bin/python3
#
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
#
...
...
@@ -146,6 +144,7 @@ def ip_interface(address, version=None):
The IPv?Interface classes describe an Address on a particular
Network, so they're basically a combination of both the Address
and Network classes.
"""
if
version
is
not
None
:
if
version
==
4
:
...
...
@@ -181,6 +180,7 @@ def v4_int_to_packed(address):
Raises:
ValueError: If the integer is negative or too large to be an
IPv4 IP address.
"""
try
:
return
struct
.
pack
(
'!I'
,
address
)
...
...
@@ -196,6 +196,7 @@ def v6_int_to_packed(address):
Returns:
The integer address packed as 16 bytes in network (big-endian) order.
"""
try
:
return
struct
.
pack
(
'!QQ'
,
address
>>
64
,
address
&
(
2
**
64
-
1
))
...
...
@@ -221,6 +222,7 @@ def _find_address_range(addresses):
break
return
(
first
,
last
)
def
_get_prefix_length
(
number1
,
number2
,
bits
):
"""Get the number of leading bits that are same for two numbers.
...
...
@@ -238,6 +240,7 @@ def _get_prefix_length(number1, number2, bits):
return
bits
-
i
return
0
def
_count_righthand_zero_bits
(
number
,
bits
):
"""Count the number of zero bits on the right hand side.
...
...
@@ -319,6 +322,7 @@ def summarize_address_range(first, last):
first_int
=
current
+
1
first
=
ip_address
(
first_int
,
version
=
first
.
_version
)
def
_collapse_addresses_recursive
(
addresses
):
"""Loops through the addresses, collapsing concurrent netblocks.
...
...
@@ -632,8 +636,8 @@ class _BaseNetwork(_IPAddressBase):
def
hosts
(
self
):
"""Generate Iterator over usable hosts in a network.
This is like __iter__ except it doesn't return the network
or broadcast addresses.
This is like __iter__ except it doesn't return the network
or broadcast addresses.
"""
cur
=
int
(
self
.
network_address
)
+
1
...
...
@@ -1965,8 +1969,7 @@ class _BaseV6(object):
class
IPv6Address
(
_BaseV6
,
_BaseAddress
):
"""Represent and manipulate single IPv6 Addresses.
"""
"""Represent and manipulate single IPv6 Addresses."""
def
__init__
(
self
,
address
):
"""Instantiate a new IPv6 address object.
...
...
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