Swap pre-commit yapf for ruff/ruff-format, fix findings

This commit is contained in:
Tim Wojtulewicz 2024-12-10 12:20:09 -07:00
parent b02f812e26
commit 49f82b325b
9 changed files with 110 additions and 81 deletions

View file

@ -4,7 +4,6 @@ import http.server as BaseHTTPServer
class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/plain")
@ -34,19 +33,32 @@ class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if __name__ == "__main__":
from optparse import OptionParser
p = OptionParser()
p.add_option("-a",
"--addr",
type="string",
default="localhost",
help=("listen on given address (numeric IP or host name), "
"an empty string (the default) means INADDR_ANY"))
p.add_option("-p", "--port", type="int", default=32123, help="listen on given TCP port number")
p.add_option("-m",
"--max",
type="int",
default=-1,
help="max number of requests to respond to, -1 means no max")
p.add_option(
"-a",
"--addr",
type="string",
default="localhost",
help=(
"listen on given address (numeric IP or host name), "
"an empty string (the default) means INADDR_ANY"
),
)
p.add_option(
"-p",
"--port",
type="int",
default=32123,
help="listen on given TCP port number",
)
p.add_option(
"-m",
"--max",
type="int",
default=-1,
help="max number of requests to respond to, -1 means no max",
)
options, args = p.parse_args()
httpd = BaseHTTPServer.HTTPServer((options.addr, options.port), MyRequestHandler)