Avoid importing private function

This commit is contained in:
chaihahaha 2025-02-25 15:07:11 +08:00 committed by GitHub
parent 12d1e968cc
commit 834c087479
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,7 +8,8 @@ import time
import uuid
import warnings
from dataclasses import dataclass, field
from http.server import BaseHTTPRequestHandler, HTTPServer, _get_best_family
from http.server import BaseHTTPRequestHandler, HTTPServer
import socket
from pathlib import Path
from typing import (
Any,
@ -694,7 +695,7 @@ def run(
):
server_address = (host, port)
prompt_cache = PromptCache()
server_class.address_family, server_address = _get_best_family(*server_address)
server_class.address_family, _, _, _, server_address = next(iter(socket.getaddrinfo(*server_address, type=socket.SOCK_STREAM, flags=socket.AI_PASSIVE)))
httpd = server_class(
server_address,
lambda *args, **kwargs: handler_class(