def net_if_addrs():
 has_enums = (sys.version_info >= (3, 4))
 if has_enums:
  import socket
 rawlist = _psplatform.net_if_addrs()
 rawlist.sort(key=(lambda x: x[1]))
 ret = collections.defaultdict(list)
 for (name, fam, addr, mask, broadcast, ptp) in rawlist:
  if has_enums:
   try:
    fam = socket.AddressFamily(fam)
   except ValueError:
    if (WINDOWS and (fam == (-1))):
     fam = _psplatform.AF_LINK
    elif (hasattr(_psplatform, 'AF_LINK') and (_psplatform.AF_LINK == fam)):
     fam = _psplatform.AF_LINK
  if (fam == _psplatform.AF_LINK):
   separator = (':' if POSIX else '-')
   while (addr.count(separator) < 5):
    addr += ('%s00' % separator)
  ret[name].append(_common.snic(fam, addr, mask, broadcast, ptp))
 return dict(ret)

def net_if_addrs ( ) : has_enums = ( sys . version_info >= ( 3 , 4 ) ) if has_enums : import socket rawlist = _psplatform . net_if_addrs ( ) rawlist . sort ( key = ( lambda x : x [ 1 ] ) ) ret = collections . defaultdict ( list ) for ( name , fam , addr , mask , broadcast , ptp ) in rawlist : if has_enums : try : fam = socket . AddressFamily ( fam ) except ValueError : if ( WINDOWS and ( fam == ( - 1 ) ) ) : fam = _psplatform . AF_LINK elif ( hasattr ( _psplatform , 'AF_LINK' ) and ( _psplatform . AF_LINK == fam ) ) : fam = _psplatform . AF_LINK if ( fam == _psplatform . AF_LINK ) : separator = ( ':' if POSIX else '-' ) while ( addr . count ( separator ) < 5 ) : addr += ( '%s00' % separator ) ret [ name ] . append ( _common . snic ( fam , addr , mask , broadcast , ptp ) ) return dict ( ret )
return the addresses associated to each nic installed on the system as a dictionary whose keys are the nic names and value is a list of namedtuples for each address assigned to the nic .