@@ -876,7 +876,7 @@ def __bool__(self):
876
876
return True
877
877
878
878
879
- def parse_ip_network (module , addr , flags = 0 , expand = False ):
879
+ def parse_ip_network (module , addr , flags = 0 , * , expand_partial = False ):
880
880
if isinstance (addr , tuple ):
881
881
# CIDR integer tuple
882
882
if len (addr ) != 2 :
@@ -896,7 +896,7 @@ def parse_ip_network(module, addr, flags=0, expand=False):
896
896
val1 = addr
897
897
val2 = None
898
898
899
- if expand :
899
+ if expand_partial :
900
900
val1 = module .expand_partial_address (val1 )
901
901
902
902
ip = IPAddress (val1 , module .version , flags = INET_PTON )
@@ -972,7 +972,7 @@ class IPNetwork(BaseIP, IPListMixin):
972
972
973
973
__slots__ = ('_prefixlen' ,)
974
974
975
- def __init__ (self , addr , version = None , flags = 0 , expand = False ):
975
+ def __init__ (self , addr , version = None , flags = 0 , * , expand_partial = False ):
976
976
"""
977
977
Constructor.
978
978
@@ -990,14 +990,14 @@ def __init__(self, addr, version=None, flags=0, expand=False):
990
990
interpretation of the addr value. Currently only supports the
991
991
:data:`NOHOST` option.
992
992
993
- :param expand : (optional) decides whether partial address is
993
+ :param expand_partial : (optional) decides whether partial address is
994
994
expanded. Currently this is only effective for IPv4 address.
995
995
996
996
>>> IPNetwork('1.2.3.4/24')
997
997
IPNetwork('1.2.3.4/24')
998
998
>>> IPNetwork('1.2.3.4/24', flags=NOHOST)
999
999
IPNetwork('1.2.3.0/24')
1000
- >>> IPNetwork('10/24', expand =True)
1000
+ >>> IPNetwork('10/24', expand_partial =True)
1001
1001
IPNetwork('10.0.0.0/24')
1002
1002
"""
1003
1003
super (IPNetwork , self ).__init__ ()
@@ -1021,7 +1021,7 @@ def __init__(self, addr, version=None, flags=0, expand=False):
1021
1021
module = addr ._module
1022
1022
prefixlen = module .width
1023
1023
elif version == 4 :
1024
- value , prefixlen = parse_ip_network (_ipv4 , addr , flags , expand )
1024
+ value , prefixlen = parse_ip_network (_ipv4 , addr , flags , expand_partial = expand_partial )
1025
1025
module = _ipv4
1026
1026
elif version == 6 :
1027
1027
value , prefixlen = parse_ip_network (_ipv6 , addr , flags )
@@ -1031,7 +1031,9 @@ def __init__(self, addr, version=None, flags=0, expand=False):
1031
1031
raise ValueError ('%r is an invalid IP version!' % version )
1032
1032
try :
1033
1033
module = _ipv4
1034
- value , prefixlen = parse_ip_network (module , addr , flags , expand )
1034
+ value , prefixlen = parse_ip_network (
1035
+ module , addr , flags , expand_partial = expand_partial
1036
+ )
1035
1037
except AddrFormatError :
1036
1038
try :
1037
1039
module = _ipv6
0 commit comments