()
return port
attempts to find a free port
attempts to find a free port
attempts to find a free port
def _get_free_port():
    """attempts to find a free port"""
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(("localhost", 0))
    _, port = s.getsockname()
    s.close()
    return port
def _get_free_port ( ) : s = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) s . bind ( ( "localhost" , 0 ) ) _ , port = s . getsockname ( ) s . close ( ) return port