Fix flake8 caused by top level imports

This commit is contained in:
Takashi Kajinami 2025-06-12 22:40:28 +09:00
parent 10889ff79b
commit 9a38c0ce17
6 changed files with 57 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python
# flake8: noqa: E402
'''
A WebSocket server that echos back whatever it receives from the client.
Copyright 2010 Joel Martin
@ -10,9 +10,16 @@ openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem
as taken from http://docs.python.org/dev/library/ssl.html#certificates
'''
import os, sys, select, optparse, logging
import logging
import optparse
import os
import select
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from websockify.websockifyserver import WebSockifyServer, WebSockifyRequestHandler
from websockify.websockifyserver import WebSockifyServer
from websockify.websockifyserver import WebSockifyRequestHandler
class WebSocketEcho(WebSockifyRequestHandler):

View File

@ -1,13 +1,16 @@
#!/usr/bin/env python
# flake8: noqa: E402
import os
import sys
import optparse
import os
import select
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from websockify.websocket import WebSocket, \
WebSocketWantReadError, WebSocketWantWriteError
from websockify.websocket import WebSocket
from websockify.websocket import WebSocketWantReadError
from websockify.websocket import WebSocketWantWriteError
parser = optparse.OptionParser(usage="%prog URL")
(opts, args) = parser.parse_args()

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
# flake8: noqa: E402
'''
WebSocket server-side load test program. Sends and receives traffic
@ -6,9 +7,18 @@ that has a random payload (length and content) that is checksummed and
given a sequence number. Any errors are reported and counted.
'''
import sys, os, select, random, time, optparse, logging
import logging
import optparse
import os
import random
import select
import sys
import time
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from websockify.websockifyserver import WebSockifyServer, WebSockifyRequestHandler
from websockify.websockifyserver import WebSockifyRequestHandler
from websockify.websockifyserver import WebSockifyServer
class WebSocketLoadServer(WebSockifyServer):

View File

@ -1,4 +1,7 @@
import logging.handlers as handlers, socket, os, time
import logging.handlers as handlers
import os
import socket
import time
class WebsockifySysLogHandler(handlers.SysLogHandler):

View File

@ -11,14 +11,25 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates
'''
import signal, socket, optparse, time, os, sys, subprocess, logging, errno, ssl, stat
from socketserver import ThreadingMixIn
import errno
from http.server import HTTPServer
import logging
import optparse
import os
import select
import signal
import socket
from socketserver import ThreadingMixIn
import ssl
import stat
import subprocess
import sys
import time
from urllib.parse import parse_qs
from urllib.parse import urlparse
from websockify import websockifyserver
from websockify import auth_plugins as auth
from urllib.parse import parse_qs, urlparse
class ProxyRequestHandler(websockifyserver.WebSockifyRequestHandler):

View File

@ -12,9 +12,16 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates
'''
import os, sys, time, errno, signal, socket, select, logging
import multiprocessing
import errno
from http.server import SimpleHTTPRequestHandler
import logging
import multiprocessing
import os
import select
import signal
import socket
import sys
import time
# Degraded functionality if these imports are missing
try: