(kind, _pid=-1)
return list(ret)
Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
Return socket connections . If pid == - 1 return system - wide connections ( as opposed to connections opened by one process only ) .
def net_connections(kind, _pid=-1):
    """Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
    """
    if kind not in conn_tmap:
        raise ValueError("invalid %r kind argument; choose between %s"
                         % (kind, ', '.join([repr(x) for x in conn_tmap])))
    families, types = conn_tmap[kind]
    rawlist = cext.net_connections(_pid, families, types)
    ret = set()
    for item in rawlist:
        fd, fam, type, laddr, raddr, status, pid = item
        status = TCP_STATUSES[status]
        fam = sockfam_to_enum(fam)
        type = socktype_to_enum(type)
        if _pid == -1:
            nt = _common.sconn(fd, fam, type, laddr, raddr, status, pid)
        else:
            nt = _common.pconn(fd, fam, type, laddr, raddr, status)
        ret.add(nt)
    return list(ret)
def net_connections ( kind , _pid = - 1 ) : if kind not in conn_tmap : raise ValueError ( "invalid %r kind argument; choose between %s" % ( kind , ', ' . join ( [ repr ( x ) for x in conn_tmap ] ) ) ) families , types = conn_tmap [ kind ] rawlist = cext . net_connections ( _pid , families , types ) ret = set ( ) for item in rawlist : fd , fam , type , laddr , raddr , status , pid = item status = TCP_STATUSES [ status ] fam = sockfam_to_enum ( fam ) type = socktype_to_enum ( type ) if _pid == - 1 : nt = _common . sconn ( fd , fam , type , laddr , raddr , status , pid ) else : nt = _common . pconn ( fd , fam , type , laddr , raddr , status ) ret . add ( nt ) return list ( ret )