#NEWLINE# def __init__( self , address , strict = False ) : #NEWLINE# #INDENT# "Instantiate a new IPv6 Network object.\n\n        Args:\n            address: A string or integer representing the IPv6 network or the IP\n              and prefix/netmask.\n              '2001:4860::/128'\n              '2001:4860:0000:0000:0000:0000:0000:0000/128'\n              '2001:4860::'\n              are all functionally the same in IPv6.  That is to say,\n              failing to provide a subnetmask will create an object with\n              a mask of /128.\n\n              Additionally, an integer can be passed, so\n              IPv6Network('2001:4860::') ==\n                IPv6Network(42541956101370907050197289607612071936L).\n              or, more generally\n              IPv6Network(IPv6Network('2001:4860::')._ip) ==\n                IPv6Network('2001:4860::')\n\n            strict: A boolean. If true, ensure that we have been passed\n              A true network address, eg, 192.168.1.0/24 and not an\n              IP address on a network, eg, 192.168.1.1/24.\n\n        Raises:\n            AddressValueError: If address isn't a valid IPv6 address.\n            NetmaskValueError: If the netmask isn't valid for\n              an IPv6 address.\n            ValueError: If strict was True and a network address was not\n              supplied.\n\n        " #NEWLINE# _BaseNet . __init__ ( self , address ) #NEWLINE# _BaseV6 . __init__ ( self , address ) #NEWLINE# if isinstance ( address , ( int , long ) ) : #NEWLINE# #INDENT# self . _ip = address #NEWLINE# self . ip = IPv6Address ( self . _ip ) #NEWLINE# self . _prefixlen = self . _max_prefixlen #NEWLINE# self . netmask = IPv6Address ( self . _ALL_ONES ) #NEWLINE# if ( ( address < 0 ) or ( address > self . _ALL_ONES ) ) : #NEWLINE# #INDENT# raise AddressValueError ( address ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# if _compat_has_real_bytes : #NEWLINE# #INDENT# if ( isinstance ( address , bytes ) and ( len ( address ) == 16 ) ) : #NEWLINE# #INDENT# tmp = struct . unpack ( '!QQ' , address ) #NEWLINE# self . _ip = ( ( tmp [ 0 ] << 64 ) | tmp [ 1 ] ) #NEWLINE# self . ip = IPv6Address ( self . _ip ) #NEWLINE# self . _prefixlen = self . _max_prefixlen #NEWLINE# self . netmask = IPv6Address ( self . _ALL_ONES ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# addr = str ( address ) . split ( '/' ) #NEWLINE# if ( len ( addr ) > 2 ) : #NEWLINE# #INDENT# raise AddressValueError ( address ) #NEWLINE# #UNINDENT# if ( not self . _is_valid_ip ( addr [ 0 ] ) ) : #NEWLINE# #INDENT# raise AddressValueError ( addr [ 0 ] ) #NEWLINE# #UNINDENT# if ( len ( addr ) == 2 ) : #NEWLINE# #INDENT# if self . _is_valid_netmask ( addr [ 1 ] ) : #NEWLINE# #INDENT# self . _prefixlen = int ( addr [ 1 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NetmaskValueError ( addr [ 1 ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . _prefixlen = self . _max_prefixlen #NEWLINE# #UNINDENT# self . netmask = IPv6Address ( self . _ip_int_from_prefix ( self . _prefixlen ) ) #NEWLINE# self . _ip = self . _ip_int_from_string ( addr [ 0 ] ) #NEWLINE# self . ip = IPv6Address ( self . _ip ) #NEWLINE# if strict : #NEWLINE# #INDENT# if ( self . ip != self . network ) : #NEWLINE# #INDENT# raise ValueError ( ( '%s has host bits set' % self . ip ) )