[PR #11379/b3dc06a7 backport][stable-12] Clean up other Python files (#11382)

Clean up other Python files (#11379)

* Address issues found by ruff check.

* Make mypy happy; remove some Python 2 compat code.

* Also declare port1.

(cherry picked from commit b3dc06a7dd)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2026-01-05 18:57:50 +01:00
committed by GitHub
parent 1d09a36e0f
commit e0bd7e334e
16 changed files with 52 additions and 47 deletions

View File

@@ -10,15 +10,11 @@ import sys
root_dir = sys.argv[1]
port = int(sys.argv[2])
try:
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ModuleNotFoundError:
from http.server import HTTPServer, SimpleHTTPRequestHandler
from http.server import HTTPServer, SimpleHTTPRequestHandler
httpd = HTTPServer(("localhost", port), SimpleHTTPRequestHandler)
try:
httpd.socket = ssl.wrap_socket(
httpd.socket = ssl.wrap_socket( # type: ignore[attr-defined]
httpd.socket,
server_side=True,
certfile=os.path.join(root_dir, "cert.pem"),